@arcgis/core 4.33.0-next.20250501 → 4.33.0-next.20250502

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{de16b771d2c8d816c738.js → 05c80002c37002ac99e8.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{5d40c4783f58af1ae0dc.js → 0e8181e7fc1386d08ffc.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{96e5d192c8d23c1e324f.js → 13e68c43acc8916520db.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{e6a5911ea21bef32834b.js → 1bc22af4cc4effcbcf2b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{9b2ab27159500315fbc1.js → 26850ec0917ee355ddb7.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{1bd4fe77ba6fb25322e7.js → 29e2b105f55adafc3a6d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{5d63dfa5a60c88e03b28.js → 2c77a543a174e5bc736a.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d0ddf4f1c6a351b447c7.js → 30d7d2c7d6e9e5e2ecb9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{febae745a29a17ca130a.js → 4480e4b61affb3b2e9d6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{4d4a271351fd288277d2.js → 49085a0b3a74e158f32f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{392e64a573f67817db02.js → 4cb199b547e5b97e65fb.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4df36ee2406861c7afa8.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ba917175ca2a6681501e.js → 563594357f3648652a5c.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{abfc5f9ac16c3e885c5f.js → 56db71ea7eb8a5652d98.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{235efd948ae470a6f238.js → 60b1365d25581ccf0485.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{3795793643f4db64af0e.js → 63c25455b9cf1b3df76a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{909be86782af3deb448e.js → 654fe135d41af81daa13.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{cd9343c78a7c3acdbbcd.js → 681b2662f6ce936afd7e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{65f2b22d8fc12e6d4a87.js → 7000d9158da929a16071.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{7551011117c3d36ff3db.js → 743cdbff5c4616ddc2b4.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{968956284f44187f0622.js → 8540fb31bd0b29ff1906.js} +1 -1
  24. package/assets/esri/core/workers/chunks/8c5cea49e48f8858f115.js +1 -0
  25. package/assets/esri/core/workers/chunks/{237a965bd41ba8903e03.js → 921c040d0497031fd8ff.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{96d2a0777f5c418055fb.js → 92b48e3365d1cc933113.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{5d485c07848164099859.js → 95a4da3150ad8e8e36d8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{46fb6ba8900286d18b6f.js → 9d564f79b82d427fc1da.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{00612d6e05b1c8647668.js → 9fff43ffcd5602ccc50f.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{1cc5c566e68f2255d035.js → a6ca68ef6311ffc365b2.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{5a51c75a2932d9da001a.js → a8d043b73e087bee7c40.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{ebfa4a0334401f5e004a.js → c12765e0c8b44e349c2a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{afddb94ff4e1a70022c7.js → c3b2b05996e2008adbe3.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{4fb4884d2de42792abe3.js → d1a9e8db5ba403abe721.js} +1 -1
  35. package/assets/esri/core/workers/chunks/d35cd309ba7bb8968a22.js +1 -0
  36. package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{7a8df1225abd54ff68ed.js → db298b292a4e43cba72d.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{2bda2cfc6e81818d7d33.js → dcaeb57c69d432118604.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{fb455fd89b74b70a6a2b.js → e613df03ceb39e29befa.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{05d7d8ff3e4cbad32580.js → e8dcaa7837b6fe7bff20.js} +1 -1
  41. package/assets/esri/core/workers/chunks/ec1a4b82cbc44ba45f83.js +1 -0
  42. package/assets/esri/core/workers/chunks/ec778cc7a55068f51937.js +1 -0
  43. package/assets/esri/core/workers/chunks/{51339193abddfe37745d.js → f2b63597ae956db74eb3.js} +1 -1
  44. package/chunks/Bufferer-CicaNej1.js +1 -1
  45. package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
  46. package/chunks/Envelope.js +1 -1
  47. package/chunks/Envelope2D.js +1 -1
  48. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  49. package/chunks/Geometry.js +1 -1
  50. package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
  51. package/chunks/OperatorClip.js +1 -1
  52. package/chunks/OperatorCrosses.js +1 -1
  53. package/chunks/OperatorCut.js +1 -1
  54. package/chunks/OperatorGeneralize.js +1 -1
  55. package/chunks/OperatorGeodesicBuffer.js +1 -1
  56. package/chunks/OperatorGeodeticArea.js +1 -1
  57. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  58. package/chunks/OperatorGeodeticDistance.js +1 -1
  59. package/chunks/OperatorGeodeticLength.js +1 -1
  60. package/chunks/OperatorIntersects.js +1 -1
  61. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  62. package/chunks/OperatorOverlaps.js +1 -1
  63. package/chunks/OperatorProximity.js +1 -1
  64. package/chunks/OperatorProximityGeodesic.js +1 -1
  65. package/chunks/OperatorShapePreservingLength.js +1 -1
  66. package/chunks/OperatorShapePreservingProject.js +1 -1
  67. package/chunks/OperatorSimplifyOGC.js +1 -1
  68. package/chunks/OperatorTouches.js +1 -1
  69. package/chunks/OperatorWithin.js +1 -1
  70. package/chunks/Point2D.js +1 -1
  71. package/chunks/ProjectionTransformation.js +1 -1
  72. package/chunks/QuadraticBezier.js +1 -1
  73. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  74. package/chunks/Transformation2D.js +1 -1
  75. package/chunks/containsOperator.js +1 -1
  76. package/chunks/disjointOperator.js +1 -1
  77. package/chunks/equalsOperator.js +1 -1
  78. package/geometry/operators/extendOperator.js +1 -1
  79. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  80. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  81. package/geometry/operators/gx/operatorBuffer.js +1 -1
  82. package/geometry/operators/gx/operatorDifference.js +1 -1
  83. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  84. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  85. package/geometry/operators/gx/operatorIntersection.js +1 -1
  86. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  87. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  88. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  89. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  90. package/geometry/operators/gx/operatorOffset.js +1 -1
  91. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  92. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  93. package/geometry/operators/gx/operatorSimplify.js +1 -1
  94. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  95. package/geometry/operators/gx/operatorUnion.js +1 -1
  96. package/geometry/operators/isNearOperator.js +1 -1
  97. package/geometry/operators/json/containsOperator.js +1 -1
  98. package/geometry/operators/json/disjointOperator.js +1 -1
  99. package/geometry/operators/reshapeOperator.js +1 -1
  100. package/geometry/operators/support/apiConverter.js +1 -1
  101. package/geometry/operators/support/initNoPeFactory.js +1 -1
  102. package/geometry/operators/support/jsonConverter.js +1 -1
  103. package/interfaces.d.ts +31 -0
  104. package/package.json +1 -1
  105. package/support/revision.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
  107. package/widgets/Directions/css.js +5 -0
  108. package/widgets/Directions.js +1 -1
  109. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  110. package/assets/esri/core/workers/chunks/11b55e7e76e50fe11bbe.js +0 -1
  111. package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +0 -1
  112. package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +0 -1
  113. package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +0 -1
  114. package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as t,S as s}from"../../../chunks/SimpleGeometryCursor.js";import{b as e}from"../../../chunks/Envelope.js";import{d as i,t as n,G as o,f as h,b as r}from"../../../chunks/Geometry.js";import{P as m,a,d as f}from"../../../chunks/QuadraticBezier.js";import{l as _,P as c,k as d,t as P,e as u}from"../../../chunks/Point2D.js";function l(t,s,e,o,h,r){if(null===t&&n(""),t.getDimension()<1&&n(""),h>0||n(""),i(t),0===s||t.isEmpty())return t;const m=new A(r);return m.m_bUseZ=t.hasAttribute(1),m.m_bUseM=t.hasAttribute(2),m.m_inputGeometry=t,m.m_distance=s,m.m_tolerance=h,m.m_joins=e,m.m_miterLimit=o>1?o:1,m.m_progressCounter=0,m.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===o.enumLine)return this.offsetLine();if(t===o.enumEnvelope)return this.offsetEnvelope();if(h(t)){const t=new m;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===o.enumPolyline){const t=new m;return this.offsetMultiPath(t),t}if(t===o.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}r("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],r=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,r-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],r=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],m=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,P=0;{const t=r.x-h.x,s=r.y-h.y,e=m.x-h.x,_=m.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),P=c.orientationRobust(h.asPoint2D(),r.asPoint2D(),m.asPoint2D())}const u=f;if(f<a&&(f+=d),P*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let r=a+_;A.buildPoint(h,this.m_distance,r,t),0===o&&(t.type|=M),this.addPointEx(t,o);const m=this.m_distance/Math.cos(n/2);for(r+=n/2,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);--i>0;)r+=n,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t)}else if(1!==this.m_joins)if(0!==this.m_joins)if(2!==this.m_joins){let s;if(f=u,this.m_distance>0?(f>a&&(f-=d),s=a-f<_):(f<a&&(f+=d),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=d),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}else{const s=r.x-h.x,e=r.y-h.y,i=m.x-h.x,n=m.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const d=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),P=Math.abs(this.m_miterLimit*this.m_distance);if(d>P){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),r=new c;r.setSub(i,n);const m=new c;m.setScaleAdd(P/r.length(),r,n);const _=Math.sqrt(d*d-this.m_distance*this.m_distance),u=(d-P)*Math.abs(this.m_distance)/_;this.m_distance>0?r.leftPerpendicularThis():r.rightPerpendicularThis(),r.scale(u/r.length());const l=new c;l.setAdd(m,r);const y=new c;y.setSub(m,r),t.x=l.x,t.y=l.y,this.addPointEx(t,o),t.x=y.x,t.y=y.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o)}else{const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const r=this.m_distance/Math.cos(.5*n);let m=a+_+.5*n;for(A.buildPoint(h,r,m,t),this.addPointEx(t,o);--i>0;)m+=n,A.buildPoint(h,r,m,t),this.addPoint(t)}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,!(this.m_offsetPts[i].type&p||this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const r=1e-8,m=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/m,f=(i.y-e.y)/m,_=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),c=(o.x-n.x)/_,d=(o.y-n.y)/_;let P=!1;const u=h.pt.clone();u.x+=(a+c)*r,u.y+=(f+d)*r;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(P=!P),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(P)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,r,m;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),r=0===o?2:h/o,r>=0&&r<=1&&(m=r,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),r=0===o?2:h/o,r>=0&&r<=1)&&(n.pt.x=t.x+r*(s.x-t.x),n.pt.y=t.y+r*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+m*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+m*(i.m-e.m)),0!==m&&1!==m||0!==r&&1!==r||(n.bAtExistingPt=!0),!((0===m||1===m)&&r>0&&r<1||(0===r||1===r)&&m>0&&m<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=f(this.m_inputGeometry,0,this.m_tolerance,0,this.m_progressTracker,12e3),e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=!!(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=!!(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,r=i.y-e.y,m=P(n,o,h,r);return u(m)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,s,e,i,n,o,h){return new v(t,s,e,i,n,o,h)}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends t{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return i(t),s=this.m_flattenError<=0?e(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const G=new E;function w(t,s,e,i,n,o){return G.execute(t,s,e,i,n,o,null)}function j(t,e,i,n,o,h){const r=G.executeMany(new s(t),e,i,n,o,h,null);return Array.from(r)}function D(){return G.supportsCurves()}export{w as execute,j as executeMany,D as supportsCurves};
5
+ import{G as t,S as s}from"../../../chunks/SimpleGeometryCursor.js";import{b as e}from"../../../chunks/Envelope.js";import{d as i,a as n,G as o,f as h,t as r}from"../../../chunks/Geometry.js";import{P as m,a,d as f}from"../../../chunks/QuadraticBezier.js";import{p as _,P as c,o as d,t as P,e as u}from"../../../chunks/Point2D.js";function l(t,s,e,o,h,r){if(null===t&&n(""),t.getDimension()<1&&n(""),h>0||n(""),i(t),0===s||t.isEmpty())return t;const m=new A(r);return m.m_bUseZ=t.hasAttribute(1),m.m_bUseM=t.hasAttribute(2),m.m_inputGeometry=t,m.m_distance=s,m.m_tolerance=h,m.m_joins=e,m.m_miterLimit=o>1?o:1,m.m_progressCounter=0,m.constructOffset()}const y=1.4142135623730951,x=.017453292519943295,p=256,b=512,M=1024;class g{static construct(t,s,e){const i=new g;return i.x=t.x,i.y=t.y,i.m_next=-1,i.m_prev=-1,i.z=s,i.m=e,i.type=0,i}clone(){const t=new g;return t.x=this.x,t.y=this.y,t.m_next=this.m_next,t.m_prev=this.m_prev,t.z=this.z,t.m=this.m,t.type=this.type,t}asPoint2D(){return new c(this.x,this.y)}}function C(){return{pt:new g,bAtExistingPt:!1}}class A{constructor(t){this.m_distance=-1,this.m_tolerance=-1,this.m_miterLimit=10,this.m_joins=0,this.m_progressCounter=0,this.m_bUseZ=!1,this.m_bUseM=!1,this.m_srcPts=[],this.m_srcPtCount=0,this.m_offsetPts=[],this.m_offsetPtCount=0,this.m_a1=0,this.m_a2=0,this.m_progressTracker=t}constructOffset(){const t=this.m_inputGeometry.getGeometryType();if(t===o.enumLine)return this.offsetLine();if(t===o.enumEnvelope)return this.offsetEnvelope();if(h(t)){const t=new m;return t.addSegment(this.m_inputGeometry,!0),this.m_inputGeometry=t,this.constructOffset()}if(t===o.enumPolyline){const t=new m;return this.offsetMultiPath(t),t}if(t===o.enumPolygon){const t=new a;return this.offsetMultiPath(t),t}r("")}offsetLine(){const t=this.m_inputGeometry,s=t.getStartXY(),e=t.getEndXY(),i=new c;i.setSub(e,s),i.normalize(),i.leftPerpendicularThis(),i.scale(this.m_distance),s.addThis(i),e.addThis(i);const n=t.clone();return n.setStartXY(s),n.setEndXY(e),n}offsetEnvelope(){const t=this.m_inputGeometry;if(this.m_distance>0&&2!==this.m_joins){const s=new a;return s.addEnvelope(t,!1),this.m_inputGeometry=s,this.constructOffset()}const s=t.clone();return s.inflateCoords(this.m_distance,this.m_distance),s}progress(){}static buildPoint(t,s,e,i){i.x=t.x+s*Math.cos(e),i.y=t.y+s*Math.sin(e),i.type=t.type,i.z=t.z,i.m=t.m,i.m_next=-1,i.m_prev=-1}addPoint(t){this.m_offsetPts.push(t.clone()),this.m_offsetPtCount++}addPointEx(t,s){if(0===this.m_offsetPtCount)return void this.addPoint(t);const e=this.m_srcPtCount,i=this.m_srcPts[0===s?e-1:s-1],n=this.m_srcPts[s],o=A.dotSign(i,n,this.m_offsetPts[this.m_offsetPtCount-1],t);if(o>0)this.addPoint(t);else if(o<0)if(A.dotSign(i,n,n,this.m_offsetPts[this.m_offsetPtCount-1])>0){const n=new g;let o;o=0===s?e-2:1===s?e-1:s-2;const h=this.m_srcPts[o],r=Math.atan2(i.y-h.y,i.x-h.x);if(A.buildPoint(i,this.m_distance,r-_,n),this.m_offsetPts[this.m_offsetPtCount-1]=n,1===this.m_joins||2===this.m_joins){n.x=.5*(n.x+i.x),n.y=.5*(n.y+i.y),this.addPoint(n),A.buildPoint(i,this.m_distance,this.m_a1+_,n);const t=n.clone();t.x=.5*(t.x+i.x),t.y=.5*(t.y+i.y),t.type|=p,this.addPoint(t),this.addPoint(n)}else A.buildPoint(i,this.m_distance,this.m_a1+_,n),n.type|=p,this.addPoint(n);this.addPointEx(t,s)}else{const t=new g;if(A.buildPoint(n,this.m_distance,this.m_a1+_,t),this.addPoint(t),1===this.m_joins||2===this.m_joins){t.x=.5*(t.x+n.x),t.y=.5*(t.y+n.y),this.addPoint(t),A.buildPoint(n,this.m_distance,this.m_a2-_,t);const s=t.clone();s.x=.5*(s.x+n.x),s.y=.5*(s.y+n.y),s.type|=p,this.addPoint(s),this.addPoint(t)}else A.buildPoint(n,this.m_distance,this.m_a2-_,t),t.type|=p,this.addPoint(t)}}buildOffset(){const t=new g,s=this.m_srcPtCount;this.m_offsetPtCount=0;const e=.5*this.m_tolerance;let i=0,n=0;for(let o=0;o<s;o++){const h=this.m_srcPts[o],r=0===o?this.m_srcPts[s-1]:this.m_srcPts[o-1],m=o===s-1?this.m_srcPts[0]:this.m_srcPts[o+1];let a,f,P=0;{const t=r.x-h.x,s=r.y-h.y,e=m.x-h.x,_=m.y-h.y;a=Math.atan2(s,t),f=Math.atan2(_,e),this.m_a1=a,this.m_a2=f,0===o&&(i=a,n=f),P=c.orientationRobust(h.asPoint2D(),r.asPoint2D(),m.asPoint2D())}const u=f;if(f<a&&(f+=d),P*this.m_distance>0)if(1===this.m_joins||2===this.m_joins){A.buildPoint(h,this.m_distance,a+_,t),this.addPoint(t);const s=.001;t.x=h.x+(t.x-h.x)*s,t.y=h.y+(t.y-h.y)*s,this.addPoint(t),A.buildPoint(h,this.m_distance,f-_,t);const e=t.clone();e.x=h.x+(e.x-h.x)*s,e.y=h.y+(e.y-h.y)*s,e.type|=p,this.addPoint(e),this.addPoint(t)}else{const s=.5*(f-a),e=0===s?this.m_distance:this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t),this.addPointEx(t,o)}else if(h.type&b){const s=1-e/Math.abs(this.m_distance);let i=1,n=this.m_distance<0?-Math.PI:Math.PI;if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.PI/t+1.5),i>1&&(n/=i)}i<=1&&(i=2,n/=2);let r=a+_;A.buildPoint(h,this.m_distance,r,t),0===o&&(t.type|=M),this.addPointEx(t,o);const m=this.m_distance/Math.cos(n/2);for(r+=n/2,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);--i>0;)r+=n,A.buildPoint(h,m,r,t),t.type|=M,this.addPoint(t);A.buildPoint(h,this.m_distance,f-_,t),t.type|=M,this.addPoint(t)}else if(1!==this.m_joins)if(0!==this.m_joins)if(2!==this.m_joins){let s;if(f=u,this.m_distance>0?(f>a&&(f-=d),s=a-f<_):(f<a&&(f+=d),s=f-a<_),s){const s=this.m_distance*y;let e;e=s<0?a+.25*Math.PI:a+3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPointEx(t,o),e=s<0?f-.25*Math.PI:f-3*Math.PI*.25,A.buildPoint(h,s,e,t),this.addPoint(t)}else{const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));f<a&&(f+=d),A.buildPoint(h,e,(a+f)/2,t),this.addPointEx(t,o)}}else{const s=r.x-h.x,e=r.y-h.y,i=m.x-h.x,n=m.y-h.y,_=(s*i+e*n)/Math.sqrt(s*s+e*e)/Math.sqrt(i*i+n*n);if(_>1-1e-8){A.buildPoint(h,y*this.m_distance,f-.25*Math.PI,t),this.addPointEx(t,o),A.buildPoint(h,y*this.m_distance,f+.25*Math.PI,t),this.addPoint(t);continue}const d=Math.abs(this.m_distance/Math.sin(.5*Math.acos(_))),P=Math.abs(this.m_miterLimit*this.m_distance);if(d>P){const s=.5*(f-a),e=this.m_distance/Math.abs(Math.sin(s));A.buildPoint(h,e,.5*(a+f),t);const i=c.construct(t.x,t.y),n=c.construct(h.x,h.y),r=new c;r.setSub(i,n);const m=new c;m.setScaleAdd(P/r.length(),r,n);const _=Math.sqrt(d*d-this.m_distance*this.m_distance),u=(d-P)*Math.abs(this.m_distance)/_;this.m_distance>0?r.leftPerpendicularThis():r.rightPerpendicularThis(),r.scale(u/r.length());const l=new c;l.setAdd(m,r);const y=new c;y.setSub(m,r),t.x=l.x,t.y=l.y,this.addPointEx(t,o),t.x=y.x,t.y=y.y,this.addPoint(t);continue}const u=.5*(f-a),l=this.m_distance/Math.abs(Math.sin(u));A.buildPoint(h,l,.5*(a+f),t),this.addPointEx(t,o)}else{const s=1-e/Math.abs(this.m_distance);let i=1,n=f-_-(a+_);if(s>-1&&s<1){let t=2*Math.acos(s);t<x&&(t=x),i=Math.trunc(Math.abs(n)/t+1.5),i>1&&(n/=i)}const r=this.m_distance/Math.cos(.5*n);let m=a+_+.5*n;for(A.buildPoint(h,r,m,t),this.addPointEx(t,o);--i>0;)m+=n,A.buildPoint(h,r,m,t),this.addPoint(t)}else A.buildPoint(h,this.m_distance,a+_,t),this.addPointEx(t,o),A.buildPoint(h,this.m_distance,f-_,t),this.addPoint(t)}return this.m_a1=i,this.m_a2=n,this.addPointEx(this.m_offsetPts[0],0),this.m_offsetPts[0]=this.m_offsetPts[this.m_offsetPtCount-1].clone(),this.removeBadSegsFast()}removeBadSegsFast(){let t=!1;for(let e=0;e<this.m_offsetPtCount;e++){const t=this.m_offsetPts[e];t.m_next=e+1,t.m_prev=e-1}this.m_offsetPts[0].m_prev=this.m_offsetPtCount-2,this.m_offsetPts[this.m_offsetPtCount-2].m_next=0;let s=0;for(let e=0;e<this.m_offsetPtCount;e++)if(this.m_offsetPts[s].type&p){const e=this.deleteClosedSeg(s);if(-1===e){t=!0;break}s=e}else s=this.m_offsetPts[s].m_next;return!t&&(this.compressOffsetArray(s),!0)}deleteClosedSeg(t){const s=this.m_offsetPtCount-1;let e,i,n=t;for(let o=1;o<=s-2;o++){n=this.m_offsetPts[n].m_next,e=n,i=t;for(let t=1;t<=o;t++){if(i=this.m_offsetPts[i].m_prev,!(this.m_offsetPts[i].type&p||this.m_offsetPts[e].type&p)){const t=this.handleClosedIntersection(i,e);if(-1!==t)return t}e=this.m_offsetPts[e].m_prev}}return-1}handleClosedIntersection(t,s){const e=this.m_offsetPts[this.m_offsetPts[t].m_prev],i=this.m_offsetPts[t],n=this.m_offsetPts[this.m_offsetPts[s].m_prev],o=this.m_offsetPts[s];if(!this.sectGraphicRect(e,i,n,o))return-1;const h=C();if(((i.x-e.x)*(o.y-n.y)-(i.y-e.y)*(o.x-n.x))*this.m_distance<0){if(this.findIntersection(e,i,n,o,h)&&!h.bAtExistingPt){const r=1e-8,m=Math.sqrt((i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y)),a=(i.x-e.x)/m,f=(i.y-e.y)/m,_=Math.sqrt((o.x-n.x)*(o.x-n.x)+(o.y-n.y)*(o.y-n.y)),c=(o.x-n.x)/_,d=(o.y-n.y)/_;let P=!1;const u=h.pt.clone();u.x+=(a+c)*r,u.y+=(f+d)*r;let l=n,y=h.pt,x=this.m_offsetPts[t].m_prev;for(;y.y>u.y!=l.y>u.y&&u.x<(l.x-y.x)*(u.y-y.y)/(l.y-y.y)+y.x&&(P=!P),l=y,x=this.m_offsetPts[x].m_next,x!==s;)y=this.m_offsetPts[x];if(P)return-1;const p=this.m_offsetPts[t].m_prev;return h.pt.type=i.type,h.pt.m_next=s,h.pt.m_prev=p,this.m_offsetPts[t]=h.pt,this.m_offsetPts[s].m_prev=t,s}}return-1}sectGraphicRect(t,s,e,i){return Math.max(t.x,s.x)>=Math.min(e.x,i.x)&&Math.max(e.x,i.x)>=Math.min(t.x,s.x)&&Math.max(t.y,s.y)>=Math.min(e.y,i.y)&&Math.max(e.y,i.y)>=Math.min(t.y,s.y)}findIntersection(t,s,e,i,n){let o,h,r,m;return n.bAtExistingPt=!1,o=(s.y-t.y)*(i.x-e.x)-(s.x-t.x)*(i.y-e.y),h=(e.y-t.y)*(s.x-t.x)-(e.x-t.x)*(s.y-t.y),r=0===o?2:h/o,r>=0&&r<=1&&(m=r,o=(i.y-e.y)*(s.x-t.x)-(i.x-e.x)*(s.y-t.y),h=(t.y-e.y)*(i.x-e.x)-(t.x-e.x)*(i.y-e.y),r=0===o?2:h/o,r>=0&&r<=1)&&(n.pt.x=t.x+r*(s.x-t.x),n.pt.y=t.y+r*(s.y-t.y),this.m_bUseZ&&(n.pt.z=e.z+m*(i.z-e.z)),this.m_bUseM&&(n.pt.m=e.m+m*(i.m-e.m)),0!==m&&1!==m||0!==r&&1!==r||(n.bAtExistingPt=!0),!((0===m||1===m)&&r>0&&r<1||(0===r||1===r)&&m>0&&m<1))}compressOffsetArray(t){for(;this.m_offsetPts[t].m_prev<t;)t=this.m_offsetPts[t].m_prev;let s=0,e=t;do{const t=this.m_offsetPts[e].clone();this.m_offsetPts[s]=t,e=t.m_next,s++}while(e!==t);this.m_offsetPts[s]=this.m_offsetPts[0].clone(),this.m_offsetPtCount=s+1}addPart(t,s){if(!(s<2))for(let e=0;e<s;e++){const s=this.m_offsetPts[t+e];if(e?this.m_bUseZ?this.m_resultPath.lineTo3DCoords(s.x,s.y,s.z):this.m_resultPath.lineToCoords(s.x,s.y):this.m_bUseZ?this.m_resultPath.startPath3DCoords(s.x,s.y,s.z):this.m_resultPath.startPathCoords(s.x,s.y),this.m_bUseM){const t=this.m_resultPath.getPointCount()-1;this.m_resultPath.setAttribute(2,t,0,s.m)}}}offsetMultiPath(t){const s=f(this.m_inputGeometry,0,this.m_tolerance,0,this.m_progressTracker,12e3),e=s.querySegmentIterator();e.resetToFirstPath();let i=-1;for(;e.nextPath();)i++,this.offsetPath(s,i,t)}offsetPath(t,s,e){let i=t.getPathStart(s),n=t.getPathEnd(s);if(this.m_resultPath=e,t.isClosedPath(s)){const s=t.getXY(i);for(;n>i&&t.getXY(n-1).equals(s);)n--;if(n-i>=2){this.m_srcPtCount=n-i,this.m_srcPts.length=this.m_srcPtCount;for(let s=i;s<n;s++)this.progress(),this.m_srcPts[s-i]=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0);this.buildOffset()&&this.addPart(0,this.m_offsetPtCount-1)}}else{const s=t.getXY(i);for(;i<n-1&&t.getXY(i+1).equals(s);)i++;const e=t.getXY(n-1);for(;i<n-1&&t.getXY(n-2).equals(e);)n--;if(n-i>=2){this.m_srcPtCount=2*(n-i)-2,this.m_srcPts.length=this.m_srcPtCount;let e=g.construct(s,this.m_bUseZ?t.getAttributeAsDbl(1,i,0):0,this.m_bUseM?t.getAttributeAsDbl(2,i,0):0);e.type|=b+M,this.m_srcPts[0]=e;let o=1,h=this.m_srcPtCount-1;for(let s=i+1;s<n-1;s++,o++,h--)this.progress(),e=g.construct(t.getXY(s),this.m_bUseZ?t.getAttributeAsDbl(1,s,0):0,this.m_bUseM?t.getAttributeAsDbl(2,s,0):0),this.m_srcPts[o]=e.clone(),e.type|=M,this.m_srcPts[h]=e.clone();if(e=g.construct(t.getXY(n-1),this.m_bUseZ?t.getAttributeAsDbl(1,n-1,0):0,this.m_bUseM?t.getAttributeAsDbl(2,n-1,0):0),e.type|=b,this.m_srcPts[o]=e.clone(),this.buildOffset())if(this.m_offsetPts.length>=2){let t=-1,s=-1,e=!!(this.m_offsetPts[this.m_offsetPtCount-1].type&M);e||(t=0);for(let i=1;i<this.m_offsetPtCount;i++){this.progress();const n=!!(this.m_offsetPts[i].type&M);n?e||(s=i-1,s-t+1>1&&this.addPart(t,s-t+1)):e&&(t=i-1),e=n}e||(s=this.m_offsetPtCount-1,s-t+1>1&&this.addPart(t,s-t+1))}else{const t=0,s=this.m_offsetPtCount-1;s-t>=1&&this.addPart(t,s-t+1)}}}this.m_srcPts.length=0,this.m_srcPtCount=0,this.m_offsetPts.length=0,this.m_offsetPtCount=0}static dotSign(t,s,e,i){const n=s.x-t.x,o=s.y-t.y,h=i.x-e.x,r=i.y-e.y,m=P(n,o,h,r);return u(m)}}class E{getOperatorType(){return 10108}accelerateGeometry(t,s,e){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,s,e,i,n,o,h){return new v(t,s,e,i,n,o,h)}execute(t,s,e,i,n,o,h){return new v(null,s,e,i,n,o,h).offset(t)}}class v extends t{constructor(t,s,e,i,n,o,h){super(),this.m_progressTracker=h,this.m_index=-1,this.m_inputGeoms=t,this.m_spatialReference=s,this.m_distance=e,this.m_joins=i,this.m_miterLimit=n,this.m_flattenError=o}tock(){return!0}getRank(){return 1}next(){if(!this.m_inputGeoms)return null;let t;for(;t=this.m_inputGeoms.next();)return this.m_index=this.m_inputGeoms.getGeometryID(),this.offset(t);return null}getGeometryID(){return this.m_index}offset(t){let s;return i(t),s=this.m_flattenError<=0?e(this.m_spatialReference,t,!0).total():this.m_flattenError,l(t,this.m_distance,this.m_joins,this.m_miterLimit,s,this.m_progressTracker)}}const G=new E;function w(t,s,e,i,n,o){return G.execute(t,s,e,i,n,o,null)}function j(t,e,i,n,o,h){const r=G.executeMany(new s(t),e,i,n,o,h,null);return Array.from(r)}function D(){return G.supportsCurves()}export{w as execute,j as executeMany,D as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{O as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{t as s,d as i,G as r,g as h}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{a as o}from"../../../chunks/Envelope.js";import{E as a,k as m,n as p}from"../../../chunks/QuadraticBezier.js";import{C as _,k as c,s as u,ar as l,l as g,ap as d,aq as G,an as C,at as y,au as I,av as x}from"../../../chunks/ProjectionTransformation.js";import{v as f}from"../../../chunks/Point2D.js";function k(t){t&&t.checkProgress()}class v{getOperatorType(){return 10012}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,e,s,i){return new S(t,e,s,i)}}class S extends t{constructor(t,e,i,r){super(),this.m_shape=null,this.m_topoGraph=null,this.m_curveStitcher=null,this.m_stitchMaxDeviation=0,this.m_chainStack=[],this.m_bitsetToChains=null,this.m_chainsLists=null,this.m_visitedChainsIndex=-1,this.m_index=-1,this.m_geometryIndex=-1,this.m_progressCounter=0,this.m_currentIds=[],this.m_currentEdgeIds=[],t||s(""),this.m_progressTracker=r,this.m_options=0!==i?i:3,(this.m_options<=0||this.m_options>63)&&s("options"),this.m_inputGeometryCursor=t,this.m_sr=e}tock(){return!0}getRank(){return 1}next(){if(-1===this.m_index){this.m_shape=new a;const t=new n;t.setEmpty(),this.m_geometryIndex=this.m_shape.createGeometryUserIndex();for(let o=this.m_inputGeometryCursor.next();null!==o;o=this.m_inputGeometryCursor.next()){i(o);const e=this.m_shape.addGeometry(o);o.getGeometryType()!==r.enumPolygon&&s("Polygon Overlay only supports Polygons"),this.m_shape.setGeometryUserIndex(e,this.m_geometryIndex,this.m_inputGeometryCursor.getGeometryID());const h=this.m_inputGeometryCursor.getRank();h>m&&this.m_shape.assignRankToGeometryVertices(e,h);const a=new n;o.queryLooseEnvelope(a),t.mergeEnvelope2D(a),k(this.m_progressTracker)}this.m_inputGeometryCursor=null;const e=o(this.m_sr,t,!0),h=o(this.m_sr,t,!1);t.inflate(10*e.total()),this.m_shape.forceSetEnvelope2D(t),this.m_stitchMaxDeviation=0;let x=0;if(this.m_shape.hasCurves()){this.m_curveStitcher=new _;const s=c(e.total(),t);this.m_stitchMaxDeviation=u(e.total()),x=l(s,this.m_stitchMaxDeviation),g(this.m_shape,s,e.total(),12e3,this.m_curveStitcher,null,this.m_progressTracker)}if(d(this.m_shape,h,this.m_progressTracker)){G(this.m_shape,e.add(x),this.m_progressTracker,!0,!1);for(let t=this.m_shape.getFirstGeometry();t!==p;t=this.m_shape.getNextGeometry(t))this.m_shape.getGeometryType(t)===r.enumPolygon&&C(this.m_shape,t,-1,!1,p,this.m_progressTracker)}this.m_topoGraph=new y,this.m_topoGraph.buildGeometryParentageSets(),this.m_topoGraph.setEditShape(this.m_shape,this.m_progressTracker);const f=this.m_topoGraph.getFirstChain();for(let s=this.m_topoGraph.getChainFirstIsland(f);s!==p;s=this.m_topoGraph.getChainNextInParent(s))for(let t=this.m_topoGraph.getChainFirstIsland(s);t!==p;t=this.m_topoGraph.getChainNextInParent(t))this.m_chainStack.push(t);if(16&this.m_options){this.m_visitedChainsIndex=this.m_topoGraph.createUserIndexForChains(),this.m_bitsetToChains=new Map,this.m_chainsLists=new I;const t=[],e=this.m_topoGraph.getFirstChain();for(t.push(e);t.length>0;){const e=t.at(-1);t.pop();for(let s=this.m_topoGraph.getChainFirstIsland(e);s!==p;s=this.m_topoGraph.getChainNextInParent(s))for(let e=this.m_topoGraph.getChainFirstIsland(s);e!==p;e=this.m_topoGraph.getChainNextInParent(e)){const s=this.m_topoGraph.getChainBitSet(e);if(null!==s&&!s.isZero()){let t;this.m_bitsetToChains.has(s)?t=this.m_bitsetToChains.get(s):(t=this.m_chainsLists.createList(),this.m_bitsetToChains.set(s,t)),this.m_chainsLists.addElement(t,e)}t.push(e)}}}}return this.makeNextGeometry()}getGeometryID(){return this.m_index}getGeometryIDs(){return this.m_currentIds.slice()}getBoundaryIDs(){return this.m_currentEdgeIds.slice()}buildIdsFromBitset(t,e){if(!t)return;const s=this.m_topoGraph.getGeometriesFromBits(t);if(s.length>0){for(let t=0,i=s.length;t<i;t++)e.push(this.m_shape.getGeometryUserIndex(s[t],this.m_geometryIndex));f(e)}}makeGeometryFromChainSinglePart(t){this.m_index++;const e=new a;null!==this.m_curveStitcher&&e.setCurveStitcherPointer(this.m_curveStitcher);const s=this.m_topoGraph.extractPolygonFromChainAndIslands(e,p,t,p);return null!==this.m_curveStitcher&&this.m_curveStitcher.stitchCurves(e,s,this.m_stitchMaxDeviation,!1),e.getGeometry(s)}makeGeometryFromChainMultiPart(t,e){this.m_index++;const s=new a;null!==this.m_curveStitcher&&s.setCurveStitcherPointer(this.m_curveStitcher);const i=this.m_bitsetToChains.has(e);h(i);const r=this.m_bitsetToChains.get(e);let n=p;for(let h=this.m_chainsLists.getFirst(r);h!==I.st_nullNode();h=this.m_chainsLists.getNext(h)){const t=this.m_chainsLists.getElement(h);n=this.m_topoGraph.extractPolygonFromChainAndIslands(s,n,t,p),this.m_topoGraph.setChainUserIndex(t,this.m_visitedChainsIndex,1)}return null!==this.m_curveStitcher&&this.m_curveStitcher.stitchCurves(s,n,this.m_stitchMaxDeviation,!1),s.getGeometry(n)}makeNextGeometry(){for(k(this.m_progressTracker);this.m_chainStack.length>0;){this.m_currentIds.length=0,this.m_currentEdgeIds.length=0;const t=this.m_chainStack.at(-1);this.m_chainStack.pop();const e=this.m_topoGraph.getChainArea(t);if(0!==e)if(e<0)for(let s=this.m_topoGraph.getChainFirstIsland(t);s!==p;s=this.m_topoGraph.getChainNextInParent(s))this.m_topoGraph.getChainArea(s)>0&&this.m_chainStack.push(s);else{for(let i=this.m_topoGraph.getChainFirstIsland(t);i!==p;i=this.m_topoGraph.getChainNextInParent(i))this.m_topoGraph.getChainArea(i)<0&&this.m_chainStack.push(i);if(-1!==this.m_visitedChainsIndex&&1===this.m_topoGraph.getChainUserIndex(t,this.m_visitedChainsIndex))continue;const e=t=>{const e=t.getUnorderedBitIterator();let s=0;for(;e.next()!==x.npos();)if(s++,s>1)return s;return s},s=e(this.m_topoGraph.getChainBitSet(t));if(s>0){if(1===s&&2&this.m_options||s>1&&1&this.m_options){const e=this.m_topoGraph.getChainBitSet(t);return this.buildIdsFromBitset(e,this.m_currentIds),16&this.m_options?this.makeGeometryFromChainMultiPart(t,e):this.makeGeometryFromChainSinglePart(t)}}else{if(!(12&~this.m_options)){if(32&this.m_options){const e=this.m_topoGraph.getChainBoundaryBitSet(t);this.buildIdsFromBitset(e,this.m_currentEdgeIds)}return this.makeGeometryFromChainSinglePart(t)}if(4&this.m_options){const s=this.m_topoGraph.getChainBoundaryBitSet(t);if(e(s)>1)return 32&this.m_options&&this.buildIdsFromBitset(s,this.m_currentEdgeIds),this.makeGeometryFromChainSinglePart(t);continue}if(8&this.m_options){const s=this.m_topoGraph.getChainBoundaryBitSet(t);if(1===e(s))return 32&this.m_options&&this.buildIdsFromBitset(s,this.m_currentEdgeIds),this.makeGeometryFromChainSinglePart(t);continue}}}}return null}}const F=new v;function P(t,s,i){return F.executeMany(new e(t),s,i,null)}function T(){return F.supportsCurves()}export{P as executeMany,T as supportsCurves};
5
+ import{O as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{a as s,d as i,G as r,g as h}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{c as o}from"../../../chunks/Envelope.js";import{E as a,k as m,n as p}from"../../../chunks/QuadraticBezier.js";import{C as _,k as c,s as u,ar as l,l as g,ap as d,aq as G,an as C,at as y,au as I,av as x}from"../../../chunks/ProjectionTransformation.js";import{v as f}from"../../../chunks/Point2D.js";function k(t){t&&t.checkProgress()}class v{getOperatorType(){return 10012}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}executeMany(t,e,s,i){return new S(t,e,s,i)}}class S extends t{constructor(t,e,i,r){super(),this.m_shape=null,this.m_topoGraph=null,this.m_curveStitcher=null,this.m_stitchMaxDeviation=0,this.m_chainStack=[],this.m_bitsetToChains=null,this.m_chainsLists=null,this.m_visitedChainsIndex=-1,this.m_index=-1,this.m_geometryIndex=-1,this.m_progressCounter=0,this.m_currentIds=[],this.m_currentEdgeIds=[],t||s(""),this.m_progressTracker=r,this.m_options=0!==i?i:3,(this.m_options<=0||this.m_options>63)&&s("options"),this.m_inputGeometryCursor=t,this.m_sr=e}tock(){return!0}getRank(){return 1}next(){if(-1===this.m_index){this.m_shape=new a;const t=new n;t.setEmpty(),this.m_geometryIndex=this.m_shape.createGeometryUserIndex();for(let o=this.m_inputGeometryCursor.next();null!==o;o=this.m_inputGeometryCursor.next()){i(o);const e=this.m_shape.addGeometry(o);o.getGeometryType()!==r.enumPolygon&&s("Polygon Overlay only supports Polygons"),this.m_shape.setGeometryUserIndex(e,this.m_geometryIndex,this.m_inputGeometryCursor.getGeometryID());const h=this.m_inputGeometryCursor.getRank();h>m&&this.m_shape.assignRankToGeometryVertices(e,h);const a=new n;o.queryLooseEnvelope(a),t.mergeEnvelope2D(a),k(this.m_progressTracker)}this.m_inputGeometryCursor=null;const e=o(this.m_sr,t,!0),h=o(this.m_sr,t,!1);t.inflate(10*e.total()),this.m_shape.forceSetEnvelope2D(t),this.m_stitchMaxDeviation=0;let x=0;if(this.m_shape.hasCurves()){this.m_curveStitcher=new _;const s=c(e.total(),t);this.m_stitchMaxDeviation=u(e.total()),x=l(s,this.m_stitchMaxDeviation),g(this.m_shape,s,e.total(),12e3,this.m_curveStitcher,null,this.m_progressTracker)}if(d(this.m_shape,h,this.m_progressTracker)){G(this.m_shape,e.add(x),this.m_progressTracker,!0,!1);for(let t=this.m_shape.getFirstGeometry();t!==p;t=this.m_shape.getNextGeometry(t))this.m_shape.getGeometryType(t)===r.enumPolygon&&C(this.m_shape,t,-1,!1,p,this.m_progressTracker)}this.m_topoGraph=new y,this.m_topoGraph.buildGeometryParentageSets(),this.m_topoGraph.setEditShape(this.m_shape,this.m_progressTracker);const f=this.m_topoGraph.getFirstChain();for(let s=this.m_topoGraph.getChainFirstIsland(f);s!==p;s=this.m_topoGraph.getChainNextInParent(s))for(let t=this.m_topoGraph.getChainFirstIsland(s);t!==p;t=this.m_topoGraph.getChainNextInParent(t))this.m_chainStack.push(t);if(16&this.m_options){this.m_visitedChainsIndex=this.m_topoGraph.createUserIndexForChains(),this.m_bitsetToChains=new Map,this.m_chainsLists=new I;const t=[],e=this.m_topoGraph.getFirstChain();for(t.push(e);t.length>0;){const e=t.at(-1);t.pop();for(let s=this.m_topoGraph.getChainFirstIsland(e);s!==p;s=this.m_topoGraph.getChainNextInParent(s))for(let e=this.m_topoGraph.getChainFirstIsland(s);e!==p;e=this.m_topoGraph.getChainNextInParent(e)){const s=this.m_topoGraph.getChainBitSet(e);if(null!==s&&!s.isZero()){let t;this.m_bitsetToChains.has(s)?t=this.m_bitsetToChains.get(s):(t=this.m_chainsLists.createList(),this.m_bitsetToChains.set(s,t)),this.m_chainsLists.addElement(t,e)}t.push(e)}}}}return this.makeNextGeometry()}getGeometryID(){return this.m_index}getGeometryIDs(){return this.m_currentIds.slice()}getBoundaryIDs(){return this.m_currentEdgeIds.slice()}buildIdsFromBitset(t,e){if(!t)return;const s=this.m_topoGraph.getGeometriesFromBits(t);if(s.length>0){for(let t=0,i=s.length;t<i;t++)e.push(this.m_shape.getGeometryUserIndex(s[t],this.m_geometryIndex));f(e)}}makeGeometryFromChainSinglePart(t){this.m_index++;const e=new a;null!==this.m_curveStitcher&&e.setCurveStitcherPointer(this.m_curveStitcher);const s=this.m_topoGraph.extractPolygonFromChainAndIslands(e,p,t,p);return null!==this.m_curveStitcher&&this.m_curveStitcher.stitchCurves(e,s,this.m_stitchMaxDeviation,!1),e.getGeometry(s)}makeGeometryFromChainMultiPart(t,e){this.m_index++;const s=new a;null!==this.m_curveStitcher&&s.setCurveStitcherPointer(this.m_curveStitcher);const i=this.m_bitsetToChains.has(e);h(i);const r=this.m_bitsetToChains.get(e);let n=p;for(let h=this.m_chainsLists.getFirst(r);h!==I.st_nullNode();h=this.m_chainsLists.getNext(h)){const t=this.m_chainsLists.getElement(h);n=this.m_topoGraph.extractPolygonFromChainAndIslands(s,n,t,p),this.m_topoGraph.setChainUserIndex(t,this.m_visitedChainsIndex,1)}return null!==this.m_curveStitcher&&this.m_curveStitcher.stitchCurves(s,n,this.m_stitchMaxDeviation,!1),s.getGeometry(n)}makeNextGeometry(){for(k(this.m_progressTracker);this.m_chainStack.length>0;){this.m_currentIds.length=0,this.m_currentEdgeIds.length=0;const t=this.m_chainStack.at(-1);this.m_chainStack.pop();const e=this.m_topoGraph.getChainArea(t);if(0!==e)if(e<0)for(let s=this.m_topoGraph.getChainFirstIsland(t);s!==p;s=this.m_topoGraph.getChainNextInParent(s))this.m_topoGraph.getChainArea(s)>0&&this.m_chainStack.push(s);else{for(let i=this.m_topoGraph.getChainFirstIsland(t);i!==p;i=this.m_topoGraph.getChainNextInParent(i))this.m_topoGraph.getChainArea(i)<0&&this.m_chainStack.push(i);if(-1!==this.m_visitedChainsIndex&&1===this.m_topoGraph.getChainUserIndex(t,this.m_visitedChainsIndex))continue;const e=t=>{const e=t.getUnorderedBitIterator();let s=0;for(;e.next()!==x.npos();)if(s++,s>1)return s;return s},s=e(this.m_topoGraph.getChainBitSet(t));if(s>0){if(1===s&&2&this.m_options||s>1&&1&this.m_options){const e=this.m_topoGraph.getChainBitSet(t);return this.buildIdsFromBitset(e,this.m_currentIds),16&this.m_options?this.makeGeometryFromChainMultiPart(t,e):this.makeGeometryFromChainSinglePart(t)}}else{if(!(12&~this.m_options)){if(32&this.m_options){const e=this.m_topoGraph.getChainBoundaryBitSet(t);this.buildIdsFromBitset(e,this.m_currentEdgeIds)}return this.makeGeometryFromChainSinglePart(t)}if(4&this.m_options){const s=this.m_topoGraph.getChainBoundaryBitSet(t);if(e(s)>1)return 32&this.m_options&&this.buildIdsFromBitset(s,this.m_currentEdgeIds),this.makeGeometryFromChainSinglePart(t);continue}if(8&this.m_options){const s=this.m_topoGraph.getChainBoundaryBitSet(t);if(1===e(s))return 32&this.m_options&&this.buildIdsFromBitset(s,this.m_currentEdgeIds),this.makeGeometryFromChainSinglePart(t);continue}}}}return null}}const F=new v;function P(t,s,i){return F.executeMany(new e(t),s,i,null)}function T(){return F.supportsCurves()}export{P as executeMany,T as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{t as s,g as r}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{T as i}from"../../../chunks/Transformation2D.js";import{l as o,q as a,o as u,p as l,P as h,t as m,E as c,a as p,u as _,n as g}from"../../../chunks/QuadraticBezier.js";import{K as f,n as y,E as d,m as x,P as T,b as A,q as E}from"../../../chunks/Point2D.js";import{P as v,b as N}from"../../../chunks/Envelope.js";import{O as S}from"../../../chunks/OperatorClip.js";import{O as w}from"../../../chunks/OperatorMultiPartToSinglePart.js";import{O as C}from"../../../chunks/OperatorCut.js";function X(t,e,s,r,n){return new j(n).findSlicesByArea(t,e,s,r)}function k(t,e,s,r,n){return new j(n).sliceIntoStrips(t,e,s,r)}function b(t,e,s,r){return new j(r).recursiveSliceEqualArea(t,e,s)}function H(t){this.currentX=this.calcX(t)}function P(t){if(null===this.curve){const e=(t-this.y0)/(this.y1-this.y0);return E(this.x0,this.x1,e)}return this.curve.intersectionOfYMonotonicWithAxisX(t,this.x0)}function Y(){return{x0:Number.NaN,y0:Number.NaN,x1:Number.NaN,y1:Number.NaN,currentX:Number.NaN,nextAET:null,prevAET:null,startNodeNext:null,nextInChain:null,curve:null,advance:H,calcX:P}}function I(t,e){const s=Y();return s.x0=t.getStartX(),s.y0=t.getStartY(),s.x1=t.getEndX(),s.y1=t.getEndY(),e&&(s.y0=A(s.x0,s.x0=s.y0),s.y1=A(s.x1,s.x1=s.y1)),s.y1<s.y0&&(s.y1=A(s.y0,s.y0=s.y1),s.x1=A(s.x0,s.x0=s.x1)),s.currentX=Number.NaN,s.nextAET=null,s.prevAET=null,s.startNodeNext=null,s.nextInChain=null,s.curve=null,s}function O(t){const e=Y();return e.x0=t.getStartX(),e.y0=t.getStartY(),e.x1=t.getEndX(),e.y1=t.getEndY(),e.curve=t,e.y1<e.y0&&(e.y1=A(e.y0,e.y0=e.y1),e.x1=A(e.x0,e.x0=e.x1)),e.currentX=Number.NaN,e.nextAET=null,e.prevAET=null,e.startNodeNext=null,e.nextInChain=null,e}function q(t){if(this.x===t.x&&this.y===t.y){const e=null!==this.endEdge,s=null!==t.startEdge;return e&&s?-1:1}return this.y!==t.y?this.y-t.y:this.x-t.x}function R(){return{x:Number.NaN,y:Number.NaN,startEdge:null,endEdge:null,compare:q}}function D(t,e){return{y:t,startingEdges:e}}class M{constructor(t,e,s,r,n,i){this.m_parent=t,this.m_y0=e,this.m_y1=s,this.m_t0=r,this.m_area=i}getMaxDerivative(){return 1}getValue(t,e){return 1===t?0:this.getArea(e)-this.m_area}getError(t){return r(0),0}getArea(t){const e=.5*(this.m_parent.m_sumBase-this.m_parent.m_sumA),s=this.m_y1-this.m_y0;let r=(this.m_parent.m_sumBase-e*(t+this.m_t0))*s*(t-this.m_t0),n=!1;for(let i=this.m_parent.m_AETHead;null!==i;i=i.nextAET)if(n=!n,n&&(null!==i.curve||null!==i.nextAET.curve)){const e=this.m_y0+s*this.m_t0,n=this.m_y0+s*t;i.curve&&(r+=V(i.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t)),i.nextAET.curve&&(r-=V(i.nextAET.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t));r+=(n-e)*(i.nextAET.calcX(e)-i.calcX(e)+(i.nextAET.calcX(n)-i.calcX(n)))*.5}return r}}function B(t,e,s){return{polygon:t,from:e,to:s}}function V(t,e,s){const n=[0,0],i=t.intersectionWithAxis2D(!0,e,null,n);r(1===i);const o=n[0],a=t.intersectionWithAxis2D(!0,s,null,n);r(1===a);const u=n[0],l=x(T,4);_(t,l,!0);const h=l[3],m=l[2],c=l[1],p=t.getCoordX(o)-t.getStartX(),g=t.getCoordY(o)-t.getStartY(),f=t=>{const e=t*t;return e*t*(10*(m.x*c.y-m.y*c.x)-15*t*(h.y*c.x-h.x*c.y)+6*e*(m.y*h.x-h.y*m.x))/60},y=t=>(-t*(c.y+t*(m.y+h.y*t))*p+t*(c.x+t*(m.x+h.x*t))*g)/2;return f(u)-f(o)-(y(u)-y(o))}class z extends t{constructor(t){super(),this.m_geoms=[],this.m_index=-1,this.m_id=-1,this.m_geoms=t}tock(){return!0}getRank(){return 1}next(){return this.m_index++,this.m_index>=this.m_geoms.length?null:(this.m_id=this.m_geoms[this.m_index].second,this.m_geoms[this.m_index].first)}getGeometryID(){return this.m_id}}class j{constructor(t){this.m_edges=[],this.m_curves=[],this.m_sortedNodes=[],this.m_sortHelper=[],this.m_cuts=[],this.m_cutAreas=[],this.m_totalAreaOfTraps=new f(0),this.m_areaTracking=0,this.m_splitArea=0,this.m_sumBase=0,this.m_sumA=0,this.m_numberOfCuts=0,this.m_currentScan=0,this.m_progressCounter=0,this.m_AETHead=null,this.m_bHorizontalSweep=!1,this.m_bPolygonHasCurves=!1,this.m_progressTracker=t}findSlicesByArea(t,e,r,n){n<0&&s("remainingArea");let i=t,a=null;i.hasNonLinearSegments()&&(this.m_bPolygonHasCurves=!0,a=o(t,1e-16,!0),G(a),i=a);const u=Math.abs(i.calculateArea2D());return 0===u||0===r||n>=u||1===r&&0===n?[]:(this.m_splitArea=(u-n)/r,this.m_numberOfCuts=r-1,n>0&&this.m_numberOfCuts++,this.m_edges.length=0,this.m_sortedNodes.length=0,this.m_cuts.length=0,this.m_areaTracking=0,this.m_totalAreaOfTraps.reset(),this.m_curves.length=0,this.buildEdges(i),this.buildScanNodes(),this.trapezoidation(),this.m_cuts)}sliceIntoStrips(t,s,r,i){if(0===i)return new e([t]);const o=new n;t.queryLooseEnvelope(o);const a=o.width()+o.height();return new z(this.splitPolygon(t,s,o.xmin-a-1+1,o.xmax+a+1,r,i))}recursiveSliceEqualArea(t,s,o){if(o<=1||t.isEmpty())return new e([t]);{const e=[],a=[];a.push(y(t.clone(),o));let u=0,l=0;for(;a.length>0;){r(l++<2*o);const t=a.at(-1);if(a.pop(),1===t.second){e.push(y(t.first,u++));continue}const h=new n;t.first.queryEnvelope(h);const m=h.width()+h.height(),c=new i;c.setIdentity(),h.width()>h.height()&&(c.setRotateCcw90(),t.first.applyTransformation(c),c.transformEnvInPlace(h));const p=t.first.calculateArea2D(),_=p/t.second,g=p-Math.trunc(t.second/2)*_,f=new j(this.m_progressTracker).findSlicesByArea(t.first,s,1,g),d=new j(this.m_progressTracker).splitPolygon(t.first,s,h.xmin-m-1+1,h.xmax+m+1,f,1),x=d.length;if(r(x>0&&x<=2),!c.isIdentity()){const t=new i;t.setRotateCw90(),d[0].first.applyTransformation(t),2===x&&d[1].first.applyTransformation(t)}2===x?(a.push(y(d[1].first,t.second-Math.trunc(t.second/2))),a.push(y(d[0].first,Math.trunc(t.second/2)))):a.push(y(d[0].first,t.second))}return new z(e)}}recursiveSliceEqualAreaImpl(t,e,s,n){return r(0),{}}processTraps(t,e,s){s?this.processTrapsCurves(t,e):this.processTrapsLinear(t,e)}processTrapsLinear(t,e){let s=0,r=1;const n=.5*(this.m_sumBase-this.m_sumA),i=e-t,o=(this.m_sumBase-n*(r+s))*i*(r-s);if(o+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(o),void(this.m_areaTracking+=o);const u=new f(o),l=new d(0,1);let h=!1;for(;s<1;){const e=this.m_splitArea-this.m_areaTracking,m=[Number.NaN,Number.NaN];if(!(a(-n*i,this.m_sumBase*i,(n*s-this.m_sumBase)*i*s-e,l,!1,m)>0)){h?this.m_areaTracking=u.getResult():this.m_areaTracking+=o;break}{h=!0,r=m[0],this.m_areaTracking=0,s=r,u.me(e);const n=r*i+t;if(this.m_cuts.push(n),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+o-u.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(o-u.getResult())}}this.m_totalAreaOfTraps.pe(o)}processTrapsCurves(t,e){let s=0,r=1;const n=new M(this,t,e,0,1,0).getArea(1);if(n+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(n),void(this.m_areaTracking+=n);const i=e-t,o=new f(n);let a=!1;for(;s<1;){const l=this.m_splitArea-this.m_areaTracking,h=new M(this,t,e,s,1,l),m=[0],c=new d(s,1);if(!(u(h,c,1,m)>0)){a?this.m_areaTracking=o.getResult():this.m_areaTracking+=n;break}{a=!0,r=m[0],this.m_areaTracking=0,s=r,o.me(l);const e=r*i+t;if(this.m_cuts.push(e),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+n-o.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(n-o.getResult())}}this.m_totalAreaOfTraps.pe(n)}advanceAET(){const t=this.m_sortedNodes[this.m_currentScan-1].y,e=this.m_sortedNodes[this.m_currentScan];let s=!1,r=!1;const n=new f(0);for(let a=this.m_AETHead;null!==a;a=a.nextAET){const t=a.prevAET;s=!s,null!==a.nextAET&&s&&(this.m_bPolygonHasCurves&&(a.curve||a.nextAET.curve)||n.pe(a.nextAET.currentX-a.currentX)),a.advance(e.y),null!==t&&a.currentX<t.currentX&&(r=!0)}this.m_sumBase=n.getResult(),r&&this.sortAET();const i=new f(0);s=!1;let o=!1;for(let a=this.m_AETHead;null!==a;a=a.nextAET){o=o||null!==a.curve;s=!s,null!==a.prevAET&&(s||this.m_bPolygonHasCurves&&(a.curve||a.prevAET.curve)||i.pe(a.currentX-a.prevAET.currentX))}this.m_sumA=i.getResult(),this.processTraps(t,e.y,o);for(let a=this.m_AETHead;null!=a;){const t=a.prevAET,s=a.nextAET;if(e.y===a.y1)if(a.prevAET=null,a.nextAET=null,null!==a.nextInChain){const e=a.currentX;a=a.nextInChain,a.currentX=e,a.prevAET=t,t?t.nextAET=a:this.m_AETHead=a,a.nextAET=s,s&&(s.prevAET=a)}else t?t.nextAET=s:this.m_AETHead=s,s&&(s.prevAET=t);a=s}}mergeNewEdgesToAET(){for(let r=this.m_sortedNodes[this.m_currentScan].startingEdges;null!==r;r=r.startNodeNext)Number.isNaN(r.currentX)&&(this.m_sortHelper.push(r),r.currentX=r.x0);if(!this.m_sortHelper.length)return;this.sortHelper();let t=this.m_AETHead,e=0,s=t;for(;null!==t&&e<this.m_sortHelper.length;)t.currentX>this.m_sortHelper[e].currentX?(this.m_sortHelper[e].prevAET=t.prevAET,t.prevAET?t.prevAET.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=t,t.prevAET=this.m_sortHelper[e],e++):(s=t,t=t.nextAET);for(;e<this.m_sortHelper.length;)this.m_sortHelper[e].prevAET=s,null!==s?s.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=null,s=this.m_sortHelper[e],e++;this.m_sortHelper.length=0}sortAET(){for(let e=this.m_AETHead;null!==e;e=e.nextAET)this.m_sortHelper.push(e);this.sortHelper(),this.m_AETHead=null;let t=null;for(const e of this.m_sortHelper)e.prevAET=t,t?t.nextAET=e:this.m_AETHead=e,e.nextAET=null,t=e;this.m_sortHelper.length=0}sortHelper(){this.m_sortHelper.sort(((t,e)=>t.currentX-e.currentX))}trapezoidation(){for(this.m_currentScan=0,this.mergeNewEdgesToAET(),this.m_currentScan++;this.m_currentScan<this.m_sortedNodes.length&&(this.progress(),this.advanceAET(),this.m_cuts.length!==this.m_numberOfCuts);)this.mergeNewEdgesToAET(),this.m_currentScan++}buildEdges(t){const e=t.querySegmentIterator();for(e.stripAttributes();e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(t.isCurve()){const e=t;if(l(e),this.m_bHorizontalSweep){const t=x(T,4);e.queryControlPoints(t);for(const e of t)e.y=A(e.x,e.x=e.y);e.constructPoints(t)}const s=e.getStartY(),r=e.getEndY();if(r===s)continue;r<s&&e.reverse(),this.m_curves.push(e.clone()),this.m_edges.push(O(this.m_curves.at(-1)))}else{const e=this.m_bHorizontalSweep?t.getStartX():t.getStartY();if((this.m_bHorizontalSweep?t.getEndX():t.getEndY())===e)continue;this.m_edges.push(I(t,this.m_bHorizontalSweep))}}this.m_edges.sort(((t,e)=>t.y0===e.y0?t.x0-e.x0:t.y0-e.y0))}buildScanNodes(){const t=[];for(const n of this.m_edges){const e=R();e.x=n.x0,e.y=n.y0,e.startEdge=n,e.endEdge=null,t.push(e);const s=R();s.x=n.x1,s.y=n.y1,s.startEdge=null,s.endEdge=n,t.push(s)}t.sort(((t,e)=>t.compare(e)));let e=0,s=t[e].y;this.m_sortedNodes.push(D(s,t[e].startEdge));let r=e;for(e++;e!==t.length;++e){t[e].y!==s&&(this.m_sortedNodes.push(D(t[e].y,null)),s=t[e].y);const n=t[e].startEdge;if(n){const t=this.m_sortedNodes.at(-1);n.startNodeNext=t.startingEdges,t.startingEdges=n}if(t[r].x!==t[e].x||t[r].y!==t[e].y){if(e-r==2){let e=r;e++,null!==t[r].endEdge&&null!==t[e].startEdge&&(t[r].endEdge.nextInChain=t[e].startEdge)}r=e}}}progress(){}splitPolygonLinear(t,s,i,o,a,u){const l=[];l.push([t,0,u]);const m=[],c=new h;for(c.startPathCoords(i,0),c.lineToCoords(o,0);l.length>0;){const h=l.at(-1);l.pop();const p=h[0],_=h[1],g=h[2],f=(new w).executeMany(new e([p]),s,this.m_progressTracker);for(let e=f.next();null!==e;e=f.next()){const h=e,p=new n;h.queryLooseEnvelope(p);let f=_,d=g;for(let t=_,e=g-1;t<g;++t,--e)p.ymin>=a[t]&&(f=t+1),p.ymax<=a[e]&&(d=e);if(f!==g)if(d!==_)if(f!==d)if(this.isYMonotone(h))this.splitYMonotone(m,h,s,a,f,d);else{const e=Math.trunc((f+d)/2);c.setXYCoords(0,i,a[e]),c.setXYCoords(1,o,a[e]);const _=(new C).execute(!1,h,c,null,this.m_progressTracker),g=_.next(),x=_.next(),T=_.next();if(null!==g){if(g.isEmpty()||(e===d-1?(m.push(y(g,e)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([g,e+1,d])),x.isEmpty()||(e===f?(m.push(y(x,e-1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([x,f,e])),null!==T&&!T.isEmpty()){const t=new n;T.queryLooseEnvelope(t),t.ymin>=a[e]?l.push([T,e+1,d]):t.ymax<=a[e]?l.push([T,f,e]):l.push([T,f,d])}}else e+1===d?(a[e]-p.ymin<p.ymax-a[e]?m.push(y(h,e)):m.push(y(h,e+1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([h,e+1,d])}else m.push(y(e,f-1));else m.push(y(e,_-1));else m.push(y(e,g-1))}}return m}splitPolygon(t,e,s,r,i,o){const a=new n;t.queryLooseEnvelope(a),a.inflateCoords(0,Math.max(a.width(),a.height()));const u=[],l=[];for(l.push(B(t,0,o));l.length;){const o={...l.at(-1)};if(l.pop(),o.polygon.hasNonLinearSegments()){const t=Math.trunc((o.to+o.from)/2),h=i[t],m=new n(s,a.ymin,r,h),c=(new S).execute(o.polygon,m,e,this.m_progressTracker);c.isEmpty()||(t-o.from==0?u.push(y(c,t-1)):l.push(B(c,o.from,t)));const p=new n(s,h,r,a.ymax),_=(new S).execute(o.polygon,p,e,this.m_progressTracker);_.isEmpty()||(o.to-t==1?u.push(y(_,t)):l.push(B(_,t+1,o.to)))}else{const n=this.splitPolygonLinear(t,e,s,r,i.slice(o.from),o.to-o.from);u.push(...n)}}u.sort(((t,e)=>t.second-e.second));const h=[];return m(u,((t,e)=>t.second===e.second),((t,e)=>{const s=new p;for(let r=t;r!==e;++r)s.add(u[r].first,!1);h.push(y(s,u[t].second))})),h}isYMonotone(t){if(1!==t.getPathCount())return!1;const e=t.getXY(0);let s=0,r=0;const n=new T;for(let i=1,o=t.getPointCount();i<=o;i++){t.queryXY(i===o?0:i,n);const a=n.y>e.y?1:n.y<e.y?-1:0;if(e.setCoordsPoint2D(n),s!==a&&0!==a){if(0!==s&&(r++,r>2))return!1;s=a}}return!0}splitYMonotone(t,e,s,n,i,o){const a=new c;a.addGeometry(e);const u=a.getFirstPath(a.getFirstGeometry()),l=a.getFirstVertex(u),h=new T,m=new T;let p=l,_=l;{const t=a.getXY(l);h.setCoordsPoint2D(t),m.setCoordsPoint2D(t)}let f=a.getNextVertex(l);const d=new T;for(let r=0,c=a.getPathSize(u);r<c;r++,f=a.getNextVertex(f))a.queryXY(f,d),d.compare(h)<0?(p=f,h.setCoordsPoint2D(d)):d.compare(m)>0&&(_=f,m.setCoordsPoint2D(d));let x=p,A=p,E=x,v=A,N=!1,S=!1,w=i,C=h.y,X=h.y,k=!1;for(;w<o;)if(n[w]<=h.y)w++;else{if(n[w]>=m.y)break;if(!N){const t=a.getNextVertex(x),e=a.getY(t);if(e<C)break;const s=n[w];C<=s&&e>=s?N=!0:(C=e,x=t)}if(!S){const t=a.getPrevVertex(A),e=a.getY(t);if(e<X)break;const s=n[w];X<=s&&e>=s?S=!0:(X=e,A=t)}if(N&&S){k=!0;let e=a.getXY(x);const s=a.getNextVertex(x);let i=a.getXY(s),o=g;if(i.y===e.y)o=i.x<e.x?x:s;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)o=x;else if(1===t)o=s;else{const e=a.splitSegmentAxisAware(x,[t],1,null,-1);r(1===e),o=a.getNextVertex(x),a.getY(o)!==n[w]&&a.setXYCoords(o,a.getX(o),n[w])}}const u=a.getPrevVertex(A);e=a.getXY(u),i=a.getXY(A);let l=g;if(i.y===e.y)l=i.x<e.x?A:u;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)l=u;else if(1===t)l=A;else{const e=a.splitSegmentAxisAware(u,[t],1,null,-1);r(1===e),l=a.getNextVertex(u),a.getY(l)!==n[w]&&a.setXYCoords(l,a.getX(l),n[w])}}t.push(y(this.extractTrapezoid(a,E,o,v,l),w-1)),E=o,v=l,x=o,A=l,C=X=n[w],N=!1,S=!1,w++}}k?t.push(y(this.extractTrapezoid(a,E,_,v,_),w-1)):t.push(y(e,w))}extractTrapezoid(t,e,s,r,n){const i=new p({vd:t.getVertexDescription()}),o=new v;let a=!0;for(let u=e;;u=t.getNextVertex(u)){const e=t.getSegment(u);if(e?i.addSegment(e,a):(t.queryPoint(u,o),a?i.startPathPoint(o):i.lineToPoint(o)),a=!1,u===s)break}s!==n&&(t.queryPoint(n,o),i.lineToPoint(o)),a=!0;for(let u=n;;u=t.getNextVertex(u)){const s=t.getSegment(u);if(s?i.addSegment(s,a):a||u===e||(t.queryPoint(u,o),i.lineToPoint(o)),a=!1,u===r)break}return i}}function G(t){return t.getImpl().ensureXYMonotoneSegments()}function L(t,e,s,r,i,o){const a=new n;t.queryEnvelope(a);const u=4*N(e,s,!0).total();return(!(r>=0)||a.ymin+u>=i[r])&&!(r+1<o&&a.ymax>i[r+1]+u)}class F{getOperatorType(){return 10011}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}sliceIntoStrips(t,e,s,r,n,i){return new W(0,t,e,s,n,0,i)}findSlicesByArea(t,e,s,r,n,i){if(!n||n.isIdentity())return X(t,e,s,r,i);{const o=t.clone();return o.applyTransformation(n),X(o,e,s,r,i)}}recursiveSliceEqualArea(t,e,s,r,n){return new W(1,t,e,null,r,s,n)}}class W extends t{constructor(t,e,s,r,n,i,o){super(),this.m_resultCursor=null,this.m_method=t,this.m_polygon=e,this.m_sr=s,this.m_ySplits=r?.slice()??null,this.m_transform=n,this.m_bReversePaths=n?.isReflective()??!1,this.m_inverseTransform=n?n.clone().invertThis():null,this.m_partCount=i,this.m_tracker=o}tock(){return!0}getRank(){return 1}next(){this.m_resultCursor||(this.m_method?this.recursiveSliceEqualArea():this.sliceIntoStrips());const t=this.m_resultCursor.next();return t?(this.m_inverseTransform&&!this.m_inverseTransform.isIdentity()&&(t.applyTransformation(this.m_inverseTransform),this.m_bReversePaths&&t.reverseAllPaths()),t):t}getGeometryID(){return this.m_resultCursor?this.m_resultCursor.getGeometryID():-1}sliceIntoStrips(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=k(this.m_polygon,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=k(t,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker)}}recursiveSliceEqualArea(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=b(this.m_polygon,this.m_sr,this.m_partCount,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=b(t,this.m_sr,this.m_partCount,this.m_tracker)}}}const K=new F;function Q(t,e,s,r,n){return K.findSlicesByArea(t,e,s,r,n,null)}function J(t,e,s,r){const n=K.recursiveSliceEqualArea(t,e,s,r,null);return Array.from(n)}function U(t,e,s,r){const n=K.sliceIntoStrips(t,e,s,0,r,null);return Array.from(n)}function Z(){return K.supportsCurves()}export{Q as findSlicesByArea,J as recursiveSliceEqualArea,U as sliceIntoStrips,Z as supportsCurves};
5
+ import{G as t,S as e}from"../../../chunks/SimpleGeometryCursor.js";import{a as s,g as r}from"../../../chunks/Geometry.js";import{Envelope2D as n}from"../../../chunks/Envelope2D.js";import{T as i}from"../../../chunks/Transformation2D.js";import{l as o,q as a,o as u,p as l,P as h,t as m,E as c,a as p,u as _,n as g}from"../../../chunks/QuadraticBezier.js";import{K as f,k as y,E as d,m as x,P as T,c as A,q as E}from"../../../chunks/Point2D.js";import{P as v,b as N}from"../../../chunks/Envelope.js";import{O as S}from"../../../chunks/OperatorClip.js";import{O as w}from"../../../chunks/OperatorMultiPartToSinglePart.js";import{O as C}from"../../../chunks/OperatorCut.js";function k(t,e,s,r,n){return new j(n).findSlicesByArea(t,e,s,r)}function X(t,e,s,r,n){return new j(n).sliceIntoStrips(t,e,s,r)}function H(t,e,s,r){return new j(r).recursiveSliceEqualArea(t,e,s)}function P(t){this.currentX=this.calcX(t)}function b(t){if(null===this.curve){const e=(t-this.y0)/(this.y1-this.y0);return E(this.x0,this.x1,e)}return this.curve.intersectionOfYMonotonicWithAxisX(t,this.x0)}function Y(){return{x0:Number.NaN,y0:Number.NaN,x1:Number.NaN,y1:Number.NaN,currentX:Number.NaN,nextAET:null,prevAET:null,startNodeNext:null,nextInChain:null,curve:null,advance:P,calcX:b}}function I(t,e){const s=Y();return s.x0=t.getStartX(),s.y0=t.getStartY(),s.x1=t.getEndX(),s.y1=t.getEndY(),e&&(s.y0=A(s.x0,s.x0=s.y0),s.y1=A(s.x1,s.x1=s.y1)),s.y1<s.y0&&(s.y1=A(s.y0,s.y0=s.y1),s.x1=A(s.x0,s.x0=s.x1)),s.currentX=Number.NaN,s.nextAET=null,s.prevAET=null,s.startNodeNext=null,s.nextInChain=null,s.curve=null,s}function O(t){const e=Y();return e.x0=t.getStartX(),e.y0=t.getStartY(),e.x1=t.getEndX(),e.y1=t.getEndY(),e.curve=t,e.y1<e.y0&&(e.y1=A(e.y0,e.y0=e.y1),e.x1=A(e.x0,e.x0=e.x1)),e.currentX=Number.NaN,e.nextAET=null,e.prevAET=null,e.startNodeNext=null,e.nextInChain=null,e}function q(t){if(this.x===t.x&&this.y===t.y){const e=null!==this.endEdge,s=null!==t.startEdge;return e&&s?-1:1}return this.y!==t.y?this.y-t.y:this.x-t.x}function R(){return{x:Number.NaN,y:Number.NaN,startEdge:null,endEdge:null,compare:q}}function D(t,e){return{y:t,startingEdges:e}}class M{constructor(t,e,s,r,n,i){this.m_parent=t,this.m_y0=e,this.m_y1=s,this.m_t0=r,this.m_area=i}getMaxDerivative(){return 1}getValue(t,e){return 1===t?0:this.getArea(e)-this.m_area}getError(t){return r(0),0}getArea(t){const e=.5*(this.m_parent.m_sumBase-this.m_parent.m_sumA),s=this.m_y1-this.m_y0;let r=(this.m_parent.m_sumBase-e*(t+this.m_t0))*s*(t-this.m_t0),n=!1;for(let i=this.m_parent.m_AETHead;null!==i;i=i.nextAET)if(n=!n,n&&(null!==i.curve||null!==i.nextAET.curve)){const e=this.m_y0+s*this.m_t0,n=this.m_y0+s*t;i.curve&&(r+=V(i.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t)),i.nextAET.curve&&(r-=V(i.nextAET.curve,this.m_y0+s*this.m_t0,this.m_y0+s*t));r+=(n-e)*(i.nextAET.calcX(e)-i.calcX(e)+(i.nextAET.calcX(n)-i.calcX(n)))*.5}return r}}function B(t,e,s){return{polygon:t,from:e,to:s}}function V(t,e,s){const n=[0,0],i=t.intersectionWithAxis2D(!0,e,null,n);r(1===i);const o=n[0],a=t.intersectionWithAxis2D(!0,s,null,n);r(1===a);const u=n[0],l=x(T,4);_(t,l,!0);const h=l[3],m=l[2],c=l[1],p=t.getCoordX(o)-t.getStartX(),g=t.getCoordY(o)-t.getStartY(),f=t=>{const e=t*t;return e*t*(10*(m.x*c.y-m.y*c.x)-15*t*(h.y*c.x-h.x*c.y)+6*e*(m.y*h.x-h.y*m.x))/60},y=t=>(-t*(c.y+t*(m.y+h.y*t))*p+t*(c.x+t*(m.x+h.x*t))*g)/2;return f(u)-f(o)-(y(u)-y(o))}class z extends t{constructor(t){super(),this.m_geoms=[],this.m_index=-1,this.m_id=-1,this.m_geoms=t}tock(){return!0}getRank(){return 1}next(){return this.m_index++,this.m_index>=this.m_geoms.length?null:(this.m_id=this.m_geoms[this.m_index].second,this.m_geoms[this.m_index].first)}getGeometryID(){return this.m_id}}class j{constructor(t){this.m_edges=[],this.m_curves=[],this.m_sortedNodes=[],this.m_sortHelper=[],this.m_cuts=[],this.m_cutAreas=[],this.m_totalAreaOfTraps=new f(0),this.m_areaTracking=0,this.m_splitArea=0,this.m_sumBase=0,this.m_sumA=0,this.m_numberOfCuts=0,this.m_currentScan=0,this.m_progressCounter=0,this.m_AETHead=null,this.m_bHorizontalSweep=!1,this.m_bPolygonHasCurves=!1,this.m_progressTracker=t}findSlicesByArea(t,e,r,n){n<0&&s("remainingArea");let i=t,a=null;i.hasNonLinearSegments()&&(this.m_bPolygonHasCurves=!0,a=o(t,1e-16,!0),G(a),i=a);const u=Math.abs(i.calculateArea2D());return 0===u||0===r||n>=u||1===r&&0===n?[]:(this.m_splitArea=(u-n)/r,this.m_numberOfCuts=r-1,n>0&&this.m_numberOfCuts++,this.m_edges.length=0,this.m_sortedNodes.length=0,this.m_cuts.length=0,this.m_areaTracking=0,this.m_totalAreaOfTraps.reset(),this.m_curves.length=0,this.buildEdges(i),this.buildScanNodes(),this.trapezoidation(),this.m_cuts)}sliceIntoStrips(t,s,r,i){if(0===i)return new e([t]);const o=new n;t.queryLooseEnvelope(o);const a=o.width()+o.height();return new z(this.splitPolygon(t,s,o.xmin-a-1+1,o.xmax+a+1,r,i))}recursiveSliceEqualArea(t,s,o){if(o<=1||t.isEmpty())return new e([t]);{const e=[],a=[];a.push(y(t.clone(),o));let u=0,l=0;for(;a.length>0;){r(l++<2*o);const t=a.at(-1);if(a.pop(),1===t.second){e.push(y(t.first,u++));continue}const h=new n;t.first.queryEnvelope(h);const m=h.width()+h.height(),c=new i;c.setIdentity(),h.width()>h.height()&&(c.setRotateCcw90(),t.first.applyTransformation(c),c.transformEnvInPlace(h));const p=t.first.calculateArea2D(),_=p/t.second,g=p-Math.trunc(t.second/2)*_,f=new j(this.m_progressTracker).findSlicesByArea(t.first,s,1,g),d=new j(this.m_progressTracker).splitPolygon(t.first,s,h.xmin-m-1+1,h.xmax+m+1,f,1),x=d.length;if(r(x>0&&x<=2),!c.isIdentity()){const t=new i;t.setRotateCw90(),d[0].first.applyTransformation(t),2===x&&d[1].first.applyTransformation(t)}2===x?(a.push(y(d[1].first,t.second-Math.trunc(t.second/2))),a.push(y(d[0].first,Math.trunc(t.second/2)))):a.push(y(d[0].first,t.second))}return new z(e)}}recursiveSliceEqualAreaImpl(t,e,s,n){return r(0),{}}processTraps(t,e,s){s?this.processTrapsCurves(t,e):this.processTrapsLinear(t,e)}processTrapsLinear(t,e){let s=0,r=1;const n=.5*(this.m_sumBase-this.m_sumA),i=e-t,o=(this.m_sumBase-n*(r+s))*i*(r-s);if(o+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(o),void(this.m_areaTracking+=o);const u=new f(o),l=new d(0,1);let h=!1;for(;s<1;){const e=this.m_splitArea-this.m_areaTracking,m=[Number.NaN,Number.NaN];if(!(a(-n*i,this.m_sumBase*i,(n*s-this.m_sumBase)*i*s-e,l,!1,m)>0)){h?this.m_areaTracking=u.getResult():this.m_areaTracking+=o;break}{h=!0,r=m[0],this.m_areaTracking=0,s=r,u.me(e);const n=r*i+t;if(this.m_cuts.push(n),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+o-u.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(o-u.getResult())}}this.m_totalAreaOfTraps.pe(o)}processTrapsCurves(t,e){let s=0,r=1;const n=new M(this,t,e,0,1,0).getArea(1);if(n+this.m_areaTracking<this.m_splitArea)return this.m_totalAreaOfTraps.pe(n),void(this.m_areaTracking+=n);const i=e-t,o=new f(n);let a=!1;for(;s<1;){const l=this.m_splitArea-this.m_areaTracking,h=new M(this,t,e,s,1,l),m=[0],c=new d(s,1);if(!(u(h,c,1,m)>0)){a?this.m_areaTracking=o.getResult():this.m_areaTracking+=n;break}{a=!0,r=m[0],this.m_areaTracking=0,s=r,o.me(l);const e=r*i+t;if(this.m_cuts.push(e),this.m_cutAreas.push(this.m_totalAreaOfTraps.getResult()+n-o.getResult()),this.m_cuts.length===this.m_numberOfCuts)return void this.m_totalAreaOfTraps.pe(n-o.getResult())}}this.m_totalAreaOfTraps.pe(n)}advanceAET(){const t=this.m_sortedNodes[this.m_currentScan-1].y,e=this.m_sortedNodes[this.m_currentScan];let s=!1,r=!1;const n=new f(0);for(let a=this.m_AETHead;null!==a;a=a.nextAET){const t=a.prevAET;s=!s,null!==a.nextAET&&s&&(this.m_bPolygonHasCurves&&(a.curve||a.nextAET.curve)||n.pe(a.nextAET.currentX-a.currentX)),a.advance(e.y),null!==t&&a.currentX<t.currentX&&(r=!0)}this.m_sumBase=n.getResult(),r&&this.sortAET();const i=new f(0);s=!1;let o=!1;for(let a=this.m_AETHead;null!==a;a=a.nextAET){o=o||null!==a.curve;s=!s,null!==a.prevAET&&(s||this.m_bPolygonHasCurves&&(a.curve||a.prevAET.curve)||i.pe(a.currentX-a.prevAET.currentX))}this.m_sumA=i.getResult(),this.processTraps(t,e.y,o);for(let a=this.m_AETHead;null!=a;){const t=a.prevAET,s=a.nextAET;if(e.y===a.y1)if(a.prevAET=null,a.nextAET=null,null!==a.nextInChain){const e=a.currentX;a=a.nextInChain,a.currentX=e,a.prevAET=t,t?t.nextAET=a:this.m_AETHead=a,a.nextAET=s,s&&(s.prevAET=a)}else t?t.nextAET=s:this.m_AETHead=s,s&&(s.prevAET=t);a=s}}mergeNewEdgesToAET(){for(let r=this.m_sortedNodes[this.m_currentScan].startingEdges;null!==r;r=r.startNodeNext)Number.isNaN(r.currentX)&&(this.m_sortHelper.push(r),r.currentX=r.x0);if(!this.m_sortHelper.length)return;this.sortHelper();let t=this.m_AETHead,e=0,s=t;for(;null!==t&&e<this.m_sortHelper.length;)t.currentX>this.m_sortHelper[e].currentX?(this.m_sortHelper[e].prevAET=t.prevAET,t.prevAET?t.prevAET.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=t,t.prevAET=this.m_sortHelper[e],e++):(s=t,t=t.nextAET);for(;e<this.m_sortHelper.length;)this.m_sortHelper[e].prevAET=s,null!==s?s.nextAET=this.m_sortHelper[e]:this.m_AETHead=this.m_sortHelper[e],this.m_sortHelper[e].nextAET=null,s=this.m_sortHelper[e],e++;this.m_sortHelper.length=0}sortAET(){for(let e=this.m_AETHead;null!==e;e=e.nextAET)this.m_sortHelper.push(e);this.sortHelper(),this.m_AETHead=null;let t=null;for(const e of this.m_sortHelper)e.prevAET=t,t?t.nextAET=e:this.m_AETHead=e,e.nextAET=null,t=e;this.m_sortHelper.length=0}sortHelper(){this.m_sortHelper.sort(((t,e)=>t.currentX-e.currentX))}trapezoidation(){for(this.m_currentScan=0,this.mergeNewEdgesToAET(),this.m_currentScan++;this.m_currentScan<this.m_sortedNodes.length&&(this.progress(),this.advanceAET(),this.m_cuts.length!==this.m_numberOfCuts);)this.mergeNewEdgesToAET(),this.m_currentScan++}buildEdges(t){const e=t.querySegmentIterator();for(e.stripAttributes();e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(t.isCurve()){const e=t;if(l(e),this.m_bHorizontalSweep){const t=x(T,4);e.queryControlPoints(t);for(const e of t)e.y=A(e.x,e.x=e.y);e.constructPoints(t)}const s=e.getStartY(),r=e.getEndY();if(r===s)continue;r<s&&e.reverse(),this.m_curves.push(e.clone()),this.m_edges.push(O(this.m_curves.at(-1)))}else{const e=this.m_bHorizontalSweep?t.getStartX():t.getStartY();if((this.m_bHorizontalSweep?t.getEndX():t.getEndY())===e)continue;this.m_edges.push(I(t,this.m_bHorizontalSweep))}}this.m_edges.sort(((t,e)=>t.y0===e.y0?t.x0-e.x0:t.y0-e.y0))}buildScanNodes(){const t=[];for(const n of this.m_edges){const e=R();e.x=n.x0,e.y=n.y0,e.startEdge=n,e.endEdge=null,t.push(e);const s=R();s.x=n.x1,s.y=n.y1,s.startEdge=null,s.endEdge=n,t.push(s)}t.sort(((t,e)=>t.compare(e)));let e=0,s=t[e].y;this.m_sortedNodes.push(D(s,t[e].startEdge));let r=e;for(e++;e!==t.length;++e){t[e].y!==s&&(this.m_sortedNodes.push(D(t[e].y,null)),s=t[e].y);const n=t[e].startEdge;if(n){const t=this.m_sortedNodes.at(-1);n.startNodeNext=t.startingEdges,t.startingEdges=n}if(t[r].x!==t[e].x||t[r].y!==t[e].y){if(e-r==2){let e=r;e++,null!==t[r].endEdge&&null!==t[e].startEdge&&(t[r].endEdge.nextInChain=t[e].startEdge)}r=e}}}progress(){}splitPolygonLinear(t,s,i,o,a,u){const l=[];l.push([t,0,u]);const m=[],c=new h;for(c.startPathCoords(i,0),c.lineToCoords(o,0);l.length>0;){const h=l.at(-1);l.pop();const p=h[0],_=h[1],g=h[2],f=(new w).executeMany(new e([p]),s,this.m_progressTracker);for(let e=f.next();null!==e;e=f.next()){const h=e,p=new n;h.queryLooseEnvelope(p);let f=_,d=g;for(let t=_,e=g-1;t<g;++t,--e)p.ymin>=a[t]&&(f=t+1),p.ymax<=a[e]&&(d=e);if(f!==g)if(d!==_)if(f!==d)if(this.isYMonotone(h))this.splitYMonotone(m,h,s,a,f,d);else{const e=Math.trunc((f+d)/2);c.setXYCoords(0,i,a[e]),c.setXYCoords(1,o,a[e]);const _=(new C).execute(!1,h,c,null,this.m_progressTracker),g=_.next(),x=_.next(),T=_.next();if(null!==g){if(g.isEmpty()||(e===d-1?(m.push(y(g,e)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([g,e+1,d])),x.isEmpty()||(e===f?(m.push(y(x,e-1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([x,f,e])),null!==T&&!T.isEmpty()){const t=new n;T.queryLooseEnvelope(t),t.ymin>=a[e]?l.push([T,e+1,d]):t.ymax<=a[e]?l.push([T,f,e]):l.push([T,f,d])}}else e+1===d?(a[e]-p.ymin<p.ymax-a[e]?m.push(y(h,e)):m.push(y(h,e+1)),r(L(m.at(-1).first,s,t,m.at(-1).second,a,u))):l.push([h,e+1,d])}else m.push(y(e,f-1));else m.push(y(e,_-1));else m.push(y(e,g-1))}}return m}splitPolygon(t,e,s,r,i,o){const a=new n;t.queryLooseEnvelope(a),a.inflateCoords(0,Math.max(a.width(),a.height()));const u=[],l=[];for(l.push(B(t,0,o));l.length;){const o={...l.at(-1)};if(l.pop(),o.polygon.hasNonLinearSegments()){const t=Math.trunc((o.to+o.from)/2),h=i[t],m=new n(s,a.ymin,r,h),c=(new S).execute(o.polygon,m,e,this.m_progressTracker);c.isEmpty()||(t-o.from==0?u.push(y(c,t-1)):l.push(B(c,o.from,t)));const p=new n(s,h,r,a.ymax),_=(new S).execute(o.polygon,p,e,this.m_progressTracker);_.isEmpty()||(o.to-t==1?u.push(y(_,t)):l.push(B(_,t+1,o.to)))}else{const n=this.splitPolygonLinear(t,e,s,r,i.slice(o.from),o.to-o.from);u.push(...n)}}u.sort(((t,e)=>t.second-e.second));const h=[];return m(u,((t,e)=>t.second===e.second),((t,e)=>{const s=new p;for(let r=t;r!==e;++r)s.add(u[r].first,!1);h.push(y(s,u[t].second))})),h}isYMonotone(t){if(1!==t.getPathCount())return!1;const e=t.getXY(0);let s=0,r=0;const n=new T;for(let i=1,o=t.getPointCount();i<=o;i++){t.queryXY(i===o?0:i,n);const a=n.y>e.y?1:n.y<e.y?-1:0;if(e.setCoordsPoint2D(n),s!==a&&0!==a){if(0!==s&&(r++,r>2))return!1;s=a}}return!0}splitYMonotone(t,e,s,n,i,o){const a=new c;a.addGeometry(e);const u=a.getFirstPath(a.getFirstGeometry()),l=a.getFirstVertex(u),h=new T,m=new T;let p=l,_=l;{const t=a.getXY(l);h.setCoordsPoint2D(t),m.setCoordsPoint2D(t)}let f=a.getNextVertex(l);const d=new T;for(let r=0,c=a.getPathSize(u);r<c;r++,f=a.getNextVertex(f))a.queryXY(f,d),d.compare(h)<0?(p=f,h.setCoordsPoint2D(d)):d.compare(m)>0&&(_=f,m.setCoordsPoint2D(d));let x=p,A=p,E=x,v=A,N=!1,S=!1,w=i,C=h.y,k=h.y,X=!1;for(;w<o;)if(n[w]<=h.y)w++;else{if(n[w]>=m.y)break;if(!N){const t=a.getNextVertex(x),e=a.getY(t);if(e<C)break;const s=n[w];C<=s&&e>=s?N=!0:(C=e,x=t)}if(!S){const t=a.getPrevVertex(A),e=a.getY(t);if(e<k)break;const s=n[w];k<=s&&e>=s?S=!0:(k=e,A=t)}if(N&&S){X=!0;let e=a.getXY(x);const s=a.getNextVertex(x);let i=a.getXY(s),o=g;if(i.y===e.y)o=i.x<e.x?x:s;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)o=x;else if(1===t)o=s;else{const e=a.splitSegmentAxisAware(x,[t],1,null,-1);r(1===e),o=a.getNextVertex(x),a.getY(o)!==n[w]&&a.setXYCoords(o,a.getX(o),n[w])}}const u=a.getPrevVertex(A);e=a.getXY(u),i=a.getXY(A);let l=g;if(i.y===e.y)l=i.x<e.x?A:u;else{const t=(n[w]-e.y)/(i.y-e.y);if(0===t)l=u;else if(1===t)l=A;else{const e=a.splitSegmentAxisAware(u,[t],1,null,-1);r(1===e),l=a.getNextVertex(u),a.getY(l)!==n[w]&&a.setXYCoords(l,a.getX(l),n[w])}}t.push(y(this.extractTrapezoid(a,E,o,v,l),w-1)),E=o,v=l,x=o,A=l,C=k=n[w],N=!1,S=!1,w++}}X?t.push(y(this.extractTrapezoid(a,E,_,v,_),w-1)):t.push(y(e,w))}extractTrapezoid(t,e,s,r,n){const i=new p({vd:t.getVertexDescription()}),o=new v;let a=!0;for(let u=e;;u=t.getNextVertex(u)){const e=t.getSegment(u);if(e?i.addSegment(e,a):(t.queryPoint(u,o),a?i.startPathPoint(o):i.lineToPoint(o)),a=!1,u===s)break}s!==n&&(t.queryPoint(n,o),i.lineToPoint(o)),a=!0;for(let u=n;;u=t.getNextVertex(u)){const s=t.getSegment(u);if(s?i.addSegment(s,a):a||u===e||(t.queryPoint(u,o),i.lineToPoint(o)),a=!1,u===r)break}return i}}function G(t){return t.getImpl().ensureXYMonotoneSegments()}function L(t,e,s,r,i,o){const a=new n;t.queryEnvelope(a);const u=4*N(e,s,!0).total();return(!(r>=0)||a.ymin+u>=i[r])&&!(r+1<o&&a.ymax>i[r+1]+u)}class F{getOperatorType(){return 10011}accelerateGeometry(t,e,s){return!1}canAccelerateGeometry(t){return!1}supportsCurves(){return!0}sliceIntoStrips(t,e,s,r,n,i){return new W(0,t,e,s,n,0,i)}findSlicesByArea(t,e,s,r,n,i){if(!n||n.isIdentity())return k(t,e,s,r,i);{const o=t.clone();return o.applyTransformation(n),k(o,e,s,r,i)}}recursiveSliceEqualArea(t,e,s,r,n){return new W(1,t,e,null,r,s,n)}}class W extends t{constructor(t,e,s,r,n,i,o){super(),this.m_resultCursor=null,this.m_method=t,this.m_polygon=e,this.m_sr=s,this.m_ySplits=r?.slice()??null,this.m_transform=n,this.m_bReversePaths=n?.isReflective()??!1,this.m_inverseTransform=n?n.clone().invertThis():null,this.m_partCount=i,this.m_tracker=o}tock(){return!0}getRank(){return 1}next(){this.m_resultCursor||(this.m_method?this.recursiveSliceEqualArea():this.sliceIntoStrips());const t=this.m_resultCursor.next();return t?(this.m_inverseTransform&&!this.m_inverseTransform.isIdentity()&&(t.applyTransformation(this.m_inverseTransform),this.m_bReversePaths&&t.reverseAllPaths()),t):t}getGeometryID(){return this.m_resultCursor?this.m_resultCursor.getGeometryID():-1}sliceIntoStrips(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=X(this.m_polygon,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=X(t,this.m_sr,this.m_ySplits,this.m_ySplits.length,this.m_tracker)}}recursiveSliceEqualArea(){if(!this.m_transform||this.m_transform.isIdentity())this.m_resultCursor=H(this.m_polygon,this.m_sr,this.m_partCount,this.m_tracker);else{const t=this.m_polygon.clone();t.applyTransformation(this.m_transform),this.m_bReversePaths&&t.reverseAllPaths(),this.m_resultCursor=H(t,this.m_sr,this.m_partCount,this.m_tracker)}}}const K=new F;function Q(t,e,s,r,n){return K.findSlicesByArea(t,e,s,r,n,null)}function J(t,e,s,r){const n=K.recursiveSliceEqualArea(t,e,s,r,null);return Array.from(n)}function U(t,e,s,r){const n=K.sliceIntoStrips(t,e,s,0,r,null);return Array.from(n)}function Z(){return K.supportsCurves()}export{Q as findSlicesByArea,J as recursiveSliceEqualArea,U as sliceIntoStrips,Z as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as r}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import"../../../chunks/QuadraticBezier.js";import{g as n}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/Envelope.js";const e=new n;function t(r,n,t){return e.execute(r,n,t,null)}function o(n,t,o){const u=e.executeMany(new r(n),t,o,null);return Array.from(u)}function u(r,n,t){return e.isSimpleAsFeature(r,n,t,null,null)}function s(){return e.supportsCurves()}export{t as execute,o as executeMany,u as isSimpleAsFeature,s as supportsCurves};
5
+ import{S as r}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import"../../../chunks/QuadraticBezier.js";import{O as n}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/Envelope.js";const e=new n;function t(r,n,t){return e.execute(r,n,t,null)}function o(n,t,o){const u=e.executeMany(new r(n),t,o,null);return Array.from(u)}function u(r,n,t){return e.isSimpleAsFeature(r,n,t,null,null)}function s(){return e.supportsCurves()}export{t as execute,o as executeMany,u as isSimpleAsFeature,s as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"../../../chunks/SimpleGeometryCursor.js";import{c as n,d as r,G as s}from"../../../chunks/Geometry.js";import{P as o,d as i}from"../../../chunks/Point2D.js";import{M as u}from"../../../chunks/QuadraticBezier.js";import{Envelope2D as m}from"../../../chunks/Envelope2D.js";import{a as c,d as a}from"../../../chunks/Envelope.js";import{ak as p}from"../../../chunks/ProjectionTransformation.js";class l{getOperatorType(){return 10003}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,n,r){return new y(e,t,n,r)}execute(t,r,s,o){const i=new e([t]),u=new e([r]),m=this.executeMany(i,u,s,o).next();return m||n("null output"),m}}function h(e,t,n,r){const o=e.getDimension(),i=t.getDimension();if(o!==i)return o>i?e:t;if(e.isEmpty())return t;if(t.isEmpty())return e;const u=new m,a=new m,l=new m;e.queryEnvelope(u),t.queryEnvelope(a),l.setCoords({env2D:u}),l.mergeEnvelope2D(a);const h=c(n,l,!0),y=e.getGeometryType(),g=t.getGeometryType();return y===s.enumPoint&&g===s.enumPoint?d(e,t,h):y===s.enumPoint&&g===s.enumMultiPoint?f(t,e,h):y===s.enumMultiPoint&&g===s.enumPoint?f(e,t,h):p(e,t,n,r)}function d(e,t,n,r){const s=a(n),i=s*s,m=e.getXY(),c=t.getXY(),p=new u({vd:e.getDescription()});return o.sqrDistance(m,c)>i&&(p.add(e),p.add(t)),p}function f(e,t,n,r){const s=e.getImpl().getAttributeStreamRef(0),o=e.getPointCount(),u=t.getXY(),c=e.createInstance(),p=a(n),l=new m;if(e.queryEnvelope(l),l.inflateCoords(p,p),l.contains(u)){const n=p*p;let r=!1;const m=i(o,!1);for(let e=0;e<o;e++){const t=s.read(2*e),o=s.read(2*e+1),i=t-u.x,c=o-u.y;i*i+c*c<=n&&(r=!0,m[e]=!0)}if(r)for(let t=0;t<o;t++)m[t]||c.addPoints(e,t,t+1);else c.addPoints(e,0,o),c.add(t)}else c.addPoints(e,0,o),c.add(t);return c}class y extends t{constructor(e,t,n,s){super(),this.m_progressTracker=s,this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=n,this.m_rightGeom=t.next(),this.m_bEmpty=!this.m_rightGeom,r(this.m_rightGeom)}tock(){return!0}getRank(){return 1}next(){if(this.m_bEmpty)return null;const e=this.m_inputGeoms.next();return e?(r(e),this.m_index=this.m_inputGeoms.getGeometryID(),h(e,this.m_rightGeom,this.m_spatialReference,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}const g=new l;function G(e,t,n){return g.execute(e,t,n,null)}function _(t,n,r){const s=g.executeMany(new e(t),new e([n]),r,null);return Array.from(s)}function x(){return g.supportsCurves()}export{G as execute,_ as executeMany,x as supportsCurves};
5
+ import{S as e,G as t}from"../../../chunks/SimpleGeometryCursor.js";import{c as n,d as r,G as s}from"../../../chunks/Geometry.js";import{P as o,d as i}from"../../../chunks/Point2D.js";import{M as u}from"../../../chunks/QuadraticBezier.js";import{Envelope2D as m}from"../../../chunks/Envelope2D.js";import{c,e as a}from"../../../chunks/Envelope.js";import{ak as p}from"../../../chunks/ProjectionTransformation.js";class l{getOperatorType(){return 10003}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,n,r){return new y(e,t,n,r)}execute(t,r,s,o){const i=new e([t]),u=new e([r]),m=this.executeMany(i,u,s,o).next();return m||n("null output"),m}}function h(e,t,n,r){const o=e.getDimension(),i=t.getDimension();if(o!==i)return o>i?e:t;if(e.isEmpty())return t;if(t.isEmpty())return e;const u=new m,a=new m,l=new m;e.queryEnvelope(u),t.queryEnvelope(a),l.setCoords({env2D:u}),l.mergeEnvelope2D(a);const h=c(n,l,!0),y=e.getGeometryType(),g=t.getGeometryType();return y===s.enumPoint&&g===s.enumPoint?f(e,t,h):y===s.enumPoint&&g===s.enumMultiPoint?d(t,e,h):y===s.enumMultiPoint&&g===s.enumPoint?d(e,t,h):p(e,t,n,r)}function f(e,t,n,r){const s=a(n),i=s*s,m=e.getXY(),c=t.getXY(),p=new u({vd:e.getDescription()});return o.sqrDistance(m,c)>i&&(p.add(e),p.add(t)),p}function d(e,t,n,r){const s=e.getImpl().getAttributeStreamRef(0),o=e.getPointCount(),u=t.getXY(),c=e.createInstance(),p=a(n),l=new m;if(e.queryEnvelope(l),l.inflateCoords(p,p),l.contains(u)){const n=p*p;let r=!1;const m=i(o,!1);for(let e=0;e<o;e++){const t=s.read(2*e),o=s.read(2*e+1),i=t-u.x,c=o-u.y;i*i+c*c<=n&&(r=!0,m[e]=!0)}if(r)for(let t=0;t<o;t++)m[t]||c.addPoints(e,t,t+1);else c.addPoints(e,0,o),c.add(t)}else c.addPoints(e,0,o),c.add(t);return c}class y extends t{constructor(e,t,n,s){super(),this.m_progressTracker=s,this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=n,this.m_rightGeom=t.next(),this.m_bEmpty=!this.m_rightGeom,r(this.m_rightGeom)}tock(){return!0}getRank(){return 1}next(){if(this.m_bEmpty)return null;const e=this.m_inputGeoms.next();return e?(r(e),this.m_index=this.m_inputGeoms.getGeometryID(),h(e,this.m_rightGeom,this.m_spatialReference,this.m_progressTracker)):null}getGeometryID(){return this.m_index}}const g=new l;function G(e,t,n){return g.execute(e,t,n,null)}function _(t,n,r){const s=g.executeMany(new e(t),new e([n]),r,null);return Array.from(s)}function x(){return g.supportsCurves()}export{G as execute,_ as executeMany,x as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as n}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import"../../../chunks/Point2D.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope2D.js";import{h as r}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/Envelope.js";const e=new r;function o(n,r,o){return e.execute(n,r,o,null)}function t(r,o){return e.executeMany(new n(r),o,null).next()}function s(){return e.supportsCurves()}export{o as execute,t as executeMany,s as supportsCurves};
5
+ import{S as n}from"../../../chunks/SimpleGeometryCursor.js";import"../../../chunks/Geometry.js";import"../../../chunks/Point2D.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope2D.js";import{j as r}from"../../../chunks/ProjectionTransformation.js";import"../../../chunks/Envelope.js";const e=new r;function o(n,r,o){return e.execute(n,r,o,null)}function t(r,o){return e.executeMany(new n(r),o,null).next()}function s(){return e.supportsCurves()}export{o as execute,t as executeMany,s as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{t as r,d as e}from"../../chunks/Geometry.js";import{D as t}from"../../chunks/Distance2DCalculator-C1KHhZwD.js";import{convertToSpatialReferenceUnit as s}from"../../core/unitUtils.js";import{getSpatialReference as n,fromGeometry as o}from"./support/apiConverter.js";class u{getOperatorType(){return 10}accelerateGeometry(r,e,t){return!1}canAccelerateGeometry(r){return!1}supportsCurves(){return!0}execute(s,n,o,u){if(s.isEmpty()||n.isEmpty())return!1;o<0&&r("distance"),e(s),e(n);const c=s,i=n;Number.isNaN(o)&&(o=Number.POSITIVE_INFINITY);return new t(o,u).isNear(c,i)}}const c=new u;function i(r,e,t,u={}){const{unit:i}=u;if(i){const e=n(r);t=s(t,i,e)}return c.execute(o(r),o(e),t,null)}const a=c.supportsCurves();export{i as execute,a as supportsCurves};
5
+ import{a as r,d as e}from"../../chunks/Geometry.js";import{D as t}from"../../chunks/Distance2DCalculator-C1KHhZwD.js";import{convertToSpatialReferenceUnit as s}from"../../core/unitUtils.js";import{getSpatialReference as n,fromGeometry as o}from"./support/apiConverter.js";class u{getOperatorType(){return 10}accelerateGeometry(r,e,t){return!1}canAccelerateGeometry(r){return!1}supportsCurves(){return!0}execute(s,n,o,u){if(s.isEmpty()||n.isEmpty())return!1;o<0&&r("distance"),e(s),e(n);const c=s,a=n;Number.isNaN(o)&&(o=Number.POSITIVE_INFINITY);return new t(o,u).isNear(c,a)}}const c=new u;function a(r,e,t,u={}){const{unit:a}=u;if(a){const e=n(r);t=s(t,a,e)}return c.execute(o(r),o(e),t,null)}const i=c.supportsCurves();export{a as execute,i as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{O as e}from"../../../chunks/ProjectionTransformation.js";import{fromGeometry as o,fromGeometryToGXGeometry as t}from"../support/jsonConverter.js";const r=new e;function n(e,n){const s=o(e);return r.execute(s.getGeometry(),t(n),s.getSpatialReference(),null)}export{n as execute};
5
+ import{b as e}from"../../../chunks/ProjectionTransformation.js";import{fromGeometry as o,fromGeometryToGXGeometry as t}from"../support/jsonConverter.js";const r=new e;function n(e,n){const s=o(e);return r.execute(s.getGeometry(),t(n),s.getSpatialReference(),null)}export{n as execute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/ProjectionTransformation.js";import{fromGeometry as o,fromGeometryToGXGeometry as t}from"../support/jsonConverter.js";const r=new e;function n(e,n){const s=o(e);return r.execute(s.getGeometry(),t(n),s.getSpatialReference())}export{n as execute};
5
+ import{d as e}from"../../../chunks/ProjectionTransformation.js";import{fromGeometry as o,fromGeometryToGXGeometry as t}from"../support/jsonConverter.js";const r=new e;function n(e,n){const s=o(e);return r.execute(s.getGeometry(),t(n),s.getSpatialReference())}export{n as execute};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,o as t,G as r,c as s}from"../../chunks/Geometry.js";import{P as a,S as n,a as m}from"../../chunks/QuadraticBezier.js";import{Envelope2D as i}from"../../chunks/Envelope2D.js";import{a as o,P as h}from"../../chunks/Envelope.js";import{g as l}from"../../chunks/ProjectionTransformation.js";import{getSpatialReference as c,fromGeometry as u,fromPolyline as g,fromSpatialReference as _,toGeometry as d}from"./support/apiConverter.js";function x(s,n,m,h){if(n.getPathCount()>1&&e(""),s.isEmpty()||n.isEmpty())return null;t(s),t(n);let l=null;const c=new i;s.queryEnvelope(c);const u=new i;n.queryEnvelope(u);const g=new i;g.setCoords({env2D:c}),g.mergeEnvelope2D(u);const _=o(m,g,!1).total(),d=new A(h);let x=d.setIndicesAndScalars(s,n,_);if(x){const e=d.getTrimmedPolyline(s,n);if(e.isEmpty())return null;l=d.getReshapedMultiPath(s,e,m)}else{if(Number.isNaN(d.m_scalarB0)||s.getGeometryType()===r.enumPolyline)return null;const e=new a;if(e.add(n,!0),d.clearIndicesAndScalars(),x=d.setIndicesAndScalars(s,e,_),!x)return null;const t=d.getTrimmedPolyline(s,e);if(t.isEmpty())return null;l=d.getReshapedMultiPath(s,t,m)}return l}class A{constructor(e){this.m_progressTracker=e,this.clearIndicesAndScalars()}setIndicesAndScalars(e,t,s){const a=new i,n=new i;e.queryEnvelope(a),e.queryEnvelope(n),a.inflateCoords(s,s);if(!a.intersect(n))return!1;const m=e.getImpl().querySegmentIterator(),o=t.getImpl().querySegmentIterator(),h=[0,0],l=[0,0];let c=-1,u=-1,g=-1,_=-1,d=-1,x=-1,A=Number.NaN,p=Number.NaN,S=Number.NaN,v=Number.NaN;for(o.nextPath();o.hasNextSegment();){const e=o.nextSegment(),t=new i;for(e.queryEnvelope(t),t.inflateCoords(s,s),m.resetToFirstPath();m.nextPath();){for(;m.hasNextSegment();){const r=m.nextSegment(),a=new i;if(r.queryEnvelope(a),t.isIntersecting(a)){if(0!==e.intersect(r,null,l,h,s)&&(Number.isNaN(S)||l[0]<S)&&(c=m.getPathIndex(),g=m.getStartPointIndex(),d=o.getStartPointIndex(),A=h[0],S=l[0],0===S))break}}if(0===S)break}if(!Number.isNaN(S)&&1!==S)break}if(Number.isNaN(S))return!1;this.m_pathA0=c,this.m_vertexA0=g,this.m_vertexB0=d,this.m_scalarA0=A,this.m_scalarB0=S;const y=e.getGeometryType();for(o.resetToLastSegment();o.hasPreviousSegment();){const e=o.previousSegment(),t=new i;for(e.queryEnvelope(t),t.inflateCoords(s,s),y===r.enumPolygon?m.resetToPath(c):m.resetToFirstPath();m.nextPath();){for(;m.hasNextSegment();){const r=m.nextSegment(),a=new i;if(r.queryEnvelope(a),t.isIntersecting(a)){const t=e.intersect(r,null,l,h,s);if(0!==t&&(Number.isNaN(v)||l[t-1]>v)&&(o.getStartPointIndex()!==this.m_vertexB0||l[t-1]!==this.m_scalarB0)&&(u=m.getPathIndex(),_=m.getStartPointIndex(),x=o.getStartPointIndex(),p=h[t-1],v=l[t-1],1===v))break}}if(1===v)break;if(y===r.enumPolygon)break}if(!Number.isNaN(v))break}return!Number.isNaN(v)&&(this.m_pathA1=u,this.m_vertexA1=_,this.m_vertexB1=x,this.m_scalarA1=p,this.m_scalarB1=v,!0)}getTrimmedPolyline(e,t){const r=new n,s=t.createInstance();let a=!0;const m=t.getImpl().querySegmentIterator();if(m.resetToVertex(this.m_vertexB0,0),this.m_vertexB0>this.m_vertexB1)return s;if(this.m_vertexB0===this.m_vertexB1){m.nextSegment().queryCut(this.m_scalarB0,this.m_scalarB1,r,!1),s.addSegment(r.get(),!0)}else for(;;){const e=m.nextSegment(),t=m.getStartPointIndex();if(t===this.m_vertexB0)1!==this.m_scalarB0&&(e.queryCut(this.m_scalarB0,1,r,!1),s.addSegment(r.get(),a),a=!1);else{if(t===this.m_vertexB1){0!==this.m_scalarB1&&(e.queryCut(0,this.m_scalarB1,r),s.addSegment(r.get(),a),a=!1);break}s.addSegment(e,a)}}if(s.isEmpty())return s;if(e.getDescription().getAttributeCount()>1){const t=e.getImpl().querySegmentIterator(),r=new h,a=s.getPointCount();t.resetToVertex(this.m_vertexA0,this.m_pathA0);t.nextSegment().queryCoord(this.m_scalarA0,r),s.setPointByVal(0,r),t.resetToVertex(this.m_vertexA1,this.m_pathA1);t.nextSegment().queryCoord(this.m_scalarA1,r),s.setPointByVal(a-1,r),s.interpolateAttributesRange(0,0,0,a-1)}return s}getReshapedMultiPath(e,t,s){let a;return a=e.getGeometryType()===r.enumPolygon?this.getReshapedPolygon(e,t,s):this.getReshapedPolyline(e,t),a}getReshapedPolygon(e,t,r){const s=e.getImpl().querySegmentIterator();s.setCirculator(!0);const a=new n;new h;const i=new m({vd:e.getDescription()});if(i.addSegmentsFromPath(t,0,0,t.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA1,this.m_pathA0),this.m_vertexA1===this.m_vertexA0&&this.m_scalarA1<=this.m_scalarA0){s.nextSegment().queryCut(this.m_scalarA1,this.m_scalarA0,a),i.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA1&&(e.queryCut(this.m_scalarA1,1,a),i.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA0){0!==this.m_scalarA0&&(e.queryCut(0,this.m_scalarA0,a),i.addSegment(a.get(),!1));break}i.addSegment(e,!1)}}const o=new m({vd:e.getDescription()}),c=t.clone();if(c.reversePath(0),o.addSegmentsFromPath(c,0,0,c.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA0,this.m_pathA0),this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0<this.m_scalarA1){s.nextSegment().queryCut(this.m_scalarA0,this.m_scalarA1,a),o.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA0&&(e.queryCut(this.m_scalarA0,1,a),o.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA1){0!==this.m_scalarA1&&(e.queryCut(0,this.m_scalarA1,a),o.addSegment(a.get(),!1));break}o.addSegment(e,!1)}}const u=Math.abs(i.calculateArea2D()),g=Math.abs(o.calculateArea2D());let _=e.createInstance();for(let n=0;n<e.getPathCount();n++)n===this.m_pathA0?u>=g?_.add(i,!1):_.add(o,!1):_.addPath(e,n,!0);return _=(new l).execute(_,r,!1,this.m_progressTracker),_}getReshapedPolyline(e,t){const r=e.getImpl().querySegmentIterator(),m=new a,i=new n;let o=!1,h=-1,l=Number.NaN;o=this.m_pathA0>this.m_pathA1||this.m_pathA0===this.m_pathA1&&(this.m_vertexA0>this.m_vertexA1||this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0>this.m_scalarA1),o?(h=this.m_vertexA1,l=this.m_scalarA1,r.resetToPath(this.m_pathA1)):(h=this.m_vertexA0,l=this.m_scalarA0,r.resetToPath(this.m_pathA0));let c=!0;for(r.nextPath()||s("reshaper");;){const e=r.nextSegment();if(r.getStartPointIndex()===h){0!==l&&(e.queryCut(0,l,i),m.addSegment(i.get(),c),c=!1);break}m.addSegment(e,c),c=!1}if(o){const e=t.clone();e.reversePath(0),m.addSegmentsFromPath(e,0,0,e.getSegmentCount(),c)}else m.addSegmentsFromPath(t,0,0,t.getSegmentCount(),c);o?(l=this.m_scalarA0,r.resetToVertex(this.m_vertexA0,this.m_pathA0)):(l=this.m_scalarA1,r.resetToVertex(this.m_vertexA1,this.m_pathA1));{const e=r.nextSegment();1!==l&&(e.queryCut(l,1,i),m.addSegment(i.get(),!1))}for(;r.hasNextSegment();){const e=r.nextSegment();m.addSegment(e,!1)}const u=e.createInstance();let g=!1;for(let s=0;s<e.getPathCount();s++)s===this.m_pathA0||s===this.m_pathA1?g||(u.add(m,!1),g=!0):u.addPath(e,s,!0);return u}clearIndicesAndScalars(){this.m_pathA0=-1,this.m_pathA1=-1,this.m_vertexA0=-1,this.m_vertexA1=-1,this.m_vertexB0=-1,this.m_vertexB1=-1,this.m_scalarA0=Number.NaN,this.m_scalarA1=Number.NaN,this.m_scalarB0=Number.NaN,this.m_scalarB1=Number.NaN}}class p{getOperatorType(){return 10006}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!1}execute(e,t,r,s){return x(e,t,r,s)}}const S=new p;function v(e,t){const r=c(e),s=S.execute(u(e),g(t),_(r),null);return d(s,r)}const y=S.supportsCurves();export{v as execute,y as supportsCurves};
5
+ import{t as e,o as t,G as r,c as s}from"../../chunks/Geometry.js";import{P as a,S as n,a as m}from"../../chunks/QuadraticBezier.js";import{Envelope2D as i}from"../../chunks/Envelope2D.js";import{c as o,P as h}from"../../chunks/Envelope.js";import{O as l}from"../../chunks/ProjectionTransformation.js";import{getSpatialReference as c,fromGeometry as u,fromPolyline as g,fromSpatialReference as _,toGeometry as d}from"./support/apiConverter.js";function x(s,n,m,h){if(n.getPathCount()>1&&e(""),s.isEmpty()||n.isEmpty())return null;t(s),t(n);let l=null;const c=new i;s.queryEnvelope(c);const u=new i;n.queryEnvelope(u);const g=new i;g.setCoords({env2D:c}),g.mergeEnvelope2D(u);const _=o(m,g,!1).total(),d=new A(h);let x=d.setIndicesAndScalars(s,n,_);if(x){const e=d.getTrimmedPolyline(s,n);if(e.isEmpty())return null;l=d.getReshapedMultiPath(s,e,m)}else{if(Number.isNaN(d.m_scalarB0)||s.getGeometryType()===r.enumPolyline)return null;const e=new a;if(e.add(n,!0),d.clearIndicesAndScalars(),x=d.setIndicesAndScalars(s,e,_),!x)return null;const t=d.getTrimmedPolyline(s,e);if(t.isEmpty())return null;l=d.getReshapedMultiPath(s,t,m)}return l}class A{constructor(e){this.m_progressTracker=e,this.clearIndicesAndScalars()}setIndicesAndScalars(e,t,s){const a=new i,n=new i;e.queryEnvelope(a),e.queryEnvelope(n),a.inflateCoords(s,s);if(!a.intersect(n))return!1;const m=e.getImpl().querySegmentIterator(),o=t.getImpl().querySegmentIterator(),h=[0,0],l=[0,0];let c=-1,u=-1,g=-1,_=-1,d=-1,x=-1,A=Number.NaN,p=Number.NaN,S=Number.NaN,v=Number.NaN;for(o.nextPath();o.hasNextSegment();){const e=o.nextSegment(),t=new i;for(e.queryEnvelope(t),t.inflateCoords(s,s),m.resetToFirstPath();m.nextPath();){for(;m.hasNextSegment();){const r=m.nextSegment(),a=new i;if(r.queryEnvelope(a),t.isIntersecting(a)){if(0!==e.intersect(r,null,l,h,s)&&(Number.isNaN(S)||l[0]<S)&&(c=m.getPathIndex(),g=m.getStartPointIndex(),d=o.getStartPointIndex(),A=h[0],S=l[0],0===S))break}}if(0===S)break}if(!Number.isNaN(S)&&1!==S)break}if(Number.isNaN(S))return!1;this.m_pathA0=c,this.m_vertexA0=g,this.m_vertexB0=d,this.m_scalarA0=A,this.m_scalarB0=S;const y=e.getGeometryType();for(o.resetToLastSegment();o.hasPreviousSegment();){const e=o.previousSegment(),t=new i;for(e.queryEnvelope(t),t.inflateCoords(s,s),y===r.enumPolygon?m.resetToPath(c):m.resetToFirstPath();m.nextPath();){for(;m.hasNextSegment();){const r=m.nextSegment(),a=new i;if(r.queryEnvelope(a),t.isIntersecting(a)){const t=e.intersect(r,null,l,h,s);if(0!==t&&(Number.isNaN(v)||l[t-1]>v)&&(o.getStartPointIndex()!==this.m_vertexB0||l[t-1]!==this.m_scalarB0)&&(u=m.getPathIndex(),_=m.getStartPointIndex(),x=o.getStartPointIndex(),p=h[t-1],v=l[t-1],1===v))break}}if(1===v)break;if(y===r.enumPolygon)break}if(!Number.isNaN(v))break}return!Number.isNaN(v)&&(this.m_pathA1=u,this.m_vertexA1=_,this.m_vertexB1=x,this.m_scalarA1=p,this.m_scalarB1=v,!0)}getTrimmedPolyline(e,t){const r=new n,s=t.createInstance();let a=!0;const m=t.getImpl().querySegmentIterator();if(m.resetToVertex(this.m_vertexB0,0),this.m_vertexB0>this.m_vertexB1)return s;if(this.m_vertexB0===this.m_vertexB1){m.nextSegment().queryCut(this.m_scalarB0,this.m_scalarB1,r,!1),s.addSegment(r.get(),!0)}else for(;;){const e=m.nextSegment(),t=m.getStartPointIndex();if(t===this.m_vertexB0)1!==this.m_scalarB0&&(e.queryCut(this.m_scalarB0,1,r,!1),s.addSegment(r.get(),a),a=!1);else{if(t===this.m_vertexB1){0!==this.m_scalarB1&&(e.queryCut(0,this.m_scalarB1,r),s.addSegment(r.get(),a),a=!1);break}s.addSegment(e,a)}}if(s.isEmpty())return s;if(e.getDescription().getAttributeCount()>1){const t=e.getImpl().querySegmentIterator(),r=new h,a=s.getPointCount();t.resetToVertex(this.m_vertexA0,this.m_pathA0);t.nextSegment().queryCoord(this.m_scalarA0,r),s.setPointByVal(0,r),t.resetToVertex(this.m_vertexA1,this.m_pathA1);t.nextSegment().queryCoord(this.m_scalarA1,r),s.setPointByVal(a-1,r),s.interpolateAttributesRange(0,0,0,a-1)}return s}getReshapedMultiPath(e,t,s){let a;return a=e.getGeometryType()===r.enumPolygon?this.getReshapedPolygon(e,t,s):this.getReshapedPolyline(e,t),a}getReshapedPolygon(e,t,r){const s=e.getImpl().querySegmentIterator();s.setCirculator(!0);const a=new n;new h;const i=new m({vd:e.getDescription()});if(i.addSegmentsFromPath(t,0,0,t.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA1,this.m_pathA0),this.m_vertexA1===this.m_vertexA0&&this.m_scalarA1<=this.m_scalarA0){s.nextSegment().queryCut(this.m_scalarA1,this.m_scalarA0,a),i.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA1&&(e.queryCut(this.m_scalarA1,1,a),i.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA0){0!==this.m_scalarA0&&(e.queryCut(0,this.m_scalarA0,a),i.addSegment(a.get(),!1));break}i.addSegment(e,!1)}}const o=new m({vd:e.getDescription()}),c=t.clone();if(c.reversePath(0),o.addSegmentsFromPath(c,0,0,c.getSegmentCountPath(0),!0),s.resetToVertex(this.m_vertexA0,this.m_pathA0),this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0<this.m_scalarA1){s.nextSegment().queryCut(this.m_scalarA0,this.m_scalarA1,a),o.addSegment(a.get(),!1)}else{{const e=s.nextSegment();1!==this.m_scalarA0&&(e.queryCut(this.m_scalarA0,1,a),o.addSegment(a.get(),!1))}for(;;){const e=s.nextSegment();if(s.getStartPointIndex()===this.m_vertexA1){0!==this.m_scalarA1&&(e.queryCut(0,this.m_scalarA1,a),o.addSegment(a.get(),!1));break}o.addSegment(e,!1)}}const u=Math.abs(i.calculateArea2D()),g=Math.abs(o.calculateArea2D());let _=e.createInstance();for(let n=0;n<e.getPathCount();n++)n===this.m_pathA0?u>=g?_.add(i,!1):_.add(o,!1):_.addPath(e,n,!0);return _=(new l).execute(_,r,!1,this.m_progressTracker),_}getReshapedPolyline(e,t){const r=e.getImpl().querySegmentIterator(),m=new a,i=new n;let o=!1,h=-1,l=Number.NaN;o=this.m_pathA0>this.m_pathA1||this.m_pathA0===this.m_pathA1&&(this.m_vertexA0>this.m_vertexA1||this.m_vertexA0===this.m_vertexA1&&this.m_scalarA0>this.m_scalarA1),o?(h=this.m_vertexA1,l=this.m_scalarA1,r.resetToPath(this.m_pathA1)):(h=this.m_vertexA0,l=this.m_scalarA0,r.resetToPath(this.m_pathA0));let c=!0;for(r.nextPath()||s("reshaper");;){const e=r.nextSegment();if(r.getStartPointIndex()===h){0!==l&&(e.queryCut(0,l,i),m.addSegment(i.get(),c),c=!1);break}m.addSegment(e,c),c=!1}if(o){const e=t.clone();e.reversePath(0),m.addSegmentsFromPath(e,0,0,e.getSegmentCount(),c)}else m.addSegmentsFromPath(t,0,0,t.getSegmentCount(),c);o?(l=this.m_scalarA0,r.resetToVertex(this.m_vertexA0,this.m_pathA0)):(l=this.m_scalarA1,r.resetToVertex(this.m_vertexA1,this.m_pathA1));{const e=r.nextSegment();1!==l&&(e.queryCut(l,1,i),m.addSegment(i.get(),!1))}for(;r.hasNextSegment();){const e=r.nextSegment();m.addSegment(e,!1)}const u=e.createInstance();let g=!1;for(let s=0;s<e.getPathCount();s++)s===this.m_pathA0||s===this.m_pathA1?g||(u.add(m,!1),g=!0):u.addPath(e,s,!0);return u}clearIndicesAndScalars(){this.m_pathA0=-1,this.m_pathA1=-1,this.m_vertexA0=-1,this.m_vertexA1=-1,this.m_vertexB0=-1,this.m_vertexB1=-1,this.m_scalarA0=Number.NaN,this.m_scalarA1=Number.NaN,this.m_scalarB0=Number.NaN,this.m_scalarB1=Number.NaN}}class p{getOperatorType(){return 10006}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!1}execute(e,t,r,s){return x(e,t,r,s)}}const S=new p;function v(e,t){const r=c(e),s=S.execute(u(e),g(t),_(r),null);return d(s,r)}const y=S.supportsCurves();export{v as execute,y as supportsCurves};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{P as e}from"../../../chunks/Point2D.js";import"../../../chunks/Envelope2D.js";import{G as t}from"../../../chunks/Geometry.js";import{E as n,P as r}from"../../../chunks/Envelope.js";import{M as s}from"../../../chunks/QuadraticBezier.js";import{c as a,b as o}from"../../../chunks/ProjectionTransformation.js";import i from"../../Extent.js";import u from"../../Multipoint.js";import c from"../../Point.js";import l from"../../Polygon.js";import m from"../../Polyline.js";import"./initNoPeFactory.js";import{fromGeometryToGXGeometry as h,toGeometry as f}from"./jsonConverter.js";const p="_gxVersion",g=2,y=1;function C(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function x(e){switch(e.type){case"point":return w(e);case"multipoint":return V(e);case"polyline":return P(e);case"polygon":return v(e);case"extent":return M(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function M(e){if(!e.getCacheValue(p)){const t=new n;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(g,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(y,0,e.zmin,e.zmax),e.setCacheValue(p,t)}return e.getCacheValue(p)}function V(e){if(!e.getCacheValue(p)){const t=new s,n=new r,a=e.points,o=e.hasM,i=e.hasZ,u=i?3:2;for(let e=0,r=a.length;e<r;e++){const r=a[e];n.setXYCoords(r[0],r[1]),i&&n.setZ(r[2]??0),o&&n.setM(r[u]??NaN),t.add(n)}e.setCacheValue(p,t)}return e.getCacheValue(p)}function w(e){if(!e.getCacheValue(p)){const t=new r;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(p,t)}return e.getCacheValue(p)}function v(e){if(!e.getCacheValue(p)){const{curveRings:t,hasM:n,hasZ:r,rings:s}=e,a=h({curveRings:t,hasM:n,hasZ:r,rings:s});e.setCacheValue(p,a)}return e.getCacheValue(p)}function P(e){if(!e.getCacheValue(p)){const{curvePaths:t,hasM:n,hasZ:r,paths:s}=e,a=h({curvePaths:t,hasM:n,hasZ:r,paths:s});e.setCacheValue(p,a)}return e.getCacheValue(p)}function j(e){if(e.wkid)return a(e.wkid);const t=e.wkt2||e.wkt;return t?o(t):null}function Z(e,n){if(e)switch(e.getGeometryType()){case t.enumPoint:return k(e,n);case t.enumEnvelope:return E(e,n);case t.enumMultiPoint:return d(e,n);case t.enumPolyline:return z(e,n);case t.enumPolygon:return R(e,n)}return null}function E(e,t){if(e.isEmpty())return null;const n=new i({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),r=e.getDescription();if(r.hasM()){const t=e.queryInterval(g,0);n.mmin=t.vmin,n.mmax=t.vmax}if(r.hasZ()){const t=e.queryInterval(y,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(p,e),n}function d(e,t){if(e.isEmpty())return null;const n=e.getDescription(),s=n.hasM(),a=n.hasZ(),o=[],i=new r;for(let r=0,u=e.getPointCount();r<u;r++){e.getPointByVal(r,i);const t=[i.getX(),i.getY()];a&&t.push(i.getZ()),s&&t.push(i.getM()),o.push(t)}const c=new u({hasM:s,hasZ:a,points:o,spatialReference:t});return c.setCacheValue(p,e),c}function k(t,n){if(t instanceof e)return new c({x:t.x,y:t.y,spatialReference:n});if(t.isEmpty())return null;const r=new c({x:t.getX(),y:t.getY(),spatialReference:n}),s=t.getDescription();return s.hasM()&&(r.m=t.getM()),s.hasZ()&&(r.z=t.getZ()),r.setCacheValue(p,t),r}function R(e,t){if(e.isEmpty())return null;const n=l.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}function z(e,t){if(e.isEmpty())return null;const n=m.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}export{M as fromExtent,x as fromGeometry,V as fromMultipoint,w as fromPoint,v as fromPolygon,P as fromPolyline,j as fromSpatialReference,C as getSpatialReference,E as toExtent,Z as toGeometry,d as toMultipoint,k as toPoint,R as toPolygon,z as toPolyline};
5
+ import{P as e}from"../../../chunks/Point2D.js";import"../../../chunks/Envelope2D.js";import{G as t}from"../../../chunks/Geometry.js";import{E as n,P as r}from"../../../chunks/Envelope.js";import{M as s}from"../../../chunks/QuadraticBezier.js";import{c as a,a as o}from"../../../chunks/ProjectionTransformation.js";import i from"../../Extent.js";import u from"../../Multipoint.js";import c from"../../Point.js";import l from"../../Polygon.js";import m from"../../Polyline.js";import"./initNoPeFactory.js";import{fromGeometryToGXGeometry as h,toGeometry as f}from"./jsonConverter.js";const p="_gxVersion",g=2,y=1;function C(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function x(e){switch(e.type){case"point":return w(e);case"multipoint":return V(e);case"polyline":return P(e);case"polygon":return v(e);case"extent":return M(e);default:throw new Error(`Unsupported geometry type: ${e.type}`)}}function M(e){if(!e.getCacheValue(p)){const t=new n;t.setCoords(e.xmin,e.ymin,e.xmax,e.ymax),e.hasM&&t.setInterval(g,0,e.mmin,e.mmax),e.hasZ&&t.setInterval(y,0,e.zmin,e.zmax),e.setCacheValue(p,t)}return e.getCacheValue(p)}function V(e){if(!e.getCacheValue(p)){const t=new s,n=new r,a=e.points,o=e.hasM,i=e.hasZ,u=i?3:2;for(let e=0,r=a.length;e<r;e++){const r=a[e];n.setXYCoords(r[0],r[1]),i&&n.setZ(r[2]??0),o&&n.setM(r[u]??NaN),t.add(n)}e.setCacheValue(p,t)}return e.getCacheValue(p)}function w(e){if(!e.getCacheValue(p)){const t=new r;t.setXYCoords(e.x,e.y),e.hasM&&t.setM(e.m),e.hasZ&&t.setZ(e.z),e.setCacheValue(p,t)}return e.getCacheValue(p)}function v(e){if(!e.getCacheValue(p)){const{curveRings:t,hasM:n,hasZ:r,rings:s}=e,a=h({curveRings:t,hasM:n,hasZ:r,rings:s});e.setCacheValue(p,a)}return e.getCacheValue(p)}function P(e){if(!e.getCacheValue(p)){const{curvePaths:t,hasM:n,hasZ:r,paths:s}=e,a=h({curvePaths:t,hasM:n,hasZ:r,paths:s});e.setCacheValue(p,a)}return e.getCacheValue(p)}function j(e){if(e.wkid)return a(e.wkid);const t=e.wkt2||e.wkt;return t?o(t):null}function Z(e,n){if(e)switch(e.getGeometryType()){case t.enumPoint:return k(e,n);case t.enumEnvelope:return E(e,n);case t.enumMultiPoint:return d(e,n);case t.enumPolyline:return z(e,n);case t.enumPolygon:return R(e,n)}return null}function E(e,t){if(e.isEmpty())return null;const n=new i({xmin:e.getXMin(),ymin:e.getYMin(),xmax:e.getXMax(),ymax:e.getYMax(),spatialReference:t}),r=e.getDescription();if(r.hasM()){const t=e.queryInterval(g,0);n.mmin=t.vmin,n.mmax=t.vmax}if(r.hasZ()){const t=e.queryInterval(y,0);n.zmin=t.vmin,n.zmax=t.vmax}return n.setCacheValue(p,e),n}function d(e,t){if(e.isEmpty())return null;const n=e.getDescription(),s=n.hasM(),a=n.hasZ(),o=[],i=new r;for(let r=0,u=e.getPointCount();r<u;r++){e.getPointByVal(r,i);const t=[i.getX(),i.getY()];a&&t.push(i.getZ()),s&&t.push(i.getM()),o.push(t)}const c=new u({hasM:s,hasZ:a,points:o,spatialReference:t});return c.setCacheValue(p,e),c}function k(t,n){if(t instanceof e)return new c({x:t.x,y:t.y,spatialReference:n});if(t.isEmpty())return null;const r=new c({x:t.getX(),y:t.getY(),spatialReference:n}),s=t.getDescription();return s.hasM()&&(r.m=t.getM()),s.hasZ()&&(r.z=t.getZ()),r.setCacheValue(p,t),r}function R(e,t){if(e.isEmpty())return null;const n=l.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}function z(e,t){if(e.isEmpty())return null;const n=m.fromJSON({spatialReference:t,...f(e,null)});return n.setCacheValue(p,e),n}export{M as fromExtent,x as fromGeometry,V as fromMultipoint,w as fromPoint,v as fromPolygon,P as fromPolyline,j as fromSpatialReference,C as getSpatialReference,E as toExtent,Z as toGeometry,d as toMultipoint,k as toPoint,R as toPolygon,z as toPolyline};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../chunks/Envelope2D.js";import"../../../chunks/Geometry.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope.js";import"../../../chunks/Point2D.js";import{j as r}from"../../../chunks/ProjectionTransformation.js";import{gradGcsIds as t,getMetersPerUnit as s,isProjectedWKT as e}from"../../../core/unitUtils.js";import{isGeographic as o}from"../../support/spatialReferenceUtils.js";r((r=>{let i,n;"number"==typeof r?i=r:n=r;const p={wkid:i,wkt:n};let m,a;if(n){m=e(n);const r=o(p);if(!m&&!r)throw new Error(`Unsupported WKT type: ${n}`)}else m=!o(p);return a=i&&t.has(i)?Math.PI/200:m?s(p):Math.PI/180,{isPCS:m,metersOrRadiansPerUnit:a,semiMajor:0,wkidOrWkt:r}}));
5
+ import"../../../chunks/Envelope2D.js";import"../../../chunks/Geometry.js";import"../../../chunks/QuadraticBezier.js";import"../../../chunks/Envelope.js";import"../../../chunks/Point2D.js";import{i as r}from"../../../chunks/ProjectionTransformation.js";import{gradGcsIds as t,getMetersPerUnit as s,isProjectedWKT as e}from"../../../core/unitUtils.js";import{isGeographic as o}from"../../support/spatialReferenceUtils.js";r((r=>{let i,n;"number"==typeof r?i=r:n=r;const p={wkid:i,wkt:n};let m,a;if(n){m=e(n);const r=o(p);if(!m&&!r)throw new Error(`Unsupported WKT type: ${n}`)}else m=!o(p);return a=i&&t.has(i)?Math.PI/200:m?s(p):Math.PI/180,{isPCS:m,metersOrRadiansPerUnit:a,semiMajor:0,wkidOrWkt:r}}));