// 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","../../geometry/GeometryCursor","./enums"],function(t,x,u){class y{constructor(b,a){}isEmpty(b){if(!b.nextPoint())return!0;let a,h,f,c;a=b.x;for(h=b.y;b.nextPoint();a=h,h=c)if(f=b.x,c=b.y,f!==a||c!==h)return b.seekPathStart(),!1;b.seekPathStart();return!0}normalize(b){const a=Math.sqrt(b[0]*b[0]+b[1]*b[1]);0!==a&&(b[0]/=a,b[1]/=a)}getLength(b,a,h,f){b=h-b;a=f-a;return Math.sqrt(b*b+a*a)}getSegLength(b){const [[a,h],[f,c]]=b;return this.getLength(a,h,f,c)}getCoord2D(b,a,h,f,c){return[b+ (h-b)*c,a+(f-a)*c]}getSegCoord2D(b,a){const [[h,f],[c,l]]=b;return this.getCoord2D(h,f,c,l,a)}getAngle(b,a,h,f,c){return Math.atan2(f-a,h-b)}getAngleCS(b,a,h,f,c){b=h-b;a=f-a;f=Math.sqrt(b*b+a*a);return 0=c?[b,a]:this.getCoord2D(b,a,h,f,c);b=1<=l?[h,f]:this.getCoord2D(b,a,h,f,l);return[c,b]}getSubCurve(b,a,h){const f=x.GeometryCursor.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(f, b,a,h)?f:null}appendSubCurve(b,a,h,f){b.startPath();a.seekPathStart();let c=0;var l=!0;if(!a.nextPoint())return!1;var k=a.x;let m=a.y;for(;a.nextPoint();){const d=this.getLength(k,m,a.x,a.y);if(0!==d){if(l){if(c+d>h){const e=(h-c)/d;let g=1;l=!1;c+d>=f&&(g=(f-c)/d,l=!0);(k=this.cut(k,m,a.x,a.y,e,g))&&b.pushPoints(k);if(l)break;l=!1}}else{if(c+d>f){(a=this.cut(k,m,a.x,a.y,0,(f-c)/d))&&b.pushPoint(a[1]);break}b.pushXY(a.x,a.y)}c+=d}k=a.x;m=a.y}return!0}getCIMPointAlong(b,a){if(!b.nextPoint())return null; let h=0,f,c,l,k;f=b.x;for(c=b.y;b.nextPoint();f=l,c=k){l=b.x;k=b.y;const m=this.getLength(f,c,l,k);if(0!==m){if(h+m>a)return this.getCoord2D(f,c,l,k,(a-h)/m);h+=m}}return null}offset(b,a,h,f,c){if(!b||2>b.length)return null;var l=0,k=b[l++];for(c=l;l=a)1>p&&(e=[e[0]-g[0],e[1]-g[1]],this.normalize(e),g=Math.sqrt((1+p)/2),g>1/f&&(g=-Math.abs(a)/g,m.push([d[0]-e[0]*g,d[1]-e[1]*g])));else switch(h){case u.GeometricEffectOffsetMethod.Mitered:if(k=Math.sqrt((1+p)/2),0p){m.push([d[0]+g[1]*a,d[1]-g[0]*a]);k=Math.floor(2.5*(1-p));if(0n?(m.push([d[0]+(g[1]+g[0])*a,d[1]+(g[1]-g[0])*a]),m.push([d[0]+(e[1]-e[0])*a,d[1]-(e[0]+e[1])*a])):(k=Math.sqrt((1+Math.abs(p))/2),e=[e[0]- g[0],e[1]-g[1]],this.normalize(e),g=a/k,m.push([d[0]-e[0]*g,d[1]-e[1]*g]))}}else e=[d[0]-k[0],d[1]-k[1]],this.normalize(e),m.push([d[0]+e[1]*a,d[1]-e[0]*a]);else e=[q[0]-d[0],q[1]-d[1]],this.normalize(e),m.push([d[0]+e[1]*a,d[1]-e[0]*a]);k=d;d=q}if(m.length<(l?3:2))return null;l&&m.push([m[0][0],m[0][1]]);return m}}t.CurveHelper=y;t.pixelTolerance=.03;Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});