@arcgis/core 4.33.10 → 4.33.12

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 (93) hide show
  1. package/applications/KnowledgeStudio/reshape.d.ts +5 -0
  2. package/applications/KnowledgeStudio/reshape.js +5 -0
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{1415d4e2f5f3193be004.js → 012dee84d97b71461397.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{342f61e784c9364a493b.js → 1ebff223f0f241686669.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{fdfb5d601d318d6a49f9.js → 2f2cb0348f36a5157293.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{cb16ba9512ae0a09c55d.js → 4ab87eea6345818de60f.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{e9aa1d9ded8a52a40c57.js → 5d74b754ee0140afbd22.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d33a5d79f2163ad62b1d.js → 64aebb3780ac4c8bfdc7.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{c6cd8784a3e222eb2d4a.js → 8edd8ebca441d670380f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{cf25f487fe4eb1579aee.js → 9128902b127d0ec70fe0.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{17c623db3d9a06a9b711.js → a5fab8d7d8403b4de682.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{bac5e1d50b69f0d94694.js → ad2a29aca4e5bcd545cc.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{9049c81445cc044286f1.js → bbb92d0ba6a34c7a7d1b.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{7b9d14cc4a466ef18d71.js → bfd51df0a44a05596061.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{3ca6f893fd58f5b17af5.js → c410b2b9d0645e9cea89.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{8008f5479f4d16964088.js → dded6853cebf2165cb37.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{db192728fa0ee08a776a.js → e7ca7ced4dfb04c81e84.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{0155e6806621f3588ffa.js → fe71a2ea7965e75ee881.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{71e1a8bd432947c66357.js → ffeda53fee883f8025ed.js} +1 -1
  21. package/assets/esri/themes/base/widgets/_VideoPlayer.scss +16 -2
  22. package/assets/esri/themes/dark/main.css +1 -1
  23. package/assets/esri/themes/light/main.css +1 -1
  24. package/assets/esri/themes/light/view.css +1 -1
  25. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  26. package/chunks/MultiPathImpl.js +1 -1
  27. package/chunks/OperatorGeodesicBuffer.js +1 -1
  28. package/chunks/OperatorGeodeticArea.js +1 -1
  29. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  30. package/chunks/OperatorGeodeticLength.js +1 -1
  31. package/chunks/OperatorProximityGeodesic.js +1 -1
  32. package/chunks/OperatorShapePreservingLength.js +1 -1
  33. package/chunks/OperatorShapePreservingProject.js +1 -1
  34. package/chunks/Point2D.js +1 -1
  35. package/chunks/ProjectionTransformation.js +1 -1
  36. package/chunks/sphere.js +1 -1
  37. package/chunks/vec42.js +1 -1
  38. package/core/libs/gl-matrix-2/math/quat.js +1 -1
  39. package/core/libs/gl-matrix-2/math/vec4.js +1 -1
  40. package/core/quantityFormatUtils.js +1 -1
  41. package/core/unitFormatUtils.js +1 -1
  42. package/geometry/coordinateFormatter.js +1 -1
  43. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  44. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  45. package/geometry/support/sphere.js +1 -1
  46. package/interfaces.d.ts +128 -0
  47. package/kernel.js +1 -1
  48. package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
  49. package/package.json +1 -1
  50. package/renderers/support/RasterSymbolizer.js +1 -1
  51. package/support/revision.js +1 -1
  52. package/symbols/support/previewSymbol3D.js +1 -1
  53. package/views/2d/LabelManager.js +1 -1
  54. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  55. package/views/2d/layers/features/FeatureContainer.js +1 -1
  56. package/views/2d/layers/features/RenderState.js +1 -1
  57. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  58. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  59. package/views/3d/camera/constraintUtils/distance.js +1 -1
  60. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  61. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  62. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  63. package/views/3d/layers/i3s/I3SIndex.js +1 -1
  64. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  65. package/views/3d/state/utils/navigationUtils.js +1 -1
  66. package/views/3d/terrain/OverlayManager.js +1 -1
  67. package/views/3d/terrain/TerrainSurface.js +1 -1
  68. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  69. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  70. package/views/LinkChartView.js +1 -1
  71. package/views/draw/DrawOperation.js +1 -1
  72. package/views/draw/support/GraphicMover.js +1 -1
  73. package/views/draw/support/HighlightHelper.js +1 -1
  74. package/views/draw/support/Reshape.js +1 -1
  75. package/views/interactive/Tooltip.js +1 -1
  76. package/views/interactive/sketch/SketchLabelOptions.js +1 -1
  77. package/views/interactive/sketch/SketchOptions.js +1 -1
  78. package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
  79. package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
  80. package/views/interactive/sketch/SketchValueOptions.js +1 -1
  81. package/views/interactive/sketch/Units.js +1 -1
  82. package/views/interactive/sketch/constraints.js +1 -1
  83. package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
  84. package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
  85. package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
  86. package/views/interactive/tooltip/fields/fields.js +1 -1
  87. package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
  88. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  89. package/views/support/LayerLayerViewInfo.js +1 -1
  90. package/views/support/angularMeasurementUtils.js +1 -1
  91. package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
  92. package/widgets/VideoPlayer/css.js +1 -1
  93. package/widgets/VideoPlayer.js +1 -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{b as t,c as e}from"./tslib.es6.js";import{d as i,a as s,G as n,g as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./MultiPathImpl.js";import{P as c,v as h,w as l,x as _,y as p,z as d,A as g,B as x,D as y,E as P,F as S,G as f,H as D,I as G,J as v}from"./ProjectionTransformation.js";import{d as T,a as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,c as E,k as R,E as I,l as C}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-CXhBP-8I.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new c,this.m_peR2=new c,this.m_peR3=new c,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;d.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,c=v.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=C((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(_)>Math.PI&&(_=_>0?_-2*Math.PI:_+2*Math.PI),_/=this.m_unitToRad,i=t+_;const p=Y();return p.xmin=Math.min(t,i),p.xmax=Math.max(t,i),p.ymin=Math.min(e,s),p.ymin=Math.min(p.ymin,l),p.ymax=Math.max(e,s),p.ymax=Math.max(p.ymax,l),p}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=V(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s);d.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s),r=v.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,c=this.m_peR2;d.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),d.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,c,null,null,0);const h=l(1,0,new M(this.m_unitToRad*t,a)),_=l(1,0,new M(this.m_unitToRad*i,m)),g=l(1,0,new M(this.m_unitToRad*i,r));let x=new T;x.setCrossProductVector(_,g);const y=_.dotProduct(g);if(x.length()<1.568e-10)return y>=0?Math.min(u.val,c.val):0;x=x.getUnitVector();let P=new T;if(P.setCrossProductVector(x,h),P.length()<1.568e-10){return Math.min(u.val,c.val)-1e-5*o}P=P.getUnitVector();let S=h.sub(x.mul(h.dotProduct(x)));{const e=new T;e.setCrossProductVector(_,S);const i=new T;i.setCrossProductVector(S,g);let s=x.dotProduct(e)>0&&x.dotProduct(i)>0;if(s||(S.negateThis(),e.setCrossProductVector(_,S),i.setCrossProductVector(S,g),s=x.dotProduct(e)>0&&x.dotProduct(i)>0),s){S=S.getUnitVector();const e=p(1,0,S),i=this.m_peR3;d.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,c.val);return Math.min(s,i.val)}}return Math.min(u.val,c.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function V(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class j{}function L(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class J{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new c,this.m_az12=new c,this.m_minGeodeticDist=new c,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=h();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return s=>{let n;switch(this.m_segCurveType){case 0:case 1:case 3:{const i={stack:[],error:void 0,hasError:!1};try{const e=t(i,new c,!1),o=t(i,new c,!1);d.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*s,this.m_az12.val,e,o,this.m_segCurveType),n=new M(e.val,o.val);break}catch(o){i.error=o,i.hasError=!0}finally{e(i)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,s);n=p(this.m_a,this.m_eSquared,t);break}case 4:n=M.lerp(this.m_segStartPt,this.m_segEndPt,s),this.m_bIsPannablePcs&&(_(this.m_sr,0,[n],1),n.mulThis(this.m_rpu));break;default:i("Invalid curve type")}return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,n.x,n.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:d.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:i("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new j}class Q{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=h();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=L(),o=L();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new J(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new g).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=x(this.m_inputSR,this.m_inputGCS,null);t=(new g).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,i,o){switch(t.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new c,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=l(this.m_a,this.m_eSquared,r),h=new M,_=s.getImpl(),p=t(a,new c,!1),g=_.getPointCount();for(let t=0;t<g;++t){_.queryXY(t,h),h.scale(this.m_rpu);const e=l(this.m_a,this.m_eSquared,h);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(d.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,h.x,h.y,p,null,null,this.m_distCurveType),p.val<m&&(m=p.val,o.outPoint=h,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),n.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&y(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(n,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],d=this.canUseSpatialTree(i,s),g=K();d&&this.buildSpatialTree(g,s);const x=H();x.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=h.querySegmentIterator();if(S.stripAttributes(),d)o(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(x,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new c,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,h=new M,_=i.getImpl(),p=s.getImpl(),g=H(),x=_.getPointCount(),y=p.getPointCount();for(let t=0;t<x;++t){if(u.assign(_.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=l(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){h.assign(p.getXY(t)),h.scale(this.m_rpu);const s=l(this.m_a,this.m_eSquared,h);if(!(T.distance(i,s)>=r)&&(d.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,h.x,h.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(h),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(n,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const c=new M,h=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],d=H(),g=t(m,this.createDistanceFunctor(h,l,_),!1),x=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(x,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&y(this.m_inputSR,[c],1,!1),d.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(g.setPointDistFrom(h),P)o(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(d,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(c,h,t,p,g);if(i.second<u&&(n.outPoint.assign(h.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,i);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,n,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const c=new M(0,0),h=new M,l=new M(0,0),p=new M,d=new M(0,0),g=new M,x=new M,y=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(d,c,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,I=A(i);for(let t=0;t<I.length;++t){const s=I[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)o(0);else{if(d.assign(m.getStartXY()),g.assign(m.getStartXY()),x.assign(m.getEndXY()),y.assign(m.getEndXY()),this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[g],1),_(this.m_inputSR,0,[y],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(c.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),p.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(n,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[h],1),_(this.m_inputSR,0,[p],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,p,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(c,l),T.setPointDistFrom(g);let i=P(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(n.outPoint.assign(g.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(y),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(n.outPoint.assign(y.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(d,x),T.setPointDistFrom(h),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(p),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(p.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(c){u.error=c,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),P(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===n.enumPoint||i===n.enumMultiPoint)return this._NormalizeAndProject(e);if(i===n.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=S(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new g).execute(e,t,this.m_progressTracker)}const s=new w;e.queryLooseEnvelope(s);const o=this.m_inputSR.getPannableExtent();if(s.ymin<o.ymin||s.ymax>o.ymax){const t=new w(s.xmin-1,o.ymin,s.xmax+1,o.ymax);if(e=(new X).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return s.width()>2*o.width()?(e=f(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new I;s.queryIntervalX(n);const o=new I;return i.queryIntervalX(o),t=n.contains(o)?D(t,this.m_inputSR):(new g).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&y(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&_(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,s){switch(t.getGeometryType()){case n.enumPoint:return this.computeBoxPoint(t,e);case n.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case n.enumPolyline:case n.enumPolygon:return this.computeBoxMultiPath(t,e,s);default:i("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[a],1),_(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);_(this.m_inputSR,0,[t],1),_(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>l(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const h=t(n,new c,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,h,null,null,this.m_distCurveType),h.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,s){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===n.enumPoint&&2===e.getDimension()){const n=[0],o=[t.getXY()];if(G(e,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}else if(a===n.enumPoint&&2===t.getDimension()){const n=[2],o=[e.getXY()];if(G(t,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}if(o===n.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,s);if(a===n.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,s,i);let r,u,c=t,h=e;if(o===n.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=n.enumPolygon),a===n.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=n.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),n=N(),o=N();if(q(c,h,t,e,n,o))return i.outPoint.assign(n.outPoint),s.outPoint.assign(n.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(G(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,n,a,m){return o(0),{}}buildSpatialTree(t,e){o(0)}}export{Q as G,J as a,L as m};
5
+ import{b as t,c as e}from"./tslib.es6.js";import{d as i,a as s,G as n,g as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./MultiPathImpl.js";import{P as c,v as h,E as l,F as _,G as p,A as d,z as g,D as x,H as y,I as P,J as S,K as f,w as D,L as G,M as v}from"./ProjectionTransformation.js";import{d as T,a as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,c as E,l as R,E as I,n as C}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-CXhBP-8I.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new c,this.m_peR2=new c,this.m_peR3=new c,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;d.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,c=v.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=C((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(_)>Math.PI&&(_=_>0?_-2*Math.PI:_+2*Math.PI),_/=this.m_unitToRad,i=t+_;const p=Y();return p.xmin=Math.min(t,i),p.xmax=Math.max(t,i),p.ymin=Math.min(e,s),p.ymin=Math.min(p.ymin,l),p.ymax=Math.max(e,s),p.ymax=Math.max(p.ymax,l),p}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=L(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=L(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=L(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s);d.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s),r=v.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,c=this.m_peR2;d.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),d.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,c,null,null,0);const h=l(1,0,new M(this.m_unitToRad*t,a)),_=l(1,0,new M(this.m_unitToRad*i,m)),g=l(1,0,new M(this.m_unitToRad*i,r));let x=new T;x.setCrossProductVector(_,g);const y=_.dotProduct(g);if(x.length()<1.568e-10)return y>=0?Math.min(u.val,c.val):0;x=x.getUnitVector();let P=new T;if(P.setCrossProductVector(x,h),P.length()<1.568e-10){return Math.min(u.val,c.val)-1e-5*o}P=P.getUnitVector();let S=h.sub(x.mul(h.dotProduct(x)));{const e=new T;e.setCrossProductVector(_,S);const i=new T;i.setCrossProductVector(S,g);let s=x.dotProduct(e)>0&&x.dotProduct(i)>0;if(s||(S.negateThis(),e.setCrossProductVector(_,S),i.setCrossProductVector(S,g),s=x.dotProduct(e)>0&&x.dotProduct(i)>0),s){S=S.getUnitVector();const e=p(1,0,S),i=this.m_peR3;d.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,c.val);return Math.min(s,i.val)}}return Math.min(u.val,c.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function L(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class V{}function j(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class J{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new c,this.m_az12=new c,this.m_minGeodeticDist=new c,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=h();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return s=>{let n;switch(this.m_segCurveType){case 0:case 1:case 3:{const i={stack:[],error:void 0,hasError:!1};try{const e=t(i,new c,!1),o=t(i,new c,!1);d.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*s,this.m_az12.val,e,o,this.m_segCurveType),n=new M(e.val,o.val);break}catch(o){i.error=o,i.hasError=!0}finally{e(i)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,s);n=p(this.m_a,this.m_eSquared,t);break}case 4:n=M.lerp(this.m_segStartPt,this.m_segEndPt,s),this.m_bIsPannablePcs&&(_(this.m_sr,0,[n],1),n.mulThis(this.m_rpu));break;default:i("Invalid curve type")}return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,n.x,n.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:d.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:i("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new V}class Q{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=h();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=j(),o=j();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new J(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new g).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=x(this.m_inputSR,this.m_inputGCS,null);t=(new g).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,i,o){switch(t.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new c,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=l(this.m_a,this.m_eSquared,r),h=new M,_=s.getImpl(),p=t(a,new c,!1),g=_.getPointCount();for(let t=0;t<g;++t){_.queryXY(t,h),h.scale(this.m_rpu);const e=l(this.m_a,this.m_eSquared,h);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(d.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,h.x,h.y,p,null,null,this.m_distCurveType),p.val<m&&(m=p.val,o.outPoint=h,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),n.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&y(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(n,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],d=this.canUseSpatialTree(i,s),g=K();d&&this.buildSpatialTree(g,s);const x=H();x.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=h.querySegmentIterator();if(S.stripAttributes(),d)o(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(x,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new c,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,h=new M,_=i.getImpl(),p=s.getImpl(),g=H(),x=_.getPointCount(),y=p.getPointCount();for(let t=0;t<x;++t){if(u.assign(_.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=l(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){h.assign(p.getXY(t)),h.scale(this.m_rpu);const s=l(this.m_a,this.m_eSquared,h);if(!(T.distance(i,s)>=r)&&(d.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,h.x,h.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(h),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(n,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const c=new M,h=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],d=H(),g=t(m,this.createDistanceFunctor(h,l,_),!1),x=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(x,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&y(this.m_inputSR,[c],1,!1),d.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(g.setPointDistFrom(h),P)o(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(d,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(c,h,t,p,g);if(i.second<u&&(n.outPoint.assign(h.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,i);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,n,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const c=new M(0,0),h=new M,l=new M(0,0),p=new M,d=new M(0,0),g=new M,x=new M,y=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(d,c,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,I=A(i);for(let t=0;t<I.length;++t){const s=I[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)o(0);else{if(d.assign(m.getStartXY()),g.assign(m.getStartXY()),x.assign(m.getEndXY()),y.assign(m.getEndXY()),this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[g],1),_(this.m_inputSR,0,[y],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(c.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),p.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(n,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[h],1),_(this.m_inputSR,0,[p],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,p,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(c,l),T.setPointDistFrom(g);let i=P(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(n.outPoint.assign(g.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(y),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(n.outPoint.assign(y.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(d,x),T.setPointDistFrom(h),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(p),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(p.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(c){u.error=c,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),P(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===n.enumPoint||i===n.enumMultiPoint)return this._NormalizeAndProject(e);if(i===n.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=S(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new g).execute(e,t,this.m_progressTracker)}const s=new w;e.queryLooseEnvelope(s);const o=this.m_inputSR.getPannableExtent();if(s.ymin<o.ymin||s.ymax>o.ymax){const t=new w(s.xmin-1,o.ymin,s.xmax+1,o.ymax);if(e=(new X).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return s.width()>2*o.width()?(e=f(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new I;s.queryIntervalX(n);const o=new I;return i.queryIntervalX(o),t=n.contains(o)?D(t,this.m_inputSR):(new g).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&y(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&_(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,s){switch(t.getGeometryType()){case n.enumPoint:return this.computeBoxPoint(t,e);case n.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case n.enumPolyline:case n.enumPolygon:return this.computeBoxMultiPath(t,e,s);default:i("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[a],1),_(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);_(this.m_inputSR,0,[t],1),_(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>l(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const h=t(n,new c,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,h,null,null,this.m_distCurveType),h.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,s){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===n.enumPoint&&2===e.getDimension()){const n=[0],o=[t.getXY()];if(G(e,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}else if(a===n.enumPoint&&2===t.getDimension()){const n=[2],o=[e.getXY()];if(G(t,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}if(o===n.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,s);if(a===n.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,s,i);let r,u,c=t,h=e;if(o===n.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=n.enumPolygon),a===n.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=n.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),n=N(),o=N();if(q(c,h,t,e,n,o))return i.outPoint.assign(n.outPoint),s.outPoint.assign(n.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(G(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,n,a,m){return o(0),{}}buildSpatialTree(t,e){o(0)}}export{Q as G,J as a,j as m};