@arcgis/core 5.1.0-next.36 → 5.1.0-next.38

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 (293) hide show
  1. package/applications/Components/analysisUtils.js +1 -1
  2. package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
  3. package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{e09722903e63f6cc2540.js → 03894992558d063d0d5e.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{4490f8eeeb2ee04daa9d.js → 0dd12d6af0cf7707109c.js} +2 -2
  7. package/assets/esri/core/workers/chunks/13838b6c045425e73cf8.js +1 -0
  8. package/assets/esri/core/workers/chunks/{6f1c590abd0e3adeb8fc.js → 1bf3e787eafec318bd2b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/1d54b71c43d9d6a5f713.js +1 -0
  10. package/assets/esri/core/workers/chunks/{64e1273e4e79c73ed579.js → 2ddfd406b9044390e9f7.js} +1 -1
  11. package/assets/esri/core/workers/chunks/2fa86dacc8a12a6a6c43.js +1 -0
  12. package/assets/esri/core/workers/chunks/34f79355145c8e4c59dd.js +1 -0
  13. package/assets/esri/core/workers/chunks/3be111488365768fd917.js +1 -0
  14. package/assets/esri/core/workers/chunks/448620052233e51b496c.js +1 -0
  15. package/assets/esri/core/workers/chunks/{6ca2064ea96bdb594f52.js → 4b0d6309abf273f1f79f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{973e3743cb7fdaa27f80.js → 4e07827ab870c65377d3.js} +1 -1
  17. package/assets/esri/core/workers/chunks/60e4312044fe40dfd41d.js +2 -0
  18. package/assets/esri/core/workers/chunks/67f95c57c1679935570b.js +1 -0
  19. package/assets/esri/core/workers/chunks/{04094d576bfa11d90f73.js → 6afdaa6c4555c467dca7.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{a7a9716582b256d76e5b.js → 873c1b705ac3d4e6c384.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{527547fa10d52cb3a7b1.js → 888f6387e795d45a7ad3.js} +2 -2
  22. package/assets/esri/core/workers/chunks/{eb811adbc5243d293ef5.js → 93bf908f596140ea4c61.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{2d49a611ad3441d7e759.js → 9ae9e9a65cb08b12caeb.js} +15 -15
  24. package/assets/esri/core/workers/chunks/{eaeb95be8d4032513247.js → b014f0b2385dc82dc683.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{2128a66f522d15493ce2.js → b2303b2771fcd75f298b.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{7c16493ea34c49a6291e.js → b8f624f8c975728d75e2.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{f5144e570952ca62a1b0.js → b98c24229463029504e8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/bf668010f36179792592.js +1 -0
  29. package/assets/esri/core/workers/chunks/c0ecb68387e342dddf58.js +1 -0
  30. package/assets/esri/core/workers/chunks/{0f2d6f267d235db48767.js → cb482e20e10ab0f63617.js} +1 -1
  31. package/assets/esri/core/workers/chunks/d024278a1c2aa7d22be3.js +1 -0
  32. package/assets/esri/core/workers/chunks/{19955d064c17ba2fd9ad.js → d0da3a44f33f4d8e682b.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{0e78678281bcb888964d.js → d456f06d0c6a5cc02be7.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{a35d1be700ebd3109397.js → d82b543c96f09ded3bf9.js} +2 -2
  35. package/assets/esri/core/workers/chunks/{776a7179d32fe62a37e3.js → de9fea9b6f2269ee0703.js} +1 -1
  36. package/assets/esri/core/workers/chunks/{e8ae71e482b8d5f54a72.js → dec51409372764e7093d.js} +1 -1
  37. package/assets/esri/core/workers/chunks/e09f8b17cb0b92354de8.js +1 -0
  38. package/assets/esri/core/workers/chunks/{b859d98fa1c39f8e4099.js → e0a63b5861e8c975097e.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{23cb0611abe1031c513c.js → fce30184f354fb7d11af.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{67de5225b2c66c9c7bc9.js → ffc87a038712a4c9d2cb.js} +1 -1
  41. package/chunks/ChapmanAtmosphere.glsl.js +4 -4
  42. package/chunks/Clouds.glsl.js +14 -14
  43. package/chunks/ComponentShader.glsl.js +1 -1
  44. package/chunks/DefaultMaterial.glsl.js +1 -1
  45. package/chunks/Fog.glsl.js +2 -1
  46. package/chunks/GaussianSplat.glsl.js +2 -2
  47. package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
  48. package/chunks/GeodeticUtils.js +1 -1
  49. package/chunks/GlowBlur.glsl.js +8 -8
  50. package/chunks/GlowComposition.glsl.js +7 -7
  51. package/chunks/HUDMaterial.glsl.js +4 -1
  52. package/chunks/Haze.glsl.js +4 -4
  53. package/chunks/MultiPathImpl.js +1 -1
  54. package/chunks/NoiseTextureAtlas.glsl.js +34 -34
  55. package/chunks/OITBlend.glsl.js +10 -10
  56. package/chunks/OperatorGeodesicBuffer.js +1 -1
  57. package/chunks/OperatorGeodeticArea.js +1 -1
  58. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  59. package/chunks/OperatorGeodeticLength.js +1 -1
  60. package/chunks/OperatorProximityGeodesic.js +1 -1
  61. package/chunks/OperatorShapePreservingLength.js +1 -1
  62. package/chunks/OperatorShapePreservingProject.js +1 -1
  63. package/chunks/Path.glsl.js +2 -2
  64. package/chunks/Point2D.js +1 -1
  65. package/chunks/RealisticTree.glsl.js +1 -1
  66. package/chunks/SlicePlaneMaterial.glsl.js +6 -5
  67. package/chunks/SpatialReference.js +1 -1
  68. package/chunks/lyr3DMain.js +1 -1
  69. package/chunks/lyr3DWorker.js +1 -1
  70. package/config.js +1 -1
  71. package/core/has.js +1 -1
  72. package/geometry/libtess.js +1 -1
  73. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  74. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  75. package/intl.js +1 -1
  76. package/kernel.js +1 -1
  77. package/layers/VoxelWasmPerSceneView.js +1 -1
  78. package/layers/graphics/dehydratedPoint.js +1 -1
  79. package/layers/video/VideoController.js +1 -1
  80. package/libs/lyr3d/Lyr3DModule.js +1 -1
  81. package/package.json +4 -4
  82. package/rest/print.js +1 -1
  83. package/support/revision.js +1 -1
  84. package/views/2d/engine/imagery/RasterBitmap.js +1 -1
  85. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  86. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  87. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  88. package/views/2d/layers/MediaLayerView2D.js +1 -1
  89. package/views/2d/layers/TileLayerView2D.js +1 -1
  90. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  91. package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
  92. package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
  93. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  94. package/views/3d/analysis/Dimension/DimensionController.js +1 -1
  95. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  96. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  97. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
  98. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  99. package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
  100. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  101. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  102. package/views/3d/environment/EnvironmentManager.js +1 -1
  103. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  104. package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
  105. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  106. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  107. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  108. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  109. package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
  110. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  111. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  112. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  113. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  114. package/views/3d/state/NearFarHeuristic.js +1 -1
  115. package/views/3d/state/ViewStateManager.js +1 -1
  116. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  117. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  118. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  119. package/views/3d/terrain/OverlayRenderer.js +1 -1
  120. package/views/3d/terrain/RasterTile.js +1 -1
  121. package/views/3d/terrain/TerrainRenderer.js +1 -1
  122. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  123. package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  125. package/views/3d/webgl-engine/collections/Component/Material/ComponentShader.glsl.js +1 -1
  126. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  127. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  128. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  129. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  130. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  131. package/views/3d/webgl-engine/effects/WeatherFader.js +2 -0
  132. package/views/3d/{environment → webgl-engine/effects/atmosphere}/ChapmanApproximation.glsl.js +3 -3
  133. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +2 -0
  134. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +2 -0
  135. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +2 -0
  136. package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechniqueConfiguration.js +2 -0
  137. package/views/3d/{environment → webgl-engine/effects/atmosphere}/ChapmanRaymarching.glsl.js +5 -5
  138. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +2 -0
  139. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +2 -0
  140. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +2 -0
  141. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphereTechnique.js +2 -0
  142. package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphereTechniqueConfiguration.js +2 -0
  143. package/views/3d/webgl-engine/effects/atmosphere/atmosphereUtils.js +2 -0
  144. package/views/3d/webgl-engine/effects/clouds/Clouds.glsl.js +2 -0
  145. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.glsl.js +2 -0
  146. package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +2 -0
  147. package/views/3d/webgl-engine/effects/clouds/CloudsCompositionTechnique.js +2 -0
  148. package/views/3d/webgl-engine/effects/clouds/CloudsParameters.js +2 -0
  149. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +2 -0
  150. package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +2 -0
  151. package/views/3d/webgl-engine/effects/clouds/CloudsTechniqueConfiguration.js +2 -0
  152. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.glsl.js +2 -0
  153. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +2 -0
  154. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasConfiguration.js +2 -0
  155. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasDimensions.js +2 -0
  156. package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasTechnique.js +2 -0
  157. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +2 -0
  158. package/views/3d/webgl-engine/effects/fog/Fog.js +2 -0
  159. package/views/3d/webgl-engine/effects/fog/FogTechnique.js +2 -0
  160. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +2 -0
  161. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +1 -1
  162. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  163. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  164. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  165. package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
  166. package/views/3d/webgl-engine/effects/haze/HazeTechnique.js +1 -1
  167. package/views/3d/webgl-engine/effects/precipitation/Precipitation.glsl.js +2 -0
  168. package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +2 -0
  169. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechnique.js +2 -0
  170. package/views/3d/webgl-engine/effects/precipitation/PrecipitationTechniqueConfiguration.js +2 -0
  171. package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
  172. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  173. package/views/3d/webgl-engine/effects/transparency/OITBlendTechniqueConfiguration.js +1 -1
  174. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  175. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +2 -0
  176. package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +2 -0
  177. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  178. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  179. package/views/3d/webgl-engine/lib/Material.js +1 -1
  180. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  181. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  182. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  183. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  184. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  185. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  186. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  187. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  188. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  189. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  190. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  191. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  192. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  193. package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
  194. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  195. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  196. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  198. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  199. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  200. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  201. package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
  202. package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
  203. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  204. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  205. package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
  206. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  207. package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
  208. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
  209. package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
  210. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  211. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  212. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  213. package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
  214. package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechniqueConfiguration.js +2 -0
  215. package/views/3d/webgl-engine/shaders/oitResolution.glsl.js +2 -0
  216. package/views/3d/webgl.js +1 -1
  217. package/views/VideoView.js +1 -1
  218. package/views/interactive/sketch/normalizedPoint.js +1 -1
  219. package/views/interactive/snapping/LineSnapper.js +1 -1
  220. package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
  221. package/views/interactive/snapping/RightAngleSnapper.js +1 -1
  222. package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
  223. package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
  224. package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
  225. package/views/interactive/snapping/SnappingManager.js +1 -1
  226. package/views/interactive/snapping/candidates/dehydrated/DehydratedVertexSnappingCandidate.js +1 -1
  227. package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
  228. package/views/support/MeasurementWorker.js +1 -1
  229. package/views/support/MeasurementWorkerHandle.js +1 -1
  230. package/views/support/measurementWorkerUtils.js +1 -1
  231. package/views/webgl/WebGLDriverTest.js +1 -1
  232. package/widgets/OrientedImageryViewer.js +1 -1
  233. package/assets/esri/core/workers/chunks/144acac9bb1aa78f1170.js +0 -1
  234. package/assets/esri/core/workers/chunks/2f20a21db44bd8448e9e.js +0 -1
  235. package/assets/esri/core/workers/chunks/5d87316d6f973d95745c.js +0 -1
  236. package/assets/esri/core/workers/chunks/63722607fbf8d411188d.js +0 -1
  237. package/assets/esri/core/workers/chunks/6ac84e6d33104e74398d.js +0 -1
  238. package/assets/esri/core/workers/chunks/a53979c45ee429e21b99.js +0 -2
  239. package/assets/esri/core/workers/chunks/b1ddc837a6805a09d0da.js +0 -1
  240. package/assets/esri/core/workers/chunks/bd278f8081be8304be8d.js +0 -1
  241. package/assets/esri/core/workers/chunks/bd902ae413887082b453.js +0 -1
  242. package/assets/esri/core/workers/chunks/ce3e192fbb53a9c6eb3b.js +0 -1
  243. package/assets/esri/core/workers/chunks/de5719ef663224860af5.js +0 -1
  244. package/assets/esri/core/workers/chunks/f7506c9d57b2ae0c5fd3.js +0 -1
  245. package/views/3d/environment/ChapmanAtmosphere.glsl.js +0 -2
  246. package/views/3d/environment/ChapmanAtmosphere.js +0 -2
  247. package/views/3d/environment/ChapmanAtmosphereTechnique.js +0 -2
  248. package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +0 -2
  249. package/views/3d/environment/Clouds.glsl.js +0 -2
  250. package/views/3d/environment/CloudsComposition.glsl.js +0 -2
  251. package/views/3d/environment/CloudsComposition.js +0 -2
  252. package/views/3d/environment/CloudsCompositionTechnique.js +0 -2
  253. package/views/3d/environment/CloudsParameters.js +0 -2
  254. package/views/3d/environment/CloudsRenderer.js +0 -2
  255. package/views/3d/environment/CloudsTechnique.js +0 -2
  256. package/views/3d/environment/CloudsTechniqueConfiguration.js +0 -2
  257. package/views/3d/environment/EnvironmentRenderer.js +0 -2
  258. package/views/3d/environment/Fog.glsl.js +0 -2
  259. package/views/3d/environment/Fog.js +0 -2
  260. package/views/3d/environment/FogTechnique.js +0 -2
  261. package/views/3d/environment/FogTechniqueConfiguration.js +0 -2
  262. package/views/3d/environment/LocalAtmosphere.js +0 -2
  263. package/views/3d/environment/MarsAtmosphere.js +0 -2
  264. package/views/3d/environment/NoiseTextureAtlas.glsl.js +0 -2
  265. package/views/3d/environment/NoiseTextureAtlas.js +0 -2
  266. package/views/3d/environment/NoiseTextureAtlasConfiguration.js +0 -2
  267. package/views/3d/environment/NoiseTextureAtlasDimensions.js +0 -2
  268. package/views/3d/environment/NoiseTextureAtlasTechnique.js +0 -2
  269. package/views/3d/environment/Precipitation.glsl.js +0 -2
  270. package/views/3d/environment/Precipitation.js +0 -2
  271. package/views/3d/environment/PrecipitationTechnique.js +0 -2
  272. package/views/3d/environment/PrecipitationTechniqueConfiguration.js +0 -2
  273. package/views/3d/environment/SimpleAtmosphere.glsl.js +0 -2
  274. package/views/3d/environment/SimpleAtmosphereTechnique.js +0 -2
  275. package/views/3d/environment/SimpleAtmosphereTechniqueConfiguration.js +0 -2
  276. package/views/3d/environment/atmosphereUtils.js +0 -2
  277. package/views/3d/webgl-engine/lib/CutFillColor.js +0 -2
  278. package/views/3d/webgl-engine/lib/CutFillDepth.js +0 -2
  279. package/views/support/geodesicAreaMeasurementUtils.js +0 -2
  280. package/views/support/geodesicLengthMeasurementUtils.js +0 -2
  281. package/views/support/geodesicMeasurementUtils.js +0 -2
  282. package/views/webgl/AppleAmdDriverHelper.js +0 -2
  283. package/views/webgl/testAppleAmdDrawArrays.js +0 -2
  284. /package/assets/esri/core/workers/chunks/{4490f8eeeb2ee04daa9d.js.LICENSE.txt → 0dd12d6af0cf7707109c.js.LICENSE.txt} +0 -0
  285. /package/assets/esri/core/workers/chunks/{a53979c45ee429e21b99.js.LICENSE.txt → 60e4312044fe40dfd41d.js.LICENSE.txt} +0 -0
  286. /package/assets/esri/core/workers/chunks/{527547fa10d52cb3a7b1.js.LICENSE.txt → 888f6387e795d45a7ad3.js.LICENSE.txt} +0 -0
  287. /package/assets/esri/core/workers/chunks/{eaeb95be8d4032513247.js.LICENSE.txt → b014f0b2385dc82dc683.js.LICENSE.txt} +0 -0
  288. /package/assets/esri/core/workers/chunks/{a35d1be700ebd3109397.js.LICENSE.txt → d82b543c96f09ded3bf9.js.LICENSE.txt} +0 -0
  289. /package/views/3d/{environment/resources → webgl-engine/effects/atmosphere}/MarsAtmosphereTexture.js +0 -0
  290. /package/views/3d/{environment/resources → webgl-engine/effects/atmosphere}/SimpleAtmosphereTexture.js +0 -0
  291. /package/views/3d/{environment → webgl-engine/effects/clouds}/Clouds.js +0 -0
  292. /package/views/3d/{environment → webgl-engine/effects/clouds}/CloudsPresets.js +0 -0
  293. /package/views/3d/webgl-engine/effects/{weather → snowcover}/SnowCover.glsl.js +0 -0
@@ -1,9 +1,9 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{fromValues as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{tileRows as o,weatherTileSize as t,weatherMapSize as a,tileSize as r,atlasSize as l}from"../views/3d/environment/NoiseTextureAtlasDimensions.js";import{ScreenSpacePass as i}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{Float2PassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{glsl as d}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{NoParameters as p}from"../views/webgl/NoParameters.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";class c extends p{constructor(){super(...arguments),this.weatherTile=e(0,0)}}function s(e){const p=new n;if(p.include(i,!1),p.fragment.code.add(d`float remap(float x, float low1, float high1, float low2, float high2) {
2
+ import{fromValues as e}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import{ScreenSpacePass as o}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{Float2PassUniform as t}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{glsl as a}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{tileRows as r,weatherTileSize as l,weatherMapSize as i,tileSize as f,atlasSize as d}from"../views/3d/webgl-engine/effects/clouds/NoiseTextureAtlasDimensions.js";import{NoParameters as p}from"../views/webgl/NoParameters.js";import{ShaderBuilder as c}from"../views/webgl/ShaderBuilder.js";class n extends p{constructor(){super(...arguments),this.weatherTile=e(0,0)}}function s(e){const p=new c;if(p.include(o,!1),p.fragment.code.add(a`float remap(float x, float low1, float high1, float low2, float high2) {
3
3
  return low2 + (x - low1) * (high2 - low2) / (high1 - low1);
4
- }`),0===e.mode){const e=2,t=8;p.fragment.code.add(d`float saturate(float x) {
4
+ }`),0===e.mode){const e=2,o=8;p.fragment.code.add(a`float saturate(float x) {
5
5
  return clamp(x, 0.0, 1.0);
6
- }`),p.fragment.code.add(d`vec3 modulo(vec3 m, float n) {
6
+ }`),p.fragment.code.add(a`vec3 modulo(vec3 m, float n) {
7
7
  return mod(mod(m, n) + n, n);
8
8
  }
9
9
  vec3 hash(vec3 p3, float frequency) {
@@ -11,9 +11,9 @@ p3 = modulo(p3, frequency);
11
11
  p3 = fract(p3 * vec3(0.1031, 0.1030, 0.0973));
12
12
  p3 += dot(p3, p3.yxz + 33.33);
13
13
  return -1.0 + 2.0 * fract((p3.xxy + p3.yxx) * p3.zyx);
14
- }`),p.fragment.code.add(d`vec3 fade(vec3 t) {
14
+ }`),p.fragment.code.add(a`vec3 fade(vec3 t) {
15
15
  return (t * t * t) * (t * (t * 6.0 - 15.0) + 10.0);
16
- }`),p.fragment.code.add(d`
16
+ }`),p.fragment.code.add(a`
17
17
  float gradientNoise(vec3 p, float frequency) {
18
18
  vec3 i = floor(p);
19
19
  vec3 f = fract(p);
@@ -67,26 +67,26 @@ return (t * t * t) * (t * (t * 6.0 - 15.0) + 10.0);
67
67
 
68
68
  vec3 get3Dfrom2D(vec2 uv) {
69
69
  vec2 tile = floor(uv);
70
- float z = floor(${d.float(o)} * tile.y + tile.x);
70
+ float z = floor(${a.float(r)} * tile.y + tile.x);
71
71
  return vec3(fract(uv), z);
72
72
  }
73
73
 
74
74
  float getTextureForPointPerlinWorley(vec3 p) {
75
- float perlinNoise = getPerlinNoise(p, ${d.float(t)});
75
+ float perlinNoise = getPerlinNoise(p, ${a.float(o)});
76
76
 
77
- float worley0 = worley(p, ${d.float(e)} * 2.0);
78
- float worley1 = worley(p, ${d.float(e)} * 8.0);
79
- float worley2 = worley(p, ${d.float(e)} * 14.0);
77
+ float worley0 = worley(p, ${a.float(e)} * 2.0);
78
+ float worley1 = worley(p, ${a.float(e)} * 8.0);
79
+ float worley2 = worley(p, ${a.float(e)} * 14.0);
80
80
 
81
81
  float worleyFBM = worley0 * 0.625 + worley1 * 0.25 + worley2 * 0.125;
82
82
  return remap(perlinNoise, 0.0, 1.0, worleyFBM, 1.0);
83
83
  }
84
84
 
85
85
  float getTextureForPointWorley(vec3 p) {
86
- float worley0 = worley(p, ${d.float(e)});
87
- float worley1 = worley(p, ${d.float(e)} * 2.0);
88
- float worley2 = worley(p, ${d.float(e)} * 4.0);
89
- float worley3 = worley(p, ${d.float(e)} * 8.0);
86
+ float worley0 = worley(p, ${a.float(e)});
87
+ float worley1 = worley(p, ${a.float(e)} * 2.0);
88
+ float worley2 = worley(p, ${a.float(e)} * 4.0);
89
+ float worley3 = worley(p, ${a.float(e)} * 8.0);
90
90
 
91
91
  float FBM0 = worley0 * 0.625 + worley1 * 0.25 + worley2 * 0.125;
92
92
  float FBM1 = worley1 * 0.625 + worley2 * 0.25 + worley3 * 0.125;
@@ -94,20 +94,20 @@ return (t * t * t) * (t * (t * 6.0 - 15.0) + 10.0);
94
94
 
95
95
  return FBM0 * 0.625 + FBM1 * 0.25 + FBM2 * 0.125;
96
96
  }
97
- `)}return p.fragment.uniforms.add(new f("weatherTile",e=>e.weatherTile)).code.add(d`
97
+ `)}return p.fragment.uniforms.add(new t("weatherTile",e=>e.weatherTile)).code.add(a`
98
98
  vec2 modulo(vec2 m, float n){
99
99
  return mod(mod(m, n) + n, n);
100
100
  }
101
101
 
102
102
  vec2 hash(vec2 p){
103
103
  // Get position of p in weather tile
104
- p = modulo(p, ${d.float(t)});
104
+ p = modulo(p, ${a.float(l)});
105
105
 
106
106
  // Get global coordinates of p
107
- p += weatherTile * ${d.float(t)};
107
+ p += weatherTile * ${a.float(l)};
108
108
 
109
109
  // Limit position to avoid numerical instability
110
- p = modulo(p, ${d.float(a)});
110
+ p = modulo(p, ${a.float(i)});
111
111
 
112
112
  vec3 p3 = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
113
113
  p3 += dot(p3, p3.yzx + 33.33);
@@ -144,10 +144,10 @@ return (t * t * t) * (t * (t * 6.0 - 15.0) + 10.0);
144
144
  }
145
145
  return 1.0 - clamp(d, 0.0, 1.0);
146
146
  }
147
- `),0===e.mode?p.fragment.main.add(d`
147
+ `),0===e.mode?p.fragment.main.add(a`
148
148
  float padWidth = 1.0;
149
- float paddedSize = ${d.float(r)} + 2.0 * padWidth;
150
- float tileCount = ${d.float(o)} * ${d.float(o)};
149
+ float paddedSize = ${a.float(f)} + 2.0 * padWidth;
150
+ float tileCount = ${a.float(r)} * ${a.float(r)};
151
151
  vec2 tile = floor((gl_FragCoord.xy - 0.5) / paddedSize);
152
152
 
153
153
  bool padCell = false;
@@ -187,52 +187,52 @@ return (t * t * t) * (t * (t * 6.0 - 15.0) + 10.0);
187
187
  vec2 pixel = gl_FragCoord.xy - padWidth - padding;
188
188
 
189
189
  if (startPadX) {
190
- pixel.x += ${d.float(r)};
190
+ pixel.x += ${a.float(f)};
191
191
  }
192
192
 
193
193
  if (startPadY) {
194
- pixel.y += ${d.float(r)};
194
+ pixel.y += ${a.float(f)};
195
195
  }
196
196
 
197
197
  if (endPadX) {
198
- pixel.x -= ${d.float(r)};
198
+ pixel.x -= ${a.float(f)};
199
199
  }
200
200
 
201
201
  if (endPadY) {
202
- pixel.y -= ${d.float(r)};
202
+ pixel.y -= ${a.float(f)};
203
203
  }
204
204
 
205
- uv = vec2(pixel.xy / ${d.float(r)});
205
+ uv = vec2(pixel.xy / ${a.float(f)});
206
206
  } else {
207
207
  vec2 pixel = gl_FragCoord.xy - padWidth - padding;
208
- uv = vec2(pixel.xy / ${d.float(r)});
208
+ uv = vec2(pixel.xy / ${a.float(f)});
209
209
  }
210
210
 
211
211
  vec3 p_ = get3Dfrom2D(uv);
212
212
  vec3 p = p_;
213
- p.z /= (${d.float(o)} * ${d.float(o)});
213
+ p.z /= (${a.float(r)} * ${a.float(r)});
214
214
 
215
215
  float worleyPerlinNoise = getTextureForPointPerlinWorley(p);
216
216
  float worleyNoise = getTextureForPointWorley(p);
217
217
 
218
218
  fragColor.r = saturate(remap(worleyPerlinNoise, worleyNoise, 1.0, 0.0, 1.0));
219
219
 
220
- p_ = mod(p_ + 1.0, ${d.float(o)} * ${d.float(o)});
220
+ p_ = mod(p_ + 1.0, ${a.float(r)} * ${a.float(r)});
221
221
  p = p_;
222
- p.z /= (${d.float(o)} * ${d.float(o)});
222
+ p.z /= (${a.float(r)} * ${a.float(r)});
223
223
 
224
224
  worleyPerlinNoise = getTextureForPointPerlinWorley(p);
225
225
  worleyNoise = getTextureForPointWorley(p);
226
226
 
227
227
  fragColor.g = saturate(remap(worleyPerlinNoise, worleyNoise, 1.0, 0.0, 1.0));
228
228
 
229
- vec2 mapUV = ${d.float(t)} * (gl_FragCoord.xy / ${d.float(l)});
229
+ vec2 mapUV = ${a.float(l)} * (gl_FragCoord.xy / ${a.float(d)});
230
230
  float map = abs(gradientNoise(mapUV));
231
231
  map = remap(map, 0.25 * (1.0 - worley(8.0 * mapUV)), 1.0, 0.0, 1.0);
232
232
  fragColor.ba = vec2(0.0, map);
233
- `):p.fragment.main.add(d`
234
- vec2 mapUV = ${d.float(t)} * (gl_FragCoord.xy / ${d.float(l)});
233
+ `):p.fragment.main.add(a`
234
+ vec2 mapUV = ${a.float(l)} * (gl_FragCoord.xy / ${a.float(d)});
235
235
  float map = abs(gradientNoise(mapUV));
236
236
  map = remap(map, 0.25 * (1.0 - worley(8.0 * mapUV)), 1.0, 0.0, 1.0);
237
237
  fragColor = vec4(map);
238
- `),p}const y=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:c,build:s},Symbol.toStringTag,{value:"Module"}));export{c as N,y as a,s as b};
238
+ `),p}const u=Object.freeze(Object.defineProperty({__proto__:null,NoiseTextureAtlasPassParameters:n,build:s},Symbol.toStringTag,{value:"Module"}));export{n as N,u as a,s as b};
@@ -1,27 +1,27 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as r,glsl as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as t}from"./OITDim.glsl.js";import{ShaderBuilder as n}from"../views/webgl/ShaderBuilder.js";class a extends t{}function i(t){const a=new n;a.include(e);const{hasEmission:i,frontFaceMask:c,computeHudOcclusion:u}=t,l=a.fragment;l.uniforms.add(new s("colorTexture",e=>e.colorTexture),new s("alphaTexture",e=>e.alphaTexture));let m=0;return a.outputs.add("fragColor","vec4",m++),i&&a.outputs.add("fragEmission","vec4",m++),u&&a.outputs.add("fragOcclusion","vec4",m++),l.uniforms.add(new s("frontFaceTexture",e=>e.frontFaceTexture)),i&&(l.uniforms.add(new s("emissionTexture",e=>e.emissionTexture)),l.uniforms.add(new s("emissionFrontFaceTexture",e=>e.emissionFrontFaceTexture))),l.main.add(o`
3
- float srcAlpha = texture(alphaTexture, uv).r;
4
- ${r(u,"fragOcclusion = vec4(1.0, 0.0, 0.0, 1.0);")}
2
+ import{ScreenSpacePass as e}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{If as r,glsl as o}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Texture2DPassUniform as s}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{O as t}from"./OITDim.glsl.js";import{oitResolution as n}from"../views/3d/webgl-engine/shaders/oitResolution.glsl.js";import{ShaderBuilder as a}from"../views/webgl/ShaderBuilder.js";class i extends t{}function c(t){const i=new a;i.include(e);const{hasEmission:c,frontFaceMask:u,computeHudOcclusion:l}=t,m=i.fragment;m.include(n,t),m.uniforms.add(new s("colorTexture",e=>e.colorTexture),new s("alphaTexture",e=>e.alphaTexture));let f=0;return i.outputs.add("fragColor","vec4",f++),c&&i.outputs.add("fragEmission","vec4",f++),l&&i.outputs.add("fragOcclusion","vec4",f++),m.uniforms.add(new s("frontFaceTexture",e=>e.frontFaceTexture)),c&&(m.uniforms.add(new s("emissionTexture",e=>e.emissionTexture)),m.uniforms.add(new s("emissionFrontFaceTexture",e=>e.emissionFrontFaceTexture))),m.main.add(o`
3
+ float srcAlpha = texture(alphaTexture, uv).r * oitInputScale;
4
+ ${r(l,"fragOcclusion = vec4(1.0, 0.0, 0.0, 1.0);")}
5
5
 
6
6
  if(srcAlpha == 0.0) {
7
7
  fragColor = vec4(0.0);
8
- ${r(i,"fragEmission = vec4(0.0);")}
8
+ ${r(c,"fragEmission = vec4(0.0);")}
9
9
  return;
10
10
  }
11
11
  vec4 frontFace = texture(frontFaceTexture, uv);
12
12
 
13
- ${r(c,o`
13
+ ${r(u,o`
14
14
  if (frontFace.a == 0.0) {
15
15
  fragColor = vec4(0.0);
16
- ${r(i,"fragEmission = vec4(0.0);")}
16
+ ${r(c,"fragEmission = vec4(0.0);")}
17
17
  return;
18
18
  }
19
19
  `)}
20
20
 
21
21
  vec4 srcColor = texture(colorTexture, uv);
22
- fragColor = vec4(mix(srcColor.rgb / srcAlpha, frontFace.rgb, frontFace.a), 1.0 - srcColor.a);
22
+ fragColor = vec4(mix(srcColor.rgb * oitInputScale / srcAlpha, frontFace.rgb, frontFace.a), 1.0 - srcColor.a);
23
23
 
24
- ${r(i,"vec4 emission = texture(emissionTexture, uv);\n vec4 emissionFrontFace = texture(emissionFrontFaceTexture, uv);\n\n // Modulate transparent emitter by front faces. This case is important for surfaces which contain emitter and\n // non-emitter at the same time. Non-emitter surface parts need to modulate emissions as well.\n emission.rgb = emission.rgb * (1.0 - frontFace.a);\n\n fragEmission = vec4(mix(emission.rgb / srcAlpha, emissionFrontFace.rgb, emissionFrontFace.a), 1.0 - srcColor.a);\n ")}
24
+ ${r(c,"vec4 emission = texture(emissionTexture, uv) * oitInputScale;\n vec4 emissionFrontFace = texture(emissionFrontFaceTexture, uv);\n\n // Modulate transparent emitter by front faces. This case is important for surfaces which contain emitter and\n // non-emitter at the same time. Non-emitter surface parts need to modulate emissions as well.\n emission.rgb = emission.rgb * (1.0 - frontFace.a);\n\n fragEmission = vec4(mix(emission.rgb / srcAlpha, emissionFrontFace.rgb, emissionFrontFace.a) * oitOutputScale, 1.0 - srcColor.a);\n ")}
25
25
 
26
- ${r(u,"fragOcclusion.r = pow(srcColor.a, 0.5);")}
27
- `),a}const c=Object.freeze(Object.defineProperty({__proto__:null,OITBlendPassParameters:a,build:i},Symbol.toStringTag,{value:"Module"}));export{a as O,c as a,i as b};
26
+ ${r(l,"fragOcclusion.r = pow(srcColor.a, 0.5);")}
27
+ `),i}const u=Object.freeze(Object.defineProperty({__proto__:null,OITBlendPassParameters:i,build:c},Symbol.toStringTag,{value:"Module"}));export{i as O,u as a,c as b};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{G as e}from"./GeometryCursor.js";import{d as t,t as s,a as n,c as i,i as r,G as o,m,f as a,e as h,h as c,o as u}from"./Geometry.js";import{Envelope2D as l}from"./Envelope2D.js";import{p as _,a as f,a2 as d,a3 as g,O as p,M as P,a4 as x,y,a5 as b,a6 as w,a7 as C,o as S,f as v,a8 as D,a9 as I,aa as G,R as M,S as T,U as N,ab as k,ac as A,ad as E,ae as q,af as R,ag as z}from"./SpatialReference.js";import{__addDisposableResource as X,__disposeResources as B}from"tslib";import{P as Y,a as O,E as j}from"./MultiPathImpl.js";import{h as F,c as W,P as J,e as U,j as H,k as L,s as V}from"./Envelope.js";import{T as K}from"./Transformation2D.js";import{d as Q,m as Z,P as $,S as ee,o as te,p as se}from"./Point2D.js";import{c as ne}from"./OperatorClip.js";import{c as ie}from"./GeometryCleaner-BEJM7I4l.js";import{O as re}from"./OperatorDensify.js";import{S as oe}from"./SimpleGeometryCursor.js";function me(e,t,s,m,a,h){m<Number.MAX_VALUE&&m>-Number.MAX_VALUE||n("Geodesic_bufferer.buffer - bad distance"),i(e);const c=ie(e),u=c.getGeometryType();if(r(u)){const e=c.getPointCount(),n=8e6;if(Math.abs(m)>n&&(e>50||u!==o.enumMultiPoint&&4===s&&e>2)){let e=c;const i=m>0?1:-1,r=7e6;let o=m,u=1;do{u++,o=(Math.abs(o)-r)*i}while(Math.abs(o)>n);o=m;for(let n=0;n<u-1;n++)e=he(e,t,s,r*i,a,u,h),o=(Math.abs(o)-r)*i;return e=he(e,t,s,o,a,u,h),e}}return he(c,t,s,m,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new Y,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new Y;if(this.bufferPoint2D(t,!1,s)){const e=U(null,s,!0);s=y(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new p).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=b(w());let r=new C,o=(new _).executeMany(r,i,this.m_progressTracker,2);const m=Q(6,!1),a=Z(l,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let f,d,g;for(;null!==(f=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=U(i,t,!0),r=F(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new C,o=(new _).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(f),s.needsSimplify()){const e=U(null,f,!0);f=y(f,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(f)),o.tock()}else this.putInGridCursors(e,f,i,!0,m,a,h,c,u)}let P=!1;for(let l=0;l<6;l++)if(null!=u[l]){P=!0;break}if(P){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new K;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const f=new C,d=(new _).executeMany(f,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=U(i,t,!0),l=F(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new S).execute(l[e],s,i,this.m_progressTracker));const n=U(i,s,!0),r=F(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new v).execute(s,this.m_gcs,!0,this.m_progressTracker),f.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new K;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=U(null,e,!0);e=y(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new S).execute(t,a,i,this.m_progressTracker));const h=U(i,a,!0),c=F(h);g=n.unproject(a,c,this.m_progressTracker),g=(new v).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new p).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new C,a[c]=(new _).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=H(t,e),u=W(null,c,!1).total();let l=ne(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new $;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new $;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=U(null,l,!0);l=y(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=l.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=D(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return I(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),I(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),I(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(I(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),I(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),I(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=d.q(this.m_a,this.m_eSquared,a),u=d.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-te,_=n+te,f=l-Math.PI,g=l+Math.PI,p=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,p,_,o,f,y,b),(_<P[0]&&P[0]<p||_<x[0]&&x[0]<p)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let d=e.length-1;d>=0;d--)C.push(e[d]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let S=0;S=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,S,r),S=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,p,this.m_cornerStep,i,S,r,P[0],x[0]),S=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,p,g,i,S,r),S=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,S,r,y[0],b[0]);let v=!1;return i||(v=this.checkAndPrepForPole(r)),w||v}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new l;return e.queryEnvelope(t),!(!G(t.ymax,this.m_gcs90)&&!G(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new Y;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=G(t.y,this.m_gcs90),n=G(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=G(n.y,this.m_gcs90),h=G(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=$.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=G(i.y,this.m_gcs90),o=G(i.y,-this.m_gcs90);r||o||(s=$.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new Y,s=new Y,n=new K,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new l;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new l;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,_;i.x>r.x?(u=-o,_=this.m_gcs90):(u=o,_=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new J;for(let l=0;l<c;l++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=_,g.y=_,t.lineTo(g);const p=new $;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new l;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);I(w,C,this.m_gcs,0,2,!0,a.xmin),I(w,C,this.m_gcs,0,2,!0,a.xmax);const S=w.getGeometry(C),v=H(S,a);v.inflateCoords(0,1);const D=W(null,v,!0).total(),G=ne(S,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(G,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new l;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new l;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new K;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new l;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new $;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new K;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);I(r,o,this.m_gcs,0,2,!0,n.xmin),I(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=H(c,n);m.inflateCoords(0,1);const h=W(null,m,!0).total();c=ne(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new $;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=X(e,new ee(new M,new M),!1),m=X(e,new ee(new M,new M),!1),a=X(e,new ee(new M,new M),!1),h=X(e,new ee(new M,new M),!1),c=new $,u=new $,l=new $,_=new $;for(T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=X(e,new M,!1),f=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),T.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{B(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{B(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new $,r=new $;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=X(e,new M,!1),m=X(e,new M,!1),a=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=X(e,new ee(new M,new M),!1),c=X(e,new ee(new M,new M),!1),u=new $,l=X(e,new M,!1),_=X(e,new ee(new M,new M),!1),f=X(e,new ee(new M,new M),!1),d=X(e,new ee(new M,new M),!1),g=X(e,new ee(new M,new M),!1),p=new $,P=new $,x=new $,y=new $,b=0;let w=1;const C=o.val,S=m.val,v=C-.5*Math.PI,D=S+.5*Math.PI,I=a.val;for(T.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,v,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),T.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);T.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;T.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=X(e,new M,!1),a=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),T.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,T.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;T.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{B(e)}}}catch(s){e.error=s,e.hasError=!0}finally{B(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{B(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,_){if(e.isEmpty())return new Y({vd:e.getDescription()});let y=e;if(m(y)){const e=10*t.getTolerance(0);y=(new re).execute(y,0,e,0,_,12e3)}const b=new ae(_);b.m_sr=t,b.m_gcs=t.getGCS(),b.m_transform=f(t,b.m_gcs,null);const w=N();b.m_gcs.querySpheroidData(w);const C=new l;y.queryEnvelope(C),b.m_a=w.majorSemiAxis,b.m_eSquared=w.e2,b.m_rpu=b.m_gcs.getUnit().getUnitToBaseFactor(),b.m_gcs90=.5*Math.PI/b.m_rpu,b.m_gcs180=Math.PI/b.m_rpu,b.m_gcs360=2*Math.PI/b.m_rpu,b.m_gcs60=b.m_gcs360/6,b.m_q90=d.q90(b.m_a,b.m_eSquared),b.m_ellipticToGeodesicMaxRatio=.5*b.m_a*Math.PI/b.m_q90;const S=b.m_gcs.getTolerance(0);b.m_radTolerance=S*b.m_rpu,4===s?(b.m_curveType=2,b.m_bShapePreserving=!0):(b.m_curveType=s,b.m_bShapePreserving=!1),b.m_distance=n,b.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?b.setConvergenceOffset():b.m_convergenceOffset=Math.max(i,.001),b.m_convergenceOffset/=r;let v,D=y.getGeometryType();if(a(D)){const e=new O({vd:y.getDescription()});e.addSegment(y,!0),v=e,D=o.enumPolyline}else if(D===o.enumEnvelope){const e=y,t=new l;e.queryEnvelope(t);const s=F(W(b.m_sr,C,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new J({vd:y.getDescription()});e.getCenter(t),v=t,D=o.enumPoint}else{const t=new O({vd:y.getDescription()});t.addEnvelope(e,!1),v=t,D=o.enumPolyline}else{const t=new Y({vd:y.getDescription()});t.addEnvelope(e,!1),v=t,D=o.enumPolygon}}else v=y;if(b.setMinCornerStep(),h(D)||b.setMinSegmentStep(),b.m_absDistance<=.5*b.m_convergenceOffset)return D!==o.enumPolygon?new Y({vd:v.getDescription()}):b.m_bShapePreserving?v:g(v,b.m_sr,b.m_curveType,b.m_segmentStep,-1,_);if(b.m_distance<0&&D!==o.enumPolygon)return new Y({vd:v.getDescription()});if(b.m_bShapePreserving&&c(D)){const e=g(v,t,4,Number.NaN,b.m_convergenceOffset,_);v=(new p).execute(e,b.m_transform,_)}else v=(new p).execute(v,b.m_transform,_);if(v=P(v,b.m_gcs),v.isEmpty())return new Y({vd:v.getDescription()});!b.m_bShapePreserving&&c(D)&&(v=x(b.m_rpu,v)),v=fe(v,b.m_gcs);let I=new Y;switch(D){case o.enumPolygon:I=b.bufferPolygon(v);break;case o.enumPolyline:I=b.bufferPolyline(v);break;case o.enumMultiPoint:I=b.bufferMultiPoint(v);break;case o.enumPoint:I=b.bufferPoint(v);break;default:u("")}const G=(new p).execute(I,b.m_transform.getInverse(),_);return G.mergeVertexDescription(v.getDescription()),G}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new $;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=X(u,new M,!1),f=X(u,new ee(new M,new M),!1),d=new $,g=new $,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(T.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),T.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{B(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=X(_,new ee(new M,new M),!1),d=new $,g=new $,p=new $;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)T.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{B(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new $,l=new $,_=X(u,new ee(new M,new M),!1);T.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),T.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=X(u,new M,!1);for(T.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,T.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=se;for(;h[0]>c[0];)h[0]-=se;for(;h[0]>=a;)h[0]-=se,c[0]-=se;for(;h[0]<a;)h[0]+=se,c[0]+=se}catch(l){u.error=l,u.hasError=!0}finally{B(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=se;for(;e-(n+t)>Math.PI;)n+=se;return n}return n+t-s>Math.PI?n-=se:s-(n+t)>Math.PI&&(n+=se),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=c(s)?e.getPathCount():s===o.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let o=0;o<n;o++){i.push(o);const n=new $;if(c(s)){const t=new l;e.queryPathEnvelope(o,t),n.assign(t.getCenter())}else n.assign(e.getXY(o));const m=t.toGeohash(n);r.push(m)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const m=e.createInstance();for(let o=0;o<n;o++){const t=i[o];c(s)?m.addPath(e,t,!0):m.addPoints(e,t,t+1)}return m}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=X(o,new M,!1),c=X(o,new M,!1),u=X(o,new M,!1);T.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),T.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),T.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=X(o,new M,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];T.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{B(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=$.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=k(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=X(o,new M,!1);T.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{B(o)}}function Pe(e,t,s,n,i,r,o,m){const a=k(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new z(e,t)}function ye(e){return L(e,0)||V(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new $,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new Y,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new l;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=k(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new $,r=new $;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),A(i,r))i.x=r.x;else if(E(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),E(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),A(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=q(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||R(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new Y,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(A(i,r))i.x=r.x;else if(E(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),E(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),A(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,q(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new $,s=new $,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-te;const i=this.m_endAzimuth[0]+te;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+te,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+te,n=s+Math.PI-(se-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new $;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=se:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=se)}n=.5*(n+s)}else if(r){const s=new $;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new l;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=k(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new Y,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new $,s=new $,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class Se{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new ve(e,t,s,n,i,!1,r,m);return(new _).executeMany(o,t,m)}return new ve(e,t,s,n,i,!1,r,m)}execute(e,s,n,i,r,o,m){const a=new oe([e]),h=[i],c=this.executeMany(a,s,n,h,r,!1,o,m).next();return c||t("geodesic buffer null output"),c}}class ve extends e{constructor(e,t,i,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new l,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=i,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{Se as OperatorGeodesicBuffer};
2
+ import{G as e}from"./GeometryCursor.js";import{d as t,t as s,a as n,c as i,i as r,G as o,m,f as a,e as h,h as c,o as u}from"./Geometry.js";import{Envelope2D as l}from"./Envelope2D.js";import{p as _,a as f,$ as d,a1 as g,O as p,X as P,a4 as x,y,a5 as b,a6 as w,a7 as C,o as S,f as v,a8 as D,a9 as I,aa as G,M,N as T,_ as N,ab as k,ac as A,ad as E,ae as q,af as R,ag as z}from"./SpatialReference.js";import{__addDisposableResource as X,__disposeResources as B}from"tslib";import{P as Y,a as O,E as j}from"./MultiPathImpl.js";import{h as F,c as W,P as J,e as U,j as H,k as L,s as V}from"./Envelope.js";import{T as $}from"./Transformation2D.js";import{d as K,m as Q,P as Z,S as ee,o as te,p as se}from"./Point2D.js";import{c as ne}from"./OperatorClip.js";import{c as ie}from"./GeometryCleaner-BEJM7I4l.js";import{O as re}from"./OperatorDensify.js";import{S as oe}from"./SimpleGeometryCursor.js";function me(e,t,s,m,a,h){m<Number.MAX_VALUE&&m>-Number.MAX_VALUE||n("Geodesic_bufferer.buffer - bad distance"),i(e);const c=ie(e),u=c.getGeometryType();if(r(u)){const e=c.getPointCount(),n=8e6;if(Math.abs(m)>n&&(e>50||u!==o.enumMultiPoint&&4===s&&e>2)){let e=c;const i=m>0?1:-1,r=7e6;let o=m,u=1;do{u++,o=(Math.abs(o)-r)*i}while(Math.abs(o)>n);o=m;for(let n=0;n<u-1;n++)e=he(e,t,s,r*i,a,u,h),o=(Math.abs(o)-r)*i;return e=he(e,t,s,o,a,u,h),e}}return he(c,t,s,m,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new Y,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new Y;if(this.bufferPoint2D(t,!1,s)){const e=U(null,s,!0);s=y(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new p).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=b(w());let r=new C,o=(new _).executeMany(r,i,this.m_progressTracker,2);const m=K(6,!1),a=Q(l,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let f,d,g;for(;null!==(f=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=U(i,t,!0),r=F(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new C,o=(new _).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(f),s.needsSimplify()){const e=U(null,f,!0);f=y(f,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(f)),o.tock()}else this.putInGridCursors(e,f,i,!0,m,a,h,c,u)}let P=!1;for(let l=0;l<6;l++)if(null!=u[l]){P=!0;break}if(P){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new $;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const f=new C,d=(new _).executeMany(f,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=U(i,t,!0),l=F(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new S).execute(l[e],s,i,this.m_progressTracker));const n=U(i,s,!0),r=F(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new v).execute(s,this.m_gcs,!0,this.m_progressTracker),f.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new $;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=U(null,e,!0);e=y(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new S).execute(t,a,i,this.m_progressTracker));const h=U(i,a,!0),c=F(h);g=n.unproject(a,c,this.m_progressTracker),g=(new v).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new p).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new C,a[c]=(new _).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=H(t,e),u=W(null,c,!1).total();let l=ne(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new Z;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new Z;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=U(null,l,!0);l=y(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=l.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=D(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return I(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),I(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),I(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(I(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),I(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),I(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=d.q(this.m_a,this.m_eSquared,a),u=d.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-te,_=n+te,f=l-Math.PI,g=l+Math.PI,p=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,p,_,o,f,y,b),(_<P[0]&&P[0]<p||_<x[0]&&x[0]<p)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let d=e.length-1;d>=0;d--)C.push(e[d]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let S=0;S=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,S,r),S=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,p,this.m_cornerStep,i,S,r,P[0],x[0]),S=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,p,g,i,S,r),S=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,S,r,y[0],b[0]);let v=!1;return i||(v=this.checkAndPrepForPole(r)),w||v}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new l;return e.queryEnvelope(t),!(!G(t.ymax,this.m_gcs90)&&!G(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new Y;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=G(t.y,this.m_gcs90),n=G(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=G(n.y,this.m_gcs90),h=G(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=Z.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=G(i.y,this.m_gcs90),o=G(i.y,-this.m_gcs90);r||o||(s=Z.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new Y,s=new Y,n=new $,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new l;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new l;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,_;i.x>r.x?(u=-o,_=this.m_gcs90):(u=o,_=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new J;for(let l=0;l<c;l++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=_,g.y=_,t.lineTo(g);const p=new Z;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new l;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);I(w,C,this.m_gcs,0,2,!0,a.xmin),I(w,C,this.m_gcs,0,2,!0,a.xmax);const S=w.getGeometry(C),v=H(S,a);v.inflateCoords(0,1);const D=W(null,v,!0).total(),G=ne(S,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(G,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new l;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new l;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new $;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new l;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new Z;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new $;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);I(r,o,this.m_gcs,0,2,!0,n.xmin),I(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=H(c,n);m.inflateCoords(0,1);const h=W(null,m,!0).total();c=ne(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new Z;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=X(e,new ee(new M,new M),!1),m=X(e,new ee(new M,new M),!1),a=X(e,new ee(new M,new M),!1),h=X(e,new ee(new M,new M),!1),c=new Z,u=new Z,l=new Z,_=new Z;for(T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=X(e,new M,!1),f=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),T.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,T.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{B(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{B(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new Z,r=new Z;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=X(e,new M,!1),m=X(e,new M,!1),a=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=X(e,new ee(new M,new M),!1),c=X(e,new ee(new M,new M),!1),u=new Z,l=X(e,new M,!1),_=X(e,new ee(new M,new M),!1),f=X(e,new ee(new M,new M),!1),d=X(e,new ee(new M,new M),!1),g=X(e,new ee(new M,new M),!1),p=new Z,P=new Z,x=new Z,y=new Z,b=0;let w=1;const C=o.val,S=m.val,v=C-.5*Math.PI,D=S+.5*Math.PI,I=a.val;for(T.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,v,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),T.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);T.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;T.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=X(e,new M,!1),a=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),T.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,T.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=X(e,new M,!1);T.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;T.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{B(e)}}}catch(s){e.error=s,e.hasError=!0}finally{B(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{B(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,_){if(e.isEmpty())return new Y({vd:e.getDescription()});let y=e;if(m(y)){const e=10*t.getTolerance(0);y=(new re).execute(y,0,e,0,_,12e3)}const b=new ae(_);b.m_sr=t,b.m_gcs=t.getGCS(),b.m_transform=f(t,b.m_gcs,null);const w=N();b.m_gcs.querySpheroidData(w);const C=new l;y.queryEnvelope(C),b.m_a=w.majorSemiAxis,b.m_eSquared=w.e2,b.m_rpu=b.m_gcs.getUnit().getUnitToBaseFactor(),b.m_gcs90=.5*Math.PI/b.m_rpu,b.m_gcs180=Math.PI/b.m_rpu,b.m_gcs360=2*Math.PI/b.m_rpu,b.m_gcs60=b.m_gcs360/6,b.m_q90=d.q90(b.m_a,b.m_eSquared),b.m_ellipticToGeodesicMaxRatio=.5*b.m_a*Math.PI/b.m_q90;const S=b.m_gcs.getTolerance(0);b.m_radTolerance=S*b.m_rpu,4===s?(b.m_curveType=2,b.m_bShapePreserving=!0):(b.m_curveType=s,b.m_bShapePreserving=!1),b.m_distance=n,b.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?b.setConvergenceOffset():b.m_convergenceOffset=Math.max(i,.001),b.m_convergenceOffset/=r;let v,D=y.getGeometryType();if(a(D)){const e=new O({vd:y.getDescription()});e.addSegment(y,!0),v=e,D=o.enumPolyline}else if(D===o.enumEnvelope){const e=y,t=new l;e.queryEnvelope(t);const s=F(W(b.m_sr,C,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new J({vd:y.getDescription()});e.getCenter(t),v=t,D=o.enumPoint}else{const t=new O({vd:y.getDescription()});t.addEnvelope(e,!1),v=t,D=o.enumPolyline}else{const t=new Y({vd:y.getDescription()});t.addEnvelope(e,!1),v=t,D=o.enumPolygon}}else v=y;if(b.setMinCornerStep(),h(D)||b.setMinSegmentStep(),b.m_absDistance<=.5*b.m_convergenceOffset)return D!==o.enumPolygon?new Y({vd:v.getDescription()}):b.m_bShapePreserving?v:g(v,b.m_sr,b.m_curveType,b.m_segmentStep,-1,_);if(b.m_distance<0&&D!==o.enumPolygon)return new Y({vd:v.getDescription()});if(b.m_bShapePreserving&&c(D)){const e=g(v,t,4,Number.NaN,b.m_convergenceOffset,_);v=(new p).execute(e,b.m_transform,_)}else v=(new p).execute(v,b.m_transform,_);if(v=P(v,b.m_gcs),v.isEmpty())return new Y({vd:v.getDescription()});!b.m_bShapePreserving&&c(D)&&(v=x(b.m_rpu,v)),v=fe(v,b.m_gcs);let I=new Y;switch(D){case o.enumPolygon:I=b.bufferPolygon(v);break;case o.enumPolyline:I=b.bufferPolyline(v);break;case o.enumMultiPoint:I=b.bufferMultiPoint(v);break;case o.enumPoint:I=b.bufferPoint(v);break;default:u("")}const G=(new p).execute(I,b.m_transform.getInverse(),_);return G.mergeVertexDescription(v.getDescription()),G}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new Z;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=X(u,new M,!1),f=X(u,new ee(new M,new M),!1),d=new Z,g=new Z,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(T.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),T.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{B(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=X(_,new ee(new M,new M),!1),d=new Z,g=new Z,p=new Z;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)T.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{B(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new Z,l=new Z,_=X(u,new ee(new M,new M),!1);T.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),T.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=X(u,new M,!1);for(T.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,T.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=se;for(;h[0]>c[0];)h[0]-=se;for(;h[0]>=a;)h[0]-=se,c[0]-=se;for(;h[0]<a;)h[0]+=se,c[0]+=se}catch(l){u.error=l,u.hasError=!0}finally{B(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=se;for(;e-(n+t)>Math.PI;)n+=se;return n}return n+t-s>Math.PI?n-=se:s-(n+t)>Math.PI&&(n+=se),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=c(s)?e.getPathCount():s===o.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let o=0;o<n;o++){i.push(o);const n=new Z;if(c(s)){const t=new l;e.queryPathEnvelope(o,t),n.assign(t.getCenter())}else n.assign(e.getXY(o));const m=t.toGeohash(n);r.push(m)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const m=e.createInstance();for(let o=0;o<n;o++){const t=i[o];c(s)?m.addPath(e,t,!0):m.addPoints(e,t,t+1)}return m}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=X(o,new M,!1),c=X(o,new M,!1),u=X(o,new M,!1);T.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),T.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),T.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=X(o,new M,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];T.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{B(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=Z.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=k(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=X(o,new M,!1);T.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{B(o)}}function Pe(e,t,s,n,i,r,o,m){const a=k(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new z(e,t)}function ye(e){return L(e,0)||V(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new Z,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new Y,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new l;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=k(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new Z,r=new Z;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),A(i,r))i.x=r.x;else if(E(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),E(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),A(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=q(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||R(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new Y,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(A(i,r))i.x=r.x;else if(E(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),E(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),A(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,q(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new Z,s=new Z,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-te;const i=this.m_endAzimuth[0]+te;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+te,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+te,n=s+Math.PI-(se-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new Z;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=se:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=se)}n=.5*(n+s)}else if(r){const s=new Z;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new l;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=k(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new Y,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new Z,s=new Z,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class Se{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new ve(e,t,s,n,i,!1,r,m);return(new _).executeMany(o,t,m)}return new ve(e,t,s,n,i,!1,r,m)}execute(e,s,n,i,r,o,m){const a=new oe([e]),h=[i],c=this.executeMany(a,s,n,h,r,!1,o,m).next();return c||t("geodesic buffer null output"),c}}class ve extends e{constructor(e,t,i,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new l,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=i,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{Se as OperatorGeodesicBuffer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{P as a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{a as o,f as m,U as l,V as p,O as u,ao as c,aD as g,aE as d,M as f,Q as E,aF as P,aG as S,R as A,S as x,W as y,aH as R,a1 as M,Z as C}from"./SpatialReference.js";import{P as T,K as w,d as N,l as q,o as b,a as I,E as v,k as $,f as z,c as D,x as O,y as G,z as k}from"./Point2D.js";import{Envelope2D as L}from"./Envelope2D.js";import{c as F,f as J}from"./Envelope.js";import{O as U}from"./OperatorClip.js";import{O as Y}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new L;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new U).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new L;_.queryEnvelope(o);const m=new L,l=new L,p=new L;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new U).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new L;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,f=0;let E=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),E=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${E}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const f=g("EqualAreaPCS");let E;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?E=`PROJCS["${f}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(E),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new Y).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new L;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?f(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),E(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new L;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),f=ae(),E=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,D,O,G;const k=new T,F=new T,J=new T,U=new T,Y=new T,j=new T;let B,H;for(D=e.getPathStart(0),v=0;v<I;v++,D=O)for(O=e.getPathEnd(v),h.queryPoint2D(O-1<<1,J),o.queryPoint2D(O-1<<1,k),Math.abs(k.y)>q&&(k.y=z(q,k.y)),G=D;G<O;G++,J.assign(U),k.assign(F)){if(h.queryPoint2D(G<<1,U),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,U),B<r||0===k.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,k.x,k.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(f.setValues(0,J),E.setValues(1,U),y=i,g[0].assign(E),d[0]=i,P=0;P>=0;){H=.5*(f.m_factor+E.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,k.x,k.y,e*H,t,m,l,this.m_curveType),Y.x=m.val,Y.y=l.val,c[0]=Y.x,c[1]=Y.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(f.m_p_PCS,E.m_p_PCS),s=.5*i*T.distance(f.m_p_PCS,E.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)E.setValues(H,j),P++,g[P].assign(E),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;f.assign(E),P--,E.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new L;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=D(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let f=c*(l-.5*d.length());f=z(f,i.x-e.x),h.pe(f)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`,!0):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`,!0),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),O(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),O(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,f,E,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),f=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*f:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*f,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=k(_.one_m_sin_phi/e.one_p_e,e.e)-k(a.one_m_sin_phi/e.one_p_e,e.e),u=k(_.one_p_sin_phi/e.one_p_e,e.e)-k(a.one_p_sin_phi/e.one_p_e,e.e),c=k(a.one_m_sin_phi/-e.one_m_e,e.e)-k(_.one_m_sin_phi/-e.one_m_e,e.e),g=k(a.one_p_sin_phi/-e.one_m_e,e.e)-k(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,E=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<E&&(S=E,E=P,P=S),d<E&&(d=E),d>P&&(d=P),d*=f,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
2
+ import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{P as a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{a as o,f as m,_ as l,a0 as p,O as u,ao as c,aD as g,aE as d,X as f,a3 as E,aF as P,aG as S,M as A,N as x,Q as y,aH as R,Z as M,U as C}from"./SpatialReference.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as D,x as O,y as G,z as k}from"./Point2D.js";import{Envelope2D as L}from"./Envelope2D.js";import{c as F,f as J}from"./Envelope.js";import{O as U}from"./OperatorClip.js";import{O as Y}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new L;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new U).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new L;_.queryEnvelope(o);const m=new L,l=new L,p=new L;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new U).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new L;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,f=0;let E=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),E=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${E}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const f=g("EqualAreaPCS");let E;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?E=`PROJCS["${f}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(E),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new Y).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new L;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?f(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),E(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new L;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),f=ae(),E=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,D,O,G;const k=new T,F=new T,J=new T,U=new T,Y=new T,j=new T;let B,H;for(D=e.getPathStart(0),v=0;v<I;v++,D=O)for(O=e.getPathEnd(v),h.queryPoint2D(O-1<<1,J),o.queryPoint2D(O-1<<1,k),Math.abs(k.y)>q&&(k.y=z(q,k.y)),G=D;G<O;G++,J.assign(U),k.assign(F)){if(h.queryPoint2D(G<<1,U),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,U),B<r||0===k.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,k.x,k.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(f.setValues(0,J),E.setValues(1,U),y=i,g[0].assign(E),d[0]=i,P=0;P>=0;){H=.5*(f.m_factor+E.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,k.x,k.y,e*H,t,m,l,this.m_curveType),Y.x=m.val,Y.y=l.val,c[0]=Y.x,c[1]=Y.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(f.m_p_PCS,E.m_p_PCS),s=.5*i*T.distance(f.m_p_PCS,E.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)E.setValues(H,j),P++,g[P].assign(E),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;f.assign(E),P--,E.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new L;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=D(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let f=c*(l-.5*d.length());f=z(f,i.x-e.x),h.pe(f)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`,!0):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`,!0),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),O(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),O(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,f,E,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),f=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*f:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*f,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=k(_.one_m_sin_phi/e.one_p_e,e.e)-k(a.one_m_sin_phi/e.one_p_e,e.e),u=k(_.one_p_sin_phi/e.one_p_e,e.e)-k(a.one_p_sin_phi/e.one_p_e,e.e),c=k(a.one_m_sin_phi/-e.one_m_e,e.e)-k(_.one_m_sin_phi/-e.one_m_e,e.e),g=k(a.one_p_sin_phi/-e.one_m_e,e.e)-k(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,E=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<E&&(S=E,E=P,P=S),d<E&&(d=E),d>P&&(d=P),d*=f,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{G as e}from"./GeometryCursor.js";import{d as t,t as r,a as s,c as n}from"./Geometry.js";import{a3 as i}from"./SpatialReference.js";import{S as m}from"./SimpleGeometryCursor.js";class o{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new a(e,r,s,t,-1,-1,n)}execute(e,r,s,n,i){const o=new m([e]),a=this.executeMany(o,r,s,n,i).next();return a||t("null output"),a}}class a extends e{constructor(e,t,n,i,m,o,a){super(),this.m_progressTracker=a,o>0&&r(""),4!==n&&m>0&&r(""),t||s("");0===t.getCoordinateSystemType()&&s(""),i>0||m>0||s(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=n,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=o}next(){{let e;for(;e=this.m_inputGeoms.next();)return n(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return i(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{o as OperatorGeodeticDensifyByLength,a as OperatorGeodeticDensifyCursor};
2
+ import{G as e}from"./GeometryCursor.js";import{d as t,t as r,a as s,c as n}from"./Geometry.js";import{a1 as i}from"./SpatialReference.js";import{S as m}from"./SimpleGeometryCursor.js";class o{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new a(e,r,s,t,-1,-1,n)}execute(e,r,s,n,i){const o=new m([e]),a=this.executeMany(o,r,s,n,i).next();return a||t("null output"),a}}class a extends e{constructor(e,t,n,i,m,o,a){super(),this.m_progressTracker=a,o>0&&r(""),4!==n&&m>0&&r(""),t||s("");0===t.getCoordinateSystemType()&&s(""),i>0||m>0||s(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=n,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=o}next(){{let e;for(;e=this.m_inputGeoms.next();)return n(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return i(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{o as OperatorGeodeticDensifyByLength,a as OperatorGeodeticDensifyCursor};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,a as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{M as l,N as u,Q as g,O as p,R as f,S as y,U as x}from"./SpatialReference.js";import{O as h}from"./OperatorDensify.js";class S{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,y){if(4===f)return(new s).execute(e,t,y);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const S=t.getGCS(),d=x();S.querySpheroidData(d);const P=d.majorSemiAxis,E=d.e2,G=S.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):a(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,y)}if(S!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=l(j,t),v===o.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=u(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=g(r,j,n,y)?n:(new p).execute(j,r,y)}return this._ExecuteMultiPathGeodeticLength(j,f,P,E,G)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),y.geodeticDistance(o,a,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{S as OperatorGeodeticLength};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,a as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{X as l,a2 as u,a3 as g,O as p,M as f,N as y,_ as x}from"./SpatialReference.js";import{O as h}from"./OperatorDensify.js";class S{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,y){if(4===f)return(new s).execute(e,t,y);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const S=t.getGCS(),d=x();S.querySpheroidData(d);const P=d.majorSemiAxis,E=d.e2,G=S.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):a(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,y)}if(S!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=l(j,t),v===o.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=u(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=g(r,j,n,y)?n:(new p).execute(j,r,y)}return this._ExecuteMultiPathGeodeticLength(j,f,P,E,G)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),y.geodeticDistance(o,a,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{S as OperatorGeodeticLength};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{P as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,f as p}from"./Envelope.js";import{G as A}from"./GeometryCursor.js";import{O as C,j as P,_ as w,W as E,ah as _,ai as j,aj as T,a1 as G,U as I,ak as D,al as v,am as R,R as b,S as U,an as q,ao as k}from"./SpatialReference.js";import{O as B}from"./OperatorShapePreservingDensify.js";class F{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,R=new S;if(v?(new C).transform(v,[t],1,[R],!1):R.assign(t),R.isNAN())return c();const b=V(D,t,y,1);let U=b.m_distance;if(0===U)return b;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),k=q.getUnit().getUnitToBaseFactor(),F=R.clone();F.scale(k);const O=I();y.querySpheroidData(O);const M=E(O.majorSemiAxis,O.e2,F),L=_(O.majorSemiAxis,O.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const W=O.majorSemiAxis*g(45),H=(new B).executeMany(z,y,W,d,0,null),J=[];let K=-1;const Q=new p,Z=new f;for(let n=H.next();null!==n;n=H.next()){if(n.isEmpty())continue;const t=H.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){J.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)J.push(o.getXY(t));if(v&&(new C).transform(v,J,J.length,J,!1),J.length>3){const e=Y(J,J.length,R,q,1);if(e.m_distance<U){U=e.m_distance,Q.assign(E(O.majorSemiAxis,O.e2,e.m_coordinate.mul(k))),K=t;let n=e.m_vertexIndex;n+1===J.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}J.forEach(e=>e.mulThis(k));const n=E(O.majorSemiAxis,O.e2,J[0]),s=new p;for(let e=1,r=J.length;e<r;++e){const r=E(O.majorSemiAxis,O.e2,J[e]);if(j(L,M,n,r,s)<U){const{second:s}=T(O.majorSemiAxis,O.e2,M,n,r,2,null);if(s<=U){const s=new p,{second:i}=T(O.majorSemiAxis,O.e2,M,n,r,0,s);i<U&&(U=i,Q.assign(s),K=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===K&&n("");const $=G(O.majorSemiAxis,O.e2,Q);$.divThis(k);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),R,y.getGCS()),oe=m(ee,K,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return O(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return V(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return Y(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=O(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return M(e,t,o,i,a);default:r("")}}}function O(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==q(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=O(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=I();r.querySpheroidData(l);const u=e(i,new b,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,k.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function V(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=I();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=E(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const _=v(x.majorSemiAxis,x.e2);let j=c;const T=new S,G=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],T),T.isNAN())continue;G.assign(T),G.scale(g);const t=E(x.majorSemiAxis,x.e2,G);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=R(_,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],T),T.isNAN())continue;G.assign(T),G.scale(g);const n=E(x.majorSemiAxis,x.e2,G);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,G.x,G.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(k){n.error=k,n.hasError=!0}finally{t(n)}}const q=new S;return-1!==P&&q.assign(s.getXY(P)),m(q,P,w)}function Y(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=Y(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=I();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=E(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const _=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=E(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=R(_,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=E(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(G){n.error=G,n.hasError=!0}finally{t(n)}}const T=new S;return-1!==P&&T.assign(s[P]),m(T,P,w)}function M(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=I();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=E(h.majorSemiAxis,h.e2,A),w=[];let _=l;const j=new S,T=new S;for(let e=0;e<_;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;T.assign(j),T.scale(f);const n=E(h.majorSemiAxis,h.e2,T);p.distance(n,P)>i?(x[_-1]=N(x[e],x[e]=x[_-1]),_--):e++}const G=(e,t)=>e.m_distance-t.m_distance,v=e(c,new b,!1);for(let e=0;e<_;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,k.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(G),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{F as OperatorProximityGeodesic};
2
+ import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{P as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,f as p}from"./Envelope.js";import{G as A}from"./GeometryCursor.js";import{O as C,j as P,V as w,Q as E,ah as _,ai as j,aj as T,Z as G,_ as I,ak as D,al as v,am as b,M as R,N as U,an as q,ao as V}from"./SpatialReference.js";import{O as k}from"./OperatorShapePreservingDensify.js";class B{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=M(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),V=q.getUnit().getUnitToBaseFactor(),B=b.clone();B.scale(V);const F=I();y.querySpheroidData(F);const Y=E(F.majorSemiAxis,F.e2,B),L=_(F.majorSemiAxis,F.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const Q=F.majorSemiAxis*g(45),Z=(new k).executeMany(z,y,Q,d,0,null),H=[];let J=-1;const K=new p,W=new f;for(let n=Z.next();null!==n;n=Z.next()){if(n.isEmpty())continue;const t=Z.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){H.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)H.push(o.getXY(t));if(v&&(new C).transform(v,H,H.length,H,!1),H.length>3){const e=O(H,H.length,b,q,1);if(e.m_distance<U){U=e.m_distance,K.assign(E(F.majorSemiAxis,F.e2,e.m_coordinate.mul(V))),J=t;let n=e.m_vertexIndex;n+1===H.length&&(n-=1),o.getSegmentBuffer(n,W,!0)}}H.forEach(e=>e.mulThis(V));const n=E(F.majorSemiAxis,F.e2,H[0]),s=new p;for(let e=1,r=H.length;e<r;++e){const r=E(F.majorSemiAxis,F.e2,H[e]);if(j(L,Y,n,r,s)<U){const{second:s}=T(F.majorSemiAxis,F.e2,Y,n,r,2,null);if(s<=U){const s=new p,{second:i}=T(F.majorSemiAxis,F.e2,Y,n,r,0,s);i<U&&(U=i,K.assign(s),J=t,o.getSegmentBuffer(e-1,W,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===J&&n("");const $=G(F.majorSemiAxis,F.e2,K);$.divThis(V);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!W.empty());const ne=W.get().getClosestCoordinate(ee,!1);ee.assign(W.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,J,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return F(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return M(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return O(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=F(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return Y(e,t,o,i,a);default:r("")}}}function F(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==q(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=F(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=I();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,V.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function M(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=I();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=E(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const _=v(x.majorSemiAxis,x.e2);let j=c;const T=new S,G=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],T),T.isNAN())continue;G.assign(T),G.scale(g);const t=E(x.majorSemiAxis,x.e2,G);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(_,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],T),T.isNAN())continue;G.assign(T),G.scale(g);const n=E(x.majorSemiAxis,x.e2,G);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,G.x,G.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(V){n.error=V,n.hasError=!0}finally{t(n)}}const q=new S;return-1!==P&&q.assign(s.getXY(P)),m(q,P,w)}function O(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=O(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=I();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=E(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const _=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=E(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(_,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=E(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(G){n.error=G,n.hasError=!0}finally{t(n)}}const T=new S;return-1!==P&&T.assign(s[P]),m(T,P,w)}function Y(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=I();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=E(h.majorSemiAxis,h.e2,A),w=[];let _=l;const j=new S,T=new S;for(let e=0;e<_;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;T.assign(j),T.scale(f);const n=E(h.majorSemiAxis,h.e2,T);p.distance(n,P)>i?(x[_-1]=N(x[e],x[e]=x[_-1]),_--):e++}const G=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<_;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,V.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(G),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{B as OperatorProximityGeodesic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{V as o,g as r,a,U as i,W as m}from"./SpatialReference.js";import{P as c,a as g}from"./MultiPathImpl.js";import{k as u,d as p,P as h}from"./Point2D.js";import{f as l}from"./Envelope.js";import{Envelope2D as y}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new l,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:S,assign:P}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function S(e){this.m_geoLength=e}function P(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new y;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,a,m){const c=i();s.querySpheroidData(c);const g=c.majorSemiAxis,y=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),S=p(_,Number.NaN),P=x(),w=x();let E;const G=[0,0,0,0],L=t.getPECoordSys(),j=new h,v=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();j.assign(e.getStartXY()),v.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=j.x,G[1]=j.y,G[2]=v.x,G[3]=v.y,o.projToGeog(L,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(j),D.setCoordsPoint2D(v),T.scale(f),D.scale(f));const s=new l,r=new l;N(g,y,T,s),N(g,y,D,r);let i=C(g,s,r);P.setValues(0,T,Number.NaN,s),w.setValues(1,D,i,r),E=a,d[0].assign(w),S[0]=a;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(P.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(L,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(P.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new l;N(g,y,b,c);const u=C(g,P.m_xyz,c),p=C(g,w.m_xyz,c);i=w.m_geoLength,Number.isNaN(i)&&(i=C(g,P.m_xyz,w.m_xyz));const h=u+p,x=E===a&&h>=20&&Math.abs(h-i)>1e-8*(i+h);if(m+2<_&&(x||Math.abs(h-i)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=a,S[m]=a):(E--,S[m-1]=E,S[m]=E);else{if(z+=h,0===m)break;P.assign(w),w.assign(d[--m]),E=S[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let i=null;const m=o.getGCS();m!==o&&(i=a(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,i,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,i,r)}return this._ExecuteShapePreservingLength(n,o,m,i,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new l;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
2
+ import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{a0 as o,g as r,a,_ as i,Q as m}from"./SpatialReference.js";import{P as c,a as g}from"./MultiPathImpl.js";import{n as u,d as p,P as h}from"./Point2D.js";import{f as l}from"./Envelope.js";import{Envelope2D as y}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new l,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:S,assign:P}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function S(e){this.m_geoLength=e}function P(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new y;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,a,m){const c=i();s.querySpheroidData(c);const g=c.majorSemiAxis,y=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),S=p(_,Number.NaN),P=x(),w=x();let E;const G=[0,0,0,0],L=t.getPECoordSys(),j=new h,v=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();j.assign(e.getStartXY()),v.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=j.x,G[1]=j.y,G[2]=v.x,G[3]=v.y,o.projToGeog(L,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(j),D.setCoordsPoint2D(v),T.scale(f),D.scale(f));const s=new l,r=new l;N(g,y,T,s),N(g,y,D,r);let i=C(g,s,r);P.setValues(0,T,Number.NaN,s),w.setValues(1,D,i,r),E=a,d[0].assign(w),S[0]=a;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(P.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(L,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(P.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new l;N(g,y,b,c);const u=C(g,P.m_xyz,c),p=C(g,w.m_xyz,c);i=w.m_geoLength,Number.isNaN(i)&&(i=C(g,P.m_xyz,w.m_xyz));const h=u+p,x=E===a&&h>=20&&Math.abs(h-i)>1e-8*(i+h);if(m+2<_&&(x||Math.abs(h-i)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=a,S[m]=a):(E--,S[m-1]=E,S[m]=E);else{if(z+=h,0===m)break;P.assign(w),w.assign(d[--m]),E=S[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let i=null;const m=o.getGCS();m!==o&&(i=a(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,i,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,i,r)}return this._ExecuteShapePreservingLength(n,o,m,i,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new l;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};