@arcgis/core 4.26.0-next.20230111 → 4.26.0-next.20230113

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 (296) hide show
  1. package/arcade/ArcadeDate.js +5 -0
  2. package/arcade/Dictionary.js +1 -1
  3. package/arcade/Feature.js +1 -1
  4. package/arcade/arcadeAsyncRuntime.js +1 -1
  5. package/arcade/arcadeCompiler.js +1 -1
  6. package/arcade/arcadeRuntime.js +1 -1
  7. package/arcade/arcadeTimeUtils.js +5 -0
  8. package/arcade/executionError.js +1 -1
  9. package/arcade/featureset/actions/Adapted.js +1 -1
  10. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  11. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  12. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  13. package/arcade/featureset/support/FeatureSet.js +1 -1
  14. package/arcade/featureset/support/shared.js +1 -1
  15. package/arcade/featureset/support/sqlUtils.js +1 -1
  16. package/arcade/functions/date.js +1 -1
  17. package/arcade/functions/featuresetbase.js +1 -1
  18. package/arcade/functions/featuresetstring.js +1 -1
  19. package/arcade/functions/geomasync.js +1 -1
  20. package/arcade/functions/geometry.js +1 -1
  21. package/arcade/functions/geomsync.js +1 -1
  22. package/arcade/functions/maths.js +1 -1
  23. package/arcade/functions/string.js +1 -1
  24. package/arcade/languageUtils.js +1 -1
  25. package/arcade/treeAnalysis.js +1 -1
  26. package/arcade.js +1 -1
  27. package/assets/esri/core/workers/RemoteClient.js +1 -1
  28. package/assets/esri/core/workers/chunks/{c9477250a5d5ebdef00c.js → 01cd5a9cd4cb1f13691c.js} +1 -1
  29. package/assets/esri/core/workers/chunks/028f9a133104e78e60d2.js +1 -0
  30. package/assets/esri/core/workers/chunks/033e6ae5da6afebd993c.js +1 -0
  31. package/assets/esri/core/workers/chunks/05ab092987251d4a1242.js +1 -0
  32. package/assets/esri/core/workers/chunks/1186a56dacaf269d5271.js +1 -0
  33. package/assets/esri/core/workers/chunks/264e1c00936bcafb9a36.js +1 -0
  34. package/assets/esri/core/workers/chunks/2680392cef77d98ad097.js +1 -0
  35. package/assets/esri/core/workers/chunks/27ba1889fe9f1812389a.js +1165 -0
  36. package/assets/esri/core/workers/chunks/2dfb17fa5b6a5d239942.js +1 -0
  37. package/assets/esri/core/workers/chunks/2e3962506c353b562a88.js +1 -0
  38. package/assets/esri/core/workers/chunks/30ae4c22f6b8aab9f841.js +1 -0
  39. package/assets/esri/core/workers/chunks/329e512f210cb3e904f1.js +1 -0
  40. package/assets/esri/core/workers/chunks/3878efe67f43962b46f8.js +1 -0
  41. package/assets/esri/core/workers/chunks/3b6748f414437cc6cfde.js +1 -0
  42. package/assets/esri/core/workers/chunks/41d25407888326c91566.js +1 -0
  43. package/assets/esri/core/workers/chunks/493e2b00133682748e62.js +1 -0
  44. package/assets/esri/core/workers/chunks/4b2edcb8ef7fae4f7d28.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c11d857dca43de2229fc.js → 4c085cee22ff64ce6d1f.js} +1 -1
  46. package/assets/esri/core/workers/chunks/4d8c53e961275b6a4ee1.js +1 -0
  47. package/assets/esri/core/workers/chunks/5049771eeffe208a9cb8.js +1 -0
  48. package/assets/esri/core/workers/chunks/{58d219ffd9dcc45bb0d1.js → 5191f80f2413ee92c875.js} +1 -1
  49. package/assets/esri/core/workers/chunks/5dfed65b615b33588488.js +1 -0
  50. package/assets/esri/core/workers/chunks/5e9869849d999aac5756.js +1 -0
  51. package/assets/esri/core/workers/chunks/6216cd8134703fd9d9b4.js +1 -0
  52. package/assets/esri/core/workers/chunks/62c8e43741f2d6141f00.js +1 -0
  53. package/assets/esri/core/workers/chunks/64f137358100a1c818f0.js +1 -0
  54. package/assets/esri/core/workers/chunks/6f5f81855985db7c1936.js +1 -0
  55. package/assets/esri/core/workers/chunks/6fba07833345b2d8d373.js +1 -0
  56. package/assets/esri/core/workers/chunks/{80c7726743baf9f54079.js → 7747ee359d357f6e5858.js} +1 -1
  57. package/assets/esri/core/workers/chunks/78fd609f334a29ef39dc.js +1 -0
  58. package/assets/esri/core/workers/chunks/798cd875d64182741364.js +1 -0
  59. package/assets/esri/core/workers/chunks/{9d247a46e0cfdad26273.js → 8176286f8dd055c8ae05.js} +1 -1
  60. package/assets/esri/core/workers/chunks/8530ac02c840c89cc1df.js +1 -0
  61. package/assets/esri/core/workers/chunks/8a69a9b5a04e7321740d.js +1 -0
  62. package/assets/esri/core/workers/chunks/8bd26c71e78698c16778.js +1 -0
  63. package/assets/esri/core/workers/chunks/8c12b82612f050492fef.js +1 -0
  64. package/assets/esri/core/workers/chunks/90653ef5e718bafd6960.js +1 -0
  65. package/assets/esri/core/workers/chunks/{418922fd99e733df023f.js → 9070aa0a94a9204ded1c.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{2ac0d2164a1b49e6f057.js → 94633a9bb5fa4f4ba4de.js} +1 -1
  67. package/assets/esri/core/workers/chunks/969bb94d5bdc9da114e2.js +1 -0
  68. package/assets/esri/core/workers/chunks/9785dba81a6af339e35a.js +1 -0
  69. package/assets/esri/core/workers/chunks/99e16173584702577b80.js +1 -0
  70. package/assets/esri/core/workers/chunks/9aee6f171d4fbac941d9.js +1 -0
  71. package/assets/esri/core/workers/chunks/a194f90ffe13b3d448b0.js +1 -0
  72. package/assets/esri/core/workers/chunks/a53d194e3eede703a6df.js +1 -0
  73. package/assets/esri/core/workers/chunks/a605bf8bc29099ae1b1a.js +1 -0
  74. package/assets/esri/core/workers/chunks/ba7239089a04098e3619.js +1 -0
  75. package/assets/esri/core/workers/chunks/bd2fe663a2b090b134e9.js +1 -0
  76. package/assets/esri/core/workers/chunks/c16003307aad2f84ac51.js +1 -0
  77. package/assets/esri/core/workers/chunks/c6eb6a97ecc6ed9ce713.js +1 -0
  78. package/assets/esri/core/workers/chunks/c81d898f4aef6ecacdb5.js +1 -0
  79. package/assets/esri/core/workers/chunks/cb83480d7074f6185e21.js +1 -0
  80. package/assets/esri/core/workers/chunks/cd0fa942d57a278b0a44.js +1 -0
  81. package/assets/esri/core/workers/chunks/d55332e4d7b8184fd718.js +1 -0
  82. package/assets/esri/core/workers/chunks/d6842acbfa7a39f3ca30.js +1 -0
  83. package/assets/esri/core/workers/chunks/d798bd544433e932f772.js +1 -0
  84. package/assets/esri/core/workers/chunks/e18851e915cb69f53032.js +1 -0
  85. package/assets/esri/core/workers/chunks/{54899827baea77776fc7.js → ea1054116ec842a4f813.js} +1 -1
  86. package/assets/esri/core/workers/chunks/ed1312c2627c0d7e654d.js +1 -0
  87. package/assets/esri/core/workers/chunks/f2750a7b44e8bc8b1e4c.js +1 -0
  88. package/assets/esri/themes/base/widgets/_Editor.scss +1 -11
  89. package/assets/esri/themes/base/widgets/_ItemList.scss +0 -13
  90. package/assets/esri/themes/dark/main.css +1 -1
  91. package/assets/esri/themes/light/main.css +1 -1
  92. package/assets/esri/themes/light/view.css +1 -1
  93. package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
  94. package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
  95. package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
  96. package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
  97. package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
  98. package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
  99. package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
  100. package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
  101. package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
  102. package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
  103. package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
  104. package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
  105. package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
  106. package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
  107. package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
  108. package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
  109. package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
  110. package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
  111. package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
  112. package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
  113. package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
  114. package/assets/esri/widgets/Sketch/t9n/Sketch_nb.json +1 -1
  115. package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
  116. package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
  117. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
  118. package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
  119. package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
  120. package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
  121. package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
  122. package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
  123. package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
  124. package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
  125. package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
  126. package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
  127. package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
  128. package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
  129. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
  130. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
  131. package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
  132. package/chunks/ComponentShader.glsl.js +1 -1
  133. package/chunks/Path.glsl.js +1 -1
  134. package/chunks/Terrain.glsl.js +1 -1
  135. package/chunks/languageUtils.js +1 -1
  136. package/geometry/support/MeshTexture.js +1 -1
  137. package/geometry/support/aaBoundingBox.js +1 -1
  138. package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
  139. package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
  140. package/interfaces.d.ts +1400 -1314
  141. package/layers/ImageryTileLayer.js +1 -1
  142. package/layers/VoxelWasmPerSceneView.js +1 -1
  143. package/layers/graphics/data/FeatureStore.js +1 -1
  144. package/layers/graphics/data/QueryEngine.js +1 -1
  145. package/layers/graphics/data/timeSupport.js +1 -1
  146. package/layers/graphics/featureConversionUtils.js +1 -1
  147. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  148. package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
  149. package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
  150. package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
  151. package/layers/mixins/ArcGISImageService.js +1 -1
  152. package/layers/mixins/ImageryTileMixin.js +1 -1
  153. package/layers/support/layerOriginUtils.js +1 -1
  154. package/layers/support/rasterFormats/JpgPlus.js +1 -1
  155. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  156. package/layers/support/rasterFunctions/ConvolutionFunction.js +1 -1
  157. package/layers/support/rasterFunctions/ConvolutionFunctionArguments.js +1 -1
  158. package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
  159. package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
  160. package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
  161. package/layers/support/rasterFunctions/NDVIFunctionArguments.js +1 -1
  162. package/layers/support/rasterFunctions/SlopeFunctionArguments.js +1 -1
  163. package/layers/support/rasterFunctions/StatisticsHistogramFunction.js +5 -0
  164. package/layers/support/rasterFunctions/{StatisticsHistogramsFunctionArguments.js → StatisticsHistogramFunctionArguments.js} +1 -1
  165. package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
  166. package/package.json +1 -1
  167. package/rest/imageService.js +1 -1
  168. package/rest/support/BaseImageMeasureResult.d.ts +4 -0
  169. package/rest/support/ImageAreaParameters.d.ts +4 -0
  170. package/rest/support/{ImageMeasureAreaAndPerimeterParameters.js → ImageAreaParameters.js} +1 -1
  171. package/rest/support/ImageAreaResult.d.ts +4 -0
  172. package/rest/support/{ImageMeasureAreaAndPerimeterResult.js → ImageAreaResult.js} +1 -1
  173. package/rest/support/ImageDistanceParameters.d.ts +4 -0
  174. package/rest/support/{ImageMeasureDistanceAndAngleParameters.js → ImageDistanceParameters.js} +1 -1
  175. package/rest/support/ImageDistanceResult.d.ts +4 -0
  176. package/rest/support/ImageDistanceResult.js +5 -0
  177. package/rest/support/ImageHeightParameters.d.ts +4 -0
  178. package/rest/support/{ImageMeasureHeightParameters.js → ImageHeightParameters.js} +1 -1
  179. package/rest/support/ImageHeightResult.d.ts +4 -0
  180. package/rest/support/{ImageMeasureHeightResult.js → ImageHeightResult.js} +1 -1
  181. package/rest/support/ImagePointParameters.d.ts +4 -0
  182. package/rest/support/{ImageMeasurePointParameters.js → ImagePointParameters.js} +1 -1
  183. package/rest/support/ImagePointResult.d.ts +4 -0
  184. package/rest/support/{ImageMeasurePointResult.js → ImagePointResult.js} +1 -1
  185. package/support/arcadeUtils.js +1 -1
  186. package/support/revision.js +1 -1
  187. package/time/timeReferenceUtils.js +1 -1
  188. package/views/2d/engine/webgl/Overlay.js +1 -1
  189. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  190. package/views/2d/layers/features/FeatureStore2D.js +1 -1
  191. package/views/2d/layers/features/Pipeline.js +1 -1
  192. package/views/2d/layers/features/support/BinStore.js +1 -1
  193. package/views/2d/layers/features/support/ClusterStore.js +1 -1
  194. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  195. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  196. package/views/3d/glTF/internal/Resource.js +1 -1
  197. package/views/3d/glTF/internal/resourceUtils.js +5 -0
  198. package/views/3d/layers/VectorTileLayerView3D.js +1 -1
  199. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  200. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  201. package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
  202. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  203. package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
  204. package/views/3d/layers/graphics/Labeler.js +1 -1
  205. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  206. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  207. package/views/3d/layers/i3s/I3SQueryFeatureStore.js +1 -1
  208. package/views/3d/state/ViewState.js +1 -1
  209. package/views/3d/state/ViewStateManager.js +1 -1
  210. package/views/3d/terrain/Overlay.js +1 -1
  211. package/views/3d/terrain/OverlayManager.js +1 -1
  212. package/views/3d/terrain/TerrainRenderer.js +1 -1
  213. package/views/3d/terrain/TerrainSurface.js +1 -1
  214. package/views/3d/terrain/TileRenderer.js +1 -1
  215. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  216. package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -1
  217. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  218. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
  219. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +1 -1
  220. package/views/3d/webgl-engine/lib/AnimationTimeStep.js +5 -0
  221. package/views/3d/webgl-engine/lib/AnimationTimer.js +1 -1
  222. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  223. package/views/3d/webgl-engine/lib/Material.js +1 -1
  224. package/views/3d/webgl-engine/lib/RenderFeature.js +5 -0
  225. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  226. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  227. package/views/3d/webgl-engine/lib/basicInterfaces.js +1 -1
  228. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  229. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  230. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  231. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  232. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  233. package/views/draw/support/layerUtils.js +1 -1
  234. package/views/webgl/RenderingContext.js +1 -1
  235. package/views/webgl/Texture.js +1 -1
  236. package/widgets/Editor/EditorViewModel.js +1 -1
  237. package/widgets/Editor.js +1 -1
  238. package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
  239. package/widgets/FeatureTemplates/ItemList.js +1 -1
  240. package/widgets/FeatureTemplates/TemplateItem.js +1 -1
  241. package/widgets/FeatureTemplates/TemplateItemGroup.js +1 -1
  242. package/widgets/FeatureTemplates.js +1 -1
  243. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  244. package/widgets/support/decorators/accessibleHandler.js +1 -1
  245. package/assets/esri/core/workers/chunks/038dc3f9ef06ef3c960c.js +0 -1
  246. package/assets/esri/core/workers/chunks/078a0b134210167b629d.js +0 -1
  247. package/assets/esri/core/workers/chunks/080a4be417be4943f6a0.js +0 -1
  248. package/assets/esri/core/workers/chunks/0877bab7c03a1de2e713.js +0 -1
  249. package/assets/esri/core/workers/chunks/0c9200ab19fd2f56f87f.js +0 -1
  250. package/assets/esri/core/workers/chunks/1cbffa96ea6683e5f3ec.js +0 -1
  251. package/assets/esri/core/workers/chunks/1f742c3b11c76814fa4d.js +0 -1
  252. package/assets/esri/core/workers/chunks/2eb2d49c549e53934b8b.js +0 -1
  253. package/assets/esri/core/workers/chunks/332494b96a47b378f4e0.js +0 -1
  254. package/assets/esri/core/workers/chunks/3326536d183a858a2a4d.js +0 -1
  255. package/assets/esri/core/workers/chunks/3f4fc8379fc11bc293cc.js +0 -1
  256. package/assets/esri/core/workers/chunks/43fecd621cd043f64828.js +0 -1165
  257. package/assets/esri/core/workers/chunks/47b0b660f5412097fe26.js +0 -1
  258. package/assets/esri/core/workers/chunks/4c0d7a074083aa9614bb.js +0 -1
  259. package/assets/esri/core/workers/chunks/594d7e871b648d5c9662.js +0 -1
  260. package/assets/esri/core/workers/chunks/680b90ac98e8d1ac0e33.js +0 -1
  261. package/assets/esri/core/workers/chunks/6b589f47cb4731df1639.js +0 -1
  262. package/assets/esri/core/workers/chunks/72557c4b1582aa18ad4d.js +0 -1
  263. package/assets/esri/core/workers/chunks/72b490ad371e0c2264f6.js +0 -1
  264. package/assets/esri/core/workers/chunks/75ce17cf13aab0440572.js +0 -1
  265. package/assets/esri/core/workers/chunks/75f4e884a1a0aedc0afd.js +0 -1
  266. package/assets/esri/core/workers/chunks/7b9ab3fb378172831c14.js +0 -1
  267. package/assets/esri/core/workers/chunks/7bef95b168303bdc4bf1.js +0 -1
  268. package/assets/esri/core/workers/chunks/803492088780e18de801.js +0 -1
  269. package/assets/esri/core/workers/chunks/89003e387684af5ebeac.js +0 -1
  270. package/assets/esri/core/workers/chunks/8f93026764a0cce0901b.js +0 -1
  271. package/assets/esri/core/workers/chunks/98350b6b95da62ef5f12.js +0 -1
  272. package/assets/esri/core/workers/chunks/a9cae0d386aa9c00f744.js +0 -1
  273. package/assets/esri/core/workers/chunks/ad65c24558098f21bbf3.js +0 -1
  274. package/assets/esri/core/workers/chunks/aef90ee3f0979a7acb38.js +0 -1
  275. package/assets/esri/core/workers/chunks/b68c7754b0220b194ecf.js +0 -1
  276. package/assets/esri/core/workers/chunks/c012317f045a74fdd79d.js +0 -1
  277. package/assets/esri/core/workers/chunks/cb42675e5b1c41634c63.js +0 -1
  278. package/assets/esri/core/workers/chunks/cb901033dd15b3b72025.js +0 -1
  279. package/assets/esri/core/workers/chunks/d398b6b8a6b0a95247de.js +0 -1
  280. package/assets/esri/core/workers/chunks/d447ebc944a9867f5a99.js +0 -1
  281. package/assets/esri/core/workers/chunks/daaabed988b6ea866350.js +0 -1
  282. package/assets/esri/core/workers/chunks/e048641971aef9dd4da9.js +0 -1
  283. package/assets/esri/core/workers/chunks/e3fd383aee378cbb0dae.js +0 -1
  284. package/assets/esri/core/workers/chunks/e967ffca641947212992.js +0 -1
  285. package/assets/esri/core/workers/chunks/e9c81eee503c1b112bad.js +0 -1
  286. package/assets/esri/core/workers/chunks/ea6cf948fe2de0242308.js +0 -1
  287. package/assets/esri/core/workers/chunks/ed5e71b45dfefcbb2da4.js +0 -1
  288. package/assets/esri/core/workers/chunks/ee50d5d0afe9bdccc84d.js +0 -1
  289. package/assets/esri/core/workers/chunks/ee91401507833875facc.js +0 -1
  290. package/assets/esri/core/workers/chunks/f7d40dd78ef116f5793b.js +0 -1
  291. package/assets/esri/core/workers/chunks/f8ab6e354834b9c0e857.js +0 -1
  292. package/assets/esri/core/workers/chunks/faea681c279486b7a5e7.js +0 -1
  293. package/layers/support/rasterFunctions/StatisticsHistogramsFunction.js +0 -5
  294. package/rest/support/ImageMeasureDistanceAndAngleResult.js +0 -5
  295. package/views/3d/support/animationUtils.js +0 -5
  296. package/views/3d/webgl-engine/lib/RenderStateFeature.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{y as e,l as t,g as n,A as r,j as s,C as u,c as o,D as a,E as c}from"../../chunks/languageUtils.js";import{ArcadeExecutionError as l,ExecutionErrorCodes as i}from"../executionError.js";import{getLocale as f}from"../../intl/locale.js";import{DateTime as g}from"luxon";function m(e){const t=new Date(e.getTime()),n=t.getFullYear(),r=new Date(0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=d(r),u=new Date(0);u.setFullYear(n,0,4),u.setHours(0,0,0,0);const o=d(u);return t.getTime()>=s.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function d(e){const t=1,n=new Date(e.getTime()),r=n.getDay(),s=(r<t?7:0)+r-t;return n.setDate(n.getDate()-s),n.setHours(0,0,0,0),n}function h(e){const t=m(e),n=new Date(0);n.setFullYear(t,0,4),n.setHours(0,0,0,0);return d(n)}function N(e,t,n){return e+(D(n)?y:w)[t]}function D(e){return e%4==0&&(e%100!=0||e%400==0)}const w=[0,31,59,90,120,151,181,212,243,273,304,334],y=[0,31,60,91,121,152,182,213,244,274,305,335];function T(e){return null===e?e:isNaN(e.getTime())?null:e}function M(D,w){D.today=function(t,n){return w(t,n,((r,s,u)=>{e(u,0,0,t,n);const o=new Date;return o.setHours(0,0,0,0),o}))},D.now=function(t,n){return w(t,n,((r,s,u)=>{e(u,0,0,t,n);return new Date}))},D.timestamp=function(t,n){return w(t,n,((r,s,u)=>{e(u,0,0,t,n);let o=new Date;return o=new Date(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),o}))},D.toutc=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?null:new Date(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())}))},D.tolocal=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?null:g.utc(a.getFullYear(),a.getMonth()+1,a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds()).toJSDate()}))},D.day=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getDate()}))},D.month=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getMonth()}))},D.year=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getFullYear()}))},D.hour=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getHours()}))},D.second=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getSeconds()}))},D.millisecond=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getMilliseconds()}))},D.minute=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getMinutes()}))},D.week=function(s,u){return w(s,u,((o,a,c)=>{e(c,1,2,s,u);const f=t(c[0]);if(null===f)return NaN;const g=n(r(c[1],0));if(g<0||g>6)throw new l(s,i.InvalidParameter,u);const m=f.getDate(),d=f.getMonth(),h=f.getFullYear(),D=f.getDay(),w=N(m,d,h)-1,y=Math.floor(w/7);return D-g+(D-g<0?7:0)<w-7*y?y+1:y}))},D.weekday=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getDay()}))},D.isoweekday=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);if(null===a)return NaN;let c=a.getDay();return 0===c&&(c=7),c}))},D.isomonth=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:a.getMonth()+1}))},D.isoweek=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);if(null===a)return NaN;const c=d(a).getTime()-h(a).getTime();return Math.round(c/6048e5)+1}))},D.isoyear=function(n,r){return w(n,r,((s,u,o)=>{e(o,1,1,n,r);const a=t(o[0]);return null===a?NaN:m(a)}))},D.date=function(r,a){return w(r,a,((c,l,i)=>{if(e(i,0,7,r,a),3===i.length)return T(new Date(n(i[0]),n(i[1]),n(i[2]),0,0,0,0));if(4===i.length)return T(new Date(n(i[0]),n(i[1]),n(i[2]),n(i[3]),0,0,0));if(5===i.length)return T(new Date(n(i[0]),n(i[1]),n(i[2]),n(i[3]),n(i[4]),0,0));if(6===i.length)return T(new Date(n(i[0]),n(i[1]),n(i[2]),n(i[3]),n(i[4]),n(i[5]),0));if(7===i.length)return T(new Date(n(i[0]),n(i[1]),n(i[2]),n(i[3]),n(i[4]),n(i[5]),n(i[6])));if(2===i.length){let e,t=s(i[1]);return""===t?null:(t=u(t),e="X"===t?g.fromSeconds(n(i[0])):"x"===t?g.fromMillis(n(i[0])):g.fromFormat(s(i[0]),t,{locale:f(),numberingSystem:"latn"}),e.isValid?e.toJSDate():null)}if(1===i.length){if(o(i[0])){if(""===i[0].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))return null;if(!0===/^[0-9][0-9][0-9][0-9]$/.test(i[0]))return t(i[0]+"-01-01")}const e=n(i[0]);if(!1===isNaN(e))return T(new Date(e));return t(i[0])}return 0===i.length?new Date:void 0}))},D.datediff=function(t,n){return w(t,n,((r,u,o)=>{e(o,2,3,t,n);const c=a(o[0]),l=a(o[1]);if(null===c||null===l)return NaN;switch(s(o[2]).toLowerCase()){case"days":case"day":case"d":return c.diff(l,"days").days;case"months":case"month":return c.diff(l,"months").months;case"minutes":case"minute":case"m":return"M"===o[2]?c.diff(l,"months").months:c.diff(l,"minutes").minutes;case"seconds":case"second":case"s":return c.diff(l,"seconds").seconds;case"milliseconds":case"millisecond":case"ms":default:return c.diff(l).milliseconds;case"hours":case"hour":case"h":return c.diff(l,"hours").hours;case"years":case"year":case"y":return c.diff(l,"years").years}}))},D.dateadd=function(t,r){return w(t,r,((u,o,l)=>{e(l,2,3,t,r);const i=a(l[0]);if(null===i)return null;let f=n(l[1]);if(isNaN(f))return i.toJSDate();let g="milliseconds";switch(s(l[2]).toLowerCase()){case"days":case"day":case"d":g="days",f=c(f);break;case"months":case"month":g="months",f=c(f);break;case"minutes":case"minute":case"m":g="M"===l[2]?"months":"minutes";break;case"seconds":case"second":case"s":g="seconds";break;case"milliseconds":case"millisecond":case"ms":g="milliseconds";break;case"hours":case"hour":case"h":g="hours";break;case"years":case"year":case"y":g="years"}return i.plus({[g]:f}).toJSDate()}))}}export{M as registerFunctions};
