// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports"],function(p){p.GeometryType=void 0;(function(a){a[a.Unknown=0]="Unknown";a[a.Point=1]="Point";a[a.LineString=2]="LineString";a[a.Polygon=3]="Polygon"})(p.GeometryType||(p.GeometryType={}));class n{constructor(a,b){this.x=a;this.y=b}clone(){return new n(this.x,this.y)}equals(a,b){return a===this.x&&b===this.y}isEqual(a){return a.x===this.x&&a.y===this.y}setCoords(a,b){this.x=a;this.y=b;return this}normalize(){var a=this.x;const b=this.y;a=Math.sqrt(a*a+b*b);this.x/=a;this.y/=a;return this}rightPerpendicular(){const a= this.x;this.x=this.y;this.y=-a;return this}leftPerpendicular(){const a=this.x;this.x=-this.y;this.y=a;return this}move(a,b){this.x+=a;this.y+=b;return this}assign(a){this.x=a.x;this.y=a.y;return this}assignAdd(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this}assignSub(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this}rotate(a,b){const c=this.x,e=this.y;this.x=c*a-e*b;this.y=c*b+e*a;return this}scale(a){this.x*=a;this.y*=a;return this}length(){const a=this.x,b=this.y;return Math.sqrt(a*a+b*b)}sub(a){this.x-= a.x;this.y-=a.y;return this}add(a){this.x+=a.x;this.y+=a.y;return this}static distance(a,b){const c=b.x-a.x;a=b.y-a.y;return Math.sqrt(c*c+a*a)}static add(a,b){return new n(a.x+b.x,a.y+b.y)}static sub(a,b){return new n(a.x-b.x,a.y-b.y)}}class w{constructor(a,b,c){this.ratio=a;this.x=b;this.y=c}}class z{constructor(a,b,c,e=8,k=8){this._lines=[];this._starts=[];this.validateTessellation=!0;this._pixelRatio=e;this._pixelMargin=k;this._tileSize=512*e;this._dz=a;this._yPos=b;this._xPos=c}setPixelMargin(a){a!== this._pixelMargin&&(this._pixelMargin=a,this.setExtent(this._extent))}setExtent(a){this._extent=a;this._finalRatio=this._tileSize/a*(1<>=this._dz;b>a&&(b=a);this._margin=b;this._xmin=a*this._xPos-b;this._ymin=a*this._yPos-b;this._xmax=this._xmin+a+2*b;this._ymax=this._ymin+a+2*b}reset(a){this._type=a;this._lines=[];this._starts=[];this._line=null;this._start=0}moveTo(a,b){this._pushLine();this._prevIsIn=this._isIn(a,b);this._moveTo(a, b,this._prevIsIn);this._prevPt=new n(a,b);this._firstPt=new n(a,b);this._dist=0}lineTo(a,b){const c=this._isIn(a,b),e=new n(a,b),k=n.distance(this._prevPt,e);if(c)if(this._prevIsIn)this._lineTo(a,b,!0);else{var d=this._prevPt;var g=e;a=this._intersect(g,d);this._start=this._dist+k*(1-this._r);this._lineTo(a.x,a.y,!0);this._lineTo(g.x,g.y,!0)}else if(this._prevIsIn)g=this._prevPt,d=e,a=this._intersect(g,d),this._lineTo(a.x,a.y,!0),this._lineTo(d.x,d.y,!1);else{const f=this._prevPt;if(!(f.x<=this._xmin&& e.x<=this._xmin||f.x>=this._xmax&&e.x>=this._xmax||f.y<=this._ymin&&e.y<=this._ymin||f.y>=this._ymax&&e.y>=this._ymax)){a=[];if(f.xthis._xmin||f.x>this._xmin&&e.x=this._ymax?g=!0:a.push(new w(b,this._xmin,h))}if(f.xthis._xmax||f.x>this._xmax&&e.x=this._ymax?g=!0:a.push(new w(b,this._xmax,h));if(f.ythis._ymin||f.y>this._ymin&&e.y=this._xmax?d=!0:a.push(new w(b,h,this._ymin));if(f.ythis._ymax||f.y>this._ymax&&e.y=this._xmax?d=!0:a.push(new w(b,h,this._ymax));if(0===a.length)d?g?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):g?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin, this._ymin,!0);else if(1a[1].ratio)this._start=this._dist+k*a[1].ratio,this._lineTo(a[1].x,a[1].y,!0),this._lineTo(a[0].x,a[0].y,!0);else for(this._start=this._dist+k*a[0].ratio,d=0;d=this._xmin&&a<=this._xmax&&b>=this._ymin&&b<=this._ymax}_intersect(a,b){let c,e,k;if(b.x>=this._xmin&&b.x<=this._xmax)e=b.y<=this._ymin?this._ymin:this._ymax,k=(e-a.y)/(b.y-a.y),c=a.x+k*(b.x-a.x);else if(b.y>=this._ymin&&b.y<=this._ymax)c=b.x<=this._xmin?this._xmin:this._xmax,k=(c-a.x)/(b.x-a.x),e=a.y+k*(b.y-a.y);else{e=b.y<=this._ymin?this._ymin:this._ymax;c=b.x<=this._xmin?this._xmin:this._xmax;const d=(c-a.x)/(b.x-a.x),g=(e-a.y)/(b.y-a.y); dthis._xmax&&(a=this._xmax),bthis._ymax&&(b=this._ymax)),a=Math.round((a-(this._xmin+this._margin))*this._finalRatio),b=Math.round((b-(this._ymin+this._margin))*this._finalRatio),this._line.push(new n(a,b)),this._isV=this._isH=!1)}_lineTo(a, b,c){if(this._type!==p.GeometryType.Polygon)if(c){a=Math.round((a-(this._xmin+this._margin))*this._finalRatio);b=Math.round((b-(this._ymin+this._margin))*this._finalRatio);if(0this._xmax&&(a=this._xmax),bthis._ymax&&(b=this._ymax)),a=Math.round((a-(this._xmin+this._margin))* this._finalRatio),b=Math.round((b-(this._ymin+this._margin))*this._finalRatio),this._line&&0=this._line.length?this._isV=this._isH=!1:(c=this._line[this._line.length-2],this._isH=c.x===a,this._isV=c.y===b)):(this._isH=c.x===a,this._isV=c.y===b)):this._isV&&k?(c.x=a,c.y=b,c=this._line[this._line.length-2],c.x===a&&c.y=== b?(this._line.pop(),1>=this._line.length?this._isV=this._isH=!1:(c=this._line[this._line.length-2],this._isH=c.x===a,this._isV=c.y===b)):(this._isH=c.x===a,this._isV=c.y===b)):(this._line.push(new n(a,b)),this._isH=e,this._isV=k))}else this._line.push(new n(a,b))}}class A{setExtent(a){this._ratio=4096===a?1:4096/a}get validateTessellation(){return 1>this._ratio}reset(a){this._lines=[];this._line=null}moveTo(a,b){this._line&&this._lines.push(this._line);this._line=[];const c=this._ratio;this._line.push(new n(a* c,b*c))}lineTo(a,b){const c=this._ratio;this._line.push(new n(a*c,b*c))}close(){const a=this._line;a&&!a[0].isEqual(a[a.length-1])&&a.push(a[0])}result(){this._line&&this._lines.push(this._line);return 0===this._lines.length?null:this._lines}}var m;(function(a){a[a.sideLeft=0]="sideLeft";a[a.sideRight=1]="sideRight";a[a.sideTop=2]="sideTop";a[a.sideBottom=3]="sideBottom"})(m||={});class u{static simplify(a,b,c){if(c){var e=-b,k=a+b,d=-b,g=a+b;a=[];b=[];var h=c.length;for(let f=0;fr.length)continue;let q=r[0],t;const v=r.length;for(let l=1;lt.y?(a.push(f),a.push(l),a.push(m.sideLeft),a.push(-1)):(b.push(f),b.push(l),b.push(m.sideLeft),b.push(-1))),q.x>=k&&(q.y=g&&(q.x>t.x?(a.push(f), a.push(l),a.push(m.sideBottom),a.push(-1)):(b.push(f),b.push(l),b.push(m.sideBottom),b.push(-1)))),q=t}0!==a.length&&0!==b.length&&(u.fillParent(c,b,a),u.fillParent(c,a,b),e=[],u.calcDeltas(e,b,a),u.calcDeltas(e,a,b),u.addDeltas(e,c))}}static fillParent(a,b,c){const e=c.length,k=b.length;for(let r=0;re&&(e=d)}for(k=0;ka>=b&&a<=c||a>=c&&a<=b;p.Point=n;p.SimpleBuilder=A;p.TileClipper=z;Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});