5
+ import{ArcadeDate as n}from"../ArcadeDate.js";import{y as e,C as t,l as r,j as o,g as a,A as s,D as u,c,E as l}from"../../chunks/languageUtils.js";import{ArcadeExecutionError as i,ExecutionErrorCodes as f}from"../executionError.js";import{getLocale as d}from"../../intl/locale.js";import{DateTime as m}from"luxon";function h(n,e,t){return n+(N(t)?A:y)[e]}function N(n){return n%4==0&&(n%100!=0||n%400==0)}const y=[0,31,59,90,120,151,181,212,243,273,304,334],A=[0,31,60,91,121,152,182,213,244,274,305,335];function w(n){return null===n?n:!1===n.isValid?null:n}function D(n,e){return""===n||"default"===n.toLowerCase().trim()?t(e):n}function T(N,y){N.today=function(r,o){return y(r,o,((a,s,u)=>{e(u,0,0,r,o);const c=new Date;return c.setHours(0,0,0,0),n.dateJSAndZoneToArcadeDate(c,t(r))}))},N.changetimezone=function(a,s){return y(a,s,((u,c,l)=>{e(l,2,2,a,s);const i=r(l[0],t(a));if(null===i)return null;const f=n.arcadeDateAndZoneToArcadeDate(i,D(o(l[1]),a));return!1===f.isValid?null:f}))},N.timezone=function(o,a){return y(o,a,((s,u,c)=>{e(c,1,2,o,a);const l=r(c[0],t(o));if(null===l)return null;const i=l.timeZone;return"system"===i?n.systemTimeZoneCanonicalName:i}))},N.timezoneoffset=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?null:c.timeZoneOffset}))},N.now=function(r,o){return y(r,o,((a,s,u)=>{e(u,0,0,r,o);const c=n.nowToArcadeDate(t(r));return!1===c.isValid?null:c}))},N.timestamp=function(t,r){return y(t,r,((o,a,s)=>{e(s,0,0,t,r);const u=n.nowUTCToArcadeDate();return!1===u.isValid?null:u}))},N.toutc=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?null:c.toUTC()}))},N.tolocal=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?null:c.toLocal()}))},N.day=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.day}))},N.month=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.monthJS}))},N.year=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.year}))},N.hour=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.hour}))},N.second=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.second}))},N.millisecond=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.millisecond}))},N.minute=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.minute}))},N.week=function(n,o){return y(n,o,((u,c,l)=>{e(l,1,2,n,o);const d=r(l[0],t(n));if(null===d)return NaN;const m=a(s(l[1],0));if(m<0||m>6)throw new i(n,f.InvalidParameter,o);const N=d.day,y=d.monthJS,A=d.year,w=d.dayOfWeekJS,D=h(N,y,A)-1,T=Math.floor(D/7);return w-m+(w-m<0?7:0)<D-7*T?T+1:T}))},N.weekday=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.dayOfWeekJS}))},N.isoweekday=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.dayOfWeekISO}))},N.isomonth=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.monthISO}))},N.isoweek=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.weekISO}))},N.isoyear=function(n,o){return y(n,o,((a,s,u)=>{e(u,1,1,n,o);const c=r(u[0],t(n));return null===c?NaN:c.yearISO}))},N.date=function(s,l){return y(s,l,((i,f,h)=>{if(e(h,0,8,s,l),3===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),0,0,0,0,t(s)));if(4===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),a(h[3]),0,0,0,t(s)));if(5===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),a(h[3]),a(h[4]),0,0,t(s)));if(6===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),a(h[3]),a(h[4]),a(h[5]),0,t(s)));if(7===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),a(h[3]),a(h[4]),a(h[5]),a(h[6]),t(s)));if(8===h.length)return w(n.fromParts(a(h[0]),a(h[1])+1,a(h[2]),a(h[3]),a(h[4]),a(h[5]),a(h[6]),D(o(h[7]),s)));if(2===h.length){let e,t=o(h[1]);return""===t?null:(t=u(t),e="X"===t?m.fromSeconds(a(h[0])):"x"===t?m.fromMillis(a(h[0])):m.fromFormat(o(h[0]),t,{locale:d(),numberingSystem:"latn"}),e.isValid?n.dateTimeToArcadeDate(e):null)}if(1===h.length){if(c(h[0])){if(""===h[0].replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))return null;if(!0===/^[0-9][0-9][0-9][0-9]$/.test(h[0]))return r(h[0]+"-01-01",t(s))}const e=a(h[0]);if(!1===isNaN(e)){const r=m.fromMillis(e);return r.isValid?n.dateTimeAndZoneToArcadeDate(r,t(s)):null}return r(h[0],t(s))}return 0===h.length?n.nowToArcadeDate(t(s)):null}))},N.datediff=function(a,u){return y(a,u,((c,l,i)=>{e(i,2,4,a,u);let f=r(i[0],t(a)),d=r(i[1],t(a));if(null===f||null===d)return NaN;let m=s(i[3],"");switch(""!==m&&null!==m?(m=o(m),f=n.arcadeDateAndZoneToArcadeDate(f,m),d=n.arcadeDateAndZoneToArcadeDate(d,m)):f.timeZone!==d.timeZone&&(f.isUnknownTimeZone?f=n.arcadeDateAndZoneToArcadeDate(f,d.timeZone):d=(d.isUnknownTimeZone,n.arcadeDateAndZoneToArcadeDate(d,f.timeZone))),o(i[2]).toLowerCase()){case"days":case"day":case"d":return f.diff(d,"days");case"months":case"month":return f.diff(d,"months");case"minutes":case"minute":case"m":return"M"===i[2]?f.diff(d,"months"):f.diff(d,"minutes");case"seconds":case"second":case"s":return f.diff(d,"seconds");case"milliseconds":case"millisecond":case"ms":default:return f.diff(d);case"hours":case"hour":case"h":return f.diff(d,"hours");case"years":case"year":case"y":return f.diff(d,"years")}}))},N.dateadd=function(n,s){return y(n,s,((u,c,i)=>{e(i,2,3,n,s);const f=r(i[0],t(n));if(null===f)return null;let d=a(i[1]);if(isNaN(d))return f;let m="milliseconds";switch(o(i[2]).toLowerCase()){case"days":case"day":case"d":m="days",d=l(d);break;case"months":case"month":m="months",d=l(d);break;case"minutes":case"minute":case"m":m="M"===i[2]?"months":"minutes";break;case"seconds":case"second":case"s":m="seconds";break;case"milliseconds":case"millisecond":case"ms":m="milliseconds";break;case"hours":case"hour":case"h":m="hours";break;case"years":case"year":case"y":m="years"}return f.plus({[m]:d})}))}}export{T as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import e from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as i}from"../executionError.js";import a from"../Feature.js";import r from"../featureSetCollection.js";import{getPortal as s,lookupUser as o,convertToFeatureSet as l,constructFeatureSetFromPortalItem as f,constructFeatureSet as c,constructFeatureSetFromRelationship as u,constructFeatureSetFromUrl as d,constructAssociationMetaDataFeatureSetFromUrl as m}from"../featureSetUtils.js";import p from"../ImmutableArray.js";import{y,A as g,j as w,T as h,h as I,m as F,w as E,c as D,x as b,i as A,g as N,X as x,L as S}from"../../chunks/languageUtils.js";import{SqlExpressionAdapted as v,StringToCodeAdapted as $,FieldRename as L,AdaptedFeatureSet as T,OriginalField as j}from"../featureset/actions/Adapted.js";import P from"../featureset/actions/AttributeFilter.js";import R from"../featureset/actions/OrderBy.js";import O from"../featureset/actions/Top.js";import C from"../featureset/sources/Empty.js";import M from"../featureset/sources/FeatureLayerMemory.js";import k from"../featureset/support/OrderbyClause.js";import{cloneField as H}from"../featureset/support/shared.js";import{isSingleField as z}from"../featureset/support/sqlUtils.js";import{calculateStat as G}from"./fieldStats.js";import{isPromiseLike as U}from"../../core/promiseUtils.js";import{WhereClause as W}from"../../core/sql/WhereClause.js";import _ from"../../layers/FeatureLayer.js";import B from"../../layers/support/Field.js";function J(e,t,n,i){if(1===i.length){if(F(i[0]))return G(e,i[0],-1);if(b(i[0]))return G(e,i[0].toArray(),-1)}return G(e,i,-1)}async function V(e,t,n){const i=e.getVariables();if(i.length>0){const a=[];for(let e=0;e<i.length;e++){const r={name:i[e]};a.push(await t.evaluateIdentifier(n,r))}const r={};for(let e=0;e<i.length;e++)r[i[e]]=a[e];return e.parameters=r,e}return e}function q(e,t,n=null){for(const i in e)if(i.toLowerCase()===t.toLowerCase())return e[i];return n}function K(e){if(null===e)return null;const t={type:q(e,"type",""),name:q(e,"name","")};if("range"===t.type)t.range=q(e,"range",[]);else{t.codedValues=[];for(const n of q(e,"codedValues",[]))t.codedValues.push({name:q(n,"name",""),code:q(n,"code",null)})}return t}function X(e){if(null===e)return null;const t={},n=q(e,"wkt",null);null!==n&&(t.wkt=n);const i=q(e,"wkid",null);return null!==i&&(t.wkid=i),t}function Y(e){if(null===e)return null;const t={hasZ:q(e,"hasz",!1),hasM:q(e,"hasm",!1)},n=q(e,"spatialreference",null);n&&(t.spatialReference=X(n));const i=q(e,"x",null);if(null!==i)return t.x=i,t.y=q(e,"y",null),t;const a=q(e,"rings",null);if(null!==a)return t.rings=a,t;const r=q(e,"paths",null);if(null!==r)return t.paths=r,t;const s=q(e,"points",null);if(null!==s)return t.points=s,t;for(const o of["xmin","xmax","ymin","ymax","zmin","zmax","mmin","mmax"]){const n=q(e,o,null);null!==n&&(t[o]=n)}return t}function Z(e,t){for(const n of t)if(n===e)return!0;return!1}function Q(e){return!!e.layerDefinition&&(!!e.featureSet&&(!1!==Z(e.layerDefinition.geometryType,["","esriGeometryPoint","esriGeometryPolyline","esriGeometryPolygon","esriGeometryMultipoint","esriGeometryEnvelope"])&&(null!==e.layerDefinition.objectIdField&&""!==e.layerDefinition.objectIdField&&(!1!==F(e.layerDefinition.fields)&&!1!==F(e.featureSet.features)))))}function ee(G){"async"===G.mode&&(G.functions.getuser=function(a,r){return G.standardFunctionAsync(a,r,(async(l,f,c)=>{y(c,0,2,a,r);let u=g(c[1],""),d=!0===u;if(u=!0===u||!1===u?"":w(u),0===c.length||c[0]instanceof e){let e=null;a.services&&a.services.portal&&(e=a.services.portal),c.length>0&&(e=s(c[0],e));const n=await o(e,u,d);if(n){const e=JSON.parse(JSON.stringify(n));for(const t of["lastLogin","created","modified"])void 0!==e[t]&&null!==e[t]&&(e[t]=new Date(e[t]));return t.convertObjectToArcadeDictionary(e)}return null}let m=null;if(h(c[0])&&(m=c[0]),m){if(d=!1,u)return null;await m.load();const n=await m.getOwningSystemUrl();if(!n){if(!u){const e=await m.getIdentityUser();return e?t.convertObjectToArcadeDictionary({username:e}):null}return null}let i=null;a.services&&a.services.portal&&(i=a.services.portal),i=s(new e(n),i);const r=await o(i,u,d);if(r){const e=JSON.parse(JSON.stringify(r));for(const t of["lastLogin","created","modified"])void 0!==e[t]&&null!==e[t]&&(e[t]=new Date(e[t]));return t.convertObjectToArcadeDictionary(e)}return null}throw new n(a,i.InvalidParameter,r)}))},G.signatures.push({name:"getuser",min:1,max:2}),G.functions.featuresetbyid=function(e,t){return G.standardFunctionAsync(e,t,((a,s,o)=>{if(y(o,2,4,e,t),o[0]instanceof r){const a=w(o[1]);let r=g(o[2],null);const s=I(g(o[3],!0));if(null===r&&(r=["*"]),!1===F(r))throw new n(e,i.InvalidParameter,t);return o[0].featureSetById(a,s,r)}throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"featuresetbyid",min:2,max:4}),G.functions.getfeatureset=function(e,t){return G.standardFunctionAsync(e,t,((a,r,s)=>{if(y(s,1,2,e,t),E(s[0])){let t=g(s[1],"datasource");return null===t&&(t="datasource"),t=w(t).toLowerCase(),l(s[0].fullSchema(),t,e.lrucache,e.interceptor,e.spatialReference)}throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"getfeatureset",min:1,max:2}),G.functions.featuresetbyportalitem=function(t,a){return G.standardFunctionAsync(t,a,((r,o,l)=>{if(y(l,2,5,t,a),null===l[0])throw new n(t,i.PortalRequired,a);if(l[0]instanceof e){const e=w(l[1]),r=w(l[2]);let o=g(l[3],null);const c=I(g(l[4],!0));if(null===o&&(o=["*"]),!1===F(o))throw new n(t,i.InvalidParameter,a);let u=null;return t.services&&t.services.portal&&(u=t.services.portal),u=s(l[0],u),f(e,r,t.spatialReference,o,c,u,t.lrucache,t.interceptor)}if(!1===D(l[0]))throw new n(t,i.PortalRequired,a);const c=w(l[0]),u=w(l[1]);let d=g(l[2],null);const m=I(g(l[3],!0));if(null===d&&(d=["*"]),!1===F(d))throw new n(t,i.InvalidParameter,a);if(t.services&&t.services.portal)return f(c,u,t.spatialReference,d,m,t.services.portal,t.lrucache,t.interceptor);throw new n(t,i.PortalRequired,a)}))},G.signatures.push({name:"featuresetbyportalitem",min:2,max:5}),G.functions.featuresetbyname=function(e,t){return G.standardFunctionAsync(e,t,((a,s,o)=>{if(y(o,2,4,e,t),o[0]instanceof r){const a=w(o[1]);let r=g(o[2],null);const s=I(g(o[3],!0));if(null===r&&(r=["*"]),!1===F(r))throw new n(e,i.InvalidParameter,t);return o[0].featureSetByName(a,s,r)}throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"featuresetbyname",min:2,max:4}),G.functions.featureset=function(e,a){return G.standardFunction(e,a,((r,s,o)=>{y(o,1,1,e,a);let l=o[0];const f={layerDefinition:{geometryType:"",objectIdField:"",globalIdField:"",typeIdField:"",fields:[]},featureSet:{geometryType:"",features:[]}};if(D(l))l=JSON.parse(l),void 0!==l.layerDefinition?(f.layerDefinition=l.layerDefinition,f.featureSet=l.featureSet,l.layerDefinition.spatialReference&&(f.layerDefinition.spatialReference=l.layerDefinition.spatialReference)):(f.featureSet.features=l.features,f.featureSet.geometryType=l.geometryType,f.layerDefinition.geometryType=f.featureSet.geometryType,f.layerDefinition.objectIdField=l.objectIdFieldName,f.layerDefinition.typeIdField=l.typeIdFieldName,f.layerDefinition.globalIdField=l.globalIdFieldName,f.layerDefinition.fields=l.fields,l.spatialReference&&(f.layerDefinition.spatialReference=l.spatialReference));else{if(!(o[0]instanceof t))throw new n(e,i.InvalidParameter,a);{l=JSON.parse(o[0].castToText(!0));const e=q(l,"layerdefinition");if(null!==e){f.layerDefinition.geometryType=q(e,"geometrytype",""),f.featureSet.geometryType=f.layerDefinition.geometryType,f.layerDefinition.globalIdField=q(e,"globalidfield",""),f.layerDefinition.objectIdField=q(e,"objectidfield",""),f.layerDefinition.typeIdField=q(e,"typeidfield","");const t=q(e,"spatialreference",null);t&&(f.layerDefinition.spatialReference=X(t));for(const i of q(e,"fields",[])){const e={name:q(i,"name",""),alias:q(i,"alias",""),type:q(i,"type",""),nullable:q(i,"nullable",!0),editable:q(i,"editable",!0),length:q(i,"length",null),domain:K(q(i,"domain"))};f.layerDefinition.fields.push(e)}const n=q(l,"featureset",null);if(n){const e={};for(const t of f.layerDefinition.fields)e[t.name.toLowerCase()]=t.name;for(const t of q(n,"features",[])){const n={},i=q(t,"attributes",{});for(const t in i)n[e[t.toLowerCase()]]=i[t];f.featureSet.features.push({attributes:n,geometry:Y(q(t,"geometry",null))})}}}else{f.layerDefinition.geometryType=q(l,"geometrytype",""),f.featureSet.geometryType=f.layerDefinition.geometryType,f.layerDefinition.objectIdField=q(l,"objectidfieldname",""),f.layerDefinition.typeIdField=q(l,"typeidfieldname","");const e=q(l,"spatialreference",null);e&&(f.layerDefinition.spatialReference=X(e));for(const n of q(l,"fields",[])){const e={name:q(n,"name",""),alias:q(n,"alias",""),type:q(n,"type",""),nullable:q(n,"nullable",!0),editable:q(n,"editable",!0),length:q(n,"length",null),domain:K(q(n,"domain"))};f.layerDefinition.fields.push(e)}const t={};for(const n of f.layerDefinition.fields)t[n.name.toLowerCase()]=n.name;for(const n of q(l,"features",[])){const e={},i=q(n,"attributes",{});for(const n in i)e[t[n.toLowerCase()]]=i[n];f.featureSet.features.push({attributes:e,geometry:Y(q(n,"geometry",null))})}}}}if(!1===Q(f))throw new n(e,i.InvalidParameter,a);return M.create(f,e.spatialReference)}))},G.signatures.push({name:"featureset",min:1,max:1}),G.functions.filter=function(e,t){return G.standardFunctionAsync(e,t,(async(a,r,s)=>{if(y(s,2,2,e,t),F(s[0])||b(s[0])){const a=[];let r=s[0];r instanceof p&&(r=r.toArray());let o=null;if(!A(s[1]))throw new n(e,i.InvalidParameter,t);o=s[1].createFunction(e);for(const e of r){const t=o(e);U(t)?!0===await t&&a.push(e):!0===t&&a.push(e)}return a}if(h(s[0])){const t=await s[0].load(),n=W.create(s[1],t.getFieldsIndex()),i=n.getVariables();if(i.length>0){const t=[];for(let n=0;n<i.length;n++){const a={name:i[n]};t.push(await G.evaluateIdentifier(e,a))}const a={};for(let e=0;e<i.length;e++)a[i[e]]=t[e];return n.parameters=a,new P({parentfeatureset:s[0],whereclause:n})}return new P({parentfeatureset:s[0],whereclause:n})}throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"filter",min:2,max:2}),G.functions.orderby=function(e,t){return G.standardFunctionAsync(e,t,(async(a,r,s)=>{if(y(s,2,2,e,t),h(s[0])){const e=new k(s[1]);return new R({parentfeatureset:s[0],orderbyclause:e})}throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"orderby",min:2,max:2}),G.functions.top=function(e,t){return G.standardFunctionAsync(e,t,(async(a,r,s)=>{if(y(s,2,2,e,t),h(s[0]))return new O({parentfeatureset:s[0],topnum:s[1]});if(F(s[0]))return N(s[1])>=s[0].length?s[0].slice(0):s[0].slice(0,N(s[1]));if(b(s[0]))return N(s[1])>=s[0].length()?s[0].slice(0):s[0].slice(0,N(s[1]));throw new n(e,i.InvalidParameter,t)}))},G.signatures.push({name:"top",min:2,max:2}),G.functions.first=function(e,t){return G.standardFunctionAsync(e,t,(async(n,i,r)=>{if(y(r,1,1,e,t),h(r[0])){const e=await r[0].first(n.abortSignal);if(null!==e){const t=a.createFromGraphicLikeObject(e.geometry,e.attributes,r[0]);return t._underlyingGraphic=e,t}return e}return F(r[0])?0===r[0].length?null:r[0][0]:b(r[0])?0===r[0].length()?null:r[0].get(0):null}))},G.signatures.push({name:"first",min:1,max:1}),G.functions.attachments=function(e,a){return G.standardFunctionAsync(e,a,(async(r,s,o)=>{y(o,1,2,e,a);const l={minsize:-1,maxsize:-1,types:null,returnMetadata:!1};if(o.length>1)if(o[1]instanceof t){if(o[1].hasField("minsize")&&(l.minsize=N(o[1].field("minsize"))),o[1].hasField("metadata")&&(l.returnMetadata=I(o[1].field("metadata"))),o[1].hasField("maxsize")&&(l.maxsize=N(o[1].field("maxsize"))),o[1].hasField("types")){const e=x(o[1].field("types"),!1);e.length>0&&(l.types=e)}}else if(null!==o[1])throw new n(e,i.InvalidParameter,a);if(E(o[0])){let t=o[0]._layer;return t instanceof _&&(t=c(t,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===t?[]:!1===h(t)?[]:(await t.load(),t.queryAttachments(o[0].field(t.objectIdField),l.minsize,l.maxsize,l.types,l.returnMetadata))}if(null===o[0])return[];throw new n(e,i.InvalidParameter,a)}))},G.signatures.push({name:"attachments",min:1,max:2}),G.functions.featuresetbyrelationshipname=function(e,t){return G.standardFunctionAsync(e,t,(async(a,r,s)=>{y(s,2,4,e,t);const o=s[0],l=w(s[1]);let f=g(s[2],null);const m=I(g(s[3],!0));if(null===f&&(f=["*"]),!1===F(f))throw new n(e,i.InvalidParameter,t);if(null===s[0])return null;if(!E(s[0]))throw new n(e,i.InvalidParameter,t);let p=o._layer;if(p instanceof _&&(p=c(p,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===p)return null;if(!1===h(p))return null;p=await p.load();const D=p.relationshipMetaData().filter((e=>e.name===l));if(0===D.length)return null;if(void 0!==D[0].relationshipTableId&&null!==D[0].relationshipTableId&&D[0].relationshipTableId>-1)return u(p,D[0],o.field(p.objectIdField),p.spatialReference,f,m,e.lrucache,e.interceptor);let b=p.serviceUrl();if(!b)return null;b="/"===b.charAt(b.length-1)?b+D[0].relatedTableId.toString():b+"/"+D[0].relatedTableId.toString();const A=await d(b,p.spatialReference,f,m,e.lrucache,e.interceptor);await A.load();let N=A.relationshipMetaData();if(N=N.filter((e=>e.id===D[0].id)),!1===o.hasField(D[0].keyField)||null===o.field(D[0].keyField)){const e=await p.getFeatureByObjectId(o.field(p.objectIdField),[D[0].keyField]);if(e){const t=W.create(N[0].keyField+"= @id",A.getFieldsIndex());return t.parameters={id:e.attributes[D[0].keyField]},A.filter(t)}return new C({parentfeatureset:A})}const x=W.create(N[0].keyField+"= @id",A.getFieldsIndex());return x.parameters={id:o.field(D[0].keyField)},A.filter(x)}))},G.signatures.push({name:"featuresetbyrelationshipname",min:2,max:4}),G.functions.featuresetbyassociation=function(e,t){return G.standardFunctionAsync(e,t,(async(a,r,s)=>{y(s,2,3,e,t);const o=s[0],l=w(g(s[1],"")).toLowerCase(),f=D(s[2])?w(s[2]):null;if(null===s[0])return null;if(!E(s[0]))throw new n(e,i.InvalidParameter,t);let u=o._layer;if(u instanceof _&&(u=c(u,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===u)return null;if(!1===h(u))return null;await u.load();const d=u.serviceUrl(),p=await m(d,e.spatialReference);let I=null,F=null,b=!1;if(null!==f&&""!==f&&void 0!==f){for(const e of p.terminals)e.terminalName===f&&(F=e.terminalId);null===F&&(b=!0)}const A=p.associations.getFieldsIndex(),N=A.get("TOGLOBALID").name,x=A.get("FROMGLOBALID").name,P=A.get("TOTERMINALID").name,R=A.get("FROMTERMINALID").name,O=A.get("FROMNETWORKSOURCEID").name,C=A.get("TONETWORKSOURCEID").name,M=A.get("ASSOCIATIONTYPE").name,k=A.get("ISCONTENTVISIBLE").name,z=A.get("OBJECTID").name;for(const e of u.fields)if("global-id"===e.type){I=o.field(e.name);break}let G=null,U=new v(new B({name:"percentalong",alias:"percentalong",type:"double"}),W.create("0",p.associations.getFieldsIndex())),J=new v(new B({name:"side",alias:"side",type:"string"}),W.create("''",p.associations.getFieldsIndex()));const V="globalid",q="globalId",K={};for(const e in p.lkp)K[e]=p.lkp[e].sourceId;const X=new $(new B({name:"classname",alias:"classname",type:"string"}),null,K);let Y="";switch(l){case"midspan":{Y=`((${N}='${I}') OR ( ${x}='${I}')) AND (${M} IN (5))`,X.codefield=W.create(`CASE WHEN (${N}='${I}') THEN ${O} ELSE ${C} END`,p.associations.getFieldsIndex());const e=H(T.findField(p.associations.fields,x));e.name=V,e.alias=V,G=new v(e,W.create(`CASE WHEN (${x}='${I}') THEN ${N} ELSE ${x} END`,p.associations.getFieldsIndex())),U=p.unVersion>=4?new j(T.findField(p.associations.fields,A.get("PERCENTALONG").name)):new v(new B({name:"percentalong",alias:"percentalong",type:"double"}),W.create("0",p.associations.getFieldsIndex()));break}case"junctionedge":{Y=`((${N}='${I}') OR ( ${x}='${I}')) AND (${M} IN (4,6))`,X.codefield=W.create(`CASE WHEN (${N}='${I}') THEN ${O} ELSE ${C} END`,p.associations.getFieldsIndex());const e=H(T.findField(p.associations.fields,x));e.name=V,e.alias=V,G=new v(e,W.create(`CASE WHEN (${x}='${I}') THEN ${N} ELSE ${x} END`,p.associations.getFieldsIndex())),J=new v(new B({name:"side",alias:"side",type:"string"}),W.create(`CASE WHEN (${M}=4) THEN 'from' ELSE 'to' END`,p.associations.getFieldsIndex()));break}case"connected":{let e=`${N}='@T'`,t=`${x}='@T'`;null!==F&&(e+=` AND ${P}=@A`,t+=` AND ${R}=@A`),Y="(("+e+") OR ("+t+"))",Y=S(Y,"@T",I??""),e=S(e,"@T",I??""),null!==F&&(e=S(e,"@A",F.toString()),Y=S(Y,"@A",F.toString())),X.codefield=W.create("CASE WHEN "+e+` THEN ${O} ELSE ${C} END`,p.associations.getFieldsIndex());const n=H(T.findField(p.associations.fields,x));n.name=V,n.alias=V,G=new v(n,W.create("CASE WHEN "+e+` THEN ${x} ELSE ${N} END`,p.associations.getFieldsIndex()));break}case"container":Y=`${N}='${I}' AND ${M} = 2`,null!==F&&(Y+=` AND ${P} = `+F.toString()),X.codefield=O,Y="( "+Y+" )",G=new L(T.findField(p.associations.fields,x),V,V);case"content":Y=`(${x}='${I}' AND ${M} = 2)`,null!==F&&(Y+=` AND ${R} = `+F.toString()),X.codefield=C,Y="( "+Y+" )",G=new L(T.findField(p.associations.fields,N),V,V);break;case"structure":Y=`(${N}='${I}' AND ${M} = 3)`,null!==F&&(Y+=` AND ${P} = `+F.toString()),X.codefield=O,Y="( "+Y+" )",G=new L(T.findField(p.associations.fields,x),V,q);break;case"attached":Y=`(${x}='${I}' AND ${M} = 3)`,null!==F&&(Y+=` AND ${R} = `+F.toString()),X.codefield=C,Y="( "+Y+" )",G=new L(T.findField(p.associations.fields,N),V,q);break;default:throw new n(e,i.InvalidParameter,t)}b&&(Y="1 <> 1");return new T({parentfeatureset:p.associations,adaptedFields:[new j(T.findField(p.associations.fields,z)),new j(T.findField(p.associations.fields,k)),G,J,X,U],extraFilter:Y?W.create(Y,p.associations.getFieldsIndex()):null})}))},G.signatures.push({name:"featuresetbyassociation",min:2,max:6}),G.functions.groupby=function(e,a){return G.standardFunctionAsync(e,a,(async(r,s,o)=>{if(y(o,3,3,e,a),!h(o[0]))throw new n(e,i.InvalidParameter,a);const l=await o[0].load(),f=[],c=[];let u=!1,d=[];if(D(o[1]))d.push(o[1]);else if(o[1]instanceof t)d.push(o[1]);else if(F(o[1]))d=o[1];else{if(!b(o[1]))throw new n(e,i.InvalidParameter,a);d=o[1].toArray()}for(const m of d)if(D(m)){const e=W.create(w(m),l.getFieldsIndex()),t=!0===z(e)?w(m):"%%%%FIELDNAME";f.push({name:t,expression:e}),"%%%%FIELDNAME"===t&&(u=!0)}else{if(!(m instanceof t))throw new n(e,i.InvalidParameter,a);{const t=m.hasField("name")?m.field("name"):"%%%%FIELDNAME",r=m.hasField("expression")?m.field("expression"):"";if("%%%%FIELDNAME"===t&&(u=!0),!t)throw new n(e,i.InvalidParameter,a);f.push({name:t,expression:W.create(r||t,l.getFieldsIndex())})}}if(d=[],D(o[2]))d.push(o[2]);else if(F(o[2]))d=o[2];else if(b(o[2]))d=o[2].toArray();else{if(!(o[2]instanceof t))throw new n(e,i.InvalidParameter,a);d.push(o[2])}for(const m of d){if(!(m instanceof t))throw new n(e,i.InvalidParameter,a);{const t=m.hasField("name")?m.field("name"):"",r=m.hasField("statistic")?m.field("statistic"):"",s=m.hasField("expression")?m.field("expression"):"";if(!t||!r||!s)throw new n(e,i.InvalidParameter,a);c.push({name:t,statistic:r.toLowerCase(),expression:W.create(s,l.getFieldsIndex())})}}if(u){const e={};for(const n of l.fields)e[n.name.toLowerCase()]=1;for(const n of f)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);for(const n of c)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);let t=0;for(const n of f)if("%%%%FIELDNAME"===n.name){for(;1===e["field_"+t.toString()];)t++;e["field_"+t.toString()]=1,n.name="FIELD_"+t.toString()}}for(const t of f)await V(t.expression,G,e);for(const t of c)await V(t.expression,G,e);return o[0].groupby(f,c)}))},G.signatures.push({name:"groupby",min:3,max:3}),G.functions.distinct=function(e,a){return G.standardFunctionAsync(e,a,(async(r,s,o)=>{if(h(o[0])){y(o,2,2,e,a);const r=await o[0].load(),s=[];let l=[];if(D(o[1]))l.push(o[1]);else if(o[1]instanceof t)l.push(o[1]);else if(F(o[1]))l=o[1];else{if(!b(o[1]))throw new n(e,i.InvalidParameter,a);l=o[1].toArray()}let f=!1;for(const o of l)if(D(o)){const e=W.create(w(o),r.getFieldsIndex()),t=!0===z(e)?w(o):"%%%%FIELDNAME";s.push({name:t,expression:e}),"%%%%FIELDNAME"===t&&(f=!0)}else{if(!(o instanceof t))throw new n(e,i.InvalidParameter,a);{const t=o.hasField("name")?o.field("name"):"%%%%FIELDNAME",l=o.hasField("expression")?o.field("expression"):"";if("%%%%FIELDNAME"===t&&(f=!0),!t)throw new n(e,i.InvalidParameter,a);s.push({name:t,expression:W.create(l||t,r.getFieldsIndex())})}}if(f){const e={};for(const n of r.fields)e[n.name.toLowerCase()]=1;for(const n of s)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);let t=0;for(const n of s)if("%%%%FIELDNAME"===n.name){for(;1===e["field_"+t.toString()];)t++;e["field_"+t.toString()]=1,n.name="FIELD_"+t.toString()}}for(const t of s)await V(t.expression,G,e);return o[0].groupby(s,[])}return J("distinct",r,s,o)}))})}export{ee as registerFunctions};
5
+ import{ArcadeDate as e}from"../ArcadeDate.js";import t from"../ArcadePortal.js";import n from"../Dictionary.js";import{ArcadeExecutionError as i,ExecutionErrorCodes as a}from"../executionError.js";import r from"../Feature.js";import s from"../featureSetCollection.js";import{getPortal as o,lookupUser as l,convertToFeatureSet as f,constructFeatureSetFromPortalItem as c,constructFeatureSet as u,constructFeatureSetFromRelationship as d,constructFeatureSetFromUrl as m,constructAssociationMetaDataFeatureSetFromUrl as p}from"../featureSetUtils.js";import y from"../ImmutableArray.js";import{y as w,T as g,c as h,j as I,l as F,C as E,k as D,A as b,h as A,m as x,w as N,x as S,i as T,g as v,X as L,L as $}from"../../chunks/languageUtils.js";import{SqlExpressionAdapted as P,StringToCodeAdapted as j,FieldRename as R,AdaptedFeatureSet as O,OriginalField as C}from"../featureset/actions/Adapted.js";import M from"../featureset/actions/AttributeFilter.js";import k from"../featureset/actions/OrderBy.js";import z from"../featureset/actions/Top.js";import H from"../featureset/sources/Empty.js";import Z from"../featureset/sources/FeatureLayerMemory.js";import G from"../featureset/support/OrderbyClause.js";import{cloneField as U}from"../featureset/support/shared.js";import{isSingleField as W}from"../featureset/support/sqlUtils.js";import{calculateStat as _}from"./fieldStats.js";import{isPromiseLike as q}from"../../core/promiseUtils.js";import{WhereClause as B}from"../../core/sql/WhereClause.js";import J from"../../layers/FeatureLayer.js";import V from"../../layers/support/Field.js";function Q(e,t,n,i){if(1===i.length){if(x(i[0]))return _(e,i[0],-1);if(S(i[0]))return _(e,i[0].toArray(),-1)}return _(e,i,-1)}async function K(e,t,n){const i=e.getVariables();if(i.length>0){const a=[];for(let e=0;e<i.length;e++){const r={name:i[e]};a.push(await t.evaluateIdentifier(n,r))}const r={};for(let e=0;e<i.length;e++)r[i[e]]=a[e];return e.parameters=r,e}return e}function X(e,t,n=null){for(const i in e)if(i.toLowerCase()===t.toLowerCase())return e[i];return n}function Y(e){if(null===e)return null;const t={type:X(e,"type",""),name:X(e,"name","")};if("range"===t.type)t.range=X(e,"range",[]);else{t.codedValues=[];for(const n of X(e,"codedValues",[]))t.codedValues.push({name:X(n,"name",""),code:X(n,"code",null)})}return t}function ee(e){if(null===e)return null;const t={},n=X(e,"wkt",null);null!==n&&(t.wkt=n);const i=X(e,"wkid",null);return null!==i&&(t.wkid=i),t}function te(e){if(null===e)return null;const t={hasZ:X(e,"hasz",!1),hasM:X(e,"hasm",!1)},n=X(e,"spatialreference",null);n&&(t.spatialReference=ee(n));const i=X(e,"x",null);if(null!==i)return t.x=i,t.y=X(e,"y",null),t;const a=X(e,"rings",null);if(null!==a)return t.rings=a,t;const r=X(e,"paths",null);if(null!==r)return t.paths=r,t;const s=X(e,"points",null);if(null!==s)return t.points=s,t;for(const o of["xmin","xmax","ymin","ymax","zmin","zmax","mmin","mmax"]){const n=X(e,o,null);null!==n&&(t[o]=n)}return t}function ne(e,t){for(const n of t)if(n===e)return!0;return!1}function ie(e){return!!e.layerDefinition&&(!!e.featureSet&&(!1!==ne(e.layerDefinition.geometryType,["","esriGeometryPoint","esriGeometryPolyline","esriGeometryPolygon","esriGeometryMultipoint","esriGeometryEnvelope"])&&(null!==e.layerDefinition.objectIdField&&""!==e.layerDefinition.objectIdField&&(!1!==x(e.layerDefinition.fields)&&!1!==x(e.featureSet.features)))))}function ae(_){"async"===_.mode&&(_.functions.timezone=function(t,r){return _.standardFunctionAsync(t,r,(async(s,o,l)=>{if(w(l,1,2,t,r),g(l[0])){if(await l[0].load(),1===l.length||null===l[1])return l[0].dateTimeReferenceFieldIndex.layerDateFieldsTimeZone;if(!(l[1]instanceof n)||!1===l[1].hasField("type"))throw new i(t,a.InvalidParameter,r);const e=l[1].field("type");if(!1===h(e))throw new i(t,a.InvalidParameter,r);switch(I(e).toLowerCase()){case"preferredtimezone":return l[0].dateTimeReferenceFieldIndex.layerPreferredTimeZone;case"editfieldsinfo":return l[0].dateTimeReferenceFieldIndex.layerEditFieldsTimeZone;case"timeinfo":return l[0].dateTimeReferenceFieldIndex.layerTimeInfoTimeZone;case"field":if(l[1].hasField("fieldname")&&h(l[1].field("fieldname")))return l[0].dateTimeReferenceFieldIndex.fieldTimeZone(I(l[1].field("fieldname")))}throw new i(t,a.InvalidParameter,r)}const f=F(l[0],E(t));if(null===f)return null;const c=f.timeZone;return"system"===c?e.systemTimeZoneCanonicalName:c}))},_.functions.sqltimestamp=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{w(s,1,3,e,t);const o=s[0];if(D(o)){if(1===s.length)return o.toSQLString();if(2===s.length)return o.changeTimeZone(I(s[1])).toSQLString();throw new i(e,a.InvalidParameter,t)}if(g(o)){if(3!==s.length)throw new i(e,a.InvalidParameter,t);await o.load();const n=I(s[1]);if(!1===D(s[2]))throw new i(e,a.InvalidParameter,t);const r=o.fieldTimeZone(n);return null===r?s[2].toSQLString():s[2].changeTimeZone(r).toSQLString()}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"sqltimestamp",min:2,max:4}),_.functions.getuser=function(e,r){return _.standardFunctionAsync(e,r,(async(s,f,c)=>{w(c,0,2,e,r);let u=b(c[1],""),d=!0===u;if(u=!0===u||!1===u?"":I(u),0===c.length||c[0]instanceof t){let t=null;e.services&&e.services.portal&&(t=e.services.portal),c.length>0&&(t=o(c[0],t));const i=await l(t,u,d);if(i){const t=JSON.parse(JSON.stringify(i));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return n.convertObjectToArcadeDictionary(t,E(e))}return null}let m=null;if(g(c[0])&&(m=c[0]),m){if(d=!1,u)return null;await m.load();const i=await m.getOwningSystemUrl();if(!i){if(!u){const t=await m.getIdentityUser();return t?n.convertObjectToArcadeDictionary({username:t},E(e)):null}return null}let a=null;e.services&&e.services.portal&&(a=e.services.portal),a=o(new t(i),a);const r=await l(a,u,d);if(r){const t=JSON.parse(JSON.stringify(r));for(const e of["lastLogin","created","modified"])void 0!==t[e]&&null!==t[e]&&(t[e]=new Date(t[e]));return n.convertObjectToArcadeDictionary(t,E(e))}return null}throw new i(e,a.InvalidParameter,r)}))},_.signatures.push({name:"getuser",min:1,max:2}),_.functions.featuresetbyid=function(e,t){return _.standardFunctionAsync(e,t,((n,r,o)=>{if(w(o,2,4,e,t),o[0]instanceof s){const n=I(o[1]);let r=b(o[2],null);const s=A(b(o[3],!0));if(null===r&&(r=["*"]),!1===x(r))throw new i(e,a.InvalidParameter,t);return o[0].featureSetById(n,s,r)}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"featuresetbyid",min:2,max:4}),_.functions.getfeatureset=function(e,t){return _.standardFunctionAsync(e,t,((n,r,s)=>{if(w(s,1,2,e,t),N(s[0])){let t=b(s[1],"datasource");return null===t&&(t="datasource"),t=I(t).toLowerCase(),f(s[0].fullSchema(),t,e.lrucache,e.interceptor,e.spatialReference)}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"getfeatureset",min:1,max:2}),_.functions.featuresetbyportalitem=function(e,n){return _.standardFunctionAsync(e,n,((r,s,l)=>{if(w(l,2,5,e,n),null===l[0])throw new i(e,a.PortalRequired,n);if(l[0]instanceof t){const t=I(l[1]),r=I(l[2]);let s=b(l[3],null);const f=A(b(l[4],!0));if(null===s&&(s=["*"]),!1===x(s))throw new i(e,a.InvalidParameter,n);let u=null;return e.services&&e.services.portal&&(u=e.services.portal),u=o(l[0],u),c(t,r,e.spatialReference,s,f,u,e.lrucache,e.interceptor)}if(!1===h(l[0]))throw new i(e,a.PortalRequired,n);const f=I(l[0]),u=I(l[1]);let d=b(l[2],null);const m=A(b(l[3],!0));if(null===d&&(d=["*"]),!1===x(d))throw new i(e,a.InvalidParameter,n);if(e.services&&e.services.portal)return c(f,u,e.spatialReference,d,m,e.services.portal,e.lrucache,e.interceptor);throw new i(e,a.PortalRequired,n)}))},_.signatures.push({name:"featuresetbyportalitem",min:2,max:5}),_.functions.featuresetbyname=function(e,t){return _.standardFunctionAsync(e,t,((n,r,o)=>{if(w(o,2,4,e,t),o[0]instanceof s){const n=I(o[1]);let r=b(o[2],null);const s=A(b(o[3],!0));if(null===r&&(r=["*"]),!1===x(r))throw new i(e,a.InvalidParameter,t);return o[0].featureSetByName(n,s,r)}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"featuresetbyname",min:2,max:4}),_.functions.featureset=function(e,t){return _.standardFunction(e,t,((r,s,o)=>{w(o,1,1,e,t);let l=o[0];const f={layerDefinition:{geometryType:"",objectIdField:"",globalIdField:"",typeIdField:"",fields:[]},featureSet:{geometryType:"",features:[]}};if(h(l))l=JSON.parse(l),void 0!==l.layerDefinition?(f.layerDefinition=l.layerDefinition,f.featureSet=l.featureSet,l.layerDefinition.spatialReference&&(f.layerDefinition.spatialReference=l.layerDefinition.spatialReference)):(f.featureSet.features=l.features,f.featureSet.geometryType=l.geometryType,f.layerDefinition.geometryType=f.featureSet.geometryType,f.layerDefinition.objectIdField=l.objectIdFieldName,f.layerDefinition.typeIdField=l.typeIdFieldName,f.layerDefinition.globalIdField=l.globalIdFieldName,f.layerDefinition.fields=l.fields,l.spatialReference&&(f.layerDefinition.spatialReference=l.spatialReference));else{if(!(o[0]instanceof n))throw new i(e,a.InvalidParameter,t);{l=JSON.parse(o[0].castToText(!0));const e=X(l,"layerdefinition");if(null!==e){f.layerDefinition.geometryType=X(e,"geometrytype",""),f.featureSet.geometryType=f.layerDefinition.geometryType,f.layerDefinition.globalIdField=X(e,"globalidfield",""),f.layerDefinition.objectIdField=X(e,"objectidfield",""),f.layerDefinition.typeIdField=X(e,"typeidfield","");const t=X(e,"spatialreference",null);t&&(f.layerDefinition.spatialReference=ee(t));for(const i of X(e,"fields",[])){const e={name:X(i,"name",""),alias:X(i,"alias",""),type:X(i,"type",""),nullable:X(i,"nullable",!0),editable:X(i,"editable",!0),length:X(i,"length",null),domain:Y(X(i,"domain"))};f.layerDefinition.fields.push(e)}const n=X(l,"featureset",null);if(n){const e={};for(const t of f.layerDefinition.fields)e[t.name.toLowerCase()]=t.name;for(const t of X(n,"features",[])){const n={},i=X(t,"attributes",{});for(const t in i)n[e[t.toLowerCase()]]=i[t];f.featureSet.features.push({attributes:n,geometry:te(X(t,"geometry",null))})}}}else{f.layerDefinition.geometryType=X(l,"geometrytype",""),f.featureSet.geometryType=f.layerDefinition.geometryType,f.layerDefinition.objectIdField=X(l,"objectidfieldname",""),f.layerDefinition.typeIdField=X(l,"typeidfieldname","");const e=X(l,"spatialreference",null);e&&(f.layerDefinition.spatialReference=ee(e));for(const n of X(l,"fields",[])){const e={name:X(n,"name",""),alias:X(n,"alias",""),type:X(n,"type",""),nullable:X(n,"nullable",!0),editable:X(n,"editable",!0),length:X(n,"length",null),domain:Y(X(n,"domain"))};f.layerDefinition.fields.push(e)}const t={};for(const n of f.layerDefinition.fields)t[n.name.toLowerCase()]=n.name;for(const n of X(l,"features",[])){const e={},i=X(n,"attributes",{});for(const n in i)e[t[n.toLowerCase()]]=i[n];f.featureSet.features.push({attributes:e,geometry:te(X(n,"geometry",null))})}}}}if(!1===ie(f))throw new i(e,a.InvalidParameter,t);return Z.create(f,e.spatialReference)}))},_.signatures.push({name:"featureset",min:1,max:1}),_.functions.filter=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{if(w(s,2,2,e,t),x(s[0])||S(s[0])){const n=[];let r=s[0];r instanceof y&&(r=r.toArray());let o=null;if(!T(s[1]))throw new i(e,a.InvalidParameter,t);o=s[1].createFunction(e);for(const e of r){const t=o(e);q(t)?!0===await t&&n.push(e):!0===t&&n.push(e)}return n}if(g(s[0])){const t=await s[0].load(),n=B.create(s[1],t.getFieldsIndex()),i=n.getVariables();if(i.length>0){const t=[];for(let n=0;n<i.length;n++){const a={name:i[n]};t.push(await _.evaluateIdentifier(e,a))}const a={};for(let e=0;e<i.length;e++)a[i[e]]=t[e];return n.parameters=a,new M({parentfeatureset:s[0],whereclause:n})}return new M({parentfeatureset:s[0],whereclause:n})}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"filter",min:2,max:2}),_.functions.orderby=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{if(w(s,2,2,e,t),g(s[0])){const e=new G(s[1]);return new k({parentfeatureset:s[0],orderbyclause:e})}throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"orderby",min:2,max:2}),_.functions.top=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{if(w(s,2,2,e,t),g(s[0]))return new z({parentfeatureset:s[0],topnum:s[1]});if(x(s[0]))return v(s[1])>=s[0].length?s[0].slice(0):s[0].slice(0,v(s[1]));if(S(s[0]))return v(s[1])>=s[0].length()?s[0].slice(0):s[0].slice(0,v(s[1]));throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"top",min:2,max:2}),_.functions.first=function(e,t){return _.standardFunctionAsync(e,t,(async(n,i,a)=>{if(w(a,1,1,e,t),g(a[0])){const e=await a[0].first(n.abortSignal);if(null!==e){const t=r.createFromGraphicLikeObject(e.geometry,e.attributes,a[0]);return t._underlyingGraphic=e,t}return e}return x(a[0])?0===a[0].length?null:a[0][0]:S(a[0])?0===a[0].length()?null:a[0].get(0):null}))},_.signatures.push({name:"first",min:1,max:1}),_.functions.attachments=function(e,t){return _.standardFunctionAsync(e,t,(async(r,s,o)=>{w(o,1,2,e,t);const l={minsize:-1,maxsize:-1,types:null,returnMetadata:!1};if(o.length>1)if(o[1]instanceof n){if(o[1].hasField("minsize")&&(l.minsize=v(o[1].field("minsize"))),o[1].hasField("metadata")&&(l.returnMetadata=A(o[1].field("metadata"))),o[1].hasField("maxsize")&&(l.maxsize=v(o[1].field("maxsize"))),o[1].hasField("types")){const e=L(o[1].field("types"),!1);e.length>0&&(l.types=e)}}else if(null!==o[1])throw new i(e,a.InvalidParameter,t);if(N(o[0])){let t=o[0]._layer;return t instanceof J&&(t=u(t,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===t?[]:!1===g(t)?[]:(await t.load(),t.queryAttachments(o[0].field(t.objectIdField),l.minsize,l.maxsize,l.types,l.returnMetadata))}if(null===o[0])return[];throw new i(e,a.InvalidParameter,t)}))},_.signatures.push({name:"attachments",min:1,max:2}),_.functions.featuresetbyrelationshipname=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{w(s,2,4,e,t);const o=s[0],l=I(s[1]);let f=b(s[2],null);const c=A(b(s[3],!0));if(null===f&&(f=["*"]),!1===x(f))throw new i(e,a.InvalidParameter,t);if(null===s[0])return null;if(!N(s[0]))throw new i(e,a.InvalidParameter,t);let p=o._layer;if(p instanceof J&&(p=u(p,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===p)return null;if(!1===g(p))return null;p=await p.load();const y=p.relationshipMetaData().filter((e=>e.name===l));if(0===y.length)return null;if(void 0!==y[0].relationshipTableId&&null!==y[0].relationshipTableId&&y[0].relationshipTableId>-1)return d(p,y[0],o.field(p.objectIdField),p.spatialReference,f,c,e.lrucache,e.interceptor);let h=p.serviceUrl();if(!h)return null;h="/"===h.charAt(h.length-1)?h+y[0].relatedTableId.toString():h+"/"+y[0].relatedTableId.toString();const F=await m(h,p.spatialReference,f,c,e.lrucache,e.interceptor);await F.load();let E=F.relationshipMetaData();if(E=E.filter((e=>e.id===y[0].id)),!1===o.hasField(y[0].keyField)||null===o.field(y[0].keyField)){const e=await p.getFeatureByObjectId(o.field(p.objectIdField),[y[0].keyField]);if(e){const t=B.create(E[0].keyField+"= @id",F.getFieldsIndex());return t.parameters={id:e.attributes[y[0].keyField]},F.filter(t)}return new H({parentfeatureset:F})}const D=B.create(E[0].keyField+"= @id",F.getFieldsIndex());return D.parameters={id:o.field(y[0].keyField)},F.filter(D)}))},_.signatures.push({name:"featuresetbyrelationshipname",min:2,max:4}),_.functions.featuresetbyassociation=function(e,t){return _.standardFunctionAsync(e,t,(async(n,r,s)=>{w(s,2,3,e,t);const o=s[0],l=I(b(s[1],"")).toLowerCase(),f=h(s[2])?I(s[2]):null;if(null===s[0])return null;if(!N(s[0]))throw new i(e,a.InvalidParameter,t);let c=o._layer;if(c instanceof J&&(c=u(c,e.spatialReference,["*"],!0,e.lrucache,e.interceptor)),null===c)return null;if(!1===g(c))return null;await c.load();const d=c.serviceUrl(),m=await p(d,e.spatialReference);let y=null,F=null,E=!1;if(null!==f&&""!==f&&void 0!==f){for(const e of m.terminals)e.terminalName===f&&(F=e.terminalId);null===F&&(E=!0)}const D=m.associations.getFieldsIndex(),A=D.get("TOGLOBALID").name,x=D.get("FROMGLOBALID").name,S=D.get("TOTERMINALID").name,T=D.get("FROMTERMINALID").name,v=D.get("FROMNETWORKSOURCEID").name,L=D.get("TONETWORKSOURCEID").name,M=D.get("ASSOCIATIONTYPE").name,k=D.get("ISCONTENTVISIBLE").name,z=D.get("OBJECTID").name;for(const e of c.fields)if("global-id"===e.type){y=o.field(e.name);break}let H=null,Z=new P(new V({name:"percentalong",alias:"percentalong",type:"double"}),B.create("0",m.associations.getFieldsIndex())),G=new P(new V({name:"side",alias:"side",type:"string"}),B.create("''",m.associations.getFieldsIndex()));const W="globalid",_="globalId",q={};for(const e in m.lkp)q[e]=m.lkp[e].sourceId;const Q=new j(new V({name:"classname",alias:"classname",type:"string"}),null,q);let K="";switch(l){case"midspan":{K=`((${A}='${y}') OR ( ${x}='${y}')) AND (${M} IN (5))`,Q.codefield=B.create(`CASE WHEN (${A}='${y}') THEN ${v} ELSE ${L} END`,m.associations.getFieldsIndex());const e=U(O.findField(m.associations.fields,x));e.name=W,e.alias=W,H=new P(e,B.create(`CASE WHEN (${x}='${y}') THEN ${A} ELSE ${x} END`,m.associations.getFieldsIndex())),Z=m.unVersion>=4?new C(O.findField(m.associations.fields,D.get("PERCENTALONG").name)):new P(new V({name:"percentalong",alias:"percentalong",type:"double"}),B.create("0",m.associations.getFieldsIndex()));break}case"junctionedge":{K=`((${A}='${y}') OR ( ${x}='${y}')) AND (${M} IN (4,6))`,Q.codefield=B.create(`CASE WHEN (${A}='${y}') THEN ${v} ELSE ${L} END`,m.associations.getFieldsIndex());const e=U(O.findField(m.associations.fields,x));e.name=W,e.alias=W,H=new P(e,B.create(`CASE WHEN (${x}='${y}') THEN ${A} ELSE ${x} END`,m.associations.getFieldsIndex())),G=new P(new V({name:"side",alias:"side",type:"string"}),B.create(`CASE WHEN (${M}=4) THEN 'from' ELSE 'to' END`,m.associations.getFieldsIndex()));break}case"connected":{let e=`${A}='@T'`,t=`${x}='@T'`;null!==F&&(e+=` AND ${S}=@A`,t+=` AND ${T}=@A`),K="(("+e+") OR ("+t+"))",K=$(K,"@T",y??""),e=$(e,"@T",y??""),null!==F&&(e=$(e,"@A",F.toString()),K=$(K,"@A",F.toString())),Q.codefield=B.create("CASE WHEN "+e+` THEN ${v} ELSE ${L} END`,m.associations.getFieldsIndex());const n=U(O.findField(m.associations.fields,x));n.name=W,n.alias=W,H=new P(n,B.create("CASE WHEN "+e+` THEN ${x} ELSE ${A} END`,m.associations.getFieldsIndex()));break}case"container":K=`${A}='${y}' AND ${M} = 2`,null!==F&&(K+=` AND ${S} = `+F.toString()),Q.codefield=v,K="( "+K+" )",H=new R(O.findField(m.associations.fields,x),W,W);case"content":K=`(${x}='${y}' AND ${M} = 2)`,null!==F&&(K+=` AND ${T} = `+F.toString()),Q.codefield=L,K="( "+K+" )",H=new R(O.findField(m.associations.fields,A),W,W);break;case"structure":K=`(${A}='${y}' AND ${M} = 3)`,null!==F&&(K+=` AND ${S} = `+F.toString()),Q.codefield=v,K="( "+K+" )",H=new R(O.findField(m.associations.fields,x),W,_);break;case"attached":K=`(${x}='${y}' AND ${M} = 3)`,null!==F&&(K+=` AND ${T} = `+F.toString()),Q.codefield=L,K="( "+K+" )",H=new R(O.findField(m.associations.fields,A),W,_);break;default:throw new i(e,a.InvalidParameter,t)}E&&(K="1 <> 1");return new O({parentfeatureset:m.associations,adaptedFields:[new C(O.findField(m.associations.fields,z)),new C(O.findField(m.associations.fields,k)),H,G,Q,Z],extraFilter:K?B.create(K,m.associations.getFieldsIndex()):null})}))},_.signatures.push({name:"featuresetbyassociation",min:2,max:6}),_.functions.groupby=function(e,t){return _.standardFunctionAsync(e,t,(async(r,s,o)=>{if(w(o,3,3,e,t),!g(o[0]))throw new i(e,a.InvalidParameter,t);const l=await o[0].load(),f=[],c=[];let u=!1,d=[];if(h(o[1]))d.push(o[1]);else if(o[1]instanceof n)d.push(o[1]);else if(x(o[1]))d=o[1];else{if(!S(o[1]))throw new i(e,a.InvalidParameter,t);d=o[1].toArray()}for(const m of d)if(h(m)){const e=B.create(I(m),l.getFieldsIndex()),t=!0===W(e)?I(m):"%%%%FIELDNAME";f.push({name:t,expression:e}),"%%%%FIELDNAME"===t&&(u=!0)}else{if(!(m instanceof n))throw new i(e,a.InvalidParameter,t);{const n=m.hasField("name")?m.field("name"):"%%%%FIELDNAME",r=m.hasField("expression")?m.field("expression"):"";if("%%%%FIELDNAME"===n&&(u=!0),!n)throw new i(e,a.InvalidParameter,t);f.push({name:n,expression:B.create(r||n,l.getFieldsIndex())})}}if(d=[],h(o[2]))d.push(o[2]);else if(x(o[2]))d=o[2];else if(S(o[2]))d=o[2].toArray();else{if(!(o[2]instanceof n))throw new i(e,a.InvalidParameter,t);d.push(o[2])}for(const m of d){if(!(m instanceof n))throw new i(e,a.InvalidParameter,t);{const n=m.hasField("name")?m.field("name"):"",r=m.hasField("statistic")?m.field("statistic"):"",s=m.hasField("expression")?m.field("expression"):"";if(!n||!r||!s)throw new i(e,a.InvalidParameter,t);c.push({name:n,statistic:r.toLowerCase(),expression:B.create(s,l.getFieldsIndex())})}}if(u){const e={};for(const n of l.fields)e[n.name.toLowerCase()]=1;for(const n of f)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);for(const n of c)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);let t=0;for(const n of f)if("%%%%FIELDNAME"===n.name){for(;1===e["field_"+t.toString()];)t++;e["field_"+t.toString()]=1,n.name="FIELD_"+t.toString()}}for(const t of f)await K(t.expression,_,e);for(const t of c)await K(t.expression,_,e);return o[0].groupby(f,c)}))},_.signatures.push({name:"groupby",min:3,max:3}),_.functions.distinct=function(e,t){return _.standardFunctionAsync(e,t,(async(r,s,o)=>{if(g(o[0])){w(o,2,2,e,t);const r=await o[0].load(),s=[];let l=[];if(h(o[1]))l.push(o[1]);else if(o[1]instanceof n)l.push(o[1]);else if(x(o[1]))l=o[1];else{if(!S(o[1]))throw new i(e,a.InvalidParameter,t);l=o[1].toArray()}let f=!1;for(const o of l)if(h(o)){const e=B.create(I(o),r.getFieldsIndex()),t=!0===W(e)?I(o):"%%%%FIELDNAME";s.push({name:t,expression:e}),"%%%%FIELDNAME"===t&&(f=!0)}else{if(!(o instanceof n))throw new i(e,a.InvalidParameter,t);{const n=o.hasField("name")?o.field("name"):"%%%%FIELDNAME",l=o.hasField("expression")?o.field("expression"):"";if("%%%%FIELDNAME"===n&&(f=!0),!n)throw new i(e,a.InvalidParameter,t);s.push({name:n,expression:B.create(l||n,r.getFieldsIndex())})}}if(f){const e={};for(const n of r.fields)e[n.name.toLowerCase()]=1;for(const n of s)"%%%%FIELDNAME"!==n.name&&(e[n.name.toLowerCase()]=1);let t=0;for(const n of s)if("%%%%FIELDNAME"===n.name){for(;1===e["field_"+t.toString()];)t++;e["field_"+t.toString()]=1,n.name="FIELD_"+t.toString()}}for(const t of s)await K(t.expression,_,e);return o[0].groupby(s,[])}return Q("distinct",r,s,o)}))})}export{ae as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import n from"../Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as a}from"../executionError.js";import{y as t,w as r,P as o,g as i,j as c,T as s,Y as d,O as u,Q as m,Z as f,S as l,_ as y,A as v,t as w,N as p}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as T}from"../featureset/support/shared.js";function h(e){return e&&e.domain?"coded-value"===e.domain.type||"codedValue"===e.domain.type?n.convertObjectToArcadeDictionary({type:"codedValue",name:e.domain.name,dataType:T[e.field.type],codedValues:e.domain.codedValues.map((n=>({name:n.name,code:n.code})))}):n.convertObjectToArcadeDictionary({type:"range",name:e.domain.name,dataType:T[e.field.type],min:e.domain.min,max:e.domain.max}):null}function A(T){"async"===T.mode&&(T.functions.domain=function(n,u){return T.standardFunctionAsync(n,u,(async(m,f,l)=>{if(t(l,2,3,n,u),r(l[0])){return h(o(l[0],c(l[1]),void 0===l[2]?void 0:i(l[2])))}if(s(l[0])){await l[0]._ensureLoaded();return h(d(c(l[1]),l[0],null,void 0===l[2]?void 0:i(l[2])))}throw new e(n,a.InvalidParameter,u)}))},T.functions.subtypes=function(o,i){return T.standardFunctionAsync(o,i,(async(c,d,m)=>{if(t(m,1,1,o,i),r(m[0])){const e=u(m[0]);return e?n.convertObjectToArcadeDictionary(e):null}if(s(m[0])){await m[0]._ensureLoaded();const e=m[0].subtypes();return e?n.convertObjectToArcadeDictionary(e):null}throw new e(o,a.InvalidParameter,i)}))},T.functions.domainname=function(n,o){return T.standardFunctionAsync(n,o,(async(u,l,y)=>{if(t(y,2,4,n,o),r(y[0]))return m(y[0],c(y[1]),y[2],void 0===y[3]?void 0:i(y[3]));if(s(y[0])){await y[0]._ensureLoaded();const n=d(c(y[1]),y[0],null,void 0===y[3]?void 0:i(y[3]));return f(n,y[2])}throw new e(n,a.InvalidParameter,o)}))},T.signatures.push({name:"domainname",min:2,max:4}),T.functions.domaincode=function(n,o){return T.standardFunctionAsync(n,o,(async(u,m,f)=>{if(t(f,2,4,n,o),r(f[0]))return l(f[0],c(f[1]),f[2],void 0===f[3]?void 0:i(f[3]));if(s(f[0])){await f[0]._ensureLoaded();const n=d(c(f[1]),f[0],null,void 0===f[3]?void 0:i(f[3]));return y(n,f[2])}throw new e(n,a.InvalidParameter,o)}))},T.signatures.push({name:"domaincode",min:2,max:4})),T.functions.text=function(n,e){return T.standardFunctionAsync(n,e,((a,r,o)=>{if(t(o,1,2,n,e),!s(o[0]))return w(o[0],o[1]);{const n=v(o[1],"");if(""===n)return o[0].castToText();if("schema"===n.toLowerCase())return o[0].convertToText("schema",a.abortSignal);if("featureset"===n.toLowerCase())return o[0].convertToText("featureset",a.abortSignal)}}))},T.functions.gdbversion=function(n,o){return T.standardFunctionAsync(n,o,(async(i,c,d)=>{if(t(d,1,1,n,o),r(d[0]))return d[0].gdbVersion();if(s(d[0])){return(await d[0].load()).gdbVersion}throw new e(n,a.InvalidParameter,o)}))},T.functions.schema=function(o,i){return T.standardFunctionAsync(o,i,(async(c,d,u)=>{if(t(u,1,1,o,i),s(u[0]))return await u[0].load(),n.convertObjectToArcadeDictionary(u[0].schema());if(r(u[0])){const e=p(u[0]);return e?n.convertObjectToArcadeDictionary(e):null}throw new e(o,a.InvalidParameter,i)}))}}export{A as registerFunctions};
5
+ import n from"../Dictionary.js";import{ArcadeExecutionError as a,ExecutionErrorCodes as e}from"../executionError.js";import{y as t,w as r,P as o,g as i,j as s,T as c,Y as d,O as u,C as m,Q as f,Z as l,S as y,_ as v,A as w,t as p,N as T}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as h}from"../featureset/support/shared.js";function A(a,e){return a&&a.domain?"coded-value"===a.domain.type||"codedValue"===a.domain.type?n.convertObjectToArcadeDictionary({type:"codedValue",name:a.domain.name,dataType:h[a.field.type],codedValues:a.domain.codedValues.map((n=>({name:n.name,code:n.code})))},m(e)):n.convertObjectToArcadeDictionary({type:"range",name:a.domain.name,dataType:h[a.field.type],min:a.domain.min,max:a.domain.max},m(e)):null}function b(h){"async"===h.mode&&(h.functions.domain=function(n,u){return h.standardFunctionAsync(n,u,(async(m,f,l)=>{if(t(l,2,3,n,u),r(l[0])){return A(o(l[0],s(l[1]),void 0===l[2]?void 0:i(l[2])),n)}if(c(l[0])){await l[0]._ensureLoaded();return A(d(s(l[1]),l[0],null,void 0===l[2]?void 0:i(l[2])),n)}throw new a(n,e.InvalidParameter,u)}))},h.functions.subtypes=function(o,i){return h.standardFunctionAsync(o,i,(async(s,d,f)=>{if(t(f,1,1,o,i),r(f[0])){const a=u(f[0]);return a?n.convertObjectToArcadeDictionary(a,m(o)):null}if(c(f[0])){await f[0]._ensureLoaded();const a=f[0].subtypes();return a?n.convertObjectToArcadeDictionary(a,m(o)):null}throw new a(o,e.InvalidParameter,i)}))},h.functions.domainname=function(n,o){return h.standardFunctionAsync(n,o,(async(u,m,y)=>{if(t(y,2,4,n,o),r(y[0]))return f(y[0],s(y[1]),y[2],void 0===y[3]?void 0:i(y[3]));if(c(y[0])){await y[0]._ensureLoaded();const n=d(s(y[1]),y[0],null,void 0===y[3]?void 0:i(y[3]));return l(n,y[2])}throw new a(n,e.InvalidParameter,o)}))},h.signatures.push({name:"domainname",min:2,max:4}),h.functions.domaincode=function(n,o){return h.standardFunctionAsync(n,o,(async(u,m,f)=>{if(t(f,2,4,n,o),r(f[0]))return y(f[0],s(f[1]),f[2],void 0===f[3]?void 0:i(f[3]));if(c(f[0])){await f[0]._ensureLoaded();const n=d(s(f[1]),f[0],null,void 0===f[3]?void 0:i(f[3]));return v(n,f[2])}throw new a(n,e.InvalidParameter,o)}))},h.signatures.push({name:"domaincode",min:2,max:4})),h.functions.text=function(n,a){return h.standardFunctionAsync(n,a,((e,r,o)=>{if(t(o,1,2,n,a),!c(o[0]))return p(o[0],o[1]);{const n=w(o[1],"");if(""===n)return o[0].castToText();if("schema"===n.toLowerCase())return o[0].convertToText("schema",e.abortSignal);if("featureset"===n.toLowerCase())return o[0].convertToText("featureset",e.abortSignal)}}))},h.functions.gdbversion=function(n,o){return h.standardFunctionAsync(n,o,(async(i,s,d)=>{if(t(d,1,1,n,o),r(d[0]))return d[0].gdbVersion();if(c(d[0])){return(await d[0].load()).gdbVersion}throw new a(n,e.InvalidParameter,o)}))},h.functions.schema=function(o,i){return h.standardFunctionAsync(o,i,(async(s,d,u)=>{if(t(u,1,1,o,i),c(u[0]))return await u[0].load(),n.convertObjectToArcadeDictionary(u[0].schema(),m(o));if(r(u[0])){const a=T(u[0]);return a?n.convertObjectToArcadeDictionary(a,m(o)):null}throw new a(o,e.InvalidParameter,i)}))}}export{b as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{version as n}from"../../kernel.js";import{cloneGeometry as t,convertSquareUnitsToCode as e,convertLinearUnitsToCode as r}from"../kernel.js";import{G as i,y as a,k as o,j as s,m as l,x as u,q as f,T as c,A as d,J as m,H as w,K as h,g as y,h as p}from"../../chunks/languageUtils.js";import{centroidPolyline as g,centroidMultiPoint as P,getMetersPerVerticalUnitForSR as v,segmentLength3d as I}from"./centroid.js";import A from"../../geometry/Extent.js";import F from"../../geometry/Geometry.js";import{disjoint as R,intersects as x,touches as N,crosses as b,within as j,contains as S,overlaps as k,equals as M,relate as Z,intersect as C,union as z,difference as E,symmetricDifference as O,clip as J,cut as L,planarArea as T,geodesicArea as U,planarLength as W,geodesicLength as q,distance as G,densify as H,geodesicDensify as K,generalize as V,buffer as B,geodesicBuffer as D,offset as Q,rotate as X,simplify as Y,isSimple as $,convexHull as _}from"../../geometry/geometryEngineAsync.js";import nn from"../../geometry/Multipoint.js";import tn from"../../geometry/Point.js";import en from"../../geometry/Polygon.js";import rn from"../../geometry/Polyline.js";import{fromJSON as an}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as on,ExecutionErrorCodes as sn}from"../executionError.js";import{getMetersPerUnitForSR as ln}from"../../core/unitUtils.js";function un(t){return 0===n.indexOf("4.")?en.fromExtent(t):new en({spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})}function fn(n,t,e){if(a(n,2,2,t,e),n[0]instanceof F&&n[1]instanceof F);else if(n[0]instanceof F&&null===n[1]);else if(n[1]instanceof F&&null===n[0]);else if(null!==n[0]||null!==n[1])throw new on(t,sn.InvalidParameter,e)}async function cn(n,t){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let e=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){e=v(n.spatialReference)/ln(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],e);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],e);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=I(a[0],a[a.length-1],e))}else"extent"===n.type&&(r+=2*I([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],e),r+=2*I([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],e),r*=2,r+=4*Math.abs(d(n.zmax,0)*e-d(n.zmin,0)*e));const i=new rn({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return W(i,t)}function dn(n){"async"===n.mode&&(n.functions.disjoint=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null===a[0]||null===a[1]||R(a[0],a[1]))))},n.functions.intersects=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&x(a[0],a[1]))))},n.functions.touches=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&N(a[0],a[1]))))},n.functions.crosses=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&b(a[0],a[1]))))},n.functions.within=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&j(a[0],a[1]))))},n.functions.contains=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&S(a[0],a[1]))))},n.functions.overlaps=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&k(a[0],a[1]))))},n.functions.equals=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(a(i,2,2,t,e),i[0]===i[1]||(i[0]instanceof F&&i[1]instanceof F?M(i[0],i[1]):!(!o(i[0])||!o(i[1]))&&i[0].getTime()===i[1].getTime()))))},n.functions.relate=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,3,3,t,e),o[0]instanceof F&&o[1]instanceof F)return Z(o[0],o[1],s(o[2]));if(o[0]instanceof F&&null===o[1])return!1;if(o[1]instanceof F&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new on(t,sn.InvalidParameter,e)}))},n.functions.intersection=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null===a[0]||null===a[1]?null:C(a[0],a[1]))))},n.functions.union=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>{const s=[];if(0===(o=i(o)).length)throw new on(e,sn.WrongNumberOfParameters,r);if(1===o.length)if(l(o[0])){const n=i(o[0]);for(let t=0;t<n.length;t++)if(null!==n[t]){if(!(n[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(n[t])}}else{if(!u(o[0])){if(o[0]instanceof F)return f(t(o[0]),e.spatialReference);if(null===o[0])return null;throw new on(e,sn.InvalidParameter,r)}{const n=i(o[0].toArray());for(let t=0;t<n.length;t++)if(null!==n[t]){if(!(n[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(n[t])}}}else for(let t=0;t<o.length;t++)if(null!==o[t]){if(!(o[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(o[t])}return 0===s.length?null:z(s)}))},n.functions.difference=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>(fn(o=i(o),e,r),null!==o[0]&&null===o[1]?t(o[0]):null===o[0]?null:E(o[0],o[1]))))},n.functions.symmetricdifference=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>(fn(o=i(o),e,r),null===o[0]&&null===o[1]?null:null===o[0]?t(o[1]):null===o[1]?t(o[0]):O(o[0],o[1]))))},n.functions.clip=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,2,2,t,e),!(o[1]instanceof A)&&null!==o[1])throw new on(t,sn.InvalidParameter,e);if(null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return null===o[1]?null:J(o[0],o[1])}))},n.functions.cut=function(e,r){return n.standardFunctionAsync(e,r,((n,o,s)=>{if(s=i(s),a(s,2,2,e,r),!(s[1]instanceof rn)&&null!==s[1])throw new on(e,sn.InvalidParameter,r);if(null===s[0])return[];if(!(s[0]instanceof F))throw new on(e,sn.InvalidParameter,r);return null===s[1]?[t(s[0])]:L(s[0],s[1])}))},n.functions.area=function(t,r){return n.standardFunctionAsync(t,r,(async(n,o,s)=>{if(a(s,1,2,t,r),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumArea(e(d(s[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,r);return n}if(l(s[0])||u(s[0])){const n=m(s[0],t.spatialReference);return null===n?0:T(n,e(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,r);return T(s[0],e(d(s[1],-1)))}))},n.functions.areageodetic=function(t,r){return n.standardFunctionAsync(t,r,(async(n,o,s)=>{if(a(s,1,2,t,r),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumArea(e(d(s[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,r);return n}if(l(s[0])||u(s[0])){const n=m(s[0],t.spatialReference);return null===n?0:U(n,e(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,r);return U(s[0],e(d(s[1],-1)))}))},n.functions.length=function(t,e){return n.standardFunctionAsync(t,e,(async(n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumLength(r(d(s[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,e);return n}if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:W(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return W(s[0],r(d(s[1],-1)))}))},n.functions.length3d=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:!0===n.hasZ?cn(n,r(d(s[1],-1))):W(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return!0===s[0].hasZ?cn(s[0],r(d(s[1],-1))):W(s[0],r(d(s[1],-1)))}))},n.functions.lengthgeodetic=function(t,e){return n.standardFunctionAsync(t,e,(async(n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumLength(r(d(s[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,e);return n}if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:q(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return q(s[0],r(d(s[1],-1)))}))},n.functions.distance=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{s=i(s),a(s,2,3,t,e);let f=s[0];(l(s[0])||u(s[0]))&&(f=h(s[0],t.spatialReference));let c=s[1];if((l(s[1])||u(s[1]))&&(c=h(s[1],t.spatialReference)),!(f instanceof F))throw new on(t,sn.InvalidParameter,e);if(!(c instanceof F))throw new on(t,sn.InvalidParameter,e);return G(f,c,r(d(s[2],-1)))}))},n.functions.distancegeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{s=i(s),a(s,2,3,t,e);const l=s[0],u=s[1];if(!(l instanceof tn))throw new on(t,sn.InvalidParameter,e);if(!(u instanceof tn))throw new on(t,sn.InvalidParameter,e);const f=new rn({paths:[],spatialReference:l.spatialReference});return f.addPath([l,u]),q(f,r(d(s[2],-1)))}))},n.functions.densify=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,3,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);if(l<=0)throw new on(t,sn.InvalidParameter,e);return s[0]instanceof en||s[0]instanceof rn?H(s[0],l,r(d(s[2],-1))):s[0]instanceof A?H(un(s[0]),l,r(d(s[2],-1))):s[0]}))},n.functions.densifygeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,3,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);if(l<=0)throw new on(t,sn.InvalidParameter,e);return s[0]instanceof en||s[0]instanceof rn?K(s[0],l,r(d(s[2],-1))):s[0]instanceof A?K(un(s[0]),l,r(d(s[2],-1))):s[0]}))},n.functions.generalize=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,4,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);return V(s[0],l,p(d(s[2],!0)),r(d(s[3],-1)))}))},n.functions.buffer=function(e,o){return n.standardFunctionAsync(e,o,((n,s,l)=>{if(l=i(l),a(l,2,3,e,o),null===l[0])return null;if(!(l[0]instanceof F))throw new on(e,sn.InvalidParameter,o);const u=y(l[1]);if(isNaN(u))throw new on(e,sn.InvalidParameter,o);return 0===u?t(l[0]):B(l[0],u,r(d(l[2],-1)))}))},n.functions.buffergeodetic=function(e,o){return n.standardFunctionAsync(e,o,((n,s,l)=>{if(l=i(l),a(l,2,3,e,o),null===l[0])return null;if(!(l[0]instanceof F))throw new on(e,sn.InvalidParameter,o);const u=y(l[1]);if(isNaN(u))throw new on(e,sn.InvalidParameter,o);return 0===u?t(l[0]):D(l[0],u,r(d(l[2],-1)))}))},n.functions.offset=function(t,e){return n.standardFunctionAsync(t,e,((n,o,l)=>{if(l=i(l),a(l,2,6,t,e),null===l[0])return null;if(!(l[0]instanceof en||l[0]instanceof rn))throw new on(t,sn.InvalidParameter,e);const u=y(l[1]);if(isNaN(u))throw new on(t,sn.InvalidParameter,e);const f=y(d(l[4],10));if(isNaN(f))throw new on(t,sn.InvalidParameter,e);const c=y(d(l[5],0));if(isNaN(c))throw new on(t,sn.InvalidParameter,e);return Q(l[0],u,r(d(l[2],-1)),s(d(l[3],"round")).toLowerCase(),f,c)}))},n.functions.rotate=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{o=i(o),a(o,2,3,t,e);let s=o[0];if(null===s)return null;if(!(s instanceof F))throw new on(t,sn.InvalidParameter,e);s instanceof A&&(s=en.fromExtent(s));const l=y(o[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);const u=d(o[2],null);if(null===u)return X(s,l);if(u instanceof tn)return X(s,l,u);throw new on(t,sn.InvalidParameter,e)}))},n.functions.centroid=function(e,r){return n.standardFunctionAsync(e,r,((n,o,s)=>{if(s=i(s),a(s,1,1,e,r),null===s[0])return null;let c=s[0];if((l(s[0])||u(s[0]))&&(c=h(s[0],e.spatialReference)),null===c)return null;if(!(c instanceof F))throw new on(e,sn.InvalidParameter,r);return c instanceof tn?f(t(s[0]),e.spatialReference):c instanceof en?c.centroid:c instanceof rn?g(c):c instanceof nn?P(c):c instanceof A?c.center:null}))},n.functions.multiparttosinglepart=function(e,r){return n.standardFunctionAsync(e,r,(async(n,o,s)=>{s=i(s),a(s,1,1,e,r);const l=[];if(null===s[0])return null;if(!(s[0]instanceof F))throw new on(e,sn.InvalidParameter,r);if(s[0]instanceof tn)return[f(t(s[0]),e.spatialReference)];if(s[0]instanceof A)return[f(t(s[0]),e.spatialReference)];const u=await Y(s[0]);if(u instanceof en){const n=[],t=[];for(let e=0;e<u.rings.length;e++)if(u.isClockwise(u.rings[e])){const t=an({rings:[u.rings[e]],hasZ:!0===u.hasZ,hazM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(t)}else t.push({ring:u.rings[e],pt:u.getPoint(e,0)});for(let e=0;e<t.length;e++)for(let r=0;r<n.length;r++)if(n[r].contains(t[e].pt)){n[r].addRing(t[e].ring);break}return n}if(u instanceof rn){const n=[];for(let t=0;t<u.paths.length;t++){const e=an({paths:[u.paths[t]],hasZ:!0===u.hasZ,hazM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(e)}return n}if(s[0]instanceof nn){const n=f(t(s[0]),e.spatialReference);for(let t=0;t<n.points.length;t++)l.push(n.getPoint(t));return l}return null}))},n.functions.issimple=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return!0;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return $(o[0])}))},n.functions.simplify=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return Y(o[0])}))},n.functions.convexhull=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return _(o[0])}))})}export{dn as registerFunctions};
5
+ import{version as n}from"../../kernel.js";import{cloneGeometry as t,convertSquareUnitsToCode as e,convertLinearUnitsToCode as r}from"../kernel.js";import{G as i,y as a,k as o,j as s,m as l,x as u,q as f,T as c,A as d,J as m,H as w,K as h,g as y,h as p}from"../../chunks/languageUtils.js";import{centroidPolyline as g,centroidMultiPoint as P,getMetersPerVerticalUnitForSR as v,segmentLength3d as I}from"./centroid.js";import A from"../../geometry/Extent.js";import F from"../../geometry/Geometry.js";import{disjoint as R,intersects as x,touches as N,crosses as b,within as j,contains as S,overlaps as k,equals as M,relate as Z,intersect as C,union as z,difference as E,symmetricDifference as O,clip as q,cut as J,planarArea as L,geodesicArea as U,planarLength as W,geodesicLength as G,distance as H,densify as K,geodesicDensify as T,generalize as V,buffer as B,geodesicBuffer as D,offset as Q,rotate as X,simplify as Y,isSimple as $,convexHull as _}from"../../geometry/geometryEngineAsync.js";import nn from"../../geometry/Multipoint.js";import tn from"../../geometry/Point.js";import en from"../../geometry/Polygon.js";import rn from"../../geometry/Polyline.js";import{fromJSON as an}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as on,ExecutionErrorCodes as sn}from"../executionError.js";import{getMetersPerUnitForSR as ln}from"../../core/unitUtils.js";function un(t){return 0===n.indexOf("4.")?en.fromExtent(t):new en({spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]})}function fn(n,t,e){if(a(n,2,2,t,e),n[0]instanceof F&&n[1]instanceof F);else if(n[0]instanceof F&&null===n[1]);else if(n[1]instanceof F&&null===n[0]);else if(null!==n[0]||null!==n[1])throw new on(t,sn.InvalidParameter,e)}async function cn(n,t){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let e=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){e=v(n.spatialReference)/ln(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],e);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],e);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=I(a[0],a[a.length-1],e))}else"extent"===n.type&&(r+=2*I([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],e),r+=2*I([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],e),r*=2,r+=4*Math.abs(d(n.zmax,0)*e-d(n.zmin,0)*e));const i=new rn({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return W(i,t)}function dn(n){"async"===n.mode&&(n.functions.disjoint=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null===a[0]||null===a[1]||R(a[0],a[1]))))},n.functions.intersects=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&x(a[0],a[1]))))},n.functions.touches=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&N(a[0],a[1]))))},n.functions.crosses=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&b(a[0],a[1]))))},n.functions.within=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&j(a[0],a[1]))))},n.functions.contains=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&S(a[0],a[1]))))},n.functions.overlaps=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null!==a[0]&&null!==a[1]&&k(a[0],a[1]))))},n.functions.equals=function(t,e){return n.standardFunctionAsync(t,e,((n,r,i)=>(a(i,2,2,t,e),i[0]===i[1]||(i[0]instanceof F&&i[1]instanceof F?M(i[0],i[1]):!(!o(i[0])||!o(i[1]))&&i[0].equals(i[1])))))},n.functions.relate=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,3,3,t,e),o[0]instanceof F&&o[1]instanceof F)return Z(o[0],o[1],s(o[2]));if(o[0]instanceof F&&null===o[1])return!1;if(o[1]instanceof F&&null===o[0])return!1;if(null===o[0]&&null===o[1])return!1;throw new on(t,sn.InvalidParameter,e)}))},n.functions.intersection=function(t,e){return n.standardFunctionAsync(t,e,((n,r,a)=>(fn(a=i(a),t,e),null===a[0]||null===a[1]?null:C(a[0],a[1]))))},n.functions.union=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>{const s=[];if(0===(o=i(o)).length)throw new on(e,sn.WrongNumberOfParameters,r);if(1===o.length)if(l(o[0])){const n=i(o[0]);for(let t=0;t<n.length;t++)if(null!==n[t]){if(!(n[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(n[t])}}else{if(!u(o[0])){if(o[0]instanceof F)return f(t(o[0]),e.spatialReference);if(null===o[0])return null;throw new on(e,sn.InvalidParameter,r)}{const n=i(o[0].toArray());for(let t=0;t<n.length;t++)if(null!==n[t]){if(!(n[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(n[t])}}}else for(let t=0;t<o.length;t++)if(null!==o[t]){if(!(o[t]instanceof F))throw new on(e,sn.InvalidParameter,r);s.push(o[t])}return 0===s.length?null:z(s)}))},n.functions.difference=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>(fn(o=i(o),e,r),null!==o[0]&&null===o[1]?t(o[0]):null===o[0]?null:E(o[0],o[1]))))},n.functions.symmetricdifference=function(e,r){return n.standardFunctionAsync(e,r,((n,a,o)=>(fn(o=i(o),e,r),null===o[0]&&null===o[1]?null:null===o[0]?t(o[1]):null===o[1]?t(o[0]):O(o[0],o[1]))))},n.functions.clip=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,2,2,t,e),!(o[1]instanceof A)&&null!==o[1])throw new on(t,sn.InvalidParameter,e);if(null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return null===o[1]?null:q(o[0],o[1])}))},n.functions.cut=function(e,r){return n.standardFunctionAsync(e,r,((n,o,s)=>{if(s=i(s),a(s,2,2,e,r),!(s[1]instanceof rn)&&null!==s[1])throw new on(e,sn.InvalidParameter,r);if(null===s[0])return[];if(!(s[0]instanceof F))throw new on(e,sn.InvalidParameter,r);return null===s[1]?[t(s[0])]:J(s[0],s[1])}))},n.functions.area=function(t,r){return n.standardFunctionAsync(t,r,(async(n,o,s)=>{if(a(s,1,2,t,r),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumArea(e(d(s[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,r);return n}if(l(s[0])||u(s[0])){const n=m(s[0],t.spatialReference);return null===n?0:L(n,e(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,r);return L(s[0],e(d(s[1],-1)))}))},n.functions.areageodetic=function(t,r){return n.standardFunctionAsync(t,r,(async(n,o,s)=>{if(a(s,1,2,t,r),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumArea(e(d(s[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,r);return n}if(l(s[0])||u(s[0])){const n=m(s[0],t.spatialReference);return null===n?0:U(n,e(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,r);return U(s[0],e(d(s[1],-1)))}))},n.functions.length=function(t,e){return n.standardFunctionAsync(t,e,(async(n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumLength(r(d(s[1],-1)),!1,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,e);return n}if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:W(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return W(s[0],r(d(s[1],-1)))}))},n.functions.length3d=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:!0===n.hasZ?cn(n,r(d(s[1],-1))):W(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return!0===s[0].hasZ?cn(s[0],r(d(s[1],-1))):W(s[0],r(d(s[1],-1)))}))},n.functions.lengthgeodetic=function(t,e){return n.standardFunctionAsync(t,e,(async(n,o,s)=>{if(a(s,1,2,t,e),null===(s=i(s))[0])return 0;if(c(s[0])){const n=await s[0].sumLength(r(d(s[1],-1)),!0,t.abortSignal);if(t.abortSignal.aborted)throw new on(t,sn.Cancelled,e);return n}if(l(s[0])||u(s[0])){const n=w(s[0],t.spatialReference);return null===n?0:G(n,r(d(s[1],-1)))}if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return G(s[0],r(d(s[1],-1)))}))},n.functions.distance=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{s=i(s),a(s,2,3,t,e);let f=s[0];(l(s[0])||u(s[0]))&&(f=h(s[0],t.spatialReference));let c=s[1];if((l(s[1])||u(s[1]))&&(c=h(s[1],t.spatialReference)),!(f instanceof F))throw new on(t,sn.InvalidParameter,e);if(!(c instanceof F))throw new on(t,sn.InvalidParameter,e);return H(f,c,r(d(s[2],-1)))}))},n.functions.distancegeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{s=i(s),a(s,2,3,t,e);const l=s[0],u=s[1];if(!(l instanceof tn))throw new on(t,sn.InvalidParameter,e);if(!(u instanceof tn))throw new on(t,sn.InvalidParameter,e);const f=new rn({paths:[],spatialReference:l.spatialReference});return f.addPath([l,u]),G(f,r(d(s[2],-1)))}))},n.functions.densify=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,3,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);if(l<=0)throw new on(t,sn.InvalidParameter,e);return s[0]instanceof en||s[0]instanceof rn?K(s[0],l,r(d(s[2],-1))):s[0]instanceof A?K(un(s[0]),l,r(d(s[2],-1))):s[0]}))},n.functions.densifygeodetic=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,3,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);if(l<=0)throw new on(t,sn.InvalidParameter,e);return s[0]instanceof en||s[0]instanceof rn?T(s[0],l,r(d(s[2],-1))):s[0]instanceof A?T(un(s[0]),l,r(d(s[2],-1))):s[0]}))},n.functions.generalize=function(t,e){return n.standardFunctionAsync(t,e,((n,o,s)=>{if(s=i(s),a(s,2,4,t,e),null===s[0])return null;if(!(s[0]instanceof F))throw new on(t,sn.InvalidParameter,e);const l=y(s[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);return V(s[0],l,p(d(s[2],!0)),r(d(s[3],-1)))}))},n.functions.buffer=function(e,o){return n.standardFunctionAsync(e,o,((n,s,l)=>{if(l=i(l),a(l,2,3,e,o),null===l[0])return null;if(!(l[0]instanceof F))throw new on(e,sn.InvalidParameter,o);const u=y(l[1]);if(isNaN(u))throw new on(e,sn.InvalidParameter,o);return 0===u?t(l[0]):B(l[0],u,r(d(l[2],-1)))}))},n.functions.buffergeodetic=function(e,o){return n.standardFunctionAsync(e,o,((n,s,l)=>{if(l=i(l),a(l,2,3,e,o),null===l[0])return null;if(!(l[0]instanceof F))throw new on(e,sn.InvalidParameter,o);const u=y(l[1]);if(isNaN(u))throw new on(e,sn.InvalidParameter,o);return 0===u?t(l[0]):D(l[0],u,r(d(l[2],-1)))}))},n.functions.offset=function(t,e){return n.standardFunctionAsync(t,e,((n,o,l)=>{if(l=i(l),a(l,2,6,t,e),null===l[0])return null;if(!(l[0]instanceof en||l[0]instanceof rn))throw new on(t,sn.InvalidParameter,e);const u=y(l[1]);if(isNaN(u))throw new on(t,sn.InvalidParameter,e);const f=y(d(l[4],10));if(isNaN(f))throw new on(t,sn.InvalidParameter,e);const c=y(d(l[5],0));if(isNaN(c))throw new on(t,sn.InvalidParameter,e);return Q(l[0],u,r(d(l[2],-1)),s(d(l[3],"round")).toLowerCase(),f,c)}))},n.functions.rotate=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{o=i(o),a(o,2,3,t,e);let s=o[0];if(null===s)return null;if(!(s instanceof F))throw new on(t,sn.InvalidParameter,e);s instanceof A&&(s=en.fromExtent(s));const l=y(o[1]);if(isNaN(l))throw new on(t,sn.InvalidParameter,e);const u=d(o[2],null);if(null===u)return X(s,l);if(u instanceof tn)return X(s,l,u);throw new on(t,sn.InvalidParameter,e)}))},n.functions.centroid=function(e,r){return n.standardFunctionAsync(e,r,((n,o,s)=>{if(s=i(s),a(s,1,1,e,r),null===s[0])return null;let c=s[0];if((l(s[0])||u(s[0]))&&(c=h(s[0],e.spatialReference)),null===c)return null;if(!(c instanceof F))throw new on(e,sn.InvalidParameter,r);return c instanceof tn?f(t(s[0]),e.spatialReference):c instanceof en?c.centroid:c instanceof rn?g(c):c instanceof nn?P(c):c instanceof A?c.center:null}))},n.functions.multiparttosinglepart=function(e,r){return n.standardFunctionAsync(e,r,(async(n,o,s)=>{s=i(s),a(s,1,1,e,r);const l=[];if(null===s[0])return null;if(!(s[0]instanceof F))throw new on(e,sn.InvalidParameter,r);if(s[0]instanceof tn)return[f(t(s[0]),e.spatialReference)];if(s[0]instanceof A)return[f(t(s[0]),e.spatialReference)];const u=await Y(s[0]);if(u instanceof en){const n=[],t=[];for(let e=0;e<u.rings.length;e++)if(u.isClockwise(u.rings[e])){const t=an({rings:[u.rings[e]],hasZ:!0===u.hasZ,hazM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(t)}else t.push({ring:u.rings[e],pt:u.getPoint(e,0)});for(let e=0;e<t.length;e++)for(let r=0;r<n.length;r++)if(n[r].contains(t[e].pt)){n[r].addRing(t[e].ring);break}return n}if(u instanceof rn){const n=[];for(let t=0;t<u.paths.length;t++){const e=an({paths:[u.paths[t]],hasZ:!0===u.hasZ,hazM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(e)}return n}if(s[0]instanceof nn){const n=f(t(s[0]),e.spatialReference);for(let t=0;t<n.points.length;t++)l.push(n.getPoint(t));return l}return null}))},n.functions.issimple=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return!0;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return $(o[0])}))},n.functions.simplify=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return Y(o[0])}))},n.functions.convexhull=function(t,e){return n.standardFunctionAsync(t,e,((n,r,o)=>{if(o=i(o),a(o,1,1,t,e),null===o[0])return null;if(!(o[0]instanceof F))throw new on(t,sn.InvalidParameter,e);return _(o[0])}))})}export{dn as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import e from"../Dictionary.js";import n from"../Feature.js";import t from"../ImmutablePointArray.js";import{y as r,m as a,x as i,q as o,F as s,G as l,v as c,c as f,j as u,k as m,b as h,a as p,i as w,f as d,w as y,s as g,H as R}from"../../chunks/languageUtils.js";import I from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import P from"../../geometry/Multipoint.js";import x from"../../geometry/Point.js";import b from"../../geometry/Polygon.js";import F from"../../geometry/Polyline.js";import{angle2D as j,angleBetween2D as O,bearing2D as S,bearingBetween2D as N,pathsSelfIntersecting as k}from"./centroid.js";import{fromJSON as J}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as G,ExecutionErrorCodes as z}from"../executionError.js";import D from"../ImmutablePathArray.js";import{isClockwise as _}from"../../geometry/support/coordsUtils.js";function M(e){return e&&"esri.arcade.Feature"===e.arcadeDeclaredClass}function C(D,C){D.ringisclockwise=function(e,n){return C(e,n,((o,s,l)=>{r(l,1,1,e,n);let c=[],f=!1,u=!1;if(null===l[0])return!1;if(a(l[0])){for(const t of l[0]){if(!(t instanceof x))throw new G(e,z.InvalidParameter,n);c.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}c.length>0&&(f=l[0][0].hasZ,u=l[0][0].hasM)}else if(l[0]instanceof t)c=l[0]._elements,c.length>0&&(f=l[0]._hasZ,u=l[0]._hasM);else{if(!i(l[0]))throw new G(e,z.InvalidParameter,n);for(const t of l[0].toArray()){if(!(t instanceof x))throw new G(e,z.InvalidParameter,n);c.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}c.length>0&&(f=l[0].get(0).hasZ,u=l[0].get(0).hasM)}return!(c.length<3)&&_(c,u,f)}))},D.polygon=function(t,a){return C(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof b==!1)throw new G(t,z.InvalidParameter,a)}else f=c[0]instanceof b?J(c[0].toJSON()):o(new b(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(f)}))},D.polyline=function(t,a){return C(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof F==!1)throw new G(t,z.InvalidParameter,a)}else f=c[0]instanceof F?J(c[0].toJSON()):o(new F(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(f)}))},D.point=function(t,a){return C(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof x==!1)throw new G(t,z.InvalidParameter,a)}else f=c[0]instanceof x?J(c[0].toJSON()):o(new x(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(f)}))},D.multipoint=function(t,a){return C(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof P==!1)throw new G(t,z.InvalidParameter,a)}else f=c[0]instanceof P?J(c[0].toJSON()):o(new P(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(f)}))},D.extent=function(t,a){return C(t,a,((i,c,f)=>{f=l(f),r(f,1,1,t,a);let u=null;if(f[0]instanceof e)u=o(n.parseGeometryFromDictionary(f[0]),t.spatialReference);else if(f[0]instanceof x){const e={xmin:f[0].x,ymin:f[0].y,xmax:f[0].x,ymax:f[0].y,spatialReference:f[0].spatialReference.toJSON()},n=f[0];n.hasZ?(e.zmin=n.z,e.zmax=n.z):n.hasM&&(e.mmin=n.m,e.mmax=n.m),u=J(e)}else u=f[0]instanceof b||f[0]instanceof F||f[0]instanceof P?J(f[0].extent?.toJSON()):f[0]instanceof I?J(f[0].toJSON()):o(new I(JSON.parse(f[0])),t.spatialReference);if(null!==u&&!1===u.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(u)}))},D.geometry=function(t,a){return C(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(null===c[0])return null;if(f=M(c[0])?o(c[0].geometry(),t.spatialReference):c[0]instanceof e?o(n.parseGeometryFromDictionary(c[0]),t.spatialReference):o(J(JSON.parse(c[0])),t.spatialReference),null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new G(t,z.WrongSpatialReference,a);return s(f)}))},D.setgeometry=function(e,n){return C(e,n,((t,a,i)=>{if(r(i,2,2,e,n),!M(i[0]))throw new G(e,z.InvalidParameter,n);if(!0===i[0].immutable)throw new G(e,z.Immutable,n);if(!(i[1]instanceof v||null===i[1]))throw new G(e,z.InvalidParameter,n);return i[0]._geometry=i[1],c}))},D.feature=function(t,r){return C(t,r,((a,i,s)=>{if(0===s.length)throw new G(t,z.WrongNumberOfParameters,r);let l=null;if(1===s.length)if(f(s[0]))l=n.fromJson(JSON.parse(s[0]));else if(M(s[0]))l=n.createFromArcadeFeature(s[0]);else if(s[0]instanceof v)l=n.createFromGraphicLikeObject(s[0],null,null);else{if(!(s[0]instanceof e))throw new G(t,z.InvalidParameter,r);{let t=s[0].hasField("geometry")?s[0].field("geometry"):null,r=s[0].hasField("attributes")?s[0].field("attributes"):null;null!==t&&t instanceof e&&(t=n.parseGeometryFromDictionary(t)),null!==r&&(r=n.parseAttributesFromDictionary(r)),l=n.createFromGraphicLikeObject(t,r,null)}}else if(2===s.length){let a=null,i=null;if(null!==s[0])if(s[0]instanceof v)a=s[0];else{if(!(a instanceof e))throw new G(t,z.InvalidParameter,r);a=n.parseGeometryFromDictionary(s[0])}if(null!==s[1]){if(!(s[1]instanceof e))throw new G(t,z.InvalidParameter,r);i=n.parseAttributesFromDictionary(s[1])}l=n.createFromGraphicLikeObject(a,i,null)}else{let a=null;const i={};if(null!==s[0])if(s[0]instanceof v)a=s[0];else{if(!(a instanceof e))throw new G(t,z.InvalidParameter,r);a=n.parseGeometryFromDictionary(s[0])}for(let e=1;e<s.length;e+=2){const n=u(s[e]),a=s[e+1];if(!(null==a||f(a)||isNaN(a)||m(a)||h(a)||p(a)))throw new G(t,z.InvalidParameter,r);if(w(a)||!1===d(a))throw new G(t,z.InvalidParameter,r);i[n]=a===c?null:a}l=n.createFromGraphicLikeObject(a,i,null)}return l._geometry=o(l.geometry(),t.spatialReference),l.immutable=!1,l}))},D.dictionary=function(n,t){return C(n,t,((r,o,s)=>{if(0===s.length){const n=new e;return n.immutable=!1,n}if(1===s.length&&f(s[0]))try{const n=JSON.parse(s[0]),t=e.convertObjectToArcadeDictionary(n,!1);return t.immutable=!1,t}catch(y){throw new G(n,z.InvalidParameter,t)}if(s.length%2!=0)throw new G(n,z.WrongNumberOfParameters,t);const l={};for(let e=0;e<s.length;e+=2){const r=u(s[e]),o=s[e+1];if(!(null==o||f(o)||isNaN(o)||m(o)||h(o)||p(o)||a(o)||i(o)))throw new G(n,z.InvalidParameter,t);if(w(o))throw new G(n,z.InvalidParameter,t);l[r]=o===c?null:o}const d=new e(l);return d.immutable=!1,d}))},D.haskey=function(n,t){return C(n,t,((a,i,o)=>{r(o,2,2,n,t);const s=u(o[1]);if(M(o[0]))return o[0].hasField(s);if(o[0]instanceof e)return o[0].hasField(s);if(o[0]instanceof v){const e=W(o[0],s,null,null,2);return!e||"notfound"!==e.keystate}throw new G(n,z.InvalidParameter,t)}))},D.hasvalue=function(n,t){return C(n,t,((a,i,o)=>{if(r(o,2,2,n,t),null===o[0]||null===o[1])return!1;const s=u(o[1]);if(y(o[0]))return!!o[0].hasField(s)&&null!==o[0].field(s);if(o[0]instanceof e)return!!o[0].hasField(s)&&null!==o[0].field(s);if(o[0]instanceof v){return null!==W(o[0],s,null,null,0)}return!1}))},D.indexof=function(e,n){return C(e,n,((t,o,s)=>{r(s,2,2,e,n);const l=s[1];if(a(s[0])){for(let e=0;e<s[0].length;e++)if(g(l,s[0][e]))return e;return-1}if(i(s[0])){const e=s[0].length();for(let n=0;n<e;n++)if(g(l,s[0].get(n)))return n;return-1}throw new G(e,z.InvalidParameter,n)}))},D.angle=function(e,n){return C(e,n,((t,a,i)=>{if(i=l(i),r(i,2,3,e,n),!(i[0]instanceof x))throw new G(e,z.InvalidParameter,n);if(!(i[1]instanceof x))throw new G(e,z.InvalidParameter,n);if(i.length>2&&!(i[2]instanceof x))throw new G(e,z.InvalidParameter,n);return 2===i.length?j(i[0],i[1]):O(i[0],i[1],i[2])}))},D.bearing=function(e,n){return C(e,n,((t,a,i)=>{if(i=l(i),r(i,2,3,e,n),!(i[0]instanceof x))throw new G(e,z.InvalidParameter,n);if(!(i[1]instanceof x))throw new G(e,z.InvalidParameter,n);if(i.length>2&&!(i[2]instanceof x))throw new G(e,z.InvalidParameter,n);return 2===i.length?S(i[0],i[1]):N(i[0],i[1],i[2])}))},D.isselfintersecting=function(e,n){return C(e,n,((t,o,s)=>{s=l(s),r(s,1,1,e,n);let c=s[0];if(c instanceof b)return c.isSelfIntersecting;if(c instanceof F)return c=c.paths,k(c);if(c instanceof P){const e=c.points;for(let n=0;n<e.length;n++)for(let t=0;t<e.length;t++)if(t!==n){let r=!0;for(let a=0;a<e[n].length;a++)if(e[n][a]!==e[t][a]){r=!1;break}if(!0===r)return!0}}return!(!a(c)&&!i(c))&&(c=R(c,e.spatialReference),null!==c&&(c=c.paths),k(c))}))}}let Z=0;function W(n,r,a,i,o=1){let s;switch(r=r.toLowerCase()){case"hasz":{const e=n.hasZ;return void 0!==e&&e}case"hasm":{const e=n.hasM;return void 0!==e&&e}case"spatialreference":{let t=n.spatialReference._arcadeCacheId;if(void 0===t){let e=!0;Object.freeze&&Object.isFrozen(n.spatialReference)&&(e=!1),e&&(Z++,n.spatialReference._arcadeCacheId=Z,t=Z)}const r=new e({wkt:n.spatialReference.wkt,wkid:n.spatialReference.wkid});return void 0!==t&&(r._arcadeCacheId="SPREF"+t.toString()),r}}switch(n.type){case"extent":switch(r){case"xmin":case"xmax":case"ymin":case"ymax":case"zmin":case"zmax":case"mmin":case"mmax":{const e=n[r];return void 0!==e?e:null}case"type":return"Extent"}break;case"polygon":switch(r){case"rings":s=n.cache._arcadeCacheId,void 0===s&&(Z++,s=Z,n.cache._arcadeCacheId=s);return new D(n.rings,n.spatialReference,!0===n.hasZ,!0===n.hasM,s);case"type":return"Polygon"}break;case"point":switch(r){case"x":case"y":case"z":case"m":return void 0!==n[r]?n[r]:null;case"type":return"Point"}break;case"polyline":switch(r){case"paths":s=n.cache._arcadeCacheId,void 0===s&&(Z++,s=Z,n.cache._arcadeCacheId=s);return new D(n.paths,n.spatialReference,!0===n.hasZ,!0===n.hasM,s);case"type":return"Polyline"}break;case"multipoint":switch(r){case"points":s=n.cache._arcadeCacheId,void 0===s&&(Z++,s=Z,n.cache._arcadeCacheId=s);return new t(n.points,n.spatialReference,!0===n.hasZ,!0===n.hasM,s,1);case"type":return"Multipoint"}}if(1===o)throw new G(a,z.InvalidIdentifier,i);return 2===o?{keystate:"notfound"}:null}export{W as geometryMember,C as registerFunctions};
5
+ import e from"../Dictionary.js";import n from"../Feature.js";import t from"../ImmutablePointArray.js";import{y as r,m as a,x as i,q as o,F as s,G as l,v as c,c as f,j as u,k as m,b as h,a as p,i as w,f as d,C as y,w as g,s as R,H as I}from"../../chunks/languageUtils.js";import v from"../../geometry/Extent.js";import P from"../../geometry/Geometry.js";import x from"../../geometry/Multipoint.js";import b from"../../geometry/Point.js";import F from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{angle2D as O,angleBetween2D as S,bearing2D as N,bearingBetween2D as k,pathsSelfIntersecting as J}from"./centroid.js";import{fromJSON as G}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as z,ExecutionErrorCodes as D}from"../executionError.js";import _ from"../ImmutablePathArray.js";import{isClockwise as C}from"../../geometry/support/coordsUtils.js";function M(e){return e&&"esri.arcade.Feature"===e.arcadeDeclaredClass}function Z(_,Z){_.ringisclockwise=function(e,n){return Z(e,n,((o,s,l)=>{r(l,1,1,e,n);let c=[],f=!1,u=!1;if(null===l[0])return!1;if(a(l[0])){for(const t of l[0]){if(!(t instanceof b))throw new z(e,D.InvalidParameter,n);c.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}c.length>0&&(f=l[0][0].hasZ,u=l[0][0].hasM)}else if(l[0]instanceof t)c=l[0]._elements,c.length>0&&(f=l[0]._hasZ,u=l[0]._hasM);else{if(!i(l[0]))throw new z(e,D.InvalidParameter,n);for(const t of l[0].toArray()){if(!(t instanceof b))throw new z(e,D.InvalidParameter,n);c.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}c.length>0&&(f=l[0].get(0).hasZ,u=l[0].get(0).hasM)}return!(c.length<3)&&C(c,u,f)}))},_.polygon=function(t,a){return Z(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof F==!1)throw new z(t,D.InvalidParameter,a)}else f=c[0]instanceof F?G(c[0].toJSON()):o(new F(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(f)}))},_.polyline=function(t,a){return Z(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof j==!1)throw new z(t,D.InvalidParameter,a)}else f=c[0]instanceof j?G(c[0].toJSON()):o(new j(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(f)}))},_.point=function(t,a){return Z(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof b==!1)throw new z(t,D.InvalidParameter,a)}else f=c[0]instanceof b?G(c[0].toJSON()):o(new b(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(f)}))},_.multipoint=function(t,a){return Z(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(c[0]instanceof e){if(f=o(n.parseGeometryFromDictionary(c[0]),t.spatialReference),f instanceof x==!1)throw new z(t,D.InvalidParameter,a)}else f=c[0]instanceof x?G(c[0].toJSON()):o(new x(JSON.parse(c[0])),t.spatialReference);if(null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(f)}))},_.extent=function(t,a){return Z(t,a,((i,c,f)=>{f=l(f),r(f,1,1,t,a);let u=null;if(f[0]instanceof e)u=o(n.parseGeometryFromDictionary(f[0]),t.spatialReference);else if(f[0]instanceof b){const e={xmin:f[0].x,ymin:f[0].y,xmax:f[0].x,ymax:f[0].y,spatialReference:f[0].spatialReference.toJSON()},n=f[0];n.hasZ?(e.zmin=n.z,e.zmax=n.z):n.hasM&&(e.mmin=n.m,e.mmax=n.m),u=G(e)}else u=f[0]instanceof F||f[0]instanceof j||f[0]instanceof x?G(f[0].extent?.toJSON()):f[0]instanceof v?G(f[0].toJSON()):o(new v(JSON.parse(f[0])),t.spatialReference);if(null!==u&&!1===u.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(u)}))},_.geometry=function(t,a){return Z(t,a,((i,l,c)=>{r(c,1,1,t,a);let f=null;if(null===c[0])return null;if(f=M(c[0])?o(c[0].geometry(),t.spatialReference):c[0]instanceof e?o(n.parseGeometryFromDictionary(c[0]),t.spatialReference):o(G(JSON.parse(c[0])),t.spatialReference),null!==f&&!1===f.spatialReference.equals(t.spatialReference))throw new z(t,D.WrongSpatialReference,a);return s(f)}))},_.setgeometry=function(e,n){return Z(e,n,((t,a,i)=>{if(r(i,2,2,e,n),!M(i[0]))throw new z(e,D.InvalidParameter,n);if(!0===i[0].immutable)throw new z(e,D.Immutable,n);if(!(i[1]instanceof P||null===i[1]))throw new z(e,D.InvalidParameter,n);return i[0]._geometry=i[1],c}))},_.feature=function(t,r){return Z(t,r,((a,i,s)=>{if(0===s.length)throw new z(t,D.WrongNumberOfParameters,r);let l=null;if(1===s.length)if(f(s[0]))l=n.fromJson(JSON.parse(s[0]));else if(M(s[0]))l=n.createFromArcadeFeature(s[0]);else if(s[0]instanceof P)l=n.createFromGraphicLikeObject(s[0],null,null);else{if(!(s[0]instanceof e))throw new z(t,D.InvalidParameter,r);{let t=s[0].hasField("geometry")?s[0].field("geometry"):null,r=s[0].hasField("attributes")?s[0].field("attributes"):null;null!==t&&t instanceof e&&(t=n.parseGeometryFromDictionary(t)),null!==r&&(r=n.parseAttributesFromDictionary(r)),l=n.createFromGraphicLikeObject(t,r,null)}}else if(2===s.length){let a=null,i=null;if(null!==s[0])if(s[0]instanceof P)a=s[0];else{if(!(a instanceof e))throw new z(t,D.InvalidParameter,r);a=n.parseGeometryFromDictionary(s[0])}if(null!==s[1]){if(!(s[1]instanceof e))throw new z(t,D.InvalidParameter,r);i=n.parseAttributesFromDictionary(s[1])}l=n.createFromGraphicLikeObject(a,i,null)}else{let a=null;const i={};if(null!==s[0])if(s[0]instanceof P)a=s[0];else{if(!(a instanceof e))throw new z(t,D.InvalidParameter,r);a=n.parseGeometryFromDictionary(s[0])}for(let e=1;e<s.length;e+=2){const n=u(s[e]),a=s[e+1];if(!(null==a||f(a)||isNaN(a)||m(a)||h(a)||p(a)))throw new z(t,D.InvalidParameter,r);if(w(a)||!1===d(a))throw new z(t,D.InvalidParameter,r);i[n]=a===c?null:a}l=n.createFromGraphicLikeObject(a,i,null)}return l._geometry=o(l.geometry(),t.spatialReference),l.immutable=!1,l}))},_.dictionary=function(n,t){return Z(n,t,((r,o,s)=>{if(0===s.length){const n=new e;return n.immutable=!1,n}if(1===s.length&&f(s[0]))try{const t=JSON.parse(s[0]),r=e.convertObjectToArcadeDictionary(t,y(n),!1);return r.immutable=!1,r}catch(g){throw new z(n,D.InvalidParameter,t)}if(s.length%2!=0)throw new z(n,D.WrongNumberOfParameters,t);const l={};for(let e=0;e<s.length;e+=2){const r=u(s[e]),o=s[e+1];if(!(null==o||f(o)||isNaN(o)||m(o)||h(o)||p(o)||a(o)||i(o)))throw new z(n,D.InvalidParameter,t);if(w(o))throw new z(n,D.InvalidParameter,t);l[r]=o===c?null:o}const d=new e(l);return d.immutable=!1,d}))},_.haskey=function(n,t){return Z(n,t,((a,i,o)=>{r(o,2,2,n,t);const s=u(o[1]);if(M(o[0]))return o[0].hasField(s);if(o[0]instanceof e)return o[0].hasField(s);if(o[0]instanceof P){const e=q(o[0],s,null,null,2);return!e||"notfound"!==e.keystate}throw new z(n,D.InvalidParameter,t)}))},_.hasvalue=function(n,t){return Z(n,t,((a,i,o)=>{if(r(o,2,2,n,t),null===o[0]||null===o[1])return!1;const s=u(o[1]);if(g(o[0]))return!!o[0].hasField(s)&&null!==o[0].field(s);if(o[0]instanceof e)return!!o[0].hasField(s)&&null!==o[0].field(s);if(o[0]instanceof P){return null!==q(o[0],s,null,null,0)}return!1}))},_.indexof=function(e,n){return Z(e,n,((t,o,s)=>{r(s,2,2,e,n);const l=s[1];if(a(s[0])){for(let e=0;e<s[0].length;e++)if(R(l,s[0][e]))return e;return-1}if(i(s[0])){const e=s[0].length();for(let n=0;n<e;n++)if(R(l,s[0].get(n)))return n;return-1}throw new z(e,D.InvalidParameter,n)}))},_.angle=function(e,n){return Z(e,n,((t,a,i)=>{if(i=l(i),r(i,2,3,e,n),!(i[0]instanceof b))throw new z(e,D.InvalidParameter,n);if(!(i[1]instanceof b))throw new z(e,D.InvalidParameter,n);if(i.length>2&&!(i[2]instanceof b))throw new z(e,D.InvalidParameter,n);return 2===i.length?O(i[0],i[1]):S(i[0],i[1],i[2])}))},_.bearing=function(e,n){return Z(e,n,((t,a,i)=>{if(i=l(i),r(i,2,3,e,n),!(i[0]instanceof b))throw new z(e,D.InvalidParameter,n);if(!(i[1]instanceof b))throw new z(e,D.InvalidParameter,n);if(i.length>2&&!(i[2]instanceof b))throw new z(e,D.InvalidParameter,n);return 2===i.length?N(i[0],i[1]):k(i[0],i[1],i[2])}))},_.isselfintersecting=function(e,n){return Z(e,n,((t,o,s)=>{s=l(s),r(s,1,1,e,n);let c=s[0];if(c instanceof F)return c.isSelfIntersecting;if(c instanceof j)return c=c.paths,J(c);if(c instanceof x){const e=c.points;for(let n=0;n<e.length;n++)for(let t=0;t<e.length;t++)if(t!==n){let r=!0;for(let a=0;a<e[n].length;a++)if(e[n][a]!==e[t][a]){r=!1;break}if(!0===r)return!0}}return!(!a(c)&&!i(c))&&(c=I(c,e.spatialReference),null!==c&&(c=c.paths),J(c))}))}}let W=0;function q(n,r,a,i,o=1){let s;switch(r=r.toLowerCase()){case"hasz":{const e=n.hasZ;return void 0!==e&&e}case"hasm":{const e=n.hasM;return void 0!==e&&e}case"spatialreference":{let t=n.spatialReference._arcadeCacheId;if(void 0===t){let e=!0;Object.freeze&&Object.isFrozen(n.spatialReference)&&(e=!1),e&&(W++,n.spatialReference._arcadeCacheId=W,t=W)}const r=new e({wkt:n.spatialReference.wkt,wkid:n.spatialReference.wkid});return void 0!==t&&(r._arcadeCacheId="SPREF"+t.toString()),r}}switch(n.type){case"extent":switch(r){case"xmin":case"xmax":case"ymin":case"ymax":case"zmin":case"zmax":case"mmin":case"mmax":{const e=n[r];return void 0!==e?e:null}case"type":return"Extent"}break;case"polygon":switch(r){case"rings":s=n.cache._arcadeCacheId,void 0===s&&(W++,s=W,n.cache._arcadeCacheId=s);return new _(n.rings,n.spatialReference,!0===n.hasZ,!0===n.hasM,s);case"type":return"Polygon"}break;case"point":switch(r){case"x":case"y":case"z":case"m":return void 0!==n[r]?n[r]:null;case"type":return"Point"}break;case"polyline":switch(r){case"paths":s=n.cache._arcadeCacheId,void 0===s&&(W++,s=W,n.cache._arcadeCacheId=s);return new _(n.paths,n.spatialReference,!0===n.hasZ,!0===n.hasM,s);case"type":return"Polyline"}break;case"multipoint":switch(r){case"points":s=n.cache._arcadeCacheId,void 0===s&&(W++,s=W,n.cache._arcadeCacheId=s);return new t(n.points,n.spatialReference,!0===n.hasZ,!0===n.hasM,s,1);case"type":return"Multipoint"}}if(1===o)throw new z(a,D.InvalidIdentifier,i);return 2===o?{keystate:"notfound"}:null}export{q as geometryMember,Z as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{version as n}from"../../kernel.js";import{cloneGeometry as e,convertSquareUnitsToCode as t,convertLinearUnitsToCode as r}from"../kernel.js";import{G as i,y as a,k as l,j as o,m as f,x as s,q as u,J as c,A as m,H as h,K as w,g as p,h as d}from"../../chunks/languageUtils.js";import{centroidPolyline as g,centroidMultiPoint as P,getMetersPerVerticalUnitForSR as v,segmentLength3d as I}from"./centroid.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Geometry.js";import x from"../../geometry/Multipoint.js";import N from"../../geometry/Point.js";import j from"../../geometry/Polygon.js";import L from"../../geometry/Polyline.js";import{fromJSON as k}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as M,ExecutionErrorCodes as Z}from"../executionError.js";import{getMetersPerUnitForSR as b}from"../../core/unitUtils.js";let A=null;function z(e){return 0===n.indexOf("4.")?j.fromExtent(e):new j({spatialReference:e.spatialReference,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}function E(n){A=n}function O(n,e){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let t=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){t=v(n.spatialReference)/b(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],t);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],t);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=I(a[0],a[a.length-1],t))}else"extent"===n.type&&(r+=2*I([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],t),r+=2*I([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],t),r*=2,r+=4*Math.abs(m(n.zmax,0)*t-m(n.zmin,0)*t));const i=new L({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return A.planarLength(i,e)}function q(n,v){function I(n,e,t){if(a(t,2,2,n,e),t[0]instanceof R&&t[1]instanceof R);else if(t[0]instanceof R&&null===t[1]);else if(t[1]instanceof R&&null===t[0]);else if(null!==t[0]||null!==t[1])throw new M(n,Z.InvalidParameter,e)}n.disjoint=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null===a[0]||null===a[1]||A.disjoint(a[0],a[1]))))},n.intersects=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.intersects(a[0],a[1]))))},n.touches=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.touches(a[0],a[1]))))},n.crosses=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.crosses(a[0],a[1]))))},n.within=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.within(a[0],a[1]))))},n.contains=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.contains(a[0],a[1]))))},n.overlaps=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.overlaps(a[0],a[1]))))},n.equals=function(n,e){return v(n,e,((t,r,i)=>(a(i,2,2,n,e),i[0]===i[1]||(i[0]instanceof R&&i[1]instanceof R?A.equals(i[0],i[1]):!(!l(i[0])||!l(i[1]))&&i[0].getTime()===i[1].getTime()))))},n.relate=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,3,3,n,e),l[0]instanceof R&&l[1]instanceof R)return A.relate(l[0],l[1],o(l[2]));if(l[0]instanceof R&&null===l[1])return!1;if(l[1]instanceof R&&null===l[0])return!1;if(null===l[0]&&null===l[1])return!1;throw new M(n,Z.InvalidParameter,e)}))},n.intersection=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null===a[0]||null===a[1]?null:A.intersect(a[0],a[1]))))},n.union=function(n,t){return v(n,t,((r,a,l)=>{const o=[];if(0===(l=i(l)).length)throw new M(n,Z.WrongNumberOfParameters,t);if(1===l.length)if(f(l[0])){const e=i(l[0]);for(let r=0;r<e.length;r++)if(null!==e[r]){if(!(e[r]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(e[r])}}else{if(!s(l[0])){if(l[0]instanceof R)return u(e(l[0]),n.spatialReference);if(null===l[0])return null;throw new M(n,Z.InvalidParameter,t)}{const e=i(l[0].toArray());for(let r=0;r<e.length;r++)if(null!==e[r]){if(!(e[r]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(e[r])}}}else for(let e=0;e<l.length;e++)if(null!==l[e]){if(!(l[e]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(l[e])}return 0===o.length?null:A.union(o)}))},n.difference=function(n,t){return v(n,t,((r,a,l)=>(l=i(l),I(n,t,l),null!==l[0]&&null===l[1]?e(l[0]):null===l[0]?null:A.difference(l[0],l[1]))))},n.symmetricdifference=function(n,t){return v(n,t,((r,a,l)=>(l=i(l),I(n,t,l),null===l[0]&&null===l[1]?null:null===l[0]?e(l[1]):null===l[1]?e(l[0]):A.symmetricDifference(l[0],l[1]))))},n.clip=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,2,2,n,e),!(l[1]instanceof y)&&null!==l[1])throw new M(n,Z.InvalidParameter,e);if(null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return null===l[1]?null:A.clip(l[0],l[1])}))},n.cut=function(n,t){return v(n,t,((r,l,o)=>{if(o=i(o),a(o,2,2,n,t),!(o[1]instanceof L)&&null!==o[1])throw new M(n,Z.InvalidParameter,t);if(null===o[0])return[];if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,t);return null===o[1]?[e(o[0])]:A.cut(o[0],o[1])}))},n.area=function(n,e){return v(n,e,((r,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=c(o[0],n.spatialReference);return null===e?0:A.planarArea(e,t(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.planarArea(o[0],t(m(o[1],-1)))}))},n.areageodetic=function(n,e){return v(n,e,((r,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=c(o[0],n.spatialReference);return null===e?0:A.geodesicArea(e,t(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.geodesicArea(o[0],t(m(o[1],-1)))}))},n.length=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:A.planarLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.planarLength(o[0],r(m(o[1],-1)))}))},n.length3d=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:!0===e.hasZ?O(e,r(m(o[1],-1))):A.planarLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return!0===o[0].hasZ?O(o[0],r(m(o[1],-1))):A.planarLength(o[0],r(m(o[1],-1)))}))},n.lengthgeodetic=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:A.geodesicLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.geodesicLength(o[0],r(m(o[1],-1)))}))},n.distance=function(n,e){return v(n,e,((t,l,o)=>{o=i(o),a(o,2,3,n,e);let u=o[0];(f(o[0])||s(o[0]))&&(u=w(o[0],n.spatialReference));let c=o[1];if((f(o[1])||s(o[1]))&&(c=w(o[1],n.spatialReference)),!(u instanceof R))throw new M(n,Z.InvalidParameter,e);if(!(c instanceof R))throw new M(n,Z.InvalidParameter,e);return A.distance(u,c,r(m(o[2],-1)))}))},n.distancegeodetic=function(n,e){return v(n,e,((t,l,o)=>{o=i(o),a(o,2,3,n,e);const f=o[0],s=o[1];if(!(f instanceof N))throw new M(n,Z.InvalidParameter,e);if(!(s instanceof N))throw new M(n,Z.InvalidParameter,e);const u=new L({paths:[],spatialReference:f.spatialReference});return u.addPath([f,s]),A.geodesicLength(u,r(m(o[2],-1)))}))},n.densify=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,3,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);if(f<=0)throw new M(n,Z.InvalidParameter,e);return o[0]instanceof j||o[0]instanceof L?A.densify(o[0],f,r(m(o[2],-1))):o[0]instanceof y?A.densify(z(o[0]),f,r(m(o[2],-1))):o[0]}))},n.densifygeodetic=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,3,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);if(f<=0)throw new M(n,Z.InvalidParameter,e);return o[0]instanceof j||o[0]instanceof L?A.geodesicDensify(o[0],f,r(m(o[2],-1))):o[0]instanceof y?A.geodesicDensify(z(o[0]),f,r(m(o[2],-1))):o[0]}))},n.generalize=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,4,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);return A.generalize(o[0],f,d(m(o[2],!0)),r(m(o[3],-1)))}))},n.buffer=function(n,t){return v(n,t,((l,o,f)=>{if(f=i(f),a(f,2,3,n,t),null===f[0])return null;if(!(f[0]instanceof R))throw new M(n,Z.InvalidParameter,t);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,t);return 0===s?e(f[0]):A.buffer(f[0],s,r(m(f[2],-1)))}))},n.buffergeodetic=function(n,t){return v(n,t,((l,o,f)=>{if(f=i(f),a(f,2,3,n,t),null===f[0])return null;if(!(f[0]instanceof R))throw new M(n,Z.InvalidParameter,t);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,t);return 0===s?e(f[0]):A.geodesicBuffer(f[0],s,r(m(f[2],-1)))}))},n.offset=function(n,e){return v(n,e,((t,l,f)=>{if(f=i(f),a(f,2,6,n,e),null===f[0])return null;if(!(f[0]instanceof j||f[0]instanceof L))throw new M(n,Z.InvalidParameter,e);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,e);const u=p(m(f[4],10));if(isNaN(u))throw new M(n,Z.InvalidParameter,e);const c=p(m(f[5],0));if(isNaN(c))throw new M(n,Z.InvalidParameter,e);return A.offset(f[0],s,r(m(f[2],-1)),o(m(f[3],"round")).toLowerCase(),u,c)}))},n.rotate=function(n,e){return v(n,e,((t,r,l)=>{l=i(l),a(l,2,3,n,e);let o=l[0];if(null===o)return null;if(!(o instanceof R))throw new M(n,Z.InvalidParameter,e);o instanceof y&&(o=j.fromExtent(o));const f=p(l[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);const s=m(l[2],null);if(null===s)return A.rotate(o,f);if(s instanceof N)return A.rotate(o,f,s);throw new M(n,Z.InvalidParameter,e)}))},n.centroid=function(n,t){return v(n,t,((r,l,o)=>{if(o=i(o),a(o,1,1,n,t),null===o[0])return null;let c=o[0];if((f(o[0])||s(o[0]))&&(c=w(o[0],n.spatialReference)),null===c)return null;if(!(c instanceof R))throw new M(n,Z.InvalidParameter,t);return c instanceof N?u(e(o[0]),n.spatialReference):c instanceof j?c.centroid:c instanceof L?g(c):c instanceof x?P(c):c instanceof y?c.center:null}))},n.multiparttosinglepart=function(n,t){return v(n,t,((r,l,o)=>{o=i(o),a(o,1,1,n,t);const f=[];if(null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,t);if(o[0]instanceof N)return[u(e(o[0]),n.spatialReference)];if(o[0]instanceof y)return[u(e(o[0]),n.spatialReference)];const s=A.simplify(o[0]);if(s instanceof j){const n=[],e=[];for(let t=0;t<s.rings.length;t++)if(s.isClockwise(s.rings[t])){const e=k({rings:[s.rings[t]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(e)}else e.push({ring:s.rings[t],pt:s.getPoint(t,0)});for(let t=0;t<e.length;t++)for(let r=0;r<n.length;r++)if(n[r].contains(e[t].pt)){n[r].addRing(e[t].ring);break}return n}if(s instanceof L){const n=[];for(let e=0;e<s.paths.length;e++){const t=k({paths:[s.paths[e]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(t)}return n}if(o[0]instanceof x){const t=u(e(o[0]),n.spatialReference);for(let n=0;n<t.points.length;n++)f.push(t.getPoint(n));return f}return null}))},n.issimple=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return!0;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.isSimple(l[0])}))},n.simplify=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.simplify(l[0])}))},n.convexhull=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.convexHull(l[0])}))}}export{q as registerFunctions,E as setGeometryEngine};
5
+ import{version as n}from"../../kernel.js";import{cloneGeometry as e,convertSquareUnitsToCode as t,convertLinearUnitsToCode as r}from"../kernel.js";import{G as i,y as a,k as l,j as o,m as f,x as s,q as u,J as c,A as m,H as h,K as w,g as p,h as d}from"../../chunks/languageUtils.js";import{centroidPolyline as g,centroidMultiPoint as P,getMetersPerVerticalUnitForSR as v,segmentLength3d as I}from"./centroid.js";import y from"../../geometry/Extent.js";import R from"../../geometry/Geometry.js";import x from"../../geometry/Multipoint.js";import N from"../../geometry/Point.js";import j from"../../geometry/Polygon.js";import L from"../../geometry/Polyline.js";import{fromJSON as k}from"../../geometry/support/jsonUtils.js";import{ArcadeExecutionError as M,ExecutionErrorCodes as Z}from"../executionError.js";import{getMetersPerUnitForSR as b}from"../../core/unitUtils.js";let A=null;function q(e){return 0===n.indexOf("4.")?j.fromExtent(e):new j({spatialReference:e.spatialReference,rings:[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}function z(n){A=n}function E(n,e){if("polygon"!==n.type&&"polyline"!==n.type&&"extent"!==n.type)return 0;let t=1;if(n.spatialReference.vcsWkid||n.spatialReference.latestVcsWkid){t=v(n.spatialReference)/b(n.spatialReference)}let r=0;if("polyline"===n.type)for(const a of n.paths)for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],t);else if("polygon"===n.type)for(const a of n.rings){for(let n=1;n<a.length;n++)r+=I(a[n],a[n-1],t);(a[0][0]!==a[a.length-1][0]||a[0][1]!==a[a.length-1][1]||void 0!==a[0][2]&&a[0][2]!==a[a.length-1][2])&&(r+=I(a[0],a[a.length-1],t))}else"extent"===n.type&&(r+=2*I([n.xmin,n.ymin,0],[n.xmax,n.ymin,0],t),r+=2*I([n.xmin,n.ymin,0],[n.xmin,n.ymax,0],t),r*=2,r+=4*Math.abs(m(n.zmax,0)*t-m(n.zmin,0)*t));const i=new L({hasZ:!1,hasM:!1,spatialReference:n.spatialReference,paths:[[0,0],[0,r]]});return A.planarLength(i,e)}function O(n,v){function I(n,e,t){if(a(t,2,2,n,e),t[0]instanceof R&&t[1]instanceof R);else if(t[0]instanceof R&&null===t[1]);else if(t[1]instanceof R&&null===t[0]);else if(null!==t[0]||null!==t[1])throw new M(n,Z.InvalidParameter,e)}n.disjoint=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null===a[0]||null===a[1]||A.disjoint(a[0],a[1]))))},n.intersects=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.intersects(a[0],a[1]))))},n.touches=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.touches(a[0],a[1]))))},n.crosses=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.crosses(a[0],a[1]))))},n.within=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.within(a[0],a[1]))))},n.contains=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.contains(a[0],a[1]))))},n.overlaps=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null!==a[0]&&null!==a[1]&&A.overlaps(a[0],a[1]))))},n.equals=function(n,e){return v(n,e,((t,r,i)=>(a(i,2,2,n,e),i[0]===i[1]||(i[0]instanceof R&&i[1]instanceof R?A.equals(i[0],i[1]):!(!l(i[0])||!l(i[1]))&&i[0].equals(i[1])))))},n.relate=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,3,3,n,e),l[0]instanceof R&&l[1]instanceof R)return A.relate(l[0],l[1],o(l[2]));if(l[0]instanceof R&&null===l[1])return!1;if(l[1]instanceof R&&null===l[0])return!1;if(null===l[0]&&null===l[1])return!1;throw new M(n,Z.InvalidParameter,e)}))},n.intersection=function(n,e){return v(n,e,((t,r,a)=>(a=i(a),I(n,e,a),null===a[0]||null===a[1]?null:A.intersect(a[0],a[1]))))},n.union=function(n,t){return v(n,t,((r,a,l)=>{const o=[];if(0===(l=i(l)).length)throw new M(n,Z.WrongNumberOfParameters,t);if(1===l.length)if(f(l[0])){const e=i(l[0]);for(let r=0;r<e.length;r++)if(null!==e[r]){if(!(e[r]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(e[r])}}else{if(!s(l[0])){if(l[0]instanceof R)return u(e(l[0]),n.spatialReference);if(null===l[0])return null;throw new M(n,Z.InvalidParameter,t)}{const e=i(l[0].toArray());for(let r=0;r<e.length;r++)if(null!==e[r]){if(!(e[r]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(e[r])}}}else for(let e=0;e<l.length;e++)if(null!==l[e]){if(!(l[e]instanceof R))throw new M(n,Z.InvalidParameter,t);o.push(l[e])}return 0===o.length?null:A.union(o)}))},n.difference=function(n,t){return v(n,t,((r,a,l)=>(l=i(l),I(n,t,l),null!==l[0]&&null===l[1]?e(l[0]):null===l[0]?null:A.difference(l[0],l[1]))))},n.symmetricdifference=function(n,t){return v(n,t,((r,a,l)=>(l=i(l),I(n,t,l),null===l[0]&&null===l[1]?null:null===l[0]?e(l[1]):null===l[1]?e(l[0]):A.symmetricDifference(l[0],l[1]))))},n.clip=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,2,2,n,e),!(l[1]instanceof y)&&null!==l[1])throw new M(n,Z.InvalidParameter,e);if(null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return null===l[1]?null:A.clip(l[0],l[1])}))},n.cut=function(n,t){return v(n,t,((r,l,o)=>{if(o=i(o),a(o,2,2,n,t),!(o[1]instanceof L)&&null!==o[1])throw new M(n,Z.InvalidParameter,t);if(null===o[0])return[];if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,t);return null===o[1]?[e(o[0])]:A.cut(o[0],o[1])}))},n.area=function(n,e){return v(n,e,((r,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=c(o[0],n.spatialReference);return null===e?0:A.planarArea(e,t(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.planarArea(o[0],t(m(o[1],-1)))}))},n.areageodetic=function(n,e){return v(n,e,((r,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=c(o[0],n.spatialReference);return null===e?0:A.geodesicArea(e,t(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.geodesicArea(o[0],t(m(o[1],-1)))}))},n.length=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:A.planarLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.planarLength(o[0],r(m(o[1],-1)))}))},n.length3d=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:!0===e.hasZ?E(e,r(m(o[1],-1))):A.planarLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return!0===o[0].hasZ?E(o[0],r(m(o[1],-1))):A.planarLength(o[0],r(m(o[1],-1)))}))},n.lengthgeodetic=function(n,e){return v(n,e,((t,l,o)=>{if(a(o,1,2,n,e),null===(o=i(o))[0])return 0;if(f(o[0])||s(o[0])){const e=h(o[0],n.spatialReference);return null===e?0:A.geodesicLength(e,r(m(o[1],-1)))}if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.geodesicLength(o[0],r(m(o[1],-1)))}))},n.distance=function(n,e){return v(n,e,((t,l,o)=>{o=i(o),a(o,2,3,n,e);let u=o[0];(f(o[0])||s(o[0]))&&(u=w(o[0],n.spatialReference));let c=o[1];if((f(o[1])||s(o[1]))&&(c=w(o[1],n.spatialReference)),!(u instanceof R))throw new M(n,Z.InvalidParameter,e);if(!(c instanceof R))throw new M(n,Z.InvalidParameter,e);return A.distance(u,c,r(m(o[2],-1)))}))},n.distancegeodetic=function(n,e){return v(n,e,((t,l,o)=>{o=i(o),a(o,2,3,n,e);const f=o[0],s=o[1];if(!(f instanceof N))throw new M(n,Z.InvalidParameter,e);if(!(s instanceof N))throw new M(n,Z.InvalidParameter,e);const u=new L({paths:[],spatialReference:f.spatialReference});return u.addPath([f,s]),A.geodesicLength(u,r(m(o[2],-1)))}))},n.densify=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,3,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);if(f<=0)throw new M(n,Z.InvalidParameter,e);return o[0]instanceof j||o[0]instanceof L?A.densify(o[0],f,r(m(o[2],-1))):o[0]instanceof y?A.densify(q(o[0]),f,r(m(o[2],-1))):o[0]}))},n.densifygeodetic=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,3,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);if(f<=0)throw new M(n,Z.InvalidParameter,e);return o[0]instanceof j||o[0]instanceof L?A.geodesicDensify(o[0],f,r(m(o[2],-1))):o[0]instanceof y?A.geodesicDensify(q(o[0]),f,r(m(o[2],-1))):o[0]}))},n.generalize=function(n,e){return v(n,e,((t,l,o)=>{if(o=i(o),a(o,2,4,n,e),null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,e);const f=p(o[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);return A.generalize(o[0],f,d(m(o[2],!0)),r(m(o[3],-1)))}))},n.buffer=function(n,t){return v(n,t,((l,o,f)=>{if(f=i(f),a(f,2,3,n,t),null===f[0])return null;if(!(f[0]instanceof R))throw new M(n,Z.InvalidParameter,t);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,t);return 0===s?e(f[0]):A.buffer(f[0],s,r(m(f[2],-1)))}))},n.buffergeodetic=function(n,t){return v(n,t,((l,o,f)=>{if(f=i(f),a(f,2,3,n,t),null===f[0])return null;if(!(f[0]instanceof R))throw new M(n,Z.InvalidParameter,t);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,t);return 0===s?e(f[0]):A.geodesicBuffer(f[0],s,r(m(f[2],-1)))}))},n.offset=function(n,e){return v(n,e,((t,l,f)=>{if(f=i(f),a(f,2,6,n,e),null===f[0])return null;if(!(f[0]instanceof j||f[0]instanceof L))throw new M(n,Z.InvalidParameter,e);const s=p(f[1]);if(isNaN(s))throw new M(n,Z.InvalidParameter,e);const u=p(m(f[4],10));if(isNaN(u))throw new M(n,Z.InvalidParameter,e);const c=p(m(f[5],0));if(isNaN(c))throw new M(n,Z.InvalidParameter,e);return A.offset(f[0],s,r(m(f[2],-1)),o(m(f[3],"round")).toLowerCase(),u,c)}))},n.rotate=function(n,e){return v(n,e,((t,r,l)=>{l=i(l),a(l,2,3,n,e);let o=l[0];if(null===o)return null;if(!(o instanceof R))throw new M(n,Z.InvalidParameter,e);o instanceof y&&(o=j.fromExtent(o));const f=p(l[1]);if(isNaN(f))throw new M(n,Z.InvalidParameter,e);const s=m(l[2],null);if(null===s)return A.rotate(o,f);if(s instanceof N)return A.rotate(o,f,s);throw new M(n,Z.InvalidParameter,e)}))},n.centroid=function(n,t){return v(n,t,((r,l,o)=>{if(o=i(o),a(o,1,1,n,t),null===o[0])return null;let c=o[0];if((f(o[0])||s(o[0]))&&(c=w(o[0],n.spatialReference)),null===c)return null;if(!(c instanceof R))throw new M(n,Z.InvalidParameter,t);return c instanceof N?u(e(o[0]),n.spatialReference):c instanceof j?c.centroid:c instanceof L?g(c):c instanceof x?P(c):c instanceof y?c.center:null}))},n.multiparttosinglepart=function(n,t){return v(n,t,((r,l,o)=>{o=i(o),a(o,1,1,n,t);const f=[];if(null===o[0])return null;if(!(o[0]instanceof R))throw new M(n,Z.InvalidParameter,t);if(o[0]instanceof N)return[u(e(o[0]),n.spatialReference)];if(o[0]instanceof y)return[u(e(o[0]),n.spatialReference)];const s=A.simplify(o[0]);if(s instanceof j){const n=[],e=[];for(let t=0;t<s.rings.length;t++)if(s.isClockwise(s.rings[t])){const e=k({rings:[s.rings[t]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(e)}else e.push({ring:s.rings[t],pt:s.getPoint(t,0)});for(let t=0;t<e.length;t++)for(let r=0;r<n.length;r++)if(n[r].contains(e[t].pt)){n[r].addRing(e[t].ring);break}return n}if(s instanceof L){const n=[];for(let e=0;e<s.paths.length;e++){const t=k({paths:[s.paths[e]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});n.push(t)}return n}if(o[0]instanceof x){const t=u(e(o[0]),n.spatialReference);for(let n=0;n<t.points.length;n++)f.push(t.getPoint(n));return f}return null}))},n.issimple=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return!0;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.isSimple(l[0])}))},n.simplify=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.simplify(l[0])}))},n.convexhull=function(n,e){return v(n,e,((t,r,l)=>{if(l=i(l),a(l,1,1,n,e),null===l[0])return null;if(!(l[0]instanceof R))throw new M(n,Z.InvalidParameter,e);return A.convexHull(l[0])}))}}export{O as registerFunctions,z as setGeometryEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{y as n,b as t,k as r,a as u,m as e,c as o,L as i,g as a,h as f,x as s}from"../../chunks/languageUtils.js";import{parse as c}from"../../core/number.js";function l(n,t,r){return void 0===r||0==+r?Math[n](t):(t=+t,r=+r,isNaN(t)||"number"!=typeof r||r%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[n](+(t[0]+"e"+(t[1]?+t[1]-r:-r)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+r:r))))}function N(N,h){function m(n,t,r){const u=a(n);return isNaN(u)?u:isNaN(t)||isNaN(r)||t>r?NaN:u<t?t:u>r?r:u}N.number=function(a,f){return h(a,f,((s,l,N)=>{n(N,1,2,a,f);const h=N[0];if(t(h))return h;if(null===h)return 0;if(r(h))return Number(h);if(u(h))return Number(h);if(e(h))return NaN;if(""===h)return Number(h);if(void 0===h)return Number(h);if(o(h)){if(void 0!==N[1]){let n=i(N[1],"‰","");return n=i(n,"¤",""),c(h,{pattern:n})}return Number(h.trim())}return Number(h)}))},N.abs=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.abs(a(o[0])))))},N.acos=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.acos(a(o[0])))))},N.asin=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.asin(a(o[0])))))},N.atan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.atan(a(o[0])))))},N.atan2=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),Math.atan2(a(o[0]),a(o[1])))))},N.ceil=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("ceil",a(o[0]),-1*n)}return Math.ceil(a(o[0]))}))},N.round=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("round",a(o[0]),-1*n)}return Math.round(a(o[0]))}))},N.floor=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("floor",a(o[0]),-1*n)}return Math.floor(a(o[0]))}))},N.cos=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.cos(a(o[0])))))},N.isnan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),"number"==typeof o[0]&&isNaN(o[0]))))},N.exp=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.exp(a(o[0])))))},N.log=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.log(a(o[0])))))},N.pow=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),a(o[0])**a(o[1]))))},N.random=function(t,r){return h(t,r,((u,e,o)=>(n(o,0,0,t,r),Math.random())))},N.sin=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.sin(a(o[0])))))},N.sqrt=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.sqrt(a(o[0])))))},N.tan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.tan(a(o[0])))))},N.defaultvalue=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),null===o[0]||""===o[0]||void 0===o[0]?o[1]:o[0])))},N.isempty=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),null===o[0]||(""===o[0]||void 0===o[0]))))},N.boolean=function(t,r){return h(t,r,((u,e,o)=>{n(o,1,1,t,r);const i=o[0];return f(i)}))},N.constrain=function(t,r){return h(t,r,((u,o,i)=>{n(i,3,3,t,r);const f=a(i[1]),c=a(i[2]);if(e(i[0])){const n=[];for(const t of i[0])n.push(m(t,f,c));return n}if(s(i[0])){const n=[];for(let t=0;t<i[0].length();t++)n.push(m(i[0].get(t),f,c));return n}return m(i[0],f,c)}))}}export{N as registerFunctions};
5
+ import{y as n,b as t,k as r,a as u,m as e,c as o,L as i,g as a,h as f,x as s}from"../../chunks/languageUtils.js";import{parse as c}from"../../core/number.js";function l(n,t,r){return void 0===r||0==+r?Math[n](t):(t=+t,r=+r,isNaN(t)||"number"!=typeof r||r%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[n](+(t[0]+"e"+(t[1]?+t[1]-r:-r)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+r:r))))}function N(N,h){function m(n,t,r){const u=a(n);return isNaN(u)?u:isNaN(t)||isNaN(r)||t>r?NaN:u<t?t:u>r?r:u}N.number=function(a,f){return h(a,f,((s,l,N)=>{n(N,1,2,a,f);const h=N[0];if(t(h))return h;if(null===h)return 0;if(r(h))return h.toNumber();if(u(h))return Number(h);if(e(h))return NaN;if(""===h)return Number(h);if(void 0===h)return Number(h);if(o(h)){if(void 0!==N[1]){let n=i(N[1],"‰","");return n=i(n,"¤",""),c(h,{pattern:n})}return Number(h.trim())}return Number(h)}))},N.abs=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.abs(a(o[0])))))},N.acos=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.acos(a(o[0])))))},N.asin=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.asin(a(o[0])))))},N.atan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.atan(a(o[0])))))},N.atan2=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),Math.atan2(a(o[0]),a(o[1])))))},N.ceil=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("ceil",a(o[0]),-1*n)}return Math.ceil(a(o[0]))}))},N.round=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("round",a(o[0]),-1*n)}return Math.round(a(o[0]))}))},N.floor=function(t,r){return h(t,r,((u,e,o)=>{if(n(o,1,2,t,r),2===o.length){let n=a(o[1]);return isNaN(n)&&(n=0),l("floor",a(o[0]),-1*n)}return Math.floor(a(o[0]))}))},N.cos=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.cos(a(o[0])))))},N.isnan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),"number"==typeof o[0]&&isNaN(o[0]))))},N.exp=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.exp(a(o[0])))))},N.log=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.log(a(o[0])))))},N.pow=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),a(o[0])**a(o[1]))))},N.random=function(t,r){return h(t,r,((u,e,o)=>(n(o,0,0,t,r),Math.random())))},N.sin=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.sin(a(o[0])))))},N.sqrt=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.sqrt(a(o[0])))))},N.tan=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),Math.tan(a(o[0])))))},N.defaultvalue=function(t,r){return h(t,r,((u,e,o)=>(n(o,2,2,t,r),null===o[0]||""===o[0]||void 0===o[0]?o[1]:o[0])))},N.isempty=function(t,r){return h(t,r,((u,e,o)=>(n(o,1,1,t,r),null===o[0]||(""===o[0]||void 0===o[0]))))},N.boolean=function(t,r){return h(t,r,((u,e,o)=>{n(o,1,1,t,r);const i=o[0];return f(i)}))},N.constrain=function(t,r){return h(t,r,((u,o,i)=>{n(i,3,3,t,r);const f=a(i[1]),c=a(i[2]);if(e(i[0])){const n=[];for(const t of i[0])n.push(m(t,f,c));return n}if(s(i[0])){const n=[];for(let t=0;t<i[0].length();t++)n.push(m(i[0].get(t),f,c));return n}return m(i[0],f,c)}))}}export{N as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as a}from"../executionError.js";import{y as o,j as i,B as u,g as s,M as p,v as d,A as c,h as l,t as f,m as h,x as y,L as m,w as g,N as A,O as w,P as I,Q as v,S as U,c as x,k as b,a as j,b as P,i as F,T as C,U as N}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as T}from"../featureset/support/shared.js";import{convertDirection as k}from"./convertdirection.js";import{XXH as L}from"./hash.js";import O from"../../geometry/Extent.js";import z from"../../geometry/Multipoint.js";import R from"../../geometry/Point.js";import M from"../../geometry/Polygon.js";import S from"../../geometry/Polyline.js";import H from"../../geometry/SpatialReference.js";function D(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function W(o,i,u){if(null!==o)if(h(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o)W(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else if(y(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.toArray())W(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else{if(b(o))return i.updateIntArray([o.getTime()]),void i.updateUint8Array([241]);if(x(o))return i.updateIntArray([o.length]),i.updateWithString(o),void i.updateUint8Array([41]);if(j(o))i.updateUint8Array([!0===o?1:0,113]);else{if(P(o))return i.updateFloatArray([o]),void i.updateUint8Array([173]);if(o instanceof e)throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof t)throw new n(u.context,a.UnsupportedHashType,u.node);if(!(o instanceof r)){if(g(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof R)return i.updateIntArray([3833836621]),i.updateIntArray([0]),i.updateFloatArray([o.x]),i.updateIntArray([1]),i.updateFloatArray([o.y]),o.hasZ&&(i.updateIntArray([2]),i.updateFloatArray([o.z])),o.hasM&&(i.updateIntArray([3]),i.updateFloatArray([o.m])),i.updateIntArray([3765347959]),void W(o.spatialReference.wkid,i,u);if(o instanceof M){i.updateIntArray([1266616829]);for(let t=0;t<o.rings.length;t++){const e=o.rings[t],r=[];let n=null,a=null;for(let i=0;i<e.length;i++){const u=o.getPoint(t,i);if(0===i)n=u;else if(D(a,u))continue;a=u,i===e.length-1&&D(n,u)||r.push(u)}i.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];i.updateIntArray([3962308117,t]),W(e,i,u),i.updateIntArray([2716288009])}i.updateIntArray([2278822459])}return i.updateIntArray([3878477243]),void W(o.spatialReference.wkid,i,u)}if(o instanceof S){i.updateIntArray([4106883559]);for(let t=0;t<o.paths.length;t++){const e=o.paths[t];i.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)i.updateIntArray([3962308117,r]),W(o.getPoint(t,r),i,u),i.updateIntArray([2716288009]);i.updateIntArray([2278822459])}return i.updateIntArray([2568784753]),void W(o.spatialReference.wkid,i,u)}if(o instanceof z){i.updateIntArray([588535921,o.points.length]);for(let t=0;t<o.points.length;t++){const e=o.getPoint(t);i.updateIntArray([t]),W(e,i,u)}return i.updateIntArray([1700171621]),void W(o.spatialReference.wkid,i,u)}if(o instanceof O)return i.updateIntArray([3483648373]),i.updateIntArray([0]),i.updateFloatArray([o.xmax]),i.updateIntArray([1]),i.updateFloatArray([o.xmin]),i.updateIntArray([2]),i.updateFloatArray([o.ymax]),i.updateIntArray([3]),i.updateFloatArray([o.ymin]),o.hasZ&&(i.updateIntArray([4]),i.updateFloatArray([o.zmax]),i.updateIntArray([5]),i.updateFloatArray([o.zmin])),o.hasM&&(i.updateIntArray([6]),i.updateFloatArray([o.mmax]),i.updateIntArray([7]),i.updateFloatArray([o.mmin])),i.updateIntArray([3622027469]),void W(o.spatialReference.wkid,i,u);if(o instanceof H)return i.updateIntArray([14]),void 0!==o.wkid&&null!==o.wkid&&i.updateIntArray([o.wkid]),void(o.wkt&&i.updateWithString(o.wkt));if(F(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(C(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(N(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o===d)throw new n(u.context,a.UnsupportedHashType,u.node);throw new n(u.context,a.UnsupportedHashType,u.node)}if(i.updateUint8Array([223]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.keys()){i.updateIntArray([t.length]),i.updateWithString(t),i.updateUint8Array([251]);W(o.field(t),i,u),i.updateUint8Array([239])}u.map.delete(o),u.currentLength--}i.updateUint8Array([73])}}else i.updateUint8Array([0,139])}function B(e,b){e.portal=function(e,r){return b(e,r,((n,a,u)=>(o(u,1,1,e,r),new t(i(u[0])))))},e.typeof=function(t,e){return b(t,e,((r,i,s)=>{o(s,1,1,t,e);const p=u(s[0]);if("Unrecognised Type"===p)throw new n(t,a.UnrecognisedType,e);return p}))},e.trim=function(t,e){return b(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim())))},e.tohex=function(t,e){return b(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)}))},e.upper=function(t,e){return b(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase())))},e.proper=function(t,e){return b(t,e,((r,n,a)=>{o(a,1,2,t,e);let u=1;2===a.length&&"firstword"===i(a[1]).toLowerCase()&&(u=2);const s=/\s/,p=i(a[0]);let d="",c=!0;for(let t=0;t<p.length;t++){let e=p[t];if(s.test(e))1===u&&(c=!0);else{e.toUpperCase()!==e.toLowerCase()&&(c?(e=e.toUpperCase(),c=!1):e=e.toLowerCase())}d+=e}return d}))},e.lower=function(t,e){return b(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase())))},e.guid=function(t,e){return b(t,e,((r,n,a)=>{if(o(a,0,1,t,e),a.length>0)switch(i(a[0]).toLowerCase()){case"digits":return p().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return p();case"digits-hyphen-braces":return"{"+p()+"}";case"digits-hyphen-parentheses":return"("+p()+")"}return"{"+p()+"}"}))},e.standardizeguid=function(t,e){return b(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(\-?)(?<partB>[0-9a-z]{4})(\-?)(?<partC>[0-9a-z]{4})(\-?)(?<partD>[0-9a-z]{4})(\-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const p=s.groups;switch(u=p.partA+"-"+p.partB+"-"+p.partC+"-"+p.partD+"-"+p.partE,i(a[1]).toLowerCase()){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-braces":return"{"+u+"}";case"digits-hyphen-parentheses":return"("+u+")"}return"{"+u+"}"}))},e.console=function(t,e){return b(t,e,((e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),d)))},e.mid=function(t,e){return b(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u<0&&(u=0),2===a.length)return i(a[0]).substr(u);let p=s(a[2]);return isNaN(p)?"":(p<0&&(p=0),i(a[0]).substr(u,p))}))},e.find=function(t,e){return b(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(c(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)}))},e.left=function(t,e){return b(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(0,u))}))},e.right=function(t,e){return b(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(-1*u,u))}))},e.split=function(t,e){return b(t,e,((r,n,a)=>{let u;o(a,2,4,t,e);let p=s(c(a[2],-1));const d=l(c(a[3],!1));if(-1===p||null===p||!0===d?u=i(a[0]).split(i(a[1])):(isNaN(p)&&(p=-1),p<-1&&(p=-1),u=i(a[0]).split(i(a[1]),p)),!1===d)return u;const f=[];for(let t=0;t<u.length&&!(-1!==p&&f.length>=p);t++)""!==u[t]&&void 0!==u[t]&&f.push(u[t]);return f}))},e.text=function(t,e){return b(t,e,((r,n,a)=>(o(a,1,2,t,e),f(a[0],a[1]))))},e.concatenate=function(t,e){return b(t,e,((t,e,r)=>{const n=[];if(r.length<1)return"";if(h(r[0])){const t=c(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=f(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(y(r[0])){const t=c(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=f(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=f(r[a]);return n.join("")}))},e.reverse=function(t,e){return b(t,e,((r,i,u)=>{if(o(u,1,1,t,e),h(u[0])){const t=u[0].slice(0);return t.reverse(),t}if(y(u[0])){const t=u[0].toArray().slice(0);return t.reverse(),t}throw new n(t,a.InvalidParameter,e)}))},e.replace=function(t,e){return b(t,e,((r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),p=i(a[2]);return 4!==a.length||l(a[3])?m(u,s,p):u.replace(s,p)}))},e.schema=function(t,e){return b(t,e,((o,i,u)=>{if(g(u[0])){const t=A(u[0]);return t?r.convertObjectToArcadeDictionary(t):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypes=function(t,e){return b(t,e,((i,u,s)=>{if(o(s,1,1,t,e),g(s[0])){const t=w(s[0]);return t?r.convertObjectToArcadeDictionary(t):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypecode=function(t,e){return b(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0])){const t=w(u[0]);if(!t)return null;if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.code;return null}return null}throw new n(t,a.InvalidParameter,e)}))},e.subtypename=function(t,e){return b(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0])){const t=w(u[0]);if(!t)return"";if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.name;return""}return""}throw new n(t,a.InvalidParameter,e)}))},e.gdbversion=function(t,e){return b(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0]))return u[0].gdbVersion();throw new n(t,a.InvalidParameter,e)}))},e.domain=function(t,e){return b(t,e,((u,p,d)=>{if(o(d,2,3,t,e),g(d[0])){const t=I(d[0],i(d[1]),void 0===d[2]?void 0:s(d[2]));return t&&t.domain?"coded-value"===t.domain.type||"codedValue"===t.domain.type?r.convertObjectToArcadeDictionary({type:"codedValue",name:t.domain.name,dataType:T[t.field.type],codedValues:t.domain.codedValues.map((t=>({name:t.name,code:t.code})))}):r.convertObjectToArcadeDictionary({type:"range",name:t.domain.name,dataType:T[t.field.type],min:t.domain.min,max:t.domain.max}):null}throw new n(t,a.InvalidParameter,e)}))},e.domainname=function(t,e){return b(t,e,((r,u,p)=>{if(o(p,2,4,t,e),g(p[0]))return v(p[0],i(p[1]),p[2],void 0===p[3]?void 0:s(p[3]));throw new n(t,a.InvalidParameter,e)}))},e.domaincode=function(t,e){return b(t,e,((r,u,p)=>{if(o(p,2,4,t,e),g(p[0]))return U(p[0],i(p[1]),p[2],void 0===p[3]?void 0:s(p[3]));throw new n(t,a.InvalidParameter,e)}))},e.urlencode=function(t,e){return b(t,e,((n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))}))},e.hash=function(t,e){return b(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=new L(0);return W(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()}))},e.convertdirection=function(t,e){return b(t,e,((r,n,a)=>(o(a,3,3,t,e),k(a[0],a[1],a[2]))))},e.fromjson=function(t,e){return b(t,e,((u,s,p)=>{if(o(p,1,1,t,e),!1===x(p[0]))throw new n(t,a.InvalidParameter,e);return r.convertJsonToArcade(JSON.parse(i(p[0])))}))},e.expects=function(t,e){return b(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);return d}))},e.tocharcode=function(t,e){return b(t,e,((r,u,p)=>{o(p,1,2,t,e);const d=s(c(p[1],0)),l=i(p[0]);if(0===l.length&&1===p.length)return null;if(l.length<=d||d<0)throw new n(t,a.OutOfBounds,e);return l.charCodeAt(d)}))},e.tocodepoint=function(t,e){return b(t,e,((r,u,p)=>{o(p,1,2,t,e);const d=s(c(p[1],0)),l=i(p[0]);if(0===l.length&&1===p.length)return null;if(l.length<=d||d<0)throw new n(t,a.OutOfBounds,e);return l.codePointAt(d)}))},e.fromcharcode=function(t,e){return b(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);const u=i.map((t=>Math.trunc(s(t)))).filter((t=>t>=0&&t<=65535));return 0===u.length?null:String.fromCharCode.apply(null,u)}))},e.fromcodepoint=function(t,e){return b(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);let u;try{u=i.map((t=>Math.trunc(s(t)))).filter((t=>t<=1114111&&t>>>0===t))}catch(p){return null}return 0===u.length?null:String.fromCodePoint.apply(null,u)}))}}export{B as registerFunctions};
5
+ import t from"../ArcadePortal.js";import e from"../Attachment.js";import r from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as a}from"../executionError.js";import{y as o,j as i,B as u,g as s,M as p,v as d,A as c,h as l,t as f,m as h,x as y,L as m,w as g,N as A,C as w,O as I,P as v,Q as U,S as x,c as b,k as j,a as P,b as F,i as C,T as N,U as T}from"../../chunks/languageUtils.js";import{layerFieldEsriConstants as k}from"../featureset/support/shared.js";import{convertDirection as L}from"./convertdirection.js";import{XXH as O}from"./hash.js";import z from"../../geometry/Extent.js";import R from"../../geometry/Multipoint.js";import M from"../../geometry/Point.js";import S from"../../geometry/Polygon.js";import H from"../../geometry/Polyline.js";import D from"../../geometry/SpatialReference.js";function W(t,e){if(!t||!e)return t===e;if(t.x===e.x&&t.y===e.y){if(t.hasZ){if(t.z!==e.z)return!1}else if(e.hasZ)return!1;if(t.hasM){if(t.m!==e.m)return!1}else if(e.hasM)return!1;return!0}return!1}function B(o,i,u){if(null!==o)if(h(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o)B(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else if(y(o)){if(i.updateUint8Array([61]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.toArray())B(t,i,u);u.map.delete(o),u.currentLength--}i.updateUint8Array([199])}else{if(j(o))return i.updateIntArray([o.toNumber()]),void i.updateUint8Array([241]);if(b(o))return i.updateIntArray([o.length]),i.updateWithString(o),void i.updateUint8Array([41]);if(P(o))i.updateUint8Array([!0===o?1:0,113]);else{if(F(o))return i.updateFloatArray([o]),void i.updateUint8Array([173]);if(o instanceof e)throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof t)throw new n(u.context,a.UnsupportedHashType,u.node);if(!(o instanceof r)){if(g(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o instanceof M)return i.updateIntArray([3833836621]),i.updateIntArray([0]),i.updateFloatArray([o.x]),i.updateIntArray([1]),i.updateFloatArray([o.y]),o.hasZ&&(i.updateIntArray([2]),i.updateFloatArray([o.z])),o.hasM&&(i.updateIntArray([3]),i.updateFloatArray([o.m])),i.updateIntArray([3765347959]),void B(o.spatialReference.wkid,i,u);if(o instanceof S){i.updateIntArray([1266616829]);for(let t=0;t<o.rings.length;t++){const e=o.rings[t],r=[];let n=null,a=null;for(let i=0;i<e.length;i++){const u=o.getPoint(t,i);if(0===i)n=u;else if(W(a,u))continue;a=u,i===e.length-1&&W(n,u)||r.push(u)}i.updateIntArray([1397116793,r.length]);for(let t=0;t<r.length;t++){const e=r[t];i.updateIntArray([3962308117,t]),B(e,i,u),i.updateIntArray([2716288009])}i.updateIntArray([2278822459])}return i.updateIntArray([3878477243]),void B(o.spatialReference.wkid,i,u)}if(o instanceof H){i.updateIntArray([4106883559]);for(let t=0;t<o.paths.length;t++){const e=o.paths[t];i.updateIntArray([1397116793,e.length]);for(let r=0;r<e.length;r++)i.updateIntArray([3962308117,r]),B(o.getPoint(t,r),i,u),i.updateIntArray([2716288009]);i.updateIntArray([2278822459])}return i.updateIntArray([2568784753]),void B(o.spatialReference.wkid,i,u)}if(o instanceof R){i.updateIntArray([588535921,o.points.length]);for(let t=0;t<o.points.length;t++){const e=o.getPoint(t);i.updateIntArray([t]),B(e,i,u)}return i.updateIntArray([1700171621]),void B(o.spatialReference.wkid,i,u)}if(o instanceof z)return i.updateIntArray([3483648373]),i.updateIntArray([0]),i.updateFloatArray([o.xmax]),i.updateIntArray([1]),i.updateFloatArray([o.xmin]),i.updateIntArray([2]),i.updateFloatArray([o.ymax]),i.updateIntArray([3]),i.updateFloatArray([o.ymin]),o.hasZ&&(i.updateIntArray([4]),i.updateFloatArray([o.zmax]),i.updateIntArray([5]),i.updateFloatArray([o.zmin])),o.hasM&&(i.updateIntArray([6]),i.updateFloatArray([o.mmax]),i.updateIntArray([7]),i.updateFloatArray([o.mmin])),i.updateIntArray([3622027469]),void B(o.spatialReference.wkid,i,u);if(o instanceof D)return i.updateIntArray([14]),void 0!==o.wkid&&null!==o.wkid&&i.updateIntArray([o.wkid]),void(o.wkt&&i.updateWithString(o.wkt));if(C(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(N(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(T(o))throw new n(u.context,a.UnsupportedHashType,u.node);if(o===d)throw new n(u.context,a.UnsupportedHashType,u.node);throw new n(u.context,a.UnsupportedHashType,u.node)}if(i.updateUint8Array([223]),u.map.has(o)){const t=u.map.get(o);i.updateIntArray([61237541^t])}else{u.map.set(o,u.currentLength++);for(const t of o.keys()){i.updateIntArray([t.length]),i.updateWithString(t),i.updateUint8Array([251]);B(o.field(t),i,u),i.updateUint8Array([239])}u.map.delete(o),u.currentLength--}i.updateUint8Array([73])}}else i.updateUint8Array([0,139])}function V(e,j){e.portal=function(e,r){return j(e,r,((n,a,u)=>(o(u,1,1,e,r),new t(i(u[0])))))},e.typeof=function(t,e){return j(t,e,((r,i,s)=>{o(s,1,1,t,e);const p=u(s[0]);if("Unrecognised Type"===p)throw new n(t,a.UnrecognisedType,e);return p}))},e.trim=function(t,e){return j(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).trim())))},e.tohex=function(t,e){return j(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=s(a[0]);return isNaN(i)?i:i.toString(16)}))},e.upper=function(t,e){return j(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toUpperCase())))},e.proper=function(t,e){return j(t,e,((r,n,a)=>{o(a,1,2,t,e);let u=1;2===a.length&&"firstword"===i(a[1]).toLowerCase()&&(u=2);const s=/\s/,p=i(a[0]);let d="",c=!0;for(let t=0;t<p.length;t++){let e=p[t];if(s.test(e))1===u&&(c=!0);else{e.toUpperCase()!==e.toLowerCase()&&(c?(e=e.toUpperCase(),c=!1):e=e.toLowerCase())}d+=e}return d}))},e.lower=function(t,e){return j(t,e,((r,n,a)=>(o(a,1,1,t,e),i(a[0]).toLowerCase())))},e.guid=function(t,e){return j(t,e,((r,n,a)=>{if(o(a,0,1,t,e),a.length>0)switch(i(a[0]).toLowerCase()){case"digits":return p().replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return p();case"digits-hyphen-braces":return"{"+p()+"}";case"digits-hyphen-parentheses":return"("+p()+")"}return"{"+p()+"}"}))},e.standardizeguid=function(t,e){return j(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=i(a[0]);if(""===u||null===u)return"";const s=/^(\{|\()?(?<partA>[0-9a-z]{8})(\-?)(?<partB>[0-9a-z]{4})(\-?)(?<partC>[0-9a-z]{4})(\-?)(?<partD>[0-9a-z]{4})(\-?)(?<partE>[0-9a-z]{12})(\}|\))?$/gim.exec(u);if(!s)return"";const p=s.groups;switch(u=p.partA+"-"+p.partB+"-"+p.partC+"-"+p.partD+"-"+p.partE,i(a[1]).toLowerCase()){case"digits":return u.replace("-","").replace("-","").replace("-","").replace("-","");case"digits-hyphen":return u;case"digits-hyphen-braces":return"{"+u+"}";case"digits-hyphen-parentheses":return"("+u+")"}return"{"+u+"}"}))},e.console=function(t,e){return j(t,e,((e,r,n)=>(0===n.length||(1===n.length?t.console(i(n[0])):t.console(i(n))),d)))},e.mid=function(t,e){return j(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=s(a[1]);if(isNaN(u))return"";if(u<0&&(u=0),2===a.length)return i(a[0]).substr(u);let p=s(a[2]);return isNaN(p)?"":(p<0&&(p=0),i(a[0]).substr(u,p))}))},e.find=function(t,e){return j(t,e,((r,n,a)=>{o(a,2,3,t,e);let u=0;if(a.length>2){if(u=s(c(a[2],0)),isNaN(u))return-1;u<0&&(u=0)}return i(a[1]).indexOf(i(a[0]),u)}))},e.left=function(t,e){return j(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(0,u))}))},e.right=function(t,e){return j(t,e,((r,n,a)=>{o(a,2,2,t,e);let u=s(a[1]);return isNaN(u)?"":(u<0&&(u=0),i(a[0]).substr(-1*u,u))}))},e.split=function(t,e){return j(t,e,((r,n,a)=>{let u;o(a,2,4,t,e);let p=s(c(a[2],-1));const d=l(c(a[3],!1));if(-1===p||null===p||!0===d?u=i(a[0]).split(i(a[1])):(isNaN(p)&&(p=-1),p<-1&&(p=-1),u=i(a[0]).split(i(a[1]),p)),!1===d)return u;const f=[];for(let t=0;t<u.length&&!(-1!==p&&f.length>=p);t++)""!==u[t]&&void 0!==u[t]&&f.push(u[t]);return f}))},e.text=function(t,e){return j(t,e,((r,n,a)=>(o(a,1,2,t,e),f(a[0],a[1]))))},e.concatenate=function(t,e){return j(t,e,((t,e,r)=>{const n=[];if(r.length<1)return"";if(h(r[0])){const t=c(r[2],"");for(let e=0;e<r[0].length;e++)n[e]=f(r[0][e],t);return r.length>1?n.join(r[1]):n.join("")}if(y(r[0])){const t=c(r[2],"");for(let e=0;e<r[0].length();e++)n[e]=f(r[0].get(e),t);return r.length>1?n.join(r[1]):n.join("")}for(let a=0;a<r.length;a++)n[a]=f(r[a]);return n.join("")}))},e.reverse=function(t,e){return j(t,e,((r,i,u)=>{if(o(u,1,1,t,e),h(u[0])){const t=u[0].slice(0);return t.reverse(),t}if(y(u[0])){const t=u[0].toArray().slice(0);return t.reverse(),t}throw new n(t,a.InvalidParameter,e)}))},e.replace=function(t,e){return j(t,e,((r,n,a)=>{o(a,3,4,t,e);const u=i(a[0]),s=i(a[1]),p=i(a[2]);return 4!==a.length||l(a[3])?m(u,s,p):u.replace(s,p)}))},e.schema=function(t,e){return j(t,e,((o,i,u)=>{if(g(u[0])){const e=A(u[0]);return e?r.convertObjectToArcadeDictionary(e,w(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypes=function(t,e){return j(t,e,((i,u,s)=>{if(o(s,1,1,t,e),g(s[0])){const e=I(s[0]);return e?r.convertObjectToArcadeDictionary(e,w(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.subtypecode=function(t,e){return j(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0])){const t=I(u[0]);if(!t)return null;if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.code;return null}return null}throw new n(t,a.InvalidParameter,e)}))},e.subtypename=function(t,e){return j(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0])){const t=I(u[0]);if(!t)return"";if(t.subtypeField&&u[0].hasField(t.subtypeField)){const e=u[0].field(t.subtypeField);for(const r of t.subtypes)if(r.code===e)return r.name;return""}return""}throw new n(t,a.InvalidParameter,e)}))},e.gdbversion=function(t,e){return j(t,e,((r,i,u)=>{if(o(u,1,1,t,e),g(u[0]))return u[0].gdbVersion();throw new n(t,a.InvalidParameter,e)}))},e.domain=function(t,e){return j(t,e,((u,p,d)=>{if(o(d,2,3,t,e),g(d[0])){const e=v(d[0],i(d[1]),void 0===d[2]?void 0:s(d[2]));return e&&e.domain?"coded-value"===e.domain.type||"codedValue"===e.domain.type?r.convertObjectToArcadeDictionary({type:"codedValue",name:e.domain.name,dataType:k[e.field.type],codedValues:e.domain.codedValues.map((t=>({name:t.name,code:t.code})))},w(t)):r.convertObjectToArcadeDictionary({type:"range",name:e.domain.name,dataType:k[e.field.type],min:e.domain.min,max:e.domain.max},w(t)):null}throw new n(t,a.InvalidParameter,e)}))},e.domainname=function(t,e){return j(t,e,((r,u,p)=>{if(o(p,2,4,t,e),g(p[0]))return U(p[0],i(p[1]),p[2],void 0===p[3]?void 0:s(p[3]));throw new n(t,a.InvalidParameter,e)}))},e.domaincode=function(t,e){return j(t,e,((r,u,p)=>{if(o(p,2,4,t,e),g(p[0]))return x(p[0],i(p[1]),p[2],void 0===p[3]?void 0:s(p[3]));throw new n(t,a.InvalidParameter,e)}))},e.urlencode=function(t,e){return j(t,e,((n,a,u)=>{if(o(u,1,1,t,e),null===u[0])return"";if(u[0]instanceof r){let t="";for(const e of u[0].keys()){const r=u[0].field(e);""!==t&&(t+="&"),t+=null===r?encodeURIComponent(e)+"=":encodeURIComponent(e)+"="+encodeURIComponent(r)}return t}return encodeURIComponent(i(u[0]))}))},e.hash=function(t,e){return j(t,e,((r,n,a)=>{o(a,1,1,t,e);const i=new O(0);return B(a[0],i,{context:t,node:e,map:new Map,currentLength:0}),i.digest()}))},e.convertdirection=function(t,e){return j(t,e,((r,n,a)=>(o(a,3,3,t,e),L(a[0],a[1],a[2]))))},e.fromjson=function(t,e){return j(t,e,((u,s,p)=>{if(o(p,1,1,t,e),!1===b(p[0]))throw new n(t,a.InvalidParameter,e);return r.convertJsonToArcade(JSON.parse(i(p[0])),w(t))}))},e.expects=function(t,e){return j(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);return d}))},e.tocharcode=function(t,e){return j(t,e,((r,u,p)=>{o(p,1,2,t,e);const d=s(c(p[1],0)),l=i(p[0]);if(0===l.length&&1===p.length)return null;if(l.length<=d||d<0)throw new n(t,a.OutOfBounds,e);return l.charCodeAt(d)}))},e.tocodepoint=function(t,e){return j(t,e,((r,u,p)=>{o(p,1,2,t,e);const d=s(c(p[1],0)),l=i(p[0]);if(0===l.length&&1===p.length)return null;if(l.length<=d||d<0)throw new n(t,a.OutOfBounds,e);return l.codePointAt(d)}))},e.fromcharcode=function(t,e){return j(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);const u=i.map((t=>Math.trunc(s(t)))).filter((t=>t>=0&&t<=65535));return 0===u.length?null:String.fromCharCode.apply(null,u)}))},e.fromcodepoint=function(t,e){return j(t,e,((r,o,i)=>{if(i.length<1)throw new n(t,a.WrongNumberOfParameters,e);let u;try{u=i.map((t=>Math.trunc(s(t)))).filter((t=>t<=1114111&&t>>>0===t))}catch(p){return null}return 0===u.length?null:String.fromCodePoint.apply(null,u)}))}}export{V as registerFunctions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import"./FunctionWrapper.js";import"./ImmutableArray.js";import"./ImmutablePathArray.js";import"./ImmutablePointArray.js";import"../geometry/Extent.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Point.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"luxon";import"../core/maybe.js";import"../core/number.js";import"../geometry/support/coordsUtils.js";import"../intl/locale.js";import"./featureset/support/shared.js";import"./ArcadeModule.js";import"./executionError.js";export{I as ImplicitResult,a0 as ImplicitResultE,R as ReturnResult,$ as ReturnResultE,E as absRound,K as autoCastArrayOfPointsToMultiPoint,J as autoCastArrayOfPointsToPolygon,H as autoCastArrayOfPointsToPolyline,G as autoCastFeatureToGeometry,u as binaryOperator,o as breakResult,d as castAsJson,e as castAsJsonAsync,p as continueResult,A as defaultUndefined,s as equalityTest,S as featureDomainCodeLookup,Q as featureDomainValueLookup,P as featureFullDomain,N as featureSchema,O as featureSubtypes,F as fixNullGeometry,q as fixSpatialReference,a3 as formatDate,a2 as formatNumber,M as generateUUID,Y as getDomain,_ as getDomainCode,Z as getDomainValue,B as getType,r as greaterThanLessThan,m as isArray,a as isBoolean,k as isDate,w as isFeature,T as isFeatureSet,U as isFeatureSetCollection,i as isFunctionParameter,x as isImmutableArray,z as isInteger,a1 as isModule,b as isNumber,f as isSimpleType,c as isString,L as multiReplace,y as pcCheck,a4 as stableStringify,C as standardiseDateFormat,W as tick,h as toBoolean,l as toDate,D as toDateTime,g as toNumber,V as toNumberArray,j as toString,X as toStringArray,t as toStringExplicit,v as voidOperation}from"../chunks/languageUtils.js";
5
+ import"./FunctionWrapper.js";import"./ImmutableArray.js";import"./ImmutablePathArray.js";import"./ImmutablePointArray.js";import"./ArcadeDate.js";import"../geometry/Extent.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Point.js";import"../geometry/Polygon.js";import"../geometry/Polyline.js";import"luxon";import"../core/maybe.js";import"../core/number.js";import"../geometry/support/coordsUtils.js";import"../intl/locale.js";import"./featureset/support/shared.js";import"./ArcadeModule.js";import"./executionError.js";export{I as ImplicitResult,a0 as ImplicitResultE,R as ReturnResult,$ as ReturnResultE,E as absRound,K as autoCastArrayOfPointsToMultiPoint,J as autoCastArrayOfPointsToPolygon,H as autoCastArrayOfPointsToPolyline,G as autoCastFeatureToGeometry,u as binaryOperator,o as breakResult,d as castAsJson,e as castAsJsonAsync,p as continueResult,C as defaultTimeZone,A as defaultUndefined,s as equalityTest,S as featureDomainCodeLookup,Q as featureDomainValueLookup,P as featureFullDomain,N as featureSchema,O as featureSubtypes,F as fixNullGeometry,q as fixSpatialReference,a4 as formatDate,a3 as formatNumber,M as generateUUID,Y as getDomain,_ as getDomainCode,Z as getDomainValue,B as getType,r as greaterThanLessThan,m as isArray,a as isBoolean,k as isDate,w as isFeature,T as isFeatureSet,U as isFeatureSetCollection,i as isFunctionParameter,x as isImmutableArray,z as isInteger,a2 as isJsDate,a1 as isModule,b as isNumber,f as isSimpleType,c as isString,L as multiReplace,y as pcCheck,a5 as stableStringify,D as standardiseDateFormat,W as tick,h as toBoolean,l as toDate,g as toNumber,V as toNumberArray,j as toString,X as toStringArray,t as toStringExplicit,v as voidOperation}from"../chunks/languageUtils.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- const e={all:{min:2,max:2},none:{min:2,max:2},any:{min:2,max:2},reduce:{min:2,max:3},map:{min:2,max:2},filter:{min:2,max:2},fromcodepoint:{min:1,max:-1},fromcharcode:{min:1,max:-1},tocodepoint:{min:1,max:2},tocharcode:{min:1,max:2},concatenate:{min:0,max:-1},expects:{min:1,max:-1},getfeatureset:{min:1,max:2},week:{min:1,max:2},fromjson:{min:1,max:1},length3d:{min:1,max:2},tohex:{min:1,max:1},hash:{min:1,max:1},isoweek:{min:1,max:1},isoweekday:{min:1,max:1},hasvalue:{min:2,max:2},isomonth:{min:1,max:1},isoyear:{min:1,max:1},resize:{min:2,max:3},slice:{min:0,max:-1},splice:{min:0,max:-1},push:{min:2,max:2},pop:{min:1,max:1},includes:{min:2,max:2},array:{min:1,max:2},front:{min:1,max:1},back:{min:1,max:1},insert:{min:3,max:3},erase:{min:2,max:2},split:{min:2,max:4},guid:{min:0,max:1},standardizeguid:{min:2,max:2},today:{min:0,max:0},angle:{min:2,max:3},bearing:{min:2,max:3},urlencode:{min:1,max:1},now:{min:0,max:0},timestamp:{min:0,max:0},day:{min:1,max:1},month:{min:1,max:1},year:{min:1,max:1},hour:{min:1,max:1},second:{min:1,max:1},millisecond:{min:1,max:1},minute:{min:1,max:1},weekday:{min:1,max:1},toutc:{min:1,max:1},tolocal:{min:1,max:1},date:{min:0,max:7},datediff:{min:2,max:3},dateadd:{min:2,max:3},trim:{min:1,max:1},text:{min:1,max:2},left:{min:2,max:2},right:{min:2,max:2},mid:{min:2,max:3},upper:{min:1,max:1},proper:{min:1,max:2},lower:{min:1,max:1},find:{min:2,max:3},iif:{min:3,max:3},decode:{min:2,max:-1},when:{min:2,max:-1},defaultvalue:{min:2,max:2},isempty:{min:1,max:1},domaincode:{min:2,max:4},domainname:{min:2,max:4},polygon:{min:1,max:1},point:{min:1,max:1},polyline:{min:1,max:1},extent:{min:1,max:1},multipoint:{min:1,max:1},ringisclockwise:{min:1,max:1},geometry:{min:1,max:1},count:{min:0,max:-1},number:{min:1,max:2},acos:{min:1,max:1},asin:{min:1,max:1},atan:{min:1,max:1},atan2:{min:2,max:2},ceil:{min:1,max:2},floor:{min:1,max:2},round:{min:1,max:2},cos:{min:1,max:1},exp:{min:1,max:1},log:{min:1,max:1},min:{min:0,max:-1},constrain:{min:3,max:3},console:{min:0,max:-1},max:{min:0,max:-1},pow:{min:2,max:2},random:{min:0,max:0},sqrt:{min:1,max:1},sin:{min:1,max:1},tan:{min:1,max:1},abs:{min:1,max:1},isnan:{min:1,max:1},stdev:{min:0,max:-1},average:{min:0,max:-1},mean:{min:0,max:-1},sum:{min:0,max:-1},variance:{min:0,max:-1},distinct:{min:0,max:-1},first:{min:1,max:1},top:{min:2,max:2},boolean:{min:1,max:1},dictionary:{min:0,max:-1},typeof:{min:1,max:1},reverse:{min:1,max:1},replace:{min:3,max:4},sort:{min:1,max:2},feature:{min:1,max:-1},haskey:{min:2,max:2},indexof:{min:2,max:2},disjoint:{min:2,max:2},intersects:{min:2,max:2},touches:{min:2,max:2},crosses:{min:2,max:2},within:{min:2,max:2},contains:{min:2,max:2},overlaps:{min:2,max:2},equals:{min:2,max:2},relate:{min:3,max:3},intersection:{min:2,max:2},union:{min:1,max:2},difference:{min:2,max:2},symmetricdifference:{min:2,max:2},clip:{min:2,max:2},cut:{min:2,max:2},area:{min:1,max:2},areageodetic:{min:1,max:2},length:{min:1,max:2},lengthgeodetic:{min:1,max:2},distancegeodetic:{min:2,max:3},distance:{min:2,max:3},densify:{min:2,max:3},densifygeodetic:{min:2,max:3},generalize:{min:2,max:4},buffer:{min:2,max:3},buffergeodetic:{min:2,max:3},offset:{min:2,max:6},rotate:{min:2,max:3},issimple:{min:1,max:1},simplify:{min:1,max:1},convexhull:{min:1,max:1},centroid:{min:1,max:1},isselfintersecting:{min:1,max:1},multiparttosinglepart:{min:1,max:1},setgeometry:{min:2,max:2},portal:{min:1,max:1},getuser:{min:0,max:2},subtypes:{min:1,max:1},subtypecode:{min:1,max:1},subtypename:{min:1,max:1},domain:{min:2,max:3},convertdirection:{min:3,max:3},schema:{min:1,max:1}},n={functionDefinitions:new Map,constantDefinitions:new Map},a={functionDefinitions:new Map,constantDefinitions:new Map};for(const b of["pi","infinity"])a.constantDefinitions.set(b,{type:"constant"}),n.constantDefinitions.set(b,{type:"constant"});a.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"newline",type:"constant"}]}),n.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"newline",type:"constant"}]});for(const b in e){const t=e[b];a.functionDefinitions.set(b,{overloads:[{type:"function",parametersInfo:{min:t.min,max:t.max}}]}),n.functionDefinitions.set(b,{overloads:[{type:"function",parametersInfo:{min:t.min,max:t.max}}]})}const t=["featureset","getuser","featuresetbyid","featuresetbyname","featuresetbyassociation","featuresetbyrelationshipname","featuresetbyurl","getfeatureset","attachments","featuresetbyportalitem"],i=["disjoint","intersects","touches","crosses","within","contains","overlaps","equals","relate","intersection","union","difference","symmetricdifference","clip","cut","area","areageodetic","length","length3d","lengthgeodetic","distance","distancegeodetic","densify","densifygeodetic","generalize","buffer","buffergeodetic","offset","rotate","issimple","convexhull","simplify","multiparttosinglepart"];function m(e){return"string"==typeof e||e instanceof String}function o(e,t){const i="sync"===t?n:a;i.functionDefinitions.has(e.name.toLowerCase())?i.functionDefinitions.get(e.name.toLowerCase())?.overloads.push({type:"function",parametersInfo:{min:e.min,max:e.max}}):i.functionDefinitions.set(e.name.toLowerCase(),{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]})}function s(e,n){if(e)for(const a of e)r(a,n)}function r(e,n){if(e&&!1!==n(e))switch(e.type){case"ImportDeclaration":s(e.specifiers,n),r(e.source,n);break;case"ExportNamedDeclaration":r(e.declaration,n);break;case"ArrayExpression":s(e.elements,n);break;case"AssignmentExpression":case"BinaryExpression":case"LogicalExpression":r(e.left,n),r(e.right,n);break;case"BlockStatement":case"Program":s(e.body,n);break;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":case"Identifier":case"Literal":break;case"CallExpression":r(e.callee,n),s(e.arguments,n);break;case"ExpressionStatement":r(e.expression,n);break;case"ForInStatement":r(e.left,n),r(e.right,n),r(e.body,n);break;case"ForStatement":r(e.init,n),r(e.test,n),r(e.update,n),r(e.body,n);break;case"WhileStatement":r(e.test,n),r(e.body,n);break;case"FunctionDeclaration":r(e.id,n),s(e.params,n),r(e.body,n);break;case"IfStatement":r(e.test,n),r(e.consequent,n),r(e.alternate,n);break;case"MemberExpression":r(e.object,n),r(e.property,n);break;case"ObjectExpression":s(e.properties,n);break;case"Property":r(e.key,n),r(e.value,n);break;case"ReturnStatement":case"UnaryExpression":case"UpdateExpression":r(e.argument,n);break;case"VariableDeclaration":s(e.declarations,n);break;case"VariableDeclarator":r(e.id,n),r(e.init,n);break;case"TemplateLiteral":s(e.expressions,n),s(e.quasis,n)}}function c(e,n){let a=!1;const t=n.toLowerCase();return r(e,(e=>!a&&("Identifier"===e.type&&e.name&&e.name.toLowerCase()===t&&(a=!0),!0))),a}function x(e){const n=[];return r(e,(e=>("ImportDeclaration"===e.type&&e.source&&e.source.value&&n.push({libname:e.specifiers[0].local.name.toLowerCase(),source:e.source.value}),!0))),n}function p(e,n){let a=!1;const t=n.toLowerCase();return r(e,(e=>!a&&("CallExpression"!==e.type||"Identifier"!==e.callee.type||!e.callee.name||e.callee.name.toLowerCase()!==t||(a=!0,!1)))),a}function l(e){const n=[];return r(e,(e=>"MemberExpression"!==e.type||"Identifier"!==e.object.type||(!1===e.computed&&e.object&&e.object.name&&e.property&&"Identifier"===e.property.type&&e.property.name?n.push(e.object.name.toLowerCase()+"."+e.property.name.toLowerCase()):e.object&&e.object.name&&e.property&&"Literal"===e.property.type&&"string"==typeof e.property.value&&n.push(e.object.name.toLowerCase()+"."+e.property.value?.toString().toLowerCase()),!1))),n}function u(e){const n=[];return r(e,(e=>{if("CallExpression"===e.type){if("Identifier"===e.callee.type&&"expects"===e.callee.name.toLowerCase()){let a="";for(let t=0;t<(e.arguments||[]).length;t++)0===t?"Identifier"===e.arguments[t].type&&(a=e.arguments[t].name.toLowerCase()):a&&"Literal"===e.arguments[t].type&&m(e.arguments[t].value)&&n.push(a+"."+e.arguments[t].value.toLowerCase());return!1}if("Identifier"===e.callee.type&&["domainname","domaincode","domain","haskey"].includes(e.callee.name.toLowerCase())&&e.arguments.length>=2){let a="";return"Identifier"===e.arguments[0].type&&(a=e.arguments[0].name.toLowerCase()),a&&"Literal"===e.arguments[1].type&&m(e.arguments[1].value)&&n.push(a+"."+e.arguments[1].value.toLowerCase()),!1}}return"MemberExpression"!==e.type||"Identifier"!==e.object.type||(!1===e.computed&&e.object&&e.object.name&&e.property&&"Identifier"===e.property.type&&e.property.name?n.push(e.object.name.toLowerCase()+"."+e.property.name.toLowerCase()):e.object&&e.object.name&&e.property&&"Literal"===e.property.type&&"string"==typeof e.property.value&&n.push(e.object.name.toLowerCase()+"."+e.property.value?.toString().toLowerCase()),!1)})),n}function f(e,n){const a=[];if(void 0!==n.params&&null!==n.params)for(let t=0;t<n.params.length;t++)a.push("any");return{name:e,return:"any",params:a}}function y(e){const n=[];return r(e,(e=>("CallExpression"===e.type&&"Identifier"===e.callee.type&&n.push(e.callee.name.toLowerCase()),!0))),n}function d(e,n=[]){let a=null;if(void 0===e.usesFeatureSet){null===a&&(a=y(e)),e.usesFeatureSet=!1;for(let n=0;n<a.length;n++)t.includes(a[n])&&(e.usesFeatureSet=!0,e.isAsync=!0);if(!1===e.usesFeatureSet&&n&&n.length>0)for(const a of n)if(c(e,a)){e.usesFeatureSet=!0,e.isAsync=!0;break}}if(void 0===e.usesModules){e.usesModules=!1;x(e).length>0&&(e.usesModules=!0)}if(void 0===e.usesGeometry){e.usesGeometry=!1,null===a&&(a=y(e));for(let n=0;n<a.length;n++)i.includes(a[n])&&(e.usesGeometry=!0)}}function g(e){const n=y(e);for(let a=0;a<n.length;a++)if(t.includes(n[a]))return!0;return!1}export{o as addFunctionDeclaration,f as extractFunctionDeclaration,u as findExpectedFieldLiterals,l as findFieldLiterals,y as findFunctionCalls,x as findModuleImports,d as findScriptDependencies,a as fullArcadeApiAsync,n as fullArcadeApiSync,p as referencesFunction,c as referencesMember,g as scriptUsesFeatureSet,r as walk};
5
+ const e={all:{min:2,max:2},none:{min:2,max:2},any:{min:2,max:2},reduce:{min:2,max:3},map:{min:2,max:2},filter:{min:2,max:2},fromcodepoint:{min:1,max:-1},fromcharcode:{min:1,max:-1},tocodepoint:{min:1,max:2},tocharcode:{min:1,max:2},concatenate:{min:0,max:-1},expects:{min:1,max:-1},getfeatureset:{min:1,max:2},week:{min:1,max:2},fromjson:{min:1,max:1},length3d:{min:1,max:2},tohex:{min:1,max:1},hash:{min:1,max:1},timezone:{min:1,max:1},timezoneoffset:{min:1,max:1},changetimezone:{min:2,max:2},isoweek:{min:1,max:1},isoweekday:{min:1,max:1},hasvalue:{min:2,max:2},isomonth:{min:1,max:1},isoyear:{min:1,max:1},resize:{min:2,max:3},slice:{min:0,max:-1},splice:{min:0,max:-1},push:{min:2,max:2},pop:{min:1,max:1},includes:{min:2,max:2},array:{min:1,max:2},front:{min:1,max:1},back:{min:1,max:1},insert:{min:3,max:3},erase:{min:2,max:2},split:{min:2,max:4},guid:{min:0,max:1},standardizeguid:{min:2,max:2},today:{min:0,max:0},angle:{min:2,max:3},bearing:{min:2,max:3},urlencode:{min:1,max:1},now:{min:0,max:0},timestamp:{min:0,max:0},day:{min:1,max:1},month:{min:1,max:1},year:{min:1,max:1},hour:{min:1,max:1},second:{min:1,max:1},millisecond:{min:1,max:1},minute:{min:1,max:1},weekday:{min:1,max:1},toutc:{min:1,max:1},tolocal:{min:1,max:1},date:{min:0,max:8},datediff:{min:2,max:4},dateadd:{min:2,max:3},trim:{min:1,max:1},text:{min:1,max:2},left:{min:2,max:2},right:{min:2,max:2},mid:{min:2,max:3},upper:{min:1,max:1},proper:{min:1,max:2},lower:{min:1,max:1},find:{min:2,max:3},iif:{min:3,max:3},decode:{min:2,max:-1},when:{min:2,max:-1},defaultvalue:{min:2,max:2},isempty:{min:1,max:1},domaincode:{min:2,max:4},domainname:{min:2,max:4},polygon:{min:1,max:1},point:{min:1,max:1},polyline:{min:1,max:1},extent:{min:1,max:1},multipoint:{min:1,max:1},ringisclockwise:{min:1,max:1},geometry:{min:1,max:1},count:{min:0,max:-1},number:{min:1,max:2},acos:{min:1,max:1},asin:{min:1,max:1},atan:{min:1,max:1},atan2:{min:2,max:2},ceil:{min:1,max:2},floor:{min:1,max:2},round:{min:1,max:2},cos:{min:1,max:1},exp:{min:1,max:1},log:{min:1,max:1},min:{min:0,max:-1},constrain:{min:3,max:3},console:{min:0,max:-1},max:{min:0,max:-1},pow:{min:2,max:2},random:{min:0,max:0},sqrt:{min:1,max:1},sin:{min:1,max:1},tan:{min:1,max:1},abs:{min:1,max:1},isnan:{min:1,max:1},stdev:{min:0,max:-1},average:{min:0,max:-1},mean:{min:0,max:-1},sum:{min:0,max:-1},variance:{min:0,max:-1},distinct:{min:0,max:-1},first:{min:1,max:1},top:{min:2,max:2},boolean:{min:1,max:1},dictionary:{min:0,max:-1},typeof:{min:1,max:1},reverse:{min:1,max:1},replace:{min:3,max:4},sort:{min:1,max:2},feature:{min:1,max:-1},haskey:{min:2,max:2},indexof:{min:2,max:2},disjoint:{min:2,max:2},intersects:{min:2,max:2},touches:{min:2,max:2},crosses:{min:2,max:2},within:{min:2,max:2},contains:{min:2,max:2},overlaps:{min:2,max:2},equals:{min:2,max:2},relate:{min:3,max:3},intersection:{min:2,max:2},union:{min:1,max:2},difference:{min:2,max:2},symmetricdifference:{min:2,max:2},clip:{min:2,max:2},cut:{min:2,max:2},area:{min:1,max:2},areageodetic:{min:1,max:2},length:{min:1,max:2},lengthgeodetic:{min:1,max:2},distancegeodetic:{min:2,max:3},distance:{min:2,max:3},densify:{min:2,max:3},densifygeodetic:{min:2,max:3},generalize:{min:2,max:4},buffer:{min:2,max:3},buffergeodetic:{min:2,max:3},offset:{min:2,max:6},rotate:{min:2,max:3},issimple:{min:1,max:1},simplify:{min:1,max:1},convexhull:{min:1,max:1},centroid:{min:1,max:1},isselfintersecting:{min:1,max:1},multiparttosinglepart:{min:1,max:1},setgeometry:{min:2,max:2},portal:{min:1,max:1},getuser:{min:0,max:2},subtypes:{min:1,max:1},subtypecode:{min:1,max:1},subtypename:{min:1,max:1},domain:{min:2,max:3},convertdirection:{min:3,max:3},sqltimestamp:{min:1,max:3},schema:{min:1,max:1}},n={functionDefinitions:new Map,constantDefinitions:new Map},a={functionDefinitions:new Map,constantDefinitions:new Map};for(const b of["pi","infinity"])a.constantDefinitions.set(b,{type:"constant"}),n.constantDefinitions.set(b,{type:"constant"});a.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"newline",type:"constant"}]}),n.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"newline",type:"constant"}]});for(const b in e){const t=e[b];a.functionDefinitions.set(b,{overloads:[{type:"function",parametersInfo:{min:t.min,max:t.max}}]}),n.functionDefinitions.set(b,{overloads:[{type:"function",parametersInfo:{min:t.min,max:t.max}}]})}const t=["featureset","getuser","featuresetbyid","featuresetbyname","featuresetbyassociation","featuresetbyrelationshipname","featuresetbyurl","getfeatureset","attachments","featuresetbyportalitem"],i=["disjoint","intersects","touches","crosses","within","contains","overlaps","equals","relate","intersection","union","difference","symmetricdifference","clip","cut","area","areageodetic","length","length3d","lengthgeodetic","distance","distancegeodetic","densify","densifygeodetic","generalize","buffer","buffergeodetic","offset","rotate","issimple","convexhull","simplify","multiparttosinglepart"];function m(e){return"string"==typeof e||e instanceof String}function o(e,t){const i="sync"===t?n:a;i.functionDefinitions.has(e.name.toLowerCase())?i.functionDefinitions.get(e.name.toLowerCase())?.overloads.push({type:"function",parametersInfo:{min:e.min,max:e.max}}):i.functionDefinitions.set(e.name.toLowerCase(),{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]})}function s(e,n){if(e)for(const a of e)r(a,n)}function r(e,n){if(e&&!1!==n(e))switch(e.type){case"ImportDeclaration":s(e.specifiers,n),r(e.source,n);break;case"ExportNamedDeclaration":r(e.declaration,n);break;case"ArrayExpression":s(e.elements,n);break;case"AssignmentExpression":case"BinaryExpression":case"LogicalExpression":r(e.left,n),r(e.right,n);break;case"BlockStatement":case"Program":s(e.body,n);break;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":case"Identifier":case"Literal":break;case"CallExpression":r(e.callee,n),s(e.arguments,n);break;case"ExpressionStatement":r(e.expression,n);break;case"ForInStatement":r(e.left,n),r(e.right,n),r(e.body,n);break;case"ForStatement":r(e.init,n),r(e.test,n),r(e.update,n),r(e.body,n);break;case"WhileStatement":r(e.test,n),r(e.body,n);break;case"FunctionDeclaration":r(e.id,n),s(e.params,n),r(e.body,n);break;case"IfStatement":r(e.test,n),r(e.consequent,n),r(e.alternate,n);break;case"MemberExpression":r(e.object,n),r(e.property,n);break;case"ObjectExpression":s(e.properties,n);break;case"Property":r(e.key,n),r(e.value,n);break;case"ReturnStatement":case"UnaryExpression":case"UpdateExpression":r(e.argument,n);break;case"VariableDeclaration":s(e.declarations,n);break;case"VariableDeclarator":r(e.id,n),r(e.init,n);break;case"TemplateLiteral":s(e.expressions,n),s(e.quasis,n)}}function c(e,n){let a=!1;const t=n.toLowerCase();return r(e,(e=>!a&&("Identifier"===e.type&&e.name&&e.name.toLowerCase()===t&&(a=!0),!0))),a}function x(e){const n=[];return r(e,(e=>("ImportDeclaration"===e.type&&e.source&&e.source.value&&n.push({libname:e.specifiers[0].local.name.toLowerCase(),source:e.source.value}),!0))),n}function p(e,n){let a=!1;const t=n.toLowerCase();return r(e,(e=>!a&&("CallExpression"!==e.type||"Identifier"!==e.callee.type||!e.callee.name||e.callee.name.toLowerCase()!==t||(a=!0,!1)))),a}function l(e){const n=[];return r(e,(e=>"MemberExpression"!==e.type||"Identifier"!==e.object.type||(!1===e.computed&&e.object&&e.object.name&&e.property&&"Identifier"===e.property.type&&e.property.name?n.push(e.object.name.toLowerCase()+"."+e.property.name.toLowerCase()):e.object&&e.object.name&&e.property&&"Literal"===e.property.type&&"string"==typeof e.property.value&&n.push(e.object.name.toLowerCase()+"."+e.property.value?.toString().toLowerCase()),!1))),n}function u(e){const n=[];return r(e,(e=>{if("CallExpression"===e.type){if("Identifier"===e.callee.type&&"expects"===e.callee.name.toLowerCase()){let a="";for(let t=0;t<(e.arguments||[]).length;t++)0===t?"Identifier"===e.arguments[t].type&&(a=e.arguments[t].name.toLowerCase()):a&&"Literal"===e.arguments[t].type&&m(e.arguments[t].value)&&n.push(a+"."+e.arguments[t].value.toLowerCase());return!1}if("Identifier"===e.callee.type&&["domainname","domaincode","domain","haskey"].includes(e.callee.name.toLowerCase())&&e.arguments.length>=2){let a="";return"Identifier"===e.arguments[0].type&&(a=e.arguments[0].name.toLowerCase()),a&&"Literal"===e.arguments[1].type&&m(e.arguments[1].value)&&n.push(a+"."+e.arguments[1].value.toLowerCase()),!1}}return"MemberExpression"!==e.type||"Identifier"!==e.object.type||(!1===e.computed&&e.object&&e.object.name&&e.property&&"Identifier"===e.property.type&&e.property.name?n.push(e.object.name.toLowerCase()+"."+e.property.name.toLowerCase()):e.object&&e.object.name&&e.property&&"Literal"===e.property.type&&"string"==typeof e.property.value&&n.push(e.object.name.toLowerCase()+"."+e.property.value?.toString().toLowerCase()),!1)})),n}function f(e,n){const a=[];if(void 0!==n.params&&null!==n.params)for(let t=0;t<n.params.length;t++)a.push("any");return{name:e,return:"any",params:a}}function y(e){const n=[];return r(e,(e=>("CallExpression"===e.type&&"Identifier"===e.callee.type&&n.push(e.callee.name.toLowerCase()),!0))),n}function d(e,n=[]){let a=null;if(void 0===e.usesFeatureSet){null===a&&(a=y(e)),e.usesFeatureSet=!1;for(let n=0;n<a.length;n++)t.includes(a[n])&&(e.usesFeatureSet=!0,e.isAsync=!0);if(!1===e.usesFeatureSet&&n&&n.length>0)for(const a of n)if(c(e,a)){e.usesFeatureSet=!0,e.isAsync=!0;break}}if(void 0===e.usesModules){e.usesModules=!1;x(e).length>0&&(e.usesModules=!0)}if(void 0===e.usesGeometry){e.usesGeometry=!1,null===a&&(a=y(e));for(let n=0;n<a.length;n++)i.includes(a[n])&&(e.usesGeometry=!0)}}function g(e){const n=y(e);for(let a=0;a<n.length;a++)if(t.includes(n[a]))return!0;return!1}export{o as addFunctionDeclaration,f as extractFunctionDeclaration,u as findExpectedFieldLiterals,l as findFieldLiterals,y as findFunctionCalls,x as findModuleImports,d as findScriptDependencies,a as fullArcadeApiAsync,n as fullArcadeApiSync,p as referencesFunction,c as referencesMember,g as scriptUsesFeatureSet,r as walk};