@arcgis/core 4.33.0-next.20250513 → 4.33.0-next.20250514

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 (185) hide show
  1. package/arcade/functions/centroid.js +1 -1
  2. package/arcade/functions/geomasync.js +1 -1
  3. package/arcade/functions/geometry.js +1 -1
  4. package/arcade/functions/geomsync.js +1 -1
  5. package/arcade/geometry/operators.js +1 -1
  6. package/arcade/geometry/operatorsWorker.js +1 -1
  7. package/arcade/treeAnalysis.js +1 -1
  8. package/assets/components/assets/combobox/t9n/messages.en.json +1 -1
  9. package/assets/components/assets/combobox/t9n/messages.json +1 -1
  10. package/assets/components/assets/icon/calendarHeatChart16.json +1 -0
  11. package/assets/components/assets/icon/calendarHeatChart24.json +1 -0
  12. package/assets/components/assets/icon/calendarHeatChart32.json +1 -0
  13. package/assets/components/assets/icon/matrixHeatChart16.json +1 -0
  14. package/assets/components/assets/icon/matrixHeatChart24.json +1 -0
  15. package/assets/components/assets/icon/matrixHeatChart32.json +1 -0
  16. package/assets/components/assets/icon/progressBarChart16.json +1 -0
  17. package/assets/components/assets/icon/progressBarChart24.json +1 -0
  18. package/assets/components/assets/icon/progressBarChart32.json +1 -0
  19. package/assets/components/assets/icon/spikeDataVisualization16.json +1 -0
  20. package/assets/components/assets/icon/spikeDataVisualization24.json +1 -0
  21. package/assets/components/assets/icon/spikeDataVisualization32.json +1 -0
  22. package/assets/components/assets/icon/spikeDataVisualizationOpen16.json +1 -0
  23. package/assets/components/assets/icon/spikeDataVisualizationOpen24.json +1 -0
  24. package/assets/components/assets/icon/spikeDataVisualizationOpen32.json +1 -0
  25. package/assets/components/assets/icon/spikeDataVisualizationOutlined16F.json +1 -0
  26. package/assets/components/assets/icon/spikeDataVisualizationOutlined24F.json +1 -0
  27. package/assets/components/assets/icon/spikeDataVisualizationOutlined32F.json +1 -0
  28. package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked16.json +1 -0
  29. package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked24.json +1 -0
  30. package/assets/components/assets/icon/spikeDataVisualizationOutlinedColorLocked32.json +1 -0
  31. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen16.json +1 -0
  32. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen24.json +1 -0
  33. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpen32.json +1 -0
  34. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked16.json +1 -0
  35. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked24.json +1 -0
  36. package/assets/components/assets/icon/spikeDataVisualizationOutlinedOpenColorLocked32.json +1 -0
  37. package/assets/esri/core/workers/RemoteClient.js +1 -1
  38. package/assets/esri/core/workers/chunks/0766ecb677d667e5fb83.js.LICENSE.txt +1 -1
  39. package/assets/esri/core/workers/chunks/{4deeeceb784e4390441d.js → 0a4cece5e96fb7e8a57b.js} +1 -1
  40. package/assets/esri/core/workers/chunks/12e99071f6582f6caeaf.js +1 -0
  41. package/assets/esri/core/workers/chunks/191a45a594ecaf7f1abb.js +1 -0
  42. package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +1 -0
  43. package/assets/esri/core/workers/chunks/218a66d53f7cf4f285aa.js.LICENSE.txt +1 -1
  44. package/assets/esri/core/workers/chunks/{07695960aa0344dbfbf3.js → 28d9e2ffc3059a55311e.js} +1 -1
  45. package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js.LICENSE.txt +1 -1
  46. package/assets/esri/core/workers/chunks/4899cdc8bb5085c356f9.js +1 -0
  47. package/assets/esri/core/workers/chunks/498886c321a2501658bc.js +1 -0
  48. package/assets/esri/core/workers/chunks/56569d0c2cf5c5167651.js +1 -0
  49. package/assets/esri/core/workers/chunks/{ba3193ea145960a50e87.js → 5c8d52b72a3bea4202ac.js} +1 -1
  50. package/assets/esri/core/workers/chunks/{aa82925ffb00babb0543.js → 6394ab6f629aa90292e6.js} +2 -2
  51. package/assets/esri/core/workers/chunks/{aa82925ffb00babb0543.js.LICENSE.txt → 6394ab6f629aa90292e6.js.LICENSE.txt} +1 -1
  52. package/assets/esri/core/workers/chunks/{8b74b609de4f70e1a75c.js → 64af433e88d4dd21a2ff.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{2b01e3bce78541620a86.js → 6cbe8205a4e0f62da519.js} +1 -1
  54. package/assets/esri/core/workers/chunks/6e64ce0958c3432004b6.js +346 -0
  55. package/assets/esri/core/workers/chunks/6e8c6c9112ecb867b7be.js +1 -0
  56. package/assets/esri/core/workers/chunks/{a8430e1e2142f1ce9b92.js → 82c395d8649096609a8a.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{a73c6b4bc5baf440f85a.js → 88b7265270feede80e1d.js} +1 -1
  58. package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
  59. package/assets/esri/core/workers/chunks/8c21cc9af4ce9652cc5c.js +1 -0
  60. package/assets/esri/core/workers/chunks/{243dc74ec62891ba1ef7.js → 8e82acd1f730571680f4.js} +1 -1
  61. package/assets/esri/core/workers/chunks/90ae15ce22a49bd84876.js.LICENSE.txt +1 -1
  62. package/assets/esri/core/workers/chunks/a09b5700c92bb76c3234.js +1 -0
  63. package/assets/esri/core/workers/chunks/b06cb23048c32940f5de.js +1 -0
  64. package/assets/esri/core/workers/chunks/{079434fe765c53d304f2.js → b1e275607d9754079f60.js} +1 -1
  65. package/assets/esri/core/workers/chunks/b4f38fe9cc948a39ad87.js.LICENSE.txt +1 -1
  66. package/assets/esri/core/workers/chunks/{3c45603af279ad7fed8c.js → b8b5dfd2d73a8410fba2.js} +1 -1
  67. package/assets/esri/core/workers/chunks/c604fefedccfd4db9953.js +1 -0
  68. package/assets/esri/core/workers/chunks/{b816b608f31954128246.js → d21d9e8b8c8a2e0485d5.js} +1 -1
  69. package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +1 -0
  70. package/assets/esri/core/workers/chunks/{fef1a5f8a6fd3502b33b.js → e0247252c6a0f3340e33.js} +28 -28
  71. package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js.LICENSE.txt +1 -1
  72. package/assets/esri/core/workers/chunks/e5608e5232e983531f72.js +1 -0
  73. package/assets/esri/core/workers/chunks/f8fb0c7eaf73709bd855.js +1 -0
  74. package/assets/esri/core/workers/chunks/fd24dd602a3fed88d90e.js +1 -0
  75. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  76. package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +17 -10
  77. package/assets/esri/themes/base/widgets/_SelectionList.scss +7 -3
  78. package/assets/esri/themes/dark/main.css +1 -1
  79. package/assets/esri/themes/light/main.css +1 -1
  80. package/assets/esri/themes/light/view.css +1 -1
  81. package/chunks/OperatorCut.js +1 -1
  82. package/chunks/OperatorDefinitions.js +5 -0
  83. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  84. package/chunks/OperatorSimplifyOGC.js +1 -1
  85. package/chunks/ProjectionTransformation.js +1 -1
  86. package/chunks/arcade.js +1 -1
  87. package/chunks/lyr3DMain.js +1 -1
  88. package/core/Accessor.js +1 -1
  89. package/core/accessorSupport/Lifecycle.js +5 -0
  90. package/core/accessorSupport/Properties.js +1 -1
  91. package/core/accessorSupport/decorators/subclass.js +1 -1
  92. package/core/accessorSupport/tracking/Flags.js +1 -1
  93. package/core/accessorSupport/watch.js +1 -1
  94. package/core/mapCollectionUtils.js +1 -1
  95. package/core/urlUtils.js +1 -1
  96. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  97. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  98. package/geometry/operators/gx/operatorSimplifyOGC.js +1 -1
  99. package/geometry/operators/simplifyOGCOperator.js +1 -1
  100. package/interfaces.d.ts +263 -2448
  101. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  102. package/layers/KnowledgeGraphLayer.js +1 -1
  103. package/layers/LinkChartLayer.js +1 -1
  104. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  105. package/layers/VideoLayer.js +1 -1
  106. package/layers/graphics/data/QueryEngineResult.js +1 -1
  107. package/layers/support/rasterFunctions/pixelUtils.js +1 -1
  108. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  109. package/package.json +1 -1
  110. package/smartMapping/statistics/uniqueValues.js +1 -1
  111. package/smartMapping/support/adapters/support/layerUtils.js +1 -1
  112. package/statistics/utils.js +1 -1
  113. package/support/revision.js +1 -1
  114. package/symbols/cim/effects/EffectRadial.js +1 -1
  115. package/versionManagement/versionAdapters/FeatureLayerVersionAdapter.js +1 -1
  116. package/versionManagement/versionAdapters/NetworkVersionAdapter.js +1 -1
  117. package/versionManagement/versionAdapters/SubTypeGroupLayerVersionAdapter.js +1 -1
  118. package/views/2d/layers/MediaLayerView2D.js +1 -1
  119. package/views/2d/layers/TileLayerView2D.js +1 -1
  120. package/views/2d/layers/VideoLayerView2D.js +1 -1
  121. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  122. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  123. package/views/3d/FocusAreasView.js +5 -0
  124. package/views/3d/analysis/Viewshed/viewshedToolManipulatorUtils.js +1 -1
  125. package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
  126. package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
  127. package/views/3d/layers/GraphicsLayerView3D.js +1 -1
  128. package/views/3d/layers/GraphicsView3D.js +1 -1
  129. package/views/3d/layers/I3SMeshView3D.js +1 -1
  130. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  131. package/views/3d/layers/Lyr3DWasm.js +1 -1
  132. package/views/3d/layers/RouteLayerView3D.js +1 -1
  133. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  134. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  135. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  136. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  137. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  138. package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
  139. package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
  140. package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
  141. package/views/3d/layers/i3s/I3SQueryResultGeometry.js +1 -1
  142. package/views/3d/layers/i3s/meshUtils.js +5 -0
  143. package/views/3d/support/hitTest.js +1 -1
  144. package/views/3d/terrain/TileTexture.js +1 -1
  145. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  146. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  147. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  148. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  149. package/views/SceneView.js +1 -1
  150. package/views/VideoView.js +1 -1
  151. package/views/layers/BuildingComponentSublayerView.js +1 -1
  152. package/views/layers/BuildingSceneLayerView.js +1 -1
  153. package/views/support/TextureCompressionWorker.js +1 -1
  154. package/views/support/TextureCompressionWorkerHandle.js +1 -1
  155. package/views/webgl/Texture.js +1 -1
  156. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  157. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  158. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  159. package/widgets/FeatureTable/Grid/Column.js +1 -1
  160. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  161. package/widgets/FeatureTable.js +1 -1
  162. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  163. package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
  164. package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
  165. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  166. package/widgets/OrientedImageryViewer.js +1 -1
  167. package/widgets/VideoPlayer/VideoPlayerViewModel.js +1 -1
  168. package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
  169. package/widgets/support/SelectionList.js +1 -1
  170. package/assets/esri/core/workers/chunks/009dbddfc6499e2cee4f.js +0 -1
  171. package/assets/esri/core/workers/chunks/0f57b6a3a85a47ebd9d0.js +0 -346
  172. package/assets/esri/core/workers/chunks/1b8cc83aa1179245b2dc.js +0 -1
  173. package/assets/esri/core/workers/chunks/26ebb7816dd8c8cd4f3b.js +0 -1
  174. package/assets/esri/core/workers/chunks/2abce00d812c7f6b542d.js +0 -1
  175. package/assets/esri/core/workers/chunks/47cd99ab3ed11a931084.js +0 -1
  176. package/assets/esri/core/workers/chunks/51d9eaeeb781fd1d1162.js +0 -1
  177. package/assets/esri/core/workers/chunks/5228fc7fcdf57f44781e.js +0 -1
  178. package/assets/esri/core/workers/chunks/83e13baab4b90a88d967.js +0 -1
  179. package/assets/esri/core/workers/chunks/93cc26e5636040fdc0b8.js +0 -1
  180. package/assets/esri/core/workers/chunks/c17c269cc30e7e1d0bfb.js +0 -1
  181. package/assets/esri/core/workers/chunks/c3f144ca69995dca34a9.js +0 -1
  182. package/assets/esri/core/workers/chunks/d551f70560a2b1ef5696.js +0 -1
  183. package/assets/esri/core/workers/chunks/e9b1349a2b3a3f300808.js +0 -1
  184. package/core/accessorSupport/interfaces.js +0 -5
  185. package/views/FocusAreasView.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t}from"../../core/mathUtils.js";import n from"../../geometry/Point.js";import{segmentIntersects as e}from"../../geometry/support/intersectsBase.js";function r(t,n,e){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0))}function o(t,n,e){return(t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0)}const s=[];for(const N of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=N[0];for(let n=1;n<N.length;n++)s[N[n]]=t}const i=[];function c(t){return t.vcsWkid&&void 0!==s[t.vcsWkid]?i[s[t.vcsWkid]]:t.latestVcsWkid&&void 0!==s[t.latestVcsWkid]?i[s[t.latestVcsWkid]]:1}function f(t,n,e){const r={x:0,y:0};n&&(r.z=0),e&&(r.m=0);let o=0,s=t[0];for(let i=0;i<t.length;i++){const c=t[i];if(!1===x(c,s)){const t=h(s,c,n),i=u(s,c,n,e);i.x*=t,i.y*=t,r.x+=i.x,r.y+=i.y,n&&(i.z*=t,r.z+=i.z),e&&(i.m*=t,r.m+=i.m),o+=t,s=c}}return o>0?(r.x/=o,r.y/=o,n&&(r.z/=o),e&&(r.m/=o)):(r.x=t[0][0],r.y=t[0][1],n&&(r.z=t[0][2]),e&&n?r.m=t[0][3]:e&&(r.m=t[0][2])),r}function u(t,n,e,r){const o={x:(t[0]+n[0])/2,y:(t[1]+n[1])/2};return e&&(o.z=(t[2]+n[2])/2),e&&r?o.m=(t[3]+n[3])/2:r&&(o.m=(t[2]+n[2])/2),o}function a(t,n){if(t.length<=1)return 0;let e=0;for(let r=1;r<t.length;r++)e+=h(t[r-1],t[r],n);return e}function h(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return Math.sqrt(r*r+o*o+t*t)}return Math.sqrt(r*r+o*o)}function l(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return r*r+o*o+t*t}return r*r+o*o}function x(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function y(t){const e={x:0,y:0,spatialReference:t.spatialReference.toJSON()},r={x:0,y:0,spatialReference:t.spatialReference.toJSON()};let o=0,s=0;for(let n=0;n<t.paths.length;n++){if(0===t.paths[n].length)continue;const i=a(t.paths[n],!0===t.hasZ);if(0===i){const r=f(t.paths[n],!0===t.hasZ,!0===t.hasM);e.x+=r.x,e.y+=r.y,!0===t.hasZ&&(e.z+=r.z),!0===t.hasM&&(e.m+=r.m),++o}else{const e=f(t.paths[n],!0===t.hasZ,!0===t.hasM);r.x+=e.x*i,r.y+=e.y*i,!0===t.hasZ&&(r.z+=e.z*i),!0===t.hasM&&(r.m+=e.m*i),s+=i}}return s>0?(r.x/=s,r.y/=s,!0===t.hasZ&&(r.z/=s),!0===t.hasM&&(r.m/=s),new n(r)):o>0?(e.x/=o,e.y/=o,!0===t.hasZ&&(r.z/=o),!0===t.hasM&&(e.m/=o),new n(e)):null}function m(t){if(0===t.points.length)return null;let e=0,r=0,o=0,s=0;for(let n=0;n<t.points.length;n++){const i=t.getPoint(n);!0===i.hasZ&&(o+=i.z),!0===i.hasM&&(s+=i.m),e+=i.x,r+=i.y,s+=i.m}const i={x:e/t.points.length,y:r/t.points.length,spatialReference:null};return i.spatialReference=t.spatialReference.toJSON(),!0===t.hasZ&&(i.z=o/t.points.length),!0===t.hasM&&(i.m=s/t.points.length),new n(i)}function p(t,n){return t.x*n.x+t.y*n.y}function g(t,n){return t.x*n.y-n.x*t.y}function M(t,n,e=0){for(;t<e;)t+=n;const r=e+n;for(;t>=r;)t-=n;return t}function z(t,n){return Math.atan2(n.y-t.y,n.x-t.x)}function d(t,n){return M(z(t,n),2*Math.PI)*(180/Math.PI)}function v(t,n){return M(Math.PI/2-z(t,n),2*Math.PI)*(180/Math.PI)}function P(t,n,e){const r={x:t.x-n.x,y:t.y-n.y},o={x:e.x-n.x,y:e.y-n.y};return Math.atan2(g(r,o),p(r,o))}function Z(n,e,r){return t(M(P(n,e,r),2*Math.PI))}function I(n,e,r){return t(M(-1*P(n,e,r),2*Math.PI))}i[9002]=.3048,i[9003]=.3048006096012192,i[9095]=.3048007491;const R=[0,0];function k(t){for(let n=0;n<t.length;n++){const r=t[n];for(let s=0;s<r.length-1;s++){const o=r[s],i=r[s+1];for(let r=n+1;r<t.length;r++)for(let n=0;n<t[r].length-1;n++){const s=t[r][n],c=t[r][n+1];if(e(o,i,s,c,R)&&!(R[0]===o[0]&&R[1]===o[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===i[0]&&R[1]===i[1]||R[0]===c[0]&&R[1]===c[1]))return!0}}const o=r.length;if(!(o<3))for(let t=0;t<=o-2;t++){const n=r[t],s=r[t+1];for(let i=t+2;i<=o-2;i++){const t=r[i],o=r[i+1];if(e(n,s,t,o,R)&&!(R[0]===n[0]&&R[1]===n[1]||R[0]===t[0]&&R[1]===t[1]||R[0]===s[0]&&R[1]===s[1]||R[0]===o[0]&&R[1]===o[1]))return!0}}}return!1}function W(t,n,e){return Math.max(n,Math.min(e,t))}function j(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function q(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function w(t,n,e){const r=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=W(j(r,[t[0]-n[0],t[1]-n[1],t[2]-n[2]])/q(r),0,1);return[n[0]+(e[0]-n[0])*o,n[1]+(e[1]-n[1])*o,n[2]+(e[2]-n[2])*o]}function J(t,n,e){let r=0;const o=e[0]-n[0],s=e[1]-n[1],i=o*o+s*s;if(0===i)r=.5;else{r=((t[0]-n[0])*o+(t[1]-n[1])*s)/i,r<0?r=0:r>1&&(r=1)}return r<=.5?[n[0]+(e[0]-n[0])*r,n[1]+(e[1]-n[1])*r]:[e[0]-(e[0]-n[0])*(1-r),e[1]-(e[1]-n[1])*(1-r)]}export{d as angle2D,Z as angleBetween2D,P as angleBetweenRad,z as angleRad,v as bearing2D,I as bearingBetween2D,m as centroidMultiPoint,y as centroidPolyline,J as closestPointOnLineSegment,w as closestPointOnLineSegmentWithZ,c as getMetersPerVerticalUnitForSR,k as pathsSelfIntersecting,h as segmentLength,r as segmentLength3d,o as segmentLength3dSqr,l as segmentLengthSqr};
5
+ import{rad2deg as t}from"../../core/mathUtils.js";import n from"../../geometry/Point.js";function e(t,n,e){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0))}function r(t,n,e){return(t[0]-n[0])**2+(t[1]-n[1])**2+(void 0!==t[2]&&void 0!==n[2]?(t[2]*e-n[2]*e)**2:0)}const o=[];for(const w of[[9002,56146130,6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const t=w[0];for(let n=1;n<w.length;n++)o[w[n]]=t}const s=[];function i(t){return t.vcsWkid&&void 0!==o[t.vcsWkid]?s[o[t.vcsWkid]]:t.latestVcsWkid&&void 0!==o[t.latestVcsWkid]?s[o[t.latestVcsWkid]]:1}function c(t,n,e){const r={x:0,y:0};n&&(r.z=0),e&&(r.m=0);let o=0,s=t[0];for(let i=0;i<t.length;i++){const c=t[i];if(!1===l(c,s)){const t=f(s,c,n),i=u(s,c,n,e);i.x*=t,i.y*=t,r.x+=i.x,r.y+=i.y,n&&(i.z*=t,r.z+=i.z),e&&(i.m*=t,r.m+=i.m),o+=t,s=c}}return o>0?(r.x/=o,r.y/=o,n&&(r.z/=o),e&&(r.m/=o)):(r.x=t[0][0],r.y=t[0][1],n&&(r.z=t[0][2]),e&&n?r.m=t[0][3]:e&&(r.m=t[0][2])),r}function u(t,n,e,r){const o={x:(t[0]+n[0])/2,y:(t[1]+n[1])/2};return e&&(o.z=(t[2]+n[2])/2),e&&r?o.m=(t[3]+n[3])/2:r&&(o.m=(t[2]+n[2])/2),o}function a(t,n){if(t.length<=1)return 0;let e=0;for(let r=1;r<t.length;r++)e+=f(t[r-1],t[r],n);return e}function f(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return Math.sqrt(r*r+o*o+t*t)}return Math.sqrt(r*r+o*o)}function h(t,n,e){const r=n[0]-t[0],o=n[1]-t[1];if(e){const t=n[2]-n[2];return r*r+o*o+t*t}return r*r+o*o}function l(t,n){if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}function x(t){const e={x:0,y:0,spatialReference:t.spatialReference.toJSON()},r={x:0,y:0,spatialReference:t.spatialReference.toJSON()};let o=0,s=0;for(let n=0;n<t.paths.length;n++){if(0===t.paths[n].length)continue;const i=a(t.paths[n],!0===t.hasZ);if(0===i){const r=c(t.paths[n],!0===t.hasZ,!0===t.hasM);e.x+=r.x,e.y+=r.y,!0===t.hasZ&&(e.z+=r.z),!0===t.hasM&&(e.m+=r.m),++o}else{const e=c(t.paths[n],!0===t.hasZ,!0===t.hasM);r.x+=e.x*i,r.y+=e.y*i,!0===t.hasZ&&(r.z+=e.z*i),!0===t.hasM&&(r.m+=e.m*i),s+=i}}return s>0?(r.x/=s,r.y/=s,!0===t.hasZ&&(r.z/=s),!0===t.hasM&&(r.m/=s),new n(r)):o>0?(e.x/=o,e.y/=o,!0===t.hasZ&&(r.z/=o),!0===t.hasM&&(e.m/=o),new n(e)):null}function y(t){if(0===t.points.length)return null;let e=0,r=0,o=0,s=0;for(let n=0;n<t.points.length;n++){const i=t.getPoint(n);!0===i.hasZ&&(o+=i.z),!0===i.hasM&&(s+=i.m),e+=i.x,r+=i.y,s+=i.m}const i={x:e/t.points.length,y:r/t.points.length,spatialReference:null};return i.spatialReference=t.spatialReference.toJSON(),!0===t.hasZ&&(i.z=o/t.points.length),!0===t.hasM&&(i.m=s/t.points.length),new n(i)}function m(t,n){return t.x*n.x+t.y*n.y}function M(t,n){return t.x*n.y-n.x*t.y}function p(t,n,e=0){for(;t<e;)t+=n;const r=e+n;for(;t>=r;)t-=n;return t}function g(t,n){return Math.atan2(n.y-t.y,n.x-t.x)}function z(t,n){return p(g(t,n),2*Math.PI)*(180/Math.PI)}function d(t,n){return p(Math.PI/2-g(t,n),2*Math.PI)*(180/Math.PI)}function v(t,n,e){const r={x:t.x-n.x,y:t.y-n.y},o={x:e.x-n.x,y:e.y-n.y};return Math.atan2(M(r,o),m(r,o))}function P(n,e,r){return t(p(v(n,e,r),2*Math.PI))}function Z(n,e,r){return t(p(-1*v(n,e,r),2*Math.PI))}function I(t,n,e){return Math.max(n,Math.min(e,t))}function R(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function k(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function W(t,n,e){const r=[e[0]-n[0],e[1]-n[1],e[2]-n[2]],o=I(R(r,[t[0]-n[0],t[1]-n[1],t[2]-n[2]])/k(r),0,1);return[n[0]+(e[0]-n[0])*o,n[1]+(e[1]-n[1])*o,n[2]+(e[2]-n[2])*o]}function q(t,n,e){let r=0;const o=e[0]-n[0],s=e[1]-n[1],i=o*o+s*s;if(0===i)r=.5;else{r=((t[0]-n[0])*o+(t[1]-n[1])*s)/i,r<0?r=0:r>1&&(r=1)}return r<=.5?[n[0]+(e[0]-n[0])*r,n[1]+(e[1]-n[1])*r]:[e[0]-(e[0]-n[0])*(1-r),e[1]-(e[1]-n[1])*(1-r)]}s[9002]=.3048,s[9003]=.3048006096012192,s[9095]=.3048007491;export{z as angle2D,P as angleBetween2D,v as angleBetweenRad,g as angleRad,d as bearing2D,Z as bearingBetween2D,y as centroidMultiPoint,x as centroidPolyline,q as closestPointOnLineSegment,W as closestPointOnLineSegmentWithZ,i as getMetersPerVerticalUnitForSR,f as segmentLength,e as segmentLength3d,r as segmentLength3dSqr,h as segmentLengthSqr};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import n from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as r}from"../executionError.js";import{cloneGeometry as a}from"../kernel.js";import{E as i,D as o,g as s,k as c,j as l,f as u,m as f,F as d,p as w,G as m,l as y,H as h,J as g,t as p,e as N,K as S,L as O}from"../../chunks/languageUtils.js";import{getPortal as v}from"../portalUtils.js";import{commonRelationsCheck as J,toCurveType as P,planarLength3D as A,measureToCoordinateFunc as I,pointToCoordinateFunc as F,distanceToCoordinateFunc as j}from"../geometry/functions.js";import{invokeRemoteGeometryOp as b}from"../geometry/operatorsWorkerConnection.js";import R from"../../geometry/Extent.js";import x from"../../geometry/Geometry.js";import D from"../../geometry/Multipoint.js";import L from"../../geometry/Point.js";import C from"../../geometry/Polygon.js";import k from"../../geometry/Polyline.js";import{fromJSON as E}from"../../geometry/support/jsonUtils.js";import U from"../../portal/Portal.js";import{lookupUser as M}from"../../portal/support/utils.js";import{isArray as T}from"../../support/guards.js";function Z(n){if(null==n)return n;switch(typeof n){case"string":case"number":return n;default:throw new e(null,r.InvalidParameter,null)}}function q(q){"async"===q.mode&&(q.functions.disjoint=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null===a[0]||null===a[1]||b("disjoint",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.intersects=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("intersects",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.touches=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("touches",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.crosses=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("crosses",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.within=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("within",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.contains=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("contains",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.overlaps=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("overlaps",[a[0].toJSON(),a[1].toJSON()]))))},q.functions.equals=function(n,t){return q.standardFunctionAsync(n,t,((e,r,a)=>(o(a,2,2,n,t),a[0]===a[1]||(a[0]instanceof x&&a[1]instanceof x?b("equals",[a[0].toJSON(),a[1].toJSON()]):(s(a[0])&&s(a[1])||!!(c(a[0])&&c(a[1])||l(a[0])&&l(a[1])))&&a[0].equals(a[1])))))},q.functions.relate=function(n,t){return q.standardFunctionAsync(n,t,((a,s,c)=>{if(c=i(c),o(c,3,3,n,t),c[0]instanceof x&&c[1]instanceof x)return b("relate",[c[0].toJSON(),c[1].toJSON(),u(c[2])]);if(c[0]instanceof x&&null===c[1])return!1;if(c[1]instanceof x&&null===c[0])return!1;if(null===c[0]&&null===c[1])return!1;throw new e(n,r.InvalidParameter,t)}))},q.functions.intersection=function(n,t){return q.standardFunctionAsync(n,t,(async(e,r,a)=>(a=i(a),J(a,n,t),null===a[0]||null===a[1]?null:E(await b("intersection",[a[0].toJSON(),a[1].toJSON()])))))},q.functions.union=function(n,t){return q.standardFunctionAsync(n,t,(async(o,s,c)=>{if(0===(c=i(c)).length)throw new e(n,r.WrongNumberOfParameters,t);const l=[];if(1===c.length)if(T(c[0])){for(const a of i(c[0]))if(null!==a){if(!(a instanceof x))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}}else{if(!f(c[0])){if(c[0]instanceof x)return d(a(c[0]),n.spatialReference);if(null===c[0])return null;throw new e(n,r.InvalidParameter,t)}for(const a of i(c[0].toArray()))if(null!==a){if(!(a instanceof x))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}}else for(const a of c)if(null!==a){if(!(a instanceof x))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}return 0===l.length?null:E(await b("union",[l]))}))},q.functions.difference=function(n,t){return q.standardFunctionAsync(n,t,(async(e,r,o)=>(o=i(o),J(o,n,t),null===o[0]?null:null===o[1]?a(o[0]):E(await b("difference",[o[0].toJSON(),o[1].toJSON()])))))},q.functions.symmetricdifference=function(n,t){return q.standardFunctionAsync(n,t,(async(e,r,o)=>(o=i(o),J(o,n,t),null===o[0]&&null===o[1]?null:null===o[0]?a(o[1]):null===o[1]?a(o[0]):E(await b("symmetricDifference",[o[0].toJSON(),o[1].toJSON()])))))},q.functions.clip=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,2,n,t),!(c[1]instanceof R)&&null!==c[1])throw new e(n,r.InvalidParameter,t);if(null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);return null===c[1]?null:E(await b("clip",[c[0].toJSON(),c[1].toJSON()]))}))},q.functions.cut=function(n,t){return q.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,t),!(l[1]instanceof k)&&null!==l[1])throw new e(n,r.InvalidParameter,t);if(null===l[0])return[];if(!(l[0]instanceof x))throw new e(n,r.InvalidParameter,t);return null===l[1]?[a(l[0])]:(await b("cut",[l[0].toJSON(),l[1].toJSON()])).map((n=>E(n)))}))},q.functions.area=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),c=i(c),w(c[0])){const a=await c[0].sumArea(Z(c[1]),null,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}let l=c[0];if((T(l)||f(l))&&(l=m(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof x))throw new e(n,r.InvalidParameter,t);return b("area",[l.toJSON(),Z(c[1])])}))},q.functions.areageodetic=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{o(c,1,3,n,t);let l=(c=i(c))[0];(T(l)||f(l))&&(l=m(l,n.spatialReference));const u=Z(c[1]),d=P(c[2])??"geodesic";if(w(l)){const a=await l.sumArea(u,d,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}if(null==l)return 0;if(!y(l))throw new e(n,r.InvalidParameter,t);return b("geodeticArea",[l.toJSON(),u,d])}))},q.functions.length=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),c=i(c),w(c[0])){const a=await c[0].sumLength(Z(c[1]),null,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}let l=c[0];if((T(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof x))throw new e(n,r.InvalidParameter,t);return b("length",[l.toJSON(),Z(c[1])])}))},q.functions.length3d=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),null===(c=i(c))[0])return 0;let l=c[0];if((T(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof x))throw new e(n,r.InvalidParameter,t);if(!0===l.hasZ){const{convertFromSpatialReferenceUnit:n,toLengthUnit:t}=await import("../geometry/unitConversion.js"),e=A(l);return n(l.spatialReference,t(c[1]),e)}return b("length",[l.toJSON(),Z(c[1])])}))},q.functions.lengthgeodetic=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{o(c,1,3,n,t);let l=(c=i(c))[0];(T(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference));const u=Z(c[1]),d=P(c[2])??"geodesic";if(w(l)){const a=await l.sumLength(u,d,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}if(null===l)return 0;if(!y(l))throw new e(n,r.InvalidParameter,t);return b("geodeticLength",[l.toJSON(),u,d])}))},q.functions.distance=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,3,n,t);let l=c[0];if((T(c[0])||f(c[0]))&&(l=g(c[0],n.spatialReference)),!(l instanceof x))throw new e(n,r.InvalidParameter,t);let u=c[1];if((T(c[1])||f(c[1]))&&(u=g(c[1],n.spatialReference)),!(u instanceof x))throw new e(n,r.InvalidParameter,t);return b("distance",[l.toJSON(),u.toJSON(),Z(c[2])])}))},q.functions.distancegeodetic=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,4,n,t);const l=c[0];if(!(l instanceof L))throw new e(n,r.InvalidParameter,t);const u=c[1];if(!(u instanceof L))throw new e(n,r.InvalidParameter,t);const f=new k({paths:[],spatialReference:l.spatialReference});return f.addPath([l,u]),b("geodeticLength",[f.toJSON(),Z(c[2]),P(c[3])??"geodesic"])}))},q.functions.densify=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);if(l<=0)throw new e(n,r.InvalidParameter,t);switch(c[0].type){case"polygon":case"polyline":case"extent":return E(await b("densify",[c[0].toJSON(),l,Z(c[2])]));default:return c[0]}}))},q.functions.densifygeodetic=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,4,n,t);const l=c[0];if(null==l)return null;if(!y(l))throw new e(n,r.InvalidParameter,t);const u=p(c[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);if(u<=0)throw new e(n,r.InvalidParameter,t);const f=Z(c[2]),d=P(c[3])??"geodesic";switch(l.type){case"polygon":case"polyline":case"extent":return E(await b("geodeticDensify",[l.toJSON(),u,f,d]));default:return l}}))},q.functions.generalize=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,4,n,t),null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);const u=N(S(c[2],!0));return E(await b("generalize",[c[0].toJSON(),l,Z(c[3]),{removeDegenerateParts:u}]))}))},q.functions.buffer=function(n,t){return q.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,2,3,n,t),null===l[0])return null;if(!(l[0]instanceof x))throw new e(n,r.InvalidParameter,t);const u=p(l[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);return 0===u?a(l[0]):E(await b("buffer",[l[0].toJSON(),u,Z(l[2])]))}))},q.functions.buffergeodetic=function(n,t){return q.standardFunctionAsync(n,t,(async(s,c,l)=>{l=i(l),o(l,2,4,n,t);const u=l[0];if(null==u)return null;if(!y(u))throw new e(n,r.InvalidParameter,t);const f=p(l[1]);if(isNaN(f))throw new e(n,r.InvalidParameter,t);if(0===f)return a(u);const d=Z(l[2]),w=P(l[3])??"geodesic";return E(await b("geodesicBuffer",[u.toJSON(),f,d,w]))}))},q.functions.offset=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,6,n,t),null===c[0])return null;if(!(c[0]instanceof C||c[0]instanceof k))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);const f=u(c[3]??"round").toLowerCase();let d;switch(f){case"round":case"bevel":case"miter":case"square":d=f;break;default:d="round"}const w=p(S(c[4],10));if(isNaN(w))throw new e(n,r.InvalidParameter,t);const m=p(S(c[5],0));if(isNaN(m))throw new e(n,r.InvalidParameter,t);return E(await b("offset",[c[0].toJSON(),l,Z(c[2]),{joins:d,miterLimit:w,flattenError:m}]))}))},q.functions.rotate=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);const l=c[0]instanceof R?C.fromExtent(c[0]):c[0],u=p(c[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);const f=S(c[2],null);if(null===f){const n="point"===l.type?l:l.extent?.center;return E(await b("rotate",[l.toJSON(),u,n?.x,n?.y]))}if(f instanceof L)return E(await b("rotate",[l.toJSON(),u,f.x,f.y]));throw new e(n,r.InvalidParameter,t)}))},q.functions.centroid=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,2,n,t),null===c[0])return null;const l=u(c[1]??"geometric").toLowerCase();if("geometric"!==l&&"labelpoint"!==l)throw new e(n,r.InvalidParameter,t);let d=c[0];if((T(c[0])||f(c[0]))&&(d="geometric"===l?g(c[0],n.spatialReference):m(c[0],n.spatialReference),null===d))return null;if(!(d instanceof x))throw new e(n,r.InvalidParameter,t);return E("geometric"===l?await b("centroid",[d.toJSON()]):await b("labelPoint",[d.toJSON()]))}))},q.functions.measuretocoordinate=function(n,t){return q.standardFunctionAsync(n,t,I)},q.functions.pointtocoordinate=function(n,t){return q.standardFunctionAsync(n,t,F)},q.functions.distancetocoordinate=function(n,t){return q.standardFunctionAsync(n,t,j)},q.functions.multiparttosinglepart=function(n,t){return q.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,1,1,n,t),null===l[0])return null;if(!(l[0]instanceof x))throw new e(n,r.InvalidParameter,t);if(l[0]instanceof L)return[d(a(l[0]),n.spatialReference)];if(l[0]instanceof R)return[d(a(l[0]),n.spatialReference)];const u=E(await b("simplify",[l[0].toJSON()]));if(u instanceof C){const n=[],t=[];for(let e=0;e<u.rings.length;e++)if(u.isClockwise(u.rings[e])){const t=E({rings:[u.rings[e]],hasZ:!0===u.hasZ,hasM:!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 k){const n=[];for(let t=0;t<u.paths.length;t++){const e=E({paths:[u.paths[t]],hasZ:!0===u.hasZ,hasM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(e)}return n}if(l[0]instanceof D){const t=[],e=d(a(l[0]),n.spatialReference);for(let n=0;n<e.points.length;n++)t.push(e.getPoint(n));return t}return null}))},q.functions.issimple=function(n,t){return q.standardFunctionAsync(n,t,((a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return!0;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);return b("isSimple",[c[0].toJSON()])}))},q.functions.simplify=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);return E(await b("simplify",[c[0].toJSON()]))}))},q.functions.convexhull=function(n,t){return q.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return null;if(!(c[0]instanceof x))throw new e(n,r.InvalidParameter,t);return E(await b("convexHull",[c[0].toJSON()]))}))},q.functions.getuser=function(a,i){return q.standardFunctionAsync(a,i,(async(s,c,l)=>{o(l,0,2,a,i);let f=S(l[1],""),d=!0===f;if(f=!0===f||!1===f?"":u(f),0===l.length||l[0]instanceof n){let n;n=a.services?.portal?a.services.portal:U.getDefault(),l.length>0&&(n=v(l[0],n));const e=await M(n,f,d);if(e){const n=JSON.parse(JSON.stringify(e));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,O(a))}return null}let m=null;if(w(l[0])&&(m=l[0]),m){if(d=!1,f)return null;await m.load();const e=await m.getOwningSystemUrl();if(!e){if(!f){const n=await m.getIdentityUser();return n?t.convertObjectToArcadeDictionary({username:n},O(a)):null}return null}let r;r=a.services?.portal?a.services.portal:U.getDefault(),r=v(new n(e),r);const i=await M(r,f,d);if(i){const n=JSON.parse(JSON.stringify(i));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,O(a))}return null}throw new e(a,r.InvalidParameter,i)}))},q.functions.nearestcoordinate=function(n,a){return q.standardFunctionAsync(n,a,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,a),!(l[0]instanceof x||null===l[0]))throw new e(n,r.InvalidParameter,a);if(!(l[1]instanceof L||null===l[1]))throw new e(n,r.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const u=l[0]instanceof R?C.fromExtent(l[0]):l[0],f=await b("getNearestCoordinate",[u.toJSON(),l[1].toJSON(),{calculateLeftRightSide:!0}]);return null===f?null:t.convertObjectToArcadeDictionary({coordinate:E(f.coordinate),distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},O(n),!1,!0)}))},q.functions.nearestvertex=function(n,a){return q.standardFunctionAsync(n,a,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,a),!(l[0]instanceof x||null===l[0]))throw new e(n,r.InvalidParameter,a);if(!(l[1]instanceof L||null===l[1]))throw new e(n,r.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const u=l[0]instanceof R?C.fromExtent(l[0]):l[0],f=await b("getNearestVertex",[u.toJSON(),l[1].toJSON()]);return null===f?null:t.convertObjectToArcadeDictionary({coordinate:E(f.coordinate),distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},O(n),!1,!0)}))})}export{q as registerFunctions};
5
+ import n from"../ArcadePortal.js";import t from"../Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as r}from"../executionError.js";import{cloneGeometry as a}from"../kernel.js";import{E as i,D as o,g as s,k as c,j as l,f as u,m as f,F as d,p as w,G as m,l as y,H as h,J as g,t as p,e as N,K as S,L as O}from"../../chunks/languageUtils.js";import{getPortal as v}from"../portalUtils.js";import{commonRelationsCheck as J,toCurveType as P,planarLength3D as A,measureToCoordinateFunc as I,pointToCoordinateFunc as F,distanceToCoordinateFunc as j}from"../geometry/functions.js";import{invokeRemoteGeometryOp as b}from"../geometry/operatorsWorkerConnection.js";import{equals as R}from"../../core/arrayUtils.js";import x from"../../geometry/Extent.js";import D from"../../geometry/Geometry.js";import L from"../../geometry/Multipoint.js";import C from"../../geometry/Point.js";import U from"../../geometry/Polygon.js";import k from"../../geometry/Polyline.js";import{fromJSON as E}from"../../geometry/support/jsonUtils.js";import M from"../../portal/Portal.js";import{lookupUser as T}from"../../portal/support/utils.js";import{isArray as Z}from"../../support/guards.js";function q(n){if(null==n)return n;switch(typeof n){case"string":case"number":return n;default:throw new e(null,r.InvalidParameter,null)}}function z(z){"async"===z.mode&&(z.functions.disjoint=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null===a[0]||null===a[1]||b("disjoint",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.intersects=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("intersects",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.touches=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("touches",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.crosses=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("crosses",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.within=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("within",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.contains=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("contains",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.overlaps=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(a=i(a),J(a,n,t),null!==a[0]&&null!==a[1]&&b("overlaps",[a[0].toJSON(),a[1].toJSON()]))))},z.functions.equals=function(n,t){return z.standardFunctionAsync(n,t,((e,r,a)=>(o(a,2,2,n,t),a[0]===a[1]||(a[0]instanceof D&&a[1]instanceof D?b("equals",[a[0].toJSON(),a[1].toJSON()]):(s(a[0])&&s(a[1])||!!(c(a[0])&&c(a[1])||l(a[0])&&l(a[1])))&&a[0].equals(a[1])))))},z.functions.relate=function(n,t){return z.standardFunctionAsync(n,t,((a,s,c)=>{if(c=i(c),o(c,3,3,n,t),c[0]instanceof D&&c[1]instanceof D)return b("relate",[c[0].toJSON(),c[1].toJSON(),u(c[2])]);if(c[0]instanceof D&&null===c[1])return!1;if(c[1]instanceof D&&null===c[0])return!1;if(null===c[0]&&null===c[1])return!1;throw new e(n,r.InvalidParameter,t)}))},z.functions.intersection=function(n,t){return z.standardFunctionAsync(n,t,(async(e,r,a)=>(a=i(a),J(a,n,t),null===a[0]||null===a[1]?null:E(await b("intersection",[a[0].toJSON(),a[1].toJSON()])))))},z.functions.union=function(n,t){return z.standardFunctionAsync(n,t,(async(o,s,c)=>{if(0===(c=i(c)).length)throw new e(n,r.WrongNumberOfParameters,t);const l=[];if(1===c.length)if(Z(c[0])){for(const a of i(c[0]))if(null!==a){if(!(a instanceof D))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}}else{if(!f(c[0])){if(c[0]instanceof D)return d(a(c[0]),n.spatialReference);if(null===c[0])return null;throw new e(n,r.InvalidParameter,t)}for(const a of i(c[0].toArray()))if(null!==a){if(!(a instanceof D))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}}else for(const a of c)if(null!==a){if(!(a instanceof D))throw new e(n,r.InvalidParameter,t);l.push(a.toJSON())}return 0===l.length?null:E(await b("union",[l]))}))},z.functions.difference=function(n,t){return z.standardFunctionAsync(n,t,(async(e,r,o)=>(o=i(o),J(o,n,t),null===o[0]?null:null===o[1]?a(o[0]):E(await b("difference",[o[0].toJSON(),o[1].toJSON()])))))},z.functions.symmetricdifference=function(n,t){return z.standardFunctionAsync(n,t,(async(e,r,o)=>(o=i(o),J(o,n,t),null===o[0]&&null===o[1]?null:null===o[0]?a(o[1]):null===o[1]?a(o[0]):E(await b("symmetricDifference",[o[0].toJSON(),o[1].toJSON()])))))},z.functions.clip=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,2,n,t),!(c[1]instanceof x)&&null!==c[1])throw new e(n,r.InvalidParameter,t);if(null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);return null===c[1]?null:E(await b("clip",[c[0].toJSON(),c[1].toJSON()]))}))},z.functions.cut=function(n,t){return z.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,t),!(l[1]instanceof k)&&null!==l[1])throw new e(n,r.InvalidParameter,t);if(null===l[0])return[];if(!(l[0]instanceof D))throw new e(n,r.InvalidParameter,t);return null===l[1]?[a(l[0])]:(await b("cut",[l[0].toJSON(),l[1].toJSON()])).map((n=>E(n)))}))},z.functions.area=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),c=i(c),w(c[0])){const a=await c[0].sumArea(q(c[1]),null,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}let l=c[0];if((Z(l)||f(l))&&(l=m(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof D))throw new e(n,r.InvalidParameter,t);return b("area",[l.toJSON(),q(c[1])])}))},z.functions.areageodetic=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{o(c,1,3,n,t);let l=(c=i(c))[0];(Z(l)||f(l))&&(l=m(l,n.spatialReference));const u=q(c[1]),d=P(c[2])??"geodesic";if(w(l)){const a=await l.sumArea(u,d,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}if(null==l)return 0;if(!y(l))throw new e(n,r.InvalidParameter,t);return b("geodeticArea",[l.toJSON(),u,d])}))},z.functions.length=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),c=i(c),w(c[0])){const a=await c[0].sumLength(q(c[1]),null,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}let l=c[0];if((Z(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof D))throw new e(n,r.InvalidParameter,t);return b("length",[l.toJSON(),q(c[1])])}))},z.functions.length3d=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(o(c,1,2,n,t),null===(c=i(c))[0])return 0;let l=c[0];if((Z(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference)),null===l)return 0;if(!(l instanceof D))throw new e(n,r.InvalidParameter,t);if(!0===l.hasZ){const{convertFromSpatialReferenceUnit:n,toLengthUnit:t}=await import("../geometry/unitConversion.js"),e=A(l);return n(l.spatialReference,t(c[1]),e)}return b("length",[l.toJSON(),q(c[1])])}))},z.functions.lengthgeodetic=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{o(c,1,3,n,t);let l=(c=i(c))[0];(Z(c[0])||f(c[0]))&&(l=h(c[0],n.spatialReference));const u=q(c[1]),d=P(c[2])??"geodesic";if(w(l)){const a=await l.sumLength(u,d,n.abortSignal);if(n.abortSignal.aborted)throw new e(n,r.Cancelled,t);return a}if(null===l)return 0;if(!y(l))throw new e(n,r.InvalidParameter,t);return b("geodeticLength",[l.toJSON(),u,d])}))},z.functions.distance=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,3,n,t);let l=c[0];if((Z(c[0])||f(c[0]))&&(l=g(c[0],n.spatialReference)),!(l instanceof D))throw new e(n,r.InvalidParameter,t);let u=c[1];if((Z(c[1])||f(c[1]))&&(u=g(c[1],n.spatialReference)),!(u instanceof D))throw new e(n,r.InvalidParameter,t);return b("distance",[l.toJSON(),u.toJSON(),q(c[2])])}))},z.functions.distancegeodetic=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,4,n,t);const l=c[0];if(!(l instanceof C))throw new e(n,r.InvalidParameter,t);const u=c[1];if(!(u instanceof C))throw new e(n,r.InvalidParameter,t);const f=new k({paths:[],spatialReference:l.spatialReference});return f.addPath([l,u]),b("geodeticLength",[f.toJSON(),q(c[2]),P(c[3])??"geodesic"])}))},z.functions.densify=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);if(l<=0)throw new e(n,r.InvalidParameter,t);switch(c[0].type){case"polygon":case"polyline":case"extent":return E(await b("densify",[c[0].toJSON(),l,q(c[2])]));default:return c[0]}}))},z.functions.densifygeodetic=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{c=i(c),o(c,2,4,n,t);const l=c[0];if(null==l)return null;if(!y(l))throw new e(n,r.InvalidParameter,t);const u=p(c[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);if(u<=0)throw new e(n,r.InvalidParameter,t);const f=q(c[2]),d=P(c[3])??"geodesic";switch(l.type){case"polygon":case"polyline":case"extent":return E(await b("geodeticDensify",[l.toJSON(),u,f,d]));default:return l}}))},z.functions.generalize=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,4,n,t),null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);const u=N(S(c[2],!0));return E(await b("generalize",[c[0].toJSON(),l,q(c[3]),{removeDegenerateParts:u}]))}))},z.functions.buffer=function(n,t){return z.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,2,3,n,t),null===l[0])return null;if(!(l[0]instanceof D))throw new e(n,r.InvalidParameter,t);const u=p(l[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);return 0===u?a(l[0]):E(await b("buffer",[l[0].toJSON(),u,q(l[2])]))}))},z.functions.buffergeodetic=function(n,t){return z.standardFunctionAsync(n,t,(async(s,c,l)=>{l=i(l),o(l,2,4,n,t);const u=l[0];if(null==u)return null;if(!y(u))throw new e(n,r.InvalidParameter,t);const f=p(l[1]);if(isNaN(f))throw new e(n,r.InvalidParameter,t);if(0===f)return a(u);const d=q(l[2]),w=P(l[3])??"geodesic";return E(await b("geodesicBuffer",[u.toJSON(),f,d,w]))}))},z.functions.offset=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,6,n,t),null===c[0])return null;if(!(c[0]instanceof U||c[0]instanceof k))throw new e(n,r.InvalidParameter,t);const l=p(c[1]);if(isNaN(l))throw new e(n,r.InvalidParameter,t);const f=u(c[3]??"round").toLowerCase();let d;switch(f){case"round":case"bevel":case"miter":case"square":d=f;break;default:d="round"}const w=p(S(c[4],10));if(isNaN(w))throw new e(n,r.InvalidParameter,t);const m=p(S(c[5],0));if(isNaN(m))throw new e(n,r.InvalidParameter,t);return E(await b("offset",[c[0].toJSON(),l,q(c[2]),{joins:d,miterLimit:w,flattenError:m}]))}))},z.functions.rotate=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,2,3,n,t),null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);const l=c[0]instanceof x?U.fromExtent(c[0]):c[0],u=p(c[1]);if(isNaN(u))throw new e(n,r.InvalidParameter,t);const f=S(c[2],null);if(null===f){const n="point"===l.type?l:l.extent?.center;return E(await b("rotate",[l.toJSON(),u,n?.x,n?.y]))}if(f instanceof C)return E(await b("rotate",[l.toJSON(),u,f.x,f.y]));throw new e(n,r.InvalidParameter,t)}))},z.functions.centroid=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,2,n,t),null===c[0])return null;const l=u(c[1]??"geometric").toLowerCase();if("geometric"!==l&&"labelpoint"!==l)throw new e(n,r.InvalidParameter,t);let d=c[0];if((Z(c[0])||f(c[0]))&&(d="geometric"===l?g(c[0],n.spatialReference):m(c[0],n.spatialReference),null===d))return null;if(!(d instanceof D))throw new e(n,r.InvalidParameter,t);return E("geometric"===l?await b("centroid",[d.toJSON()]):await b("labelPoint",[d.toJSON()]))}))},z.functions.measuretocoordinate=function(n,t){return z.standardFunctionAsync(n,t,I)},z.functions.pointtocoordinate=function(n,t){return z.standardFunctionAsync(n,t,F)},z.functions.distancetocoordinate=function(n,t){return z.standardFunctionAsync(n,t,j)},z.functions.multiparttosinglepart=function(n,t){return z.standardFunctionAsync(n,t,(async(s,c,l)=>{if(l=i(l),o(l,1,1,n,t),null===l[0])return null;if(!(l[0]instanceof D))throw new e(n,r.InvalidParameter,t);if(l[0]instanceof C)return[d(a(l[0]),n.spatialReference)];if(l[0]instanceof x)return[d(a(l[0]),n.spatialReference)];const u=E(await b("simplify",[l[0].toJSON()]));if(u instanceof U){const n=[],t=[];for(let e=0;e<u.rings.length;e++)if(u.isClockwise(u.rings[e])){const t=E({rings:[u.rings[e]],hasZ:!0===u.hasZ,hasM:!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 k){const n=[];for(let t=0;t<u.paths.length;t++){const e=E({paths:[u.paths[t]],hasZ:!0===u.hasZ,hasM:!0===u.hasM,spatialReference:u.spatialReference.toJSON()});n.push(e)}return n}if(l[0]instanceof L){const t=[],e=d(a(l[0]),n.spatialReference);for(let n=0;n<e.points.length;n++)t.push(e.getPoint(n));return t}return null}))},z.functions.isselfintersecting=function(n,t){return z.standardFunctionAsync(n,t,(async(n,t,e)=>{o(e,1,1,n,t);let r=(e=i(e))[0];if((Z(e[0])||f(e[0]))&&(r=h(e[0],n.spatialReference)),r instanceof L){const n=r.points;for(let t=0;t<n.length;t++)for(let e=t+1;e<n.length;e++)if(R(n[t],n[e]))return!0;return!1}return(r instanceof k||r instanceof U)&&await b("isSelfIntersecting",[r.toJSON()])}))},z.functions.issimple=function(n,t){return z.standardFunctionAsync(n,t,((a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return!0;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);return b("isSimple",[c[0].toJSON()])}))},z.functions.simplify=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);return E(await b("simplify",[c[0].toJSON()]))}))},z.functions.convexhull=function(n,t){return z.standardFunctionAsync(n,t,(async(a,s,c)=>{if(c=i(c),o(c,1,1,n,t),null===c[0])return null;if(!(c[0]instanceof D))throw new e(n,r.InvalidParameter,t);return E(await b("convexHull",[c[0].toJSON()]))}))},z.functions.getuser=function(a,i){return z.standardFunctionAsync(a,i,(async(s,c,l)=>{o(l,0,2,a,i);let f=S(l[1],""),d=!0===f;if(f=!0===f||!1===f?"":u(f),0===l.length||l[0]instanceof n){let n;n=a.services?.portal?a.services.portal:M.getDefault(),l.length>0&&(n=v(l[0],n));const e=await T(n,f,d);if(e){const n=JSON.parse(JSON.stringify(e));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,O(a))}return null}let m=null;if(w(l[0])&&(m=l[0]),m){if(d=!1,f)return null;await m.load();const e=await m.getOwningSystemUrl();if(!e){if(!f){const n=await m.getIdentityUser();return n?t.convertObjectToArcadeDictionary({username:n},O(a)):null}return null}let r;r=a.services?.portal?a.services.portal:M.getDefault(),r=v(new n(e),r);const i=await T(r,f,d);if(i){const n=JSON.parse(JSON.stringify(i));for(const t of["lastLogin","created","modified"])void 0!==n[t]&&null!==n[t]&&(n[t]=new Date(n[t]));return t.convertObjectToArcadeDictionary(n,O(a))}return null}throw new e(a,r.InvalidParameter,i)}))},z.functions.nearestcoordinate=function(n,a){return z.standardFunctionAsync(n,a,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,a),!(l[0]instanceof D||null===l[0]))throw new e(n,r.InvalidParameter,a);if(!(l[1]instanceof C||null===l[1]))throw new e(n,r.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const u=l[0]instanceof x?U.fromExtent(l[0]):l[0],f=await b("getNearestCoordinate",[u.toJSON(),l[1].toJSON(),{calculateLeftRightSide:!0}]);return null===f?null:t.convertObjectToArcadeDictionary({coordinate:E(f.coordinate),distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},O(n),!1,!0)}))},z.functions.nearestvertex=function(n,a){return z.standardFunctionAsync(n,a,(async(s,c,l)=>{if(l=i(l),o(l,2,2,n,a),!(l[0]instanceof D||null===l[0]))throw new e(n,r.InvalidParameter,a);if(!(l[1]instanceof C||null===l[1]))throw new e(n,r.InvalidParameter,a);if(null===l[0]||null===l[1])return null;const u=l[0]instanceof x?U.fromExtent(l[0]):l[0],f=await b("getNearestVertex",[u.toJSON(),l[1].toJSON()]);return null===f?null:t.convertObjectToArcadeDictionary({coordinate:E(f.coordinate),distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},O(n),!1,!0)}))})}export{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.33/esri/copyright.txt for details.
4
4
  */
5
- import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import l from"../ImmutablePointArray.js";import{D as o,m as s,F as f,W as c,E as u,n as m,v as p,q as h,l as w,f as g,g as R,k as y,j as d,i as P,d as v,L as I,X as b,y as O,A as j,H as S}from"../../chunks/languageUtils.js";import{angle2D as N,angleBetween2D as x,bearing2D as J,bearingBetween2D as F,pathsSelfIntersecting as k}from"./centroid.js";import{constructGeometryFromDictionary as Z}from"../geometry/constructors.js";import W from"../../geometry/Extent.js";import z from"../../geometry/Geometry.js";import A from"../../geometry/Multipoint.js";import q from"../../geometry/Point.js";import D from"../../geometry/Polygon.js";import M from"../../geometry/Polyline.js";import{isClockwise as G}from"../../geometry/support/coordsUtils.js";import{fromJSON as L}from"../../geometry/support/jsonUtils.js";import{isArray as U,isString as E,isNumber as _,isBoolean as T}from"../../support/guards.js";function C(C,H){C.ringisclockwise=function(e,t){return H(e,t,((n,i,f)=>{o(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(U(f[0]))for(const l of f[0]){if(!(l instanceof q))throw new r(e,a.InvalidParameter,t);c.push(l.hasZ?l.hasM?[l.x,l.y,l.z,l.m]:[l.x,l.y,l.z]:[l.x,l.y])}else if(f[0]instanceof l)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof q))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&G(c)}))},C.polygon=function(e,t){return H(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"polygon"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof D)u=L(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new D(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},C.polyline=function(e,t){return H(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"polyline"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof M)u=L(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new M(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},C.point=function(e,t){return H(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"point"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof q)u=L(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new q(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},C.multipoint=function(e,t){return H(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(Z(s[0],e.spatialReference,"multipoint"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof A)u=L(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new A(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},C.extent=function(e,t){return H(e,t,((i,l,s)=>{s=u(s),o(s,1,1,e,t);let m=null;if(s[0]instanceof n)m=f(Z(s[0],e.spatialReference),e.spatialReference);else if(s[0]instanceof q){const e={xmin:s[0].x,ymin:s[0].y,xmax:s[0].x,ymax:s[0].y,spatialReference:s[0].spatialReference.toJSON()},t=s[0];t.hasZ&&(e.zmin=t.z,e.zmax=t.z),t.hasM&&(e.mmin=t.m,e.mmax=t.m),m=L(e)}else if(s[0]instanceof D)m=L(s[0].extent?.toJSON());else if(s[0]instanceof M)m=L(s[0].extent?.toJSON());else if(s[0]instanceof A)m=L(s[0].extent?.toJSON());else if(s[0]instanceof W)m=L(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),m=f(new W(t),e.spatialReference)}if(null!==m&&!1===m.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(m)}))},C.geometry=function(e,t){return H(e,t,((i,l,s)=>{o(s,1,1,e,t);let u=null;if(null===s[0])return null;if(m(s[0]))u=f(s[0].geometry(),e.spatialReference);else if(s[0]instanceof n)u=f(Z(s[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(L(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},C.setgeometry=function(e,t){return H(e,t,((n,i,l)=>{if(o(l,2,2,e,t),!m(l[0]))throw new r(e,a.InvalidParameter,t);if(!0===l[0].immutable)throw new r(e,a.Immutable,t);if(!(l[1]instanceof z||null===l[1]))throw new r(e,a.InvalidParameter,t);return l[0]._geometry=l[1],p}))},C.feature=function(e,t){return H(e,t,((l,o,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(E(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(m(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof z)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{const n=s[0].hasField("geometry")?s[0].field("geometry"):null,l=s[0].hasField("attributes")?s[0].field("attributes"):null;let o,f;if(h(n))o=Z(n,e.spatialReference);else{if(null!=n&&!w(n))throw new r(e,a.InvalidParameter,t);o=n}if(h(l))f=i.parseAttributesFromDictionary(l);else{if(null!=l)throw new r(e,a.InvalidParameter,t);f=null}c=i.createFromGraphicLikeObject(o,f,null,e.timeZone)}}else if(2===s.length){let l=null,o=null;if(null!==s[0])if(s[0]instanceof z)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=Z(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}else{let l=null;const o={};if(null!==s[0])if(s[0]instanceof z)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=Z(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=g(s[n]),l=s[n+1];if(!(null==l||E(l)||isNaN(l)||R(l)||_(l)||y(l)||d(l)||T(l)))throw new r(e,a.InvalidParameter,t);if(P(l)||!1===v(l))throw new r(e,a.InvalidParameter,t);o[i]=l===p?null:l}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},C.dictionary=function(e,t){return H(e,t,((i,l,o)=>{if(0===o.length||1===o.length&&null===o[0]){const e=new n;return e.immutable=!1,e}if(1===o.length&&E(o[0]))try{const t=JSON.parse(o[0]),r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&o[0]instanceof z)try{const t=o[0].toJSON();t.hasZ=!0===o[0].hasZ,t.hasM=!0===o[0].hasM;const r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&m(o[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",o[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of o[0].keys())t.setField(n,o[0].field(n));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&(h(o[0])||b(o[0])))try{const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(2===o.length&&o[0]instanceof n&&T(o[1]))try{if(!(!0===o[1])){const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}return o[0].deepClone()}catch(u){throw new r(e,a.InvalidParameter,t)}if(o.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<o.length;n+=2){const i=g(o[n]),l=o[n+1];if(!(null==l||E(l)||isNaN(l)||R(l)||_(l)||T(l)||d(l)||y(l)||U(l)||s(l)))throw new r(e,a.InvalidParameter,t);if(P(l))throw new r(e,a.InvalidParameter,t);f[i]=l===p?null:l}const c=new n(f);return c.immutable=!1,c}))},C.haskey=function(t,i){return H(t,i,((l,s,f)=>{o(f,2,2,t,i);const c=g(f[1]);if(O(f[0])||f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof z){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},C.hasvalue=function(e,n){return H(e,n,((r,a,i)=>(o(i,2,2,e,n),null!=t(i[0],i[1]))))},C.indexof=function(e,t){return H(e,t,((n,i,l)=>{o(l,2,2,e,t);const f=l[1];if(U(l[0])){for(let e=0;e<l[0].length;e++)if(j(f,l[0][e]))return e;return-1}if(s(l[0])){const e=l[0].length();for(let t=0;t<e;t++)if(j(f,l[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},C.angle=function(e,t){return H(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof q))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof q))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof q))throw new r(e,a.InvalidParameter,t);return 2===l.length?N(l[0],l[1]):x(l[0],l[1],l[2])}))},C.bearing=function(e,t){return H(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof q))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof q))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof q))throw new r(e,a.InvalidParameter,t);return 2===l.length?J(l[0],l[1]):F(l[0],l[1],l[2])}))},C.isselfintersecting=function(e,t){return H(e,t,((n,r,a)=>{a=u(a),o(a,1,1,e,t);let i=a[0];if(i instanceof D)return i.isSelfIntersecting;if(i instanceof M)return k(i.paths);if(i instanceof A){const e=i.points;for(let t=0;t<e.length;t++)for(let n=0;n<e.length;n++)if(n!==t){let r=!0;for(let a=0;a<e[t].length;a++)if(e[t][a]!==e[n][a]){r=!1;break}if(!0===r)return!0}}if(U(i)||s(i)){const t=S(i,e.spatialReference);return null!==t&&(i=t.paths),k(i)}return!1}))}}export{C as registerFunctions};
5
+ import{geometryMember as e,getNestedOptionalValue as t}from"../containerUtils.js";import n from"../Dictionary.js";import{ArcadeExecutionError as r,ExecutionErrorCodes as a}from"../executionError.js";import i from"../Feature.js";import l from"../ImmutablePointArray.js";import{D as o,m as s,F as f,W as c,E as u,n as m,v as p,q as w,l as h,f as R,g,k as y,j as d,i as P,d as v,L as I,X as b,y as O,A as j}from"../../chunks/languageUtils.js";import{angle2D as N,angleBetween2D as S,bearing2D as x,bearingBetween2D as J}from"./centroid.js";import{constructGeometryFromDictionary as F}from"../geometry/constructors.js";import k from"../../geometry/Extent.js";import Z from"../../geometry/Geometry.js";import W from"../../geometry/Multipoint.js";import z from"../../geometry/Point.js";import A from"../../geometry/Polygon.js";import q from"../../geometry/Polyline.js";import{isClockwise as D}from"../../geometry/support/coordsUtils.js";import{fromJSON as M}from"../../geometry/support/jsonUtils.js";import{isArray as G,isString as L,isNumber as U,isBoolean as E}from"../../support/guards.js";function _(_,T){_.ringisclockwise=function(e,t){return T(e,t,((n,i,f)=>{o(f,1,1,e,t);let c=[];if(null===f[0])return!1;if(G(f[0]))for(const l of f[0]){if(!(l instanceof z))throw new r(e,a.InvalidParameter,t);c.push(l.hasZ?l.hasM?[l.x,l.y,l.z,l.m]:[l.x,l.y,l.z]:[l.x,l.y])}else if(f[0]instanceof l)c=f[0]._elements;else{if(!s(f[0]))throw new r(e,a.InvalidParameter,t);for(const n of f[0].toArray()){if(!(n instanceof z))throw new r(e,a.InvalidParameter,t);c.push(n.hasZ?n.hasM?[n.x,n.y,n.z,n.m]:[n.x,n.y,n.z]:[n.x,n.y])}}return!(c.length<3)&&D(c)}))},_.polygon=function(e,t){return T(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(F(s[0],e.spatialReference,"polygon"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof A)u=M(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new A(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.polyline=function(e,t){return T(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(F(s[0],e.spatialReference,"polyline"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof q)u=M(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new q(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.point=function(e,t){return T(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(F(s[0],e.spatialReference,"point"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof z)u=M(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new z(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.multipoint=function(e,t){return T(e,t,((i,l,s)=>{let u;if(o(s,1,1,e,t),s[0]instanceof n){const t=f(F(s[0],e.spatialReference,"multipoint"),e.spatialReference);if(null==t)return null;u=t}else if(s[0]instanceof W)u=M(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(new W(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.extent=function(e,t){return T(e,t,((i,l,s)=>{s=u(s),o(s,1,1,e,t);let m=null;if(s[0]instanceof n)m=f(F(s[0],e.spatialReference),e.spatialReference);else if(s[0]instanceof z){const e={xmin:s[0].x,ymin:s[0].y,xmax:s[0].x,ymax:s[0].y,spatialReference:s[0].spatialReference.toJSON()},t=s[0];t.hasZ&&(e.zmin=t.z,e.zmax=t.z),t.hasM&&(e.mmin=t.m,e.mmax=t.m),m=M(e)}else if(s[0]instanceof A)m=M(s[0].extent?.toJSON());else if(s[0]instanceof q)m=M(s[0].extent?.toJSON());else if(s[0]instanceof W)m=M(s[0].extent?.toJSON());else if(s[0]instanceof k)m=M(s[0].toJSON());else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),m=f(new k(t),e.spatialReference)}if(null!==m&&!1===m.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(m)}))},_.geometry=function(e,t){return T(e,t,((i,l,s)=>{o(s,1,1,e,t);let u=null;if(null===s[0])return null;if(m(s[0]))u=f(s[0].geometry(),e.spatialReference);else if(s[0]instanceof n)u=f(F(s[0],e.spatialReference),e.spatialReference);else{const t=JSON.parse(s[0]);t&&!t.spatialReference&&(t.spatialReference=e.spatialReference),u=f(M(t),e.spatialReference)}if(null!==u&&!1===u.spatialReference.equals(e.spatialReference))throw new r(e,a.WrongSpatialReference,t);return c(u)}))},_.setgeometry=function(e,t){return T(e,t,((n,i,l)=>{if(o(l,2,2,e,t),!m(l[0]))throw new r(e,a.InvalidParameter,t);if(!0===l[0].immutable)throw new r(e,a.Immutable,t);if(!(l[1]instanceof Z||null===l[1]))throw new r(e,a.InvalidParameter,t);return l[0]._geometry=l[1],p}))},_.feature=function(e,t){return T(e,t,((l,o,s)=>{if(0===s.length)throw new r(e,a.WrongNumberOfParameters,t);let c;if(1===s.length)if(L(s[0]))c=i.fromJson(JSON.parse(s[0]),e.timeZone);else if(m(s[0]))c=i.createFromArcadeFeature(s[0]);else if(s[0]instanceof Z)c=i.createFromGraphicLikeObject(s[0],null,null,e.timeZone);else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);{const n=s[0].hasField("geometry")?s[0].field("geometry"):null,l=s[0].hasField("attributes")?s[0].field("attributes"):null;let o,f;if(w(n))o=F(n,e.spatialReference);else{if(null!=n&&!h(n))throw new r(e,a.InvalidParameter,t);o=n}if(w(l))f=i.parseAttributesFromDictionary(l);else{if(null!=l)throw new r(e,a.InvalidParameter,t);f=null}c=i.createFromGraphicLikeObject(o,f,null,e.timeZone)}}else if(2===s.length){let l=null,o=null;if(null!==s[0])if(s[0]instanceof Z)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=F(s[0],e.spatialReference)}if(null!==s[1]){if(!(s[1]instanceof n))throw new r(e,a.InvalidParameter,t);o=i.parseAttributesFromDictionary(s[1])}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}else{let l=null;const o={};if(null!==s[0])if(s[0]instanceof Z)l=s[0];else{if(!(s[0]instanceof n))throw new r(e,a.InvalidParameter,t);l=F(s[0],e.spatialReference)}for(let n=1;n<s.length;n+=2){const i=R(s[n]),l=s[n+1];if(!(null==l||L(l)||isNaN(l)||g(l)||U(l)||y(l)||d(l)||E(l)))throw new r(e,a.InvalidParameter,t);if(P(l)||!1===v(l))throw new r(e,a.InvalidParameter,t);o[i]=l===p?null:l}c=i.createFromGraphicLikeObject(l,o,null,e.timeZone)}return c._geometry=f(c.geometry(),e.spatialReference),c.immutable=!1,c}))},_.dictionary=function(e,t){return T(e,t,((i,l,o)=>{if(0===o.length||1===o.length&&null===o[0]){const e=new n;return e.immutable=!1,e}if(1===o.length&&L(o[0]))try{const t=JSON.parse(o[0]),r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&o[0]instanceof Z)try{const t=o[0].toJSON();t.hasZ=!0===o[0].hasZ,t.hasM=!0===o[0].hasM;const r=n.convertObjectToArcadeDictionary(t,I(e),!1);return r.immutable=!1,r}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&m(o[0]))try{const e=new n;e.immutable=!1,e.setField("geometry",o[0].geometry());const t=new n;t.immutable=!1,e.setField("attributes",t);for(const n of o[0].keys())t.setField(n,o[0].field(n));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(1===o.length&&(w(o[0])||b(o[0])))try{const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}catch(u){throw new r(e,a.InvalidParameter,t)}if(2===o.length&&o[0]instanceof n&&E(o[1]))try{if(!(!0===o[1])){const e=new n;e.immutable=!1;for(const t of o[0].keys())e.setField(t,o[0].field(t));return e}return o[0].deepClone()}catch(u){throw new r(e,a.InvalidParameter,t)}if(o.length%2!=0)throw new r(e,a.WrongNumberOfParameters,t);const f={};for(let n=0;n<o.length;n+=2){const i=R(o[n]),l=o[n+1];if(!(null==l||L(l)||isNaN(l)||g(l)||U(l)||E(l)||d(l)||y(l)||G(l)||s(l)))throw new r(e,a.InvalidParameter,t);if(P(l))throw new r(e,a.InvalidParameter,t);f[i]=l===p?null:l}const c=new n(f);return c.immutable=!1,c}))},_.haskey=function(t,i){return T(t,i,((l,s,f)=>{o(f,2,2,t,i);const c=R(f[1]);if(O(f[0])||f[0]instanceof n)return f[0].hasField(c);if(f[0]instanceof Z){const t=e(f[0],c,null,null,2);return!t||"notfound"!==t.keystate}throw new r(t,a.InvalidParameter,i)}))},_.hasvalue=function(e,n){return T(e,n,((r,a,i)=>(o(i,2,2,e,n),null!=t(i[0],i[1]))))},_.indexof=function(e,t){return T(e,t,((n,i,l)=>{o(l,2,2,e,t);const f=l[1];if(G(l[0])){for(let e=0;e<l[0].length;e++)if(j(f,l[0][e]))return e;return-1}if(s(l[0])){const e=l[0].length();for(let t=0;t<e;t++)if(j(f,l[0].get(t)))return t;return-1}throw new r(e,a.InvalidParameter,t)}))},_.angle=function(e,t){return T(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof z))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof z))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof z))throw new r(e,a.InvalidParameter,t);return 2===l.length?N(l[0],l[1]):S(l[0],l[1],l[2])}))},_.bearing=function(e,t){return T(e,t,((n,i,l)=>{if(l=u(l),o(l,2,3,e,t),!(l[0]instanceof z))throw new r(e,a.InvalidParameter,t);if(!(l[1]instanceof z))throw new r(e,a.InvalidParameter,t);if(l.length>2&&!(l[2]instanceof z))throw new r(e,a.InvalidParameter,t);return 2===l.length?x(l[0],l[1]):J(l[0],l[1],l[2])}))}}export{_ 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.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as t}from"../executionError.js";import{cloneGeometry as r}from"../kernel.js";import{E as i,D as a,g as l,k as o,j as u,f as c,m as s,F as f,G as m,l as d,H as w,J as h,t as p,e as g,K as v,L as P}from"../../chunks/languageUtils.js";import{commonRelationsCheck as x,toCurveType as y,planarLength3D as I,measureToCoordinateFunc as R,pointToCoordinateFunc as j,distanceToCoordinateFunc as N}from"../geometry/functions.js";import{convertFromSpatialReferenceUnit as b,toAreaUnit as E,convert as L,toLengthUnit as D,convertToSpatialReferenceUnit as O}from"../geometry/unitConversion.js";import T from"../../geometry/Extent.js";import k from"../../geometry/Geometry.js";import M from"../../geometry/Multipoint.js";import S from"../../geometry/Point.js";import A from"../../geometry/Polygon.js";import C from"../../geometry/Polyline.js";import{fromJSON as Z}from"../../geometry/support/jsonUtils.js";import{squareMeters as q,meters as J}from"../geometry/extendedUnitData.js";import{isArray as U}from"../../support/guards.js";let z;async function G(){null==z&&(z=await import("../geometry/operators.js"),await z.loadAll())}function H(G,H){G.disjoint=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null===a[0]||null===a[1]||z.disjoint.execute(a[0],a[1]))))},G.intersects=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.intersects.execute(a[0],a[1]))))},G.touches=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.touches.execute(a[0],a[1]))))},G.crosses=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.crosses.execute(a[0],a[1]))))},G.within=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.within.execute(a[0],a[1]))))},G.contains=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.contains.execute(a[0],a[1]))))},G.overlaps=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&z.overlaps.execute(a[0],a[1]))))},G.equals=function(e,n){return H(e,n,((t,r,i)=>(a(i,2,2,e,n),i[0]===i[1]||(i[0]instanceof k&&i[1]instanceof k?z.equals.execute(i[0],i[1]):(l(i[0])&&l(i[1])||o(i[0])&&o(i[1])||!(!u(i[0])||!u(i[1])))&&i[0].equals(i[1])))))},G.relate=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,3,3,e,r),u[0]instanceof k&&u[1]instanceof k)return z.relate.execute(u[0],u[1],c(u[2]));if(u[0]instanceof k&&null===u[1])return!1;if(u[1]instanceof k&&null===u[0])return!1;if(null===u[0]&&null===u[1])return!1;throw new n(e,t.InvalidParameter,r)}))},G.intersection=function(e,n){return H(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null===a[0]||null===a[1]?null:z.intersection.execute(a[0],a[1]))))},G.union=function(e,a){return H(e,a,((l,o,u)=>{if(0===(u=i(u)).length)throw new n(e,t.WrongNumberOfParameters,a);const c=[];if(1===u.length)if(U(u[0])){for(const r of i(u[0]))if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);c.push(r)}}else{if(!s(u[0])){if(u[0]instanceof k)return f(r(u[0]),e.spatialReference);if(null===u[0])return null;throw new n(e,t.InvalidParameter,a)}for(const r of i(u[0].toArray()))if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);c.push(r)}}else for(const r of u)if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);c.push(r)}return 0===c.length?null:z.union.executeMany(c)}))},G.difference=function(e,n){return H(e,n,((t,a,l)=>(l=i(l),x(l,e,n),null===l[0]?null:null===l[1]?r(l[0]):z.difference.execute(l[0],l[1]))))},G.symmetricdifference=function(e,n){return H(e,n,((t,a,l)=>(l=i(l),x(l,e,n),null===l[0]&&null===l[1]?null:null===l[0]?r(l[1]):null===l[1]?r(l[0]):z.symmetricDifference.execute(l[0],l[1]))))},G.clip=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,2,2,e,r),!(u[1]instanceof T)&&null!==u[1])throw new n(e,t.InvalidParameter,r);if(null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return null===u[1]?null:z.clip.execute(u[0],u[1])}))},G.cut=function(e,l){return H(e,l,((o,u,c)=>{if(c=i(c),a(c,2,2,e,l),!(c[1]instanceof C)&&null!==c[1])throw new n(e,t.InvalidParameter,l);if(null===c[0])return[];if(!(c[0]instanceof k))throw new n(e,t.InvalidParameter,l);return null===c[1]?[r(c[0])]:z.cut.execute(c[0],c[1])}))},G.area=function(e,r){return H(e,r,((l,o,u)=>{a(u,1,2,e,r);let c=(u=i(u))[0];if((U(u[0])||s(u[0]))&&(c=m(u[0],e.spatialReference)),null===c)return 0;if(!(c instanceof k))throw new n(e,t.InvalidParameter,r);return b(c.spatialReference,E(u[1]),z.area.execute(c))}))},G.areageodetic=function(e,r){return H(e,r,((l,o,u)=>{a(u,1,3,e,r);let c=(u=i(u))[0];(U(c)||s(c))&&(c=m(c,e.spatialReference));const f=E(u[1]),w=y(u[2])??"geodesic";if(null==c)return 0;if(!d(c))throw new n(e,t.InvalidParameter,r);return L(q,f,z.geodeticArea.execute(c,{curveType:w}))}))},G.length=function(e,r){return H(e,r,((l,o,u)=>{a(u,1,2,e,r);let c=(u=i(u))[0];if((U(u[0])||s(u[0]))&&(c=w(u[0],e.spatialReference)),null===c)return 0;if(!(c instanceof k))throw new n(e,t.InvalidParameter,r);return b(c.spatialReference,D(u[1]),z.length.execute(c))}))},G.length3d=function(e,r){return H(e,r,((l,o,u)=>{a(u,1,2,e,r);let c=(u=i(u))[0];if((U(u[0])||s(u[0]))&&(c=w(u[0],e.spatialReference)),null===c)return 0;if(!(c instanceof k))throw new n(e,t.InvalidParameter,r);return!0===c.hasZ?b(c.spatialReference,D(u[1]),I(c)):b(c.spatialReference,D(u[1]),z.length.execute(c))}))},G.lengthgeodetic=function(e,r){return H(e,r,((l,o,u)=>{a(u,1,3,e,r);let c=(u=i(u))[0];(U(u[0])||s(u[0]))&&(c=w(u[0],e.spatialReference));const f=y(u[2])??"geodesic";if(null==c)return 0;if(null!=c&&!d(c))throw new n(e,t.InvalidParameter,r);const m=D(u[1]);return L(J,m,z.geodeticLength.execute(c,{curveType:f}))}))},G.distance=function(e,r){return H(e,r,((l,o,u)=>{u=i(u),a(u,2,3,e,r);let c=u[0];if((U(u[0])||s(u[0]))&&(c=h(u[0],e.spatialReference)),!(c instanceof k))throw new n(e,t.InvalidParameter,r);let f=u[1];if((U(u[1])||s(u[1]))&&(f=h(u[1],e.spatialReference)),!(f instanceof k))throw new n(e,t.InvalidParameter,r);return b(c.spatialReference,D(u[2]),z.distance.execute(c,f))}))},G.distancegeodetic=function(e,r){return H(e,r,((l,o,u)=>{u=i(u),a(u,2,4,e,r);const c=u[0];if(!(c instanceof S))throw new n(e,t.InvalidParameter,r);const s=u[1];if(!(s instanceof S))throw new n(e,t.InvalidParameter,r);const f=D(u[2]),m=y(u[3])??"geodesic",d=new C({paths:[],spatialReference:c.spatialReference});return d.addPath([c,s]),L(J,f,z.geodeticLength.execute(d,{curveType:m}))}))},G.densify=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,2,3,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const c=p(u[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,r);if(c<=0)throw new n(e,t.InvalidParameter,r);const s=O(D(u[2]),u[0].spatialReference,c);switch(u[0].type){case"polygon":case"polyline":case"extent":return z.densify.execute(u[0],s);default:return u[0]}}))},G.densifygeodetic=function(e,r){return H(e,r,((l,o,u)=>{u=i(u),a(u,2,4,e,r);const c=u[0];if(null==c)return null;if(!d(c))throw new n(e,t.InvalidParameter,r);const s=p(u[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,r);if(s<=0)throw new n(e,t.InvalidParameter,r);const f=D(u[2]),m=y(u[3])??"geodesic",w=L(f,J,s);switch(c.type){case"polygon":case"polyline":case"extent":return z.geodeticDensify.execute(c,w,{curveType:m});default:return c}}))},G.generalize=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,2,4,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const c=p(u[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,r);const s=O(D(u[3]),u[0].spatialReference,c);return z.generalize.execute(u[0],s,{removeDegenerateParts:g(v(u[2],!0))})}))},G.buffer=function(e,l){return H(e,l,((o,u,c)=>{if(c=i(c),a(c,2,3,e,l),null===c[0])return null;if(!(c[0]instanceof k))throw new n(e,t.InvalidParameter,l);const s=p(c[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,l);return 0===s?r(c[0]):z.buffer.execute(c[0],O(D(c[2]),c[0].spatialReference,s))}))},G.buffergeodetic=function(e,l){return H(e,l,((o,u,c)=>{c=i(c),a(c,2,4,e,l);const s=c[0];if(null==s)return null;if(!d(s))throw new n(e,t.InvalidParameter,l);const f=p(c[1]);if(isNaN(f))throw new n(e,t.InvalidParameter,l);if(0===f)return r(s);const m=D(c[2]),w=y(c[3])??"geodesic";return z.geodesicBuffer.execute(s,L(m,J,f),{curveType:w})}))},G.offset=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,2,6,e,r),null===u[0])return null;if(!(u[0]instanceof A||u[0]instanceof C))throw new n(e,t.InvalidParameter,r);const s=p(u[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,r);const f=O(D(u[2]),u[0].spatialReference,s),m=c(u[3]??"round").toLowerCase();let d;switch(m){case"round":case"bevel":case"miter":case"square":d=m;break;default:d="round"}const w=p(v(u[4],10));if(isNaN(w))throw new n(e,t.InvalidParameter,r);const h=p(v(u[5],0));if(isNaN(h))throw new n(e,t.InvalidParameter,r);return z.offset.execute(u[0],f,{joins:d,miterLimit:w,flattenError:h})}))},G.rotate=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,2,3,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const c=u[0]instanceof T?A.fromExtent(u[0]):u[0],s=p(u[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,r);const f=v(u[2],null);if(null===f){const e="point"===c.type?c:c.extent?.center;return z.rotate(c,s,e?.x,e?.y)}if(f instanceof S)return z.rotate(c,s,f.x,f.y);throw new n(e,t.InvalidParameter,r)}))},G.centroid=function(e,r){return H(e,r,((e,r,l)=>{if(l=i(l),a(l,1,2,e,r),null===l[0])return null;const o=c(l[1]??"geometric").toLowerCase();if("geometric"!==o&&"labelpoint"!==o)throw new n(e,t.InvalidParameter,r);let u=l[0];if((U(l[0])||s(l[0]))&&(u="geometric"===o?h(l[0],e.spatialReference):m(l[0],e.spatialReference),null===u))return null;if(!(u instanceof k))throw new n(e,t.InvalidParameter,r);return"geometric"===o?z.centroid.execute(u):z.labelPoint.execute(u)}))},G.measuretocoordinate=function(e,n){return H(e,n,R)},G.pointtocoordinate=function(e,n){return H(e,n,j)},G.distancetocoordinate=function(e,n){return H(e,n,N)},G.multiparttosinglepart=function(e,l){return H(e,l,((o,u,c)=>{if(c=i(c),a(c,1,1,e,l),null===c[0])return null;if(!(c[0]instanceof k))throw new n(e,t.InvalidParameter,l);if(c[0]instanceof S)return[f(r(c[0]),e.spatialReference)];if(c[0]instanceof T)return[f(r(c[0]),e.spatialReference)];const s=z.simplify.execute(c[0]);if(s instanceof A){const e=[],n=[];for(let t=0;t<s.rings.length;t++)if(s.isClockwise(s.rings[t])){const n=Z({rings:[s.rings[t]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});e.push(n)}else n.push({ring:s.rings[t],pt:s.getPoint(t,0)});for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(e[r].contains(n[t].pt)){e[r].addRing(n[t].ring);break}return e}if(s instanceof C){const e=[];for(let n=0;n<s.paths.length;n++){const t=Z({paths:[s.paths[n]],hasZ:!0===s.hasZ,hasM:!0===s.hasM,spatialReference:s.spatialReference.toJSON()});e.push(t)}return e}if(c[0]instanceof M){const n=[],t=f(r(c[0]),e.spatialReference);for(let e=0;e<t.points.length;e++)n.push(t.getPoint(e));return n}return null}))},G.issimple=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return!0;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return z.simplify.isSimple(u[0])}))},G.simplify=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return z.simplify.execute(u[0])}))},G.convexhull=function(e,r){return H(e,r,((l,o,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return z.convexHull.execute(u[0])}))},G.nearestcoordinate=function(r,l){return H(r,l,((o,u,c)=>{if(c=i(c),a(c,2,2,r,l),!(c[0]instanceof k||null===c[0]))throw new n(r,t.InvalidParameter,l);if(!(c[1]instanceof S||null===c[1]))throw new n(r,t.InvalidParameter,l);if(null===c[0]||null===c[1])return null;const s=c[0]instanceof T?A.fromExtent(c[0]):c[0],f=z.proximity.getNearestCoordinate(s,c[1],{calculateLeftRightSide:!0});return null===f||f.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:f.coordinate,distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},P(r),!1,!0)}))},G.nearestvertex=function(r,l){return H(r,l,((o,u,c)=>{if(c=i(c),a(c,2,2,r,l),!(c[0]instanceof k||null===c[0]))throw new n(r,t.InvalidParameter,l);if(!(c[1]instanceof S||null===c[1]))throw new n(r,t.InvalidParameter,l);if(null===c[0]||null===c[1])return null;const s=c[0]instanceof T?A.fromExtent(c[0]):c[0],f=z.proximity.getNearestVertex(s,c[1]);return null===f||f.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:f.coordinate,distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},P(r),!1,!0)}))}}export{G as loadOperators,H as registerFunctions};
5
+ import e from"../Dictionary.js";import{ArcadeExecutionError as n,ExecutionErrorCodes as t}from"../executionError.js";import{cloneGeometry as r}from"../kernel.js";import{E as i,D as a,g as o,k as l,j as u,f as s,m as c,F as f,G as m,l as d,H as w,J as h,t as p,e as g,K as v,L as P}from"../../chunks/languageUtils.js";import{commonRelationsCheck as x,toCurveType as y,planarLength3D as I,measureToCoordinateFunc as R,pointToCoordinateFunc as j,distanceToCoordinateFunc as N}from"../geometry/functions.js";import{convertFromSpatialReferenceUnit as b,toAreaUnit as E,convert as L,toLengthUnit as D,convertToSpatialReferenceUnit as O}from"../geometry/unitConversion.js";import{equals as S}from"../../core/arrayUtils.js";import T from"../../geometry/Extent.js";import k from"../../geometry/Geometry.js";import M from"../../geometry/Multipoint.js";import A from"../../geometry/Point.js";import C from"../../geometry/Polygon.js";import Z from"../../geometry/Polyline.js";import{fromJSON as q}from"../../geometry/support/jsonUtils.js";import{squareMeters as U,meters as J}from"../geometry/extendedUnitData.js";import{isArray as z}from"../../support/guards.js";let G;async function H(){null==G&&(G=await import("../geometry/operators.js"),await G.loadAll())}function B(H,B){H.disjoint=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null===a[0]||null===a[1]||G.disjoint.execute(a[0],a[1]))))},H.intersects=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.intersects.execute(a[0],a[1]))))},H.touches=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.touches.execute(a[0],a[1]))))},H.crosses=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.crosses.execute(a[0],a[1]))))},H.within=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.within.execute(a[0],a[1]))))},H.contains=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.contains.execute(a[0],a[1]))))},H.overlaps=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null!==a[0]&&null!==a[1]&&G.overlaps.execute(a[0],a[1]))))},H.equals=function(e,n){return B(e,n,((t,r,i)=>(a(i,2,2,e,n),i[0]===i[1]||(i[0]instanceof k&&i[1]instanceof k?G.equals.execute(i[0],i[1]):(o(i[0])&&o(i[1])||l(i[0])&&l(i[1])||!(!u(i[0])||!u(i[1])))&&i[0].equals(i[1])))))},H.relate=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,3,3,e,r),u[0]instanceof k&&u[1]instanceof k)return G.relate.execute(u[0],u[1],s(u[2]));if(u[0]instanceof k&&null===u[1])return!1;if(u[1]instanceof k&&null===u[0])return!1;if(null===u[0]&&null===u[1])return!1;throw new n(e,t.InvalidParameter,r)}))},H.intersection=function(e,n){return B(e,n,((t,r,a)=>(a=i(a),x(a,e,n),null===a[0]||null===a[1]?null:G.intersection.execute(a[0],a[1]))))},H.union=function(e,a){return B(e,a,((o,l,u)=>{if(0===(u=i(u)).length)throw new n(e,t.WrongNumberOfParameters,a);const s=[];if(1===u.length)if(z(u[0])){for(const r of i(u[0]))if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);s.push(r)}}else{if(!c(u[0])){if(u[0]instanceof k)return f(r(u[0]),e.spatialReference);if(null===u[0])return null;throw new n(e,t.InvalidParameter,a)}for(const r of i(u[0].toArray()))if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);s.push(r)}}else for(const r of u)if(null!==r){if(!(r instanceof k))throw new n(e,t.InvalidParameter,a);s.push(r)}return 0===s.length?null:G.union.executeMany(s)}))},H.difference=function(e,n){return B(e,n,((t,a,o)=>(o=i(o),x(o,e,n),null===o[0]?null:null===o[1]?r(o[0]):G.difference.execute(o[0],o[1]))))},H.symmetricdifference=function(e,n){return B(e,n,((t,a,o)=>(o=i(o),x(o,e,n),null===o[0]&&null===o[1]?null:null===o[0]?r(o[1]):null===o[1]?r(o[0]):G.symmetricDifference.execute(o[0],o[1]))))},H.clip=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,2,2,e,r),!(u[1]instanceof T)&&null!==u[1])throw new n(e,t.InvalidParameter,r);if(null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return null===u[1]?null:G.clip.execute(u[0],u[1])}))},H.cut=function(e,o){return B(e,o,((l,u,s)=>{if(s=i(s),a(s,2,2,e,o),!(s[1]instanceof Z)&&null!==s[1])throw new n(e,t.InvalidParameter,o);if(null===s[0])return[];if(!(s[0]instanceof k))throw new n(e,t.InvalidParameter,o);return null===s[1]?[r(s[0])]:G.cut.execute(s[0],s[1])}))},H.area=function(e,r){return B(e,r,((o,l,u)=>{a(u,1,2,e,r);let s=(u=i(u))[0];if((z(u[0])||c(u[0]))&&(s=m(u[0],e.spatialReference)),null===s)return 0;if(!(s instanceof k))throw new n(e,t.InvalidParameter,r);return b(s.spatialReference,E(u[1]),G.area.execute(s))}))},H.areageodetic=function(e,r){return B(e,r,((o,l,u)=>{a(u,1,3,e,r);let s=(u=i(u))[0];(z(s)||c(s))&&(s=m(s,e.spatialReference));const f=E(u[1]),w=y(u[2])??"geodesic";if(null==s)return 0;if(!d(s))throw new n(e,t.InvalidParameter,r);return L(U,f,G.geodeticArea.execute(s,{curveType:w}))}))},H.length=function(e,r){return B(e,r,((o,l,u)=>{a(u,1,2,e,r);let s=(u=i(u))[0];if((z(u[0])||c(u[0]))&&(s=w(u[0],e.spatialReference)),null===s)return 0;if(!(s instanceof k))throw new n(e,t.InvalidParameter,r);return b(s.spatialReference,D(u[1]),G.length.execute(s))}))},H.length3d=function(e,r){return B(e,r,((o,l,u)=>{a(u,1,2,e,r);let s=(u=i(u))[0];if((z(u[0])||c(u[0]))&&(s=w(u[0],e.spatialReference)),null===s)return 0;if(!(s instanceof k))throw new n(e,t.InvalidParameter,r);return!0===s.hasZ?b(s.spatialReference,D(u[1]),I(s)):b(s.spatialReference,D(u[1]),G.length.execute(s))}))},H.lengthgeodetic=function(e,r){return B(e,r,((o,l,u)=>{a(u,1,3,e,r);let s=(u=i(u))[0];(z(u[0])||c(u[0]))&&(s=w(u[0],e.spatialReference));const f=y(u[2])??"geodesic";if(null==s)return 0;if(null!=s&&!d(s))throw new n(e,t.InvalidParameter,r);const m=D(u[1]);return L(J,m,G.geodeticLength.execute(s,{curveType:f}))}))},H.distance=function(e,r){return B(e,r,((o,l,u)=>{u=i(u),a(u,2,3,e,r);let s=u[0];if((z(u[0])||c(u[0]))&&(s=h(u[0],e.spatialReference)),!(s instanceof k))throw new n(e,t.InvalidParameter,r);let f=u[1];if((z(u[1])||c(u[1]))&&(f=h(u[1],e.spatialReference)),!(f instanceof k))throw new n(e,t.InvalidParameter,r);return b(s.spatialReference,D(u[2]),G.distance.execute(s,f))}))},H.distancegeodetic=function(e,r){return B(e,r,((o,l,u)=>{u=i(u),a(u,2,4,e,r);const s=u[0];if(!(s instanceof A))throw new n(e,t.InvalidParameter,r);const c=u[1];if(!(c instanceof A))throw new n(e,t.InvalidParameter,r);const f=D(u[2]),m=y(u[3])??"geodesic",d=new Z({paths:[],spatialReference:s.spatialReference});return d.addPath([s,c]),L(J,f,G.geodeticLength.execute(d,{curveType:m}))}))},H.densify=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,2,3,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const s=p(u[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,r);if(s<=0)throw new n(e,t.InvalidParameter,r);const c=O(D(u[2]),u[0].spatialReference,s);switch(u[0].type){case"polygon":case"polyline":case"extent":return G.densify.execute(u[0],c);default:return u[0]}}))},H.densifygeodetic=function(e,r){return B(e,r,((o,l,u)=>{u=i(u),a(u,2,4,e,r);const s=u[0];if(null==s)return null;if(!d(s))throw new n(e,t.InvalidParameter,r);const c=p(u[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,r);if(c<=0)throw new n(e,t.InvalidParameter,r);const f=D(u[2]),m=y(u[3])??"geodesic",w=L(f,J,c);switch(s.type){case"polygon":case"polyline":case"extent":return G.geodeticDensify.execute(s,w,{curveType:m});default:return s}}))},H.generalize=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,2,4,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const s=p(u[1]);if(isNaN(s))throw new n(e,t.InvalidParameter,r);const c=O(D(u[3]),u[0].spatialReference,s);return G.generalize.execute(u[0],c,{removeDegenerateParts:g(v(u[2],!0))})}))},H.buffer=function(e,o){return B(e,o,((l,u,s)=>{if(s=i(s),a(s,2,3,e,o),null===s[0])return null;if(!(s[0]instanceof k))throw new n(e,t.InvalidParameter,o);const c=p(s[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,o);return 0===c?r(s[0]):G.buffer.execute(s[0],O(D(s[2]),s[0].spatialReference,c))}))},H.buffergeodetic=function(e,o){return B(e,o,((l,u,s)=>{s=i(s),a(s,2,4,e,o);const c=s[0];if(null==c)return null;if(!d(c))throw new n(e,t.InvalidParameter,o);const f=p(s[1]);if(isNaN(f))throw new n(e,t.InvalidParameter,o);if(0===f)return r(c);const m=D(s[2]),w=y(s[3])??"geodesic";return G.geodesicBuffer.execute(c,L(m,J,f),{curveType:w})}))},H.offset=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,2,6,e,r),null===u[0])return null;if(!(u[0]instanceof C||u[0]instanceof Z))throw new n(e,t.InvalidParameter,r);const c=p(u[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,r);const f=O(D(u[2]),u[0].spatialReference,c),m=s(u[3]??"round").toLowerCase();let d;switch(m){case"round":case"bevel":case"miter":case"square":d=m;break;default:d="round"}const w=p(v(u[4],10));if(isNaN(w))throw new n(e,t.InvalidParameter,r);const h=p(v(u[5],0));if(isNaN(h))throw new n(e,t.InvalidParameter,r);return G.offset.execute(u[0],f,{joins:d,miterLimit:w,flattenError:h})}))},H.rotate=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,2,3,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);const s=u[0]instanceof T?C.fromExtent(u[0]):u[0],c=p(u[1]);if(isNaN(c))throw new n(e,t.InvalidParameter,r);const f=v(u[2],null);if(null===f){const e="point"===s.type?s:s.extent?.center;return G.rotate(s,c,e?.x,e?.y)}if(f instanceof A)return G.rotate(s,c,f.x,f.y);throw new n(e,t.InvalidParameter,r)}))},H.centroid=function(e,r){return B(e,r,((e,r,o)=>{if(o=i(o),a(o,1,2,e,r),null===o[0])return null;const l=s(o[1]??"geometric").toLowerCase();if("geometric"!==l&&"labelpoint"!==l)throw new n(e,t.InvalidParameter,r);let u=o[0];if((z(o[0])||c(o[0]))&&(u="geometric"===l?h(o[0],e.spatialReference):m(o[0],e.spatialReference),null===u))return null;if(!(u instanceof k))throw new n(e,t.InvalidParameter,r);return"geometric"===l?G.centroid.execute(u):G.labelPoint.execute(u)}))},H.measuretocoordinate=function(e,n){return B(e,n,R)},H.pointtocoordinate=function(e,n){return B(e,n,j)},H.distancetocoordinate=function(e,n){return B(e,n,N)},H.multiparttosinglepart=function(e,o){return B(e,o,((l,u,s)=>{if(s=i(s),a(s,1,1,e,o),null===s[0])return null;if(!(s[0]instanceof k))throw new n(e,t.InvalidParameter,o);if(s[0]instanceof A)return[f(r(s[0]),e.spatialReference)];if(s[0]instanceof T)return[f(r(s[0]),e.spatialReference)];const c=G.simplify.execute(s[0]);if(c instanceof C){const e=[],n=[];for(let t=0;t<c.rings.length;t++)if(c.isClockwise(c.rings[t])){const n=q({rings:[c.rings[t]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});e.push(n)}else n.push({ring:c.rings[t],pt:c.getPoint(t,0)});for(let t=0;t<n.length;t++)for(let r=0;r<e.length;r++)if(e[r].contains(n[t].pt)){e[r].addRing(n[t].ring);break}return e}if(c instanceof Z){const e=[];for(let n=0;n<c.paths.length;n++){const t=q({paths:[c.paths[n]],hasZ:!0===c.hasZ,hasM:!0===c.hasM,spatialReference:c.spatialReference.toJSON()});e.push(t)}return e}if(s[0]instanceof M){const n=[],t=f(r(s[0]),e.spatialReference);for(let e=0;e<t.points.length;e++)n.push(t.getPoint(e));return n}return null}))},H.isselfintersecting=function(e,n){return B(e,n,((e,n,t)=>{a(t,1,1,e,n);let r=(t=i(t))[0];if((z(t[0])||c(t[0]))&&(r=w(t[0],e.spatialReference)),r instanceof M){const e=r.points;for(let n=0;n<e.length;n++)for(let t=n+1;t<e.length;t++)if(S(e[n],e[t]))return!0;return!1}return(r instanceof Z||r instanceof C)&&G.isSelfIntersecting(r)}))},H.issimple=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return!0;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return G.simplify.isSimple(u[0])}))},H.simplify=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return G.simplify.execute(u[0])}))},H.convexhull=function(e,r){return B(e,r,((o,l,u)=>{if(u=i(u),a(u,1,1,e,r),null===u[0])return null;if(!(u[0]instanceof k))throw new n(e,t.InvalidParameter,r);return G.convexHull.execute(u[0])}))},H.nearestcoordinate=function(r,o){return B(r,o,((l,u,s)=>{if(s=i(s),a(s,2,2,r,o),!(s[0]instanceof k||null===s[0]))throw new n(r,t.InvalidParameter,o);if(!(s[1]instanceof A||null===s[1]))throw new n(r,t.InvalidParameter,o);if(null===s[0]||null===s[1])return null;const c=s[0]instanceof T?C.fromExtent(s[0]):s[0],f=G.proximity.getNearestCoordinate(c,s[1],{calculateLeftRightSide:!0});return null===f||f.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:f.coordinate,distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},P(r),!1,!0)}))},H.nearestvertex=function(r,o){return B(r,o,((l,u,s)=>{if(s=i(s),a(s,2,2,r,o),!(s[0]instanceof k||null===s[0]))throw new n(r,t.InvalidParameter,o);if(!(s[1]instanceof A||null===s[1]))throw new n(r,t.InvalidParameter,o);if(null===s[0]||null===s[1])return null;const c=s[0]instanceof T?C.fromExtent(s[0]):s[0],f=G.proximity.getNearestVertex(c,s[1]);return null===f||f.isEmpty?null:e.convertObjectToArcadeDictionary({coordinate:f.coordinate,distance:f.distance,sideOfLine:0===f.distance?"straddle":f.rightSide?"right":"left"},P(r),!1,!0)}))}}export{H as loadOperators,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.33/esri/copyright.txt for details.
4
4
  */
5
- import{execute as n}from"../../geometry/operators/affineTransformOperator.js";import{l as f}from"../../chunks/geodesicBufferOperator.js";export{g as geodesicBuffer}from"../../chunks/geodesicBufferOperator.js";import{l as m}from"../../chunks/geodeticAreaOperator.js";export{g as geodeticArea}from"../../chunks/geodeticAreaOperator.js";import{l as h}from"../../chunks/geodeticDensifyOperator.js";export{g as geodeticDensify}from"../../chunks/geodeticDensifyOperator.js";import{l as j}from"../../chunks/geodeticLengthOperator.js";export{g as geodeticLength}from"../../chunks/geodeticLengthOperator.js";import x from"../../geometry/operators/support/Transformation.js";export{a as area}from"../../chunks/areaOperator.js";export{b as buffer}from"../../chunks/bufferOperator.js";export{c as centroid}from"../../chunks/centroidOperator.js";export{c as clip}from"../../chunks/clipOperator.js";export{c as contains}from"../../chunks/containsOperator.js";export{c as convexHull}from"../../chunks/convexHullOperator.js";export{c as crosses}from"../../chunks/crossesOperator.js";export{c as cut}from"../../chunks/cutOperator.js";export{d as densify}from"../../chunks/densifyOperator.js";export{d as difference}from"../../chunks/differenceOperator.js";export{d as disjoint}from"../../chunks/disjointOperator.js";export{d as distance}from"../../chunks/distanceOperator.js";export{e as equals}from"../../chunks/equalsOperator.js";export{g as generalize}from"../../chunks/generalizeOperator.js";export{i as intersection}from"../../chunks/intersectionOperator.js";export{i as intersects}from"../../chunks/intersectsOperator.js";export{l as labelPoint}from"../../chunks/labelPointOperator.js";export{l as length}from"../../chunks/lengthOperator.js";export{o as offset}from"../../chunks/offsetOperator.js";export{o as overlaps}from"../../chunks/overlapsOperator.js";export{p as proximity}from"../../chunks/proximityOperator.js";export{r as relate}from"../../chunks/relateOperator.js";export{s as simplify}from"../../chunks/simplifyOperator.js";export{s as symmetricDifference}from"../../chunks/symmetricDifferenceOperator.js";export{t as touches}from"../../chunks/touchesOperator.js";export{u as union}from"../../chunks/unionOperator.js";export{w as within}from"../../chunks/withinOperator.js";function O(r,e,o,s){const t=(new x).rotate(e,o,s);return n(r,t)}async function k(){await Promise.all([m(),f(),h(),j()])}export{k as loadAll,O as rotate};
5
+ import{NonSimpleResult as n}from"../../chunks/OperatorDefinitions.js";import{execute as f}from"../../geometry/operators/affineTransformOperator.js";import{l as m}from"../../chunks/geodesicBufferOperator.js";export{g as geodesicBuffer}from"../../chunks/geodesicBufferOperator.js";import{l as h}from"../../chunks/geodeticAreaOperator.js";export{g as geodeticArea}from"../../chunks/geodeticAreaOperator.js";import{l as j}from"../../chunks/geodeticDensifyOperator.js";export{g as geodeticDensify}from"../../chunks/geodeticDensifyOperator.js";import{l as O}from"../../chunks/geodeticLengthOperator.js";export{g as geodeticLength}from"../../chunks/geodeticLengthOperator.js";import{isSimple as k}from"../../geometry/operators/simplifyOGCOperator.js";import x from"../../geometry/operators/support/Transformation.js";export{a as area}from"../../chunks/areaOperator.js";export{b as buffer}from"../../chunks/bufferOperator.js";export{c as centroid}from"../../chunks/centroidOperator.js";export{c as clip}from"../../chunks/clipOperator.js";export{c as contains}from"../../chunks/containsOperator.js";export{c as convexHull}from"../../chunks/convexHullOperator.js";export{c as crosses}from"../../chunks/crossesOperator.js";export{c as cut}from"../../chunks/cutOperator.js";export{d as densify}from"../../chunks/densifyOperator.js";export{d as difference}from"../../chunks/differenceOperator.js";export{d as disjoint}from"../../chunks/disjointOperator.js";export{d as distance}from"../../chunks/distanceOperator.js";export{e as equals}from"../../chunks/equalsOperator.js";export{g as generalize}from"../../chunks/generalizeOperator.js";export{i as intersection}from"../../chunks/intersectionOperator.js";export{i as intersects}from"../../chunks/intersectsOperator.js";export{l as labelPoint}from"../../chunks/labelPointOperator.js";export{l as length}from"../../chunks/lengthOperator.js";export{o as offset}from"../../chunks/offsetOperator.js";export{o as overlaps}from"../../chunks/overlapsOperator.js";export{p as proximity}from"../../chunks/proximityOperator.js";export{r as relate}from"../../chunks/relateOperator.js";export{s as simplify}from"../../chunks/simplifyOperator.js";export{s as symmetricDifference}from"../../chunks/symmetricDifferenceOperator.js";export{t as touches}from"../../chunks/touchesOperator.js";export{u as union}from"../../chunks/unionOperator.js";export{w as within}from"../../chunks/withinOperator.js";function y(r,e,o,s){const t=(new x).rotate(e,o,s);return f(r,t)}const D=new Set([5,6,7,10,11,12]);function v(r){const e=new n;return!k(r,e)&&D.has(e.m_reason)}async function A(){await Promise.all([h(),m(),j(),O()])}export{v as isSelfIntersecting,A as loadAll,y as rotate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromJSON as e}from"../../geometry/support/jsonUtils.js";function t(e,t){let r;return{loaded:!1,load:()=>r??=t().then((t=>{o[e]={loaded:!0,execute:t}}))}}function r(e){return null==e?null:e.toJSON()}const o={disjoint:t("disjoint",(()=>import("../../geometry/operators/json/disjointOperator.js").then((e=>e.execute)))),intersects:t("intersects",(()=>import("../../geometry/operators/json/intersectsOperator.js").then((e=>e.execute)))),touches:t("touches",(()=>import("../../geometry/operators/json/touchesOperator.js").then((e=>e.execute)))),crosses:t("crosses",(()=>import("../../geometry/operators/json/crossesOperator.js").then((e=>e.execute)))),within:t("within",(()=>import("../../geometry/operators/json/withinOperator.js").then((e=>e.execute)))),contains:t("contains",(()=>import("../../geometry/operators/json/containsOperator.js").then((e=>e.execute)))),overlaps:t("overlaps",(()=>import("../../geometry/operators/json/overlapsOperator.js").then((e=>e.execute)))),equals:t("equals",(async()=>{const t=await import("../../geometry/operators/equalsOperator.js");return(r,o)=>t.execute(e(r),e(o))})),relate:t("relate",(async()=>{const t=await import("../../geometry/operators/relateOperator.js");return(r,o,n)=>t.execute(e(r),e(o),n)})),intersection:t("intersection",(()=>import("../../geometry/operators/json/intersectionOperator.js").then((e=>e.execute)))),union:t("union",(()=>import("../../geometry/operators/json/unionOperator.js").then((e=>e.executeMany)))),difference:t("difference",(async()=>{const t=await import("../../geometry/operators/differenceOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),symmetricDifference:t("symmetricDifference",(async()=>{const t=await import("../../geometry/operators/symmetricDifferenceOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),clip:t("clip",(async()=>{const t=await import("../../geometry/operators/clipOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),cut:t("cut",(async()=>{const t=await import("../../geometry/operators/cutOperator.js");return(o,n)=>t.execute(e(o),e(n)).map((e=>r(e)))})),area:t("area",(async()=>{const t=await import("../../geometry/operators/areaOperator.js"),{convertFromSpatialReferenceUnit:r,toAreaUnit:o}=await import("./unitConversion.js");return(n,a)=>{const s=t.execute(e(n));return r(n.spatialReference,o(a),s)}})),geodeticArea:t("geodeticArea",(async()=>{const t=await import("../../geometry/operators/geodeticAreaOperator.js"),{convert:r,squareMeters:o,toAreaUnit:n}=await import("./unitConversion.js");return await t.load(),(a,s,i)=>{const c=t.execute(e(a),{curveType:i});return r(o,n(s),c)}})),length:t("length",(async()=>{const e=await import("../../geometry/operators/json/lengthOperator.js"),{convertFromSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n)=>{const a=e.execute(o);return t(o.spatialReference,r(n),a)}})),geodeticLength:t("geodeticLength",(async()=>{const t=await import("../../geometry/operators/geodeticLengthOperator.js"),{convert:r,meters:o,toLengthUnit:n}=await import("./unitConversion.js");return await t.load(),(a,s,i)=>{const c=t.execute(e(a),{curveType:i});return r(o,n(s),c)}})),distance:t("distance",(async()=>{const t=await import("../../geometry/operators/distanceOperator.js"),{convertFromSpatialReferenceUnit:r,toLengthUnit:o}=await import("./unitConversion.js");return(n,a,s)=>{const i=t.execute(e(n),e(a));return r(n.spatialReference,o(s),i)}})),densify:t("densify",(async()=>{const t=await import("../../geometry/operators/densifyOperator.js"),{convertToSpatialReferenceUnit:o,toLengthUnit:n}=await import("./unitConversion.js");return(a,s,i)=>(s=o(n(i),a.spatialReference,s),r(t.execute(e(a),s)))})),geodeticDensify:t("geodeticDensify",(async()=>{const t=await import("../../geometry/operators/geodeticDensifyOperator.js"),{convert:o,meters:n,toLengthUnit:a}=await import("./unitConversion.js");return await t.load(),(s,i,c,p)=>(i=o(a(c),n,i),r(t.execute(e(s),i,{curveType:p})))})),generalize:t("generalize",(async()=>{const t=await import("../../geometry/operators/generalizeOperator.js"),{convertToSpatialReferenceUnit:o,toLengthUnit:n}=await import("./unitConversion.js");return(a,s,i,c)=>(s=o(n(i),a.spatialReference,s),r(t.execute(e(a),s,c)))})),buffer:t("buffer",(async()=>{const e=await import("../../geometry/operators/json/bufferOperator.js"),{convertToSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n,a)=>(n=t(r(a),o.spatialReference,n),e.execute(o,n))})),geodesicBuffer:t("geodesicBuffer",(async()=>{const e=await import("../../geometry/operators/json/geodesicBufferOperator.js"),{convert:t,meters:r,toLengthUnit:o}=await import("./unitConversion.js");return await e.load(),(n,a,s,i)=>(a=t(o(s),r,a),e.execute(n,a,{curveType:i}))})),offset:t("offset",(async()=>{const e=await import("../../geometry/operators/json/offsetOperator.js"),{convertToSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n,a,s)=>(n=t(r(a),o.spatialReference,n),e.execute(o,n,s))})),rotate:t("rotate",(async()=>{const t=await import("../../geometry/operators/affineTransformOperator.js"),{default:o}=await import("../../geometry/operators/support/Transformation.js");return(n,a,s,i)=>{const c=(new o).rotate(a,s,i);return r(t.execute(e(n),c))}})),centroid:t("centroid",(async()=>{const t=await import("../../geometry/operators/centroidOperator.js");return o=>r(t.execute(e(o)))})),labelPoint:t("labelPoint",(async()=>{const t=await import("../../geometry/operators/labelPointOperator.js");return o=>r(t.execute(e(o)))})),simplify:t("simplify",(()=>import("../../geometry/operators/json/simplifyOperator.js").then((e=>e.execute)))),isSimple:t("isSimple",(()=>import("../../geometry/operators/json/simplifyOperator.js").then((e=>e.isSimple)))),convexHull:t("convexHull",(()=>import("../../geometry/operators/json/convexHullOperator.js").then((e=>e.execute)))),getNearestCoordinate:t("getNearestCoordinate",(async()=>{const t=await import("../../geometry/operators/proximityOperator.js");return(o,n,a)=>{const s=t.getNearestCoordinate(e(o),e(n),a);return{...s,coordinate:r(s.coordinate)}}})),getNearestVertex:t("getNearestVertex",(async()=>{const t=await import("../../geometry/operators/proximityOperator.js");return(o,n)=>{const a=t.getNearestVertex(e(o),e(n));return{...a,coordinate:r(a.coordinate)}}}))};function n(e,t){const r=o[e];return r.loaded?r.execute.apply(void 0,t):r.load().then((()=>n(e,t)))}export{n as invokeGeometryOp};
5
+ import{fromJSON as e}from"../../geometry/support/jsonUtils.js";function t(e,t){let r;return{loaded:!1,load:()=>r??=t().then((t=>{o[e]={loaded:!0,execute:t}}))}}function r(e){return null==e?null:e.toJSON()}const o={disjoint:t("disjoint",(()=>import("../../geometry/operators/json/disjointOperator.js").then((e=>e.execute)))),intersects:t("intersects",(()=>import("../../geometry/operators/json/intersectsOperator.js").then((e=>e.execute)))),touches:t("touches",(()=>import("../../geometry/operators/json/touchesOperator.js").then((e=>e.execute)))),crosses:t("crosses",(()=>import("../../geometry/operators/json/crossesOperator.js").then((e=>e.execute)))),within:t("within",(()=>import("../../geometry/operators/json/withinOperator.js").then((e=>e.execute)))),contains:t("contains",(()=>import("../../geometry/operators/json/containsOperator.js").then((e=>e.execute)))),overlaps:t("overlaps",(()=>import("../../geometry/operators/json/overlapsOperator.js").then((e=>e.execute)))),equals:t("equals",(async()=>{const t=await import("../../geometry/operators/equalsOperator.js");return(r,o)=>t.execute(e(r),e(o))})),relate:t("relate",(async()=>{const t=await import("../../geometry/operators/relateOperator.js");return(r,o,n)=>t.execute(e(r),e(o),n)})),intersection:t("intersection",(()=>import("../../geometry/operators/json/intersectionOperator.js").then((e=>e.execute)))),union:t("union",(()=>import("../../geometry/operators/json/unionOperator.js").then((e=>e.executeMany)))),difference:t("difference",(async()=>{const t=await import("../../geometry/operators/differenceOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),symmetricDifference:t("symmetricDifference",(async()=>{const t=await import("../../geometry/operators/symmetricDifferenceOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),clip:t("clip",(async()=>{const t=await import("../../geometry/operators/clipOperator.js");return(o,n)=>r(t.execute(e(o),e(n)))})),cut:t("cut",(async()=>{const t=await import("../../geometry/operators/cutOperator.js");return(o,n)=>t.execute(e(o),e(n)).map((e=>r(e)))})),area:t("area",(async()=>{const t=await import("../../geometry/operators/areaOperator.js"),{convertFromSpatialReferenceUnit:r,toAreaUnit:o}=await import("./unitConversion.js");return(n,a)=>{const s=t.execute(e(n));return r(n.spatialReference,o(a),s)}})),geodeticArea:t("geodeticArea",(async()=>{const t=await import("../../geometry/operators/geodeticAreaOperator.js"),{convert:r,squareMeters:o,toAreaUnit:n}=await import("./unitConversion.js");return await t.load(),(a,s,i)=>{const c=t.execute(e(a),{curveType:i});return r(o,n(s),c)}})),length:t("length",(async()=>{const e=await import("../../geometry/operators/json/lengthOperator.js"),{convertFromSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n)=>{const a=e.execute(o);return t(o.spatialReference,r(n),a)}})),geodeticLength:t("geodeticLength",(async()=>{const t=await import("../../geometry/operators/geodeticLengthOperator.js"),{convert:r,meters:o,toLengthUnit:n}=await import("./unitConversion.js");return await t.load(),(a,s,i)=>{const c=t.execute(e(a),{curveType:i});return r(o,n(s),c)}})),distance:t("distance",(async()=>{const t=await import("../../geometry/operators/distanceOperator.js"),{convertFromSpatialReferenceUnit:r,toLengthUnit:o}=await import("./unitConversion.js");return(n,a,s)=>{const i=t.execute(e(n),e(a));return r(n.spatialReference,o(s),i)}})),densify:t("densify",(async()=>{const t=await import("../../geometry/operators/densifyOperator.js"),{convertToSpatialReferenceUnit:o,toLengthUnit:n}=await import("./unitConversion.js");return(a,s,i)=>(s=o(n(i),a.spatialReference,s),r(t.execute(e(a),s)))})),geodeticDensify:t("geodeticDensify",(async()=>{const t=await import("../../geometry/operators/geodeticDensifyOperator.js"),{convert:o,meters:n,toLengthUnit:a}=await import("./unitConversion.js");return await t.load(),(s,i,c,p)=>(i=o(a(c),n,i),r(t.execute(e(s),i,{curveType:p})))})),generalize:t("generalize",(async()=>{const t=await import("../../geometry/operators/generalizeOperator.js"),{convertToSpatialReferenceUnit:o,toLengthUnit:n}=await import("./unitConversion.js");return(a,s,i,c)=>(s=o(n(i),a.spatialReference,s),r(t.execute(e(a),s,c)))})),buffer:t("buffer",(async()=>{const e=await import("../../geometry/operators/json/bufferOperator.js"),{convertToSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n,a)=>(n=t(r(a),o.spatialReference,n),e.execute(o,n))})),geodesicBuffer:t("geodesicBuffer",(async()=>{const e=await import("../../geometry/operators/json/geodesicBufferOperator.js"),{convert:t,meters:r,toLengthUnit:o}=await import("./unitConversion.js");return await e.load(),(n,a,s,i)=>(a=t(o(s),r,a),e.execute(n,a,{curveType:i}))})),offset:t("offset",(async()=>{const e=await import("../../geometry/operators/json/offsetOperator.js"),{convertToSpatialReferenceUnit:t,toLengthUnit:r}=await import("./unitConversion.js");return(o,n,a,s)=>(n=t(r(a),o.spatialReference,n),e.execute(o,n,s))})),rotate:t("rotate",(async()=>{const t=await import("../../geometry/operators/affineTransformOperator.js"),{default:o}=await import("../../geometry/operators/support/Transformation.js");return(n,a,s,i)=>{const c=(new o).rotate(a,s,i);return r(t.execute(e(n),c))}})),centroid:t("centroid",(async()=>{const t=await import("../../geometry/operators/centroidOperator.js");return o=>r(t.execute(e(o)))})),labelPoint:t("labelPoint",(async()=>{const t=await import("../../geometry/operators/labelPointOperator.js");return o=>r(t.execute(e(o)))})),simplify:t("simplify",(()=>import("../../geometry/operators/json/simplifyOperator.js").then((e=>e.execute)))),isSelfIntersecting:t("isSelfIntersecting",(async()=>{const{NonSimpleResult:t}=await import("../../chunks/OperatorDefinitions.js"),r=await import("../../geometry/operators/simplifyOGCOperator.js"),o=new Set([5,6,7,10,11,12]);return n=>{const a=new t;return!r.isSimple(e(n),a)&&o.has(a.m_reason)}})),isSimple:t("isSimple",(()=>import("../../geometry/operators/json/simplifyOperator.js").then((e=>e.isSimple)))),convexHull:t("convexHull",(()=>import("../../geometry/operators/json/convexHullOperator.js").then((e=>e.execute)))),getNearestCoordinate:t("getNearestCoordinate",(async()=>{const t=await import("../../geometry/operators/proximityOperator.js");return(o,n,a)=>{const s=t.getNearestCoordinate(e(o),e(n),a);return{...s,coordinate:r(s.coordinate)}}})),getNearestVertex:t("getNearestVertex",(async()=>{const t=await import("../../geometry/operators/proximityOperator.js");return(o,n)=>{const a=t.getNearestVertex(e(o),e(n));return{...a,coordinate:r(a.coordinate)}}}))};function n(e,t){const r=o[e];return r.loaded?r.execute.apply(void 0,t):r.load().then((()=>n(e,t)))}export{n as invokeGeometryOp};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{toSymbolId as e}from"./arcadeEnvironment.js";import"../core/has.js";const n={all:{min:2,max:2},time:{min:0,max:4},dateonly:{min:0,max:3},getenvironment:{min:0,max:0},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:0,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:3},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},nearestcoordinate:{min:2,max:2},nearestvertex:{min:2,max:2},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},measuretocoordinate:{min:2,max:2},distancetocoordinate:{min:2,max:2},pointtocoordinate:{min:2,max:2}},a={functionDefinitions:new Map,constantDefinitions:new Map},t={functionDefinitions:new Map,constantDefinitions:new Map};for(const k of["pi","infinity"])t.constantDefinitions.set(k,{type:"constant"}),a.constantDefinitions.set(k,{type:"constant"});t.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"}]}),a.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 k in n){const e=n[k];t.functionDefinitions.set(k,{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]}),a.functionDefinitions.set(k,{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]})}const i=new Set(["attachments","featureset","featuresetbyassociation","featuresetbyid","featuresetbyname","featuresetbyportalitem","featuresetbyrelationshipname","featuresetbyurl","filterbysubtypecode","getfeatureset","getfeaturesetinfo","getuser","knowledgegraphbyportalitem","querygraph"]),m=new Set(["translatetext"]),s=new Set(["area","areageodetic","buffer","buffergeodetic","centroid","clip","contains","convexhull","crosses","cut","densify","densifygeodetic","difference","disjoint","distance","distancegeodetic","distancetocoordinate","equals","generalize","intersection","intersects","issimple","length","length3d","lengthgeodetic","measuretocoordinate","multiparttosinglepart","nearestcoordinate","nearestvertex","offset","overlaps","pointtocoordinate","relate","rotate","simplify","symmetricdifference","touches","union","within"]);function o(e,n){const i="sync"===n?a:t;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 r(e,n){if(e)for(const a of e)c(a,n)}function c(e,n){if(e&&!1!==n(e))switch(e.type){case"ImportDeclaration":r(e.specifiers,n),c(e.source,n);break;case"ExportNamedDeclaration":c(e.declaration,n);break;case"ArrayExpression":r(e.elements,n);break;case"AssignmentExpression":case"BinaryExpression":case"LogicalExpression":c(e.left,n),c(e.right,n);break;case"BlockStatement":case"Program":r(e.body,n);break;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":case"Identifier":case"Literal":break;case"CallExpression":c(e.callee,n),r(e.arguments,n);break;case"ExpressionStatement":c(e.expression,n);break;case"ForInStatement":case"ForOfStatement":c(e.left,n),c(e.right,n),c(e.body,n);break;case"ForStatement":c(e.init,n),c(e.test,n),c(e.update,n),c(e.body,n);break;case"WhileStatement":c(e.test,n),c(e.body,n);break;case"FunctionDeclaration":c(e.id,n),r(e.params,n),c(e.body,n);break;case"IfStatement":c(e.test,n),c(e.consequent,n),c(e.alternate,n);break;case"MemberExpression":c(e.object,n),c(e.property,n);break;case"ObjectExpression":r(e.properties,n);break;case"Property":c(e.key,n),c(e.value,n);break;case"ReturnStatement":case"UnaryExpression":case"UpdateExpression":c(e.argument,n);break;case"VariableDeclaration":r(e.declarations,n);break;case"VariableDeclarator":c(e.id,n),c(e.init,n);break;case"TemplateLiteral":r(e.expressions,n),r(e.quasis,n)}}function x(e){return"Literal"===e?.type&&"string"==typeof e.value}function l(e,n){let a=!1;const t=n.toLowerCase();return c(e,(e=>!a&&("Identifier"===e.type&&e.name&&e.name.toLowerCase()===t&&(a=!0),!0))),a}function u(n){const a=[];return c(n,(n=>("ImportDeclaration"===n.type&&n.source&&n.source.value&&a.push({libname:e(n.specifiers[0].local),source:n.source.value}),!0))),a}function p(e,n){let a=!1;const t=n.toLowerCase();return c(e,(e=>!a&&("CallExpression"!==e.type||"Identifier"!==e.callee.type||!e.callee.name||e.callee.name.toLowerCase()!==t||(a=!0,!1)))),a}function f(n){const a=[];return c(n,(n=>"MemberExpression"!==n.type||"Identifier"!==n.object.type||(("Identifier"===n.property.type||"Literal"===n.property.type&&"string"==typeof n.property.value)&&a.push({varId:e(n.object),memberId:e(n.property)}),!1))),a}function d(n){const a=[];return c(n,(n=>{if("CallExpression"===n.type&&"Identifier"===n.callee.type)switch(e(n.callee)){case"expects":if(n.arguments.length>1){const[t,...i]=n.arguments;if("Identifier"===t?.type){const n=e(t);for(const e of i)x(e)&&a.push({varId:n,memberNamePattern:e.value})}}return!1;case"domainname":case"domaincode":case"domain":case"haskey":case"hasvalue":if(n.arguments.length>=2){const[t,i]=n.arguments;"Identifier"===t?.type&&x(i)&&a.push({varId:e(t),memberNamePattern:i.value})}return!0;case"defaultvalue":if(n.arguments.length>2){const[t,i]=n.arguments;"Identifier"===t?.type&&x(i)&&a.push({varId:e(t),memberNamePattern:i.value})}return!0;default:return!0}return"MemberExpression"!==n.type||"Identifier"!==n.object.type||(n.computed?!!x(n.property)&&(a.push({varId:e(n.object),memberNamePattern:n.property.value}),!1):(a.push({varId:e(n.object),memberNamePattern:n.property.name}),!1))})),a}function y(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 b(e){const n=[];return c(e,(e=>("CallExpression"===e.type&&"Identifier"===e.callee.type&&n.push(e.callee.name.toLowerCase()),!0))),n}function g(e,n=[]){let a=null;if(void 0===e.usesFeatureSet){null===a&&(a=b(e)),e.usesFeatureSet=!1;for(let n=0;n<a.length;n++)i.has(a[n])&&(e.usesFeatureSet=!0,e.isAsync=!0);if(!1===e.usesFeatureSet&&n&&n.length>0)for(const a of n)if(l(e,a)){e.usesFeatureSet=!0,e.isAsync=!0;break}}if(void 0===e.isAsync&&(null===a&&(a=b(e)),a.some((e=>m.has(e)))&&(e.isAsync=!0)),void 0===e.usesModules){e.usesModules=!1;u(e).length>0&&(e.usesModules=!0)}if(void 0===e.usesGeometry){e.usesGeometry=!1,null===a&&(a=b(e));for(let n=0;n<a.length;n++)s.has(a[n])&&(e.usesGeometry=!0)}}function h(e){const n=b(e);for(let a=0;a<n.length;a++)if(i.has(n[a]))return!0;return!1}export{o as addFunctionDeclaration,y as extractFunctionDeclaration,d as findExpectedFieldLiterals,b as findFunctionCalls,f as findLiteralMemberAccesses,u as findModuleImports,g as findScriptDependencies,t as fullArcadeApiAsync,a as fullArcadeApiSync,p as referencesFunction,l as referencesMember,h as scriptUsesFeatureSet,c as walk};
5
+ import{toSymbolId as e}from"./arcadeEnvironment.js";import"../core/has.js";const n={all:{min:2,max:2},time:{min:0,max:4},dateonly:{min:0,max:3},getenvironment:{min:0,max:0},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:0,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:3},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},nearestcoordinate:{min:2,max:2},nearestvertex:{min:2,max:2},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},measuretocoordinate:{min:2,max:2},distancetocoordinate:{min:2,max:2},pointtocoordinate:{min:2,max:2}},a={functionDefinitions:new Map,constantDefinitions:new Map},t={functionDefinitions:new Map,constantDefinitions:new Map};for(const k of["pi","infinity"])t.constantDefinitions.set(k,{type:"constant"}),a.constantDefinitions.set(k,{type:"constant"});t.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"}]}),a.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 k in n){const e=n[k];t.functionDefinitions.set(k,{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]}),a.functionDefinitions.set(k,{overloads:[{type:"function",parametersInfo:{min:e.min,max:e.max}}]})}const i=new Set(["attachments","featureset","featuresetbyassociation","featuresetbyid","featuresetbyname","featuresetbyportalitem","featuresetbyrelationshipname","featuresetbyurl","filterbysubtypecode","getfeatureset","getfeaturesetinfo","getuser","knowledgegraphbyportalitem","querygraph"]),m=new Set(["translatetext"]),s=new Set(["area","areageodetic","buffer","buffergeodetic","centroid","clip","contains","convexhull","crosses","cut","densify","densifygeodetic","difference","disjoint","distance","distancegeodetic","distancetocoordinate","equals","generalize","intersection","intersects","isselfintersecting","issimple","length","length3d","lengthgeodetic","measuretocoordinate","multiparttosinglepart","nearestcoordinate","nearestvertex","offset","overlaps","pointtocoordinate","relate","rotate","simplify","symmetricdifference","touches","union","within"]);function o(e,n){const i="sync"===n?a:t;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 r(e,n){if(e)for(const a of e)c(a,n)}function c(e,n){if(e&&!1!==n(e))switch(e.type){case"ImportDeclaration":r(e.specifiers,n),c(e.source,n);break;case"ExportNamedDeclaration":c(e.declaration,n);break;case"ArrayExpression":r(e.elements,n);break;case"AssignmentExpression":case"BinaryExpression":case"LogicalExpression":c(e.left,n),c(e.right,n);break;case"BlockStatement":case"Program":r(e.body,n);break;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":case"Identifier":case"Literal":break;case"CallExpression":c(e.callee,n),r(e.arguments,n);break;case"ExpressionStatement":c(e.expression,n);break;case"ForInStatement":case"ForOfStatement":c(e.left,n),c(e.right,n),c(e.body,n);break;case"ForStatement":c(e.init,n),c(e.test,n),c(e.update,n),c(e.body,n);break;case"WhileStatement":c(e.test,n),c(e.body,n);break;case"FunctionDeclaration":c(e.id,n),r(e.params,n),c(e.body,n);break;case"IfStatement":c(e.test,n),c(e.consequent,n),c(e.alternate,n);break;case"MemberExpression":c(e.object,n),c(e.property,n);break;case"ObjectExpression":r(e.properties,n);break;case"Property":c(e.key,n),c(e.value,n);break;case"ReturnStatement":case"UnaryExpression":case"UpdateExpression":c(e.argument,n);break;case"VariableDeclaration":r(e.declarations,n);break;case"VariableDeclarator":c(e.id,n),c(e.init,n);break;case"TemplateLiteral":r(e.expressions,n),r(e.quasis,n)}}function x(e){return"Literal"===e?.type&&"string"==typeof e.value}function l(e,n){let a=!1;const t=n.toLowerCase();return c(e,(e=>!a&&("Identifier"===e.type&&e.name&&e.name.toLowerCase()===t&&(a=!0),!0))),a}function u(n){const a=[];return c(n,(n=>("ImportDeclaration"===n.type&&n.source&&n.source.value&&a.push({libname:e(n.specifiers[0].local),source:n.source.value}),!0))),a}function p(e,n){let a=!1;const t=n.toLowerCase();return c(e,(e=>!a&&("CallExpression"!==e.type||"Identifier"!==e.callee.type||!e.callee.name||e.callee.name.toLowerCase()!==t||(a=!0,!1)))),a}function f(n){const a=[];return c(n,(n=>"MemberExpression"!==n.type||"Identifier"!==n.object.type||(("Identifier"===n.property.type||"Literal"===n.property.type&&"string"==typeof n.property.value)&&a.push({varId:e(n.object),memberId:e(n.property)}),!1))),a}function d(n){const a=[];return c(n,(n=>{if("CallExpression"===n.type&&"Identifier"===n.callee.type)switch(e(n.callee)){case"expects":if(n.arguments.length>1){const[t,...i]=n.arguments;if("Identifier"===t?.type){const n=e(t);for(const e of i)x(e)&&a.push({varId:n,memberNamePattern:e.value})}}return!1;case"domainname":case"domaincode":case"domain":case"haskey":case"hasvalue":if(n.arguments.length>=2){const[t,i]=n.arguments;"Identifier"===t?.type&&x(i)&&a.push({varId:e(t),memberNamePattern:i.value})}return!0;case"defaultvalue":if(n.arguments.length>2){const[t,i]=n.arguments;"Identifier"===t?.type&&x(i)&&a.push({varId:e(t),memberNamePattern:i.value})}return!0;default:return!0}return"MemberExpression"!==n.type||"Identifier"!==n.object.type||(n.computed?!!x(n.property)&&(a.push({varId:e(n.object),memberNamePattern:n.property.value}),!1):(a.push({varId:e(n.object),memberNamePattern:n.property.name}),!1))})),a}function y(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 g(e){const n=[];return c(e,(e=>("CallExpression"===e.type&&"Identifier"===e.callee.type&&n.push(e.callee.name.toLowerCase()),!0))),n}function b(e,n=[]){let a=null;if(void 0===e.usesFeatureSet){null===a&&(a=g(e)),e.usesFeatureSet=!1;for(let n=0;n<a.length;n++)i.has(a[n])&&(e.usesFeatureSet=!0,e.isAsync=!0);if(!1===e.usesFeatureSet&&n&&n.length>0)for(const a of n)if(l(e,a)){e.usesFeatureSet=!0,e.isAsync=!0;break}}if(void 0===e.isAsync&&(null===a&&(a=g(e)),a.some((e=>m.has(e)))&&(e.isAsync=!0)),void 0===e.usesModules){e.usesModules=!1;u(e).length>0&&(e.usesModules=!0)}if(void 0===e.usesGeometry){e.usesGeometry=!1,null===a&&(a=g(e));for(let n=0;n<a.length;n++)s.has(a[n])&&(e.usesGeometry=!0)}}function h(e){const n=g(e);for(let a=0;a<n.length;a++)if(i.has(n[a]))return!0;return!1}export{o as addFunctionDeclaration,y as extractFunctionDeclaration,d as findExpectedFieldLiterals,g as findFunctionCalls,f as findLiteralMemberAccesses,u as findModuleImports,b as findScriptDependencies,t as fullArcadeApiAsync,a as fullArcadeApiSync,p as referencesFunction,l as referencesMember,h as scriptUsesFeatureSet,c as walk};
@@ -1 +1 @@
1
- {"all":"All","allSelected":"All selected","clear":"Clear value","removeTag":"Remove tag","selected":"selected"}
1
+ {"all":"All","allSelected":"All selected","selectAll":"Select All","clear":"Clear value","removeTag":"Remove tag","selected":"selected"}
@@ -1 +1 @@
1
- {"all":"All","allSelected":"All selected","clear":"Clear value","removeTag":"Remove tag","selected":"selected"}
1
+ {"all":"All","allSelected":"All selected","selectAll":"Select All","clear":"Clear value","removeTag":"Remove tag","selected":"selected"}
@@ -0,0 +1 @@
1
+ [{"d":"M16 15v1H0V0h1v15h15z"},{"opacity":".25","d":"M9 11h3v2H9v-2zm-6-1h3V8H3v2zm6-5H6v2h3V5zM6 2H3v2h3V2zm3 0v2h3V2H9z"},{"opacity":".75","d":"M3 11h6v2H3v-2zm3-1h9V8H6v2zm6 3h3v-2h-3v2zM6 5H3v2h3V5zm3 2h6V5H9v2zm0-5H6v2h3V2zm3 0v2h3V2h-3z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M23 22v1H1V1h1v21h21z"},{"opacity":".5","d":"M16 14h-3v-2h3v2z"},{"opacity":".25","d":"M4 15h3v2H4v-2zm0 5h3v-2H4v2zm12 0h3v-2h-3v2zm3-8v2h3v-2h-3zm-9 2h3v-2h-3v2zm-6-3h3V9H4v2zm15-8h-3v2h3V3zm-9 3H7v2h3V6zm6 0h-3v2h3V6zm-3-3h-3v2h3V3z"},{"opacity":".75","d":"M19 18h3v2h-3v-2zm-3-6v2h3v-2h-3zm3-9v2h3V3h-3zM7 6H4v2h3V6zm3 2h3V6h-3v2zm6-5h-3v2h3V3zm-9 8h15V9H7v2zm0 6h15v-2H7v2zm9-9h6V6h-6v2zm-6-5H4v2h6V3zm0 9H4v2h6v-2zm-3 8h9v-2H7v2z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M31 30v1H1V1h1v29h29z"},{"opacity":".5","d":"M9 17h5v3H9v-3zm5-8v3h5V9h-5z"},{"opacity":".75","d":"M4 25h10v3H4v-3zm15 3h10v-3H19v3zM9 24h20v-3H9v3zm0-8h20v-3H9v3zm0 1H4v3h5v-3zm10 0v3h5v-3h-5zm-5-8H4v3h10V9zm5 0v3h10V9H19zM9 5H4v3h5V5zm15 0H14v3h10V5z"},{"opacity":".25","d":"M14 25h5v3h-5v-3zM4 24h5v-3H4v3zm10-4h5v-3h-5v3zm10 0h5v-3h-5v3zM4 16h5v-3H4v3zM14 5H9v3h5V5zm10 0v3h5V5h-5z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M16 15v1H0V0h1v15h15z"},{"opacity":".25","d":"M10 9H7V6h3v3z"},{"opacity":".75","d":"M3 10h3v3H3v-3zm4 3h3v-3H7v3zM3 9h3V6H3v3zm8-3v3h3V6h-3zM7 5h3V2H7v3z"},{"opacity":".5","d":"M11 10h3v3h-3v-3zM3 5h3V2H3v3zm8-3v3h3V2h-3z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M23 22v1H1V1h1v21h21z"},{"opacity":".25","d":"M8 17h3v3H8v-3zm4-1h3v-3h-3v3zm8-3v3h3v-3h-3zM4 12h3V9H4v3zm12 0h3V9h-3v3zM8 8h3V5H8v3z"},{"opacity":".75","d":"M4 17h3v3H4v-3zm8 3h3v-3h-3v3zm8 0h3v-3h-3v3zM4 16h3v-3H4v3zm4 0h3v-3H8v3zm8 0h3v-3h-3v3zm-8-4h3V9H8v3zm4 0h3V9h-3v3zm8 0h3V9h-3v3zM4 8h3V5H4v3zm8 0h3V5h-3v3zm8-3v3h3V5h-3zM8 4h3V1H8v3zm4 0h3V1h-3v3zm4 0h3V1h-3v3z"},{"opacity":".5","d":"M16 17h3v3h-3v-3zm0-9h3V5h-3v3zM4 4h3V1H4v3zm16-3v3h3V1h-3z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M31 30v1H1V1h1v29h29z"},{"opacity":".25","d":"M9 24h4v4H9v-4zm5-1h4v-4h-4v4zm10-4v4h4v-4h-4zM4 18h4v-4H4v4zm15 0h4v-4h-4v4zM9 13h4V9H9v4z"},{"opacity":".75","d":"M4 24h4v4H4v-4zm10 4h4v-4h-4v4zm10 0h4v-4h-4v4zM4 23h4v-4H4v4zm5 0h4v-4H9v4zm10 0h4v-4h-4v4zM9 18h4v-4H9v4zm5 0h4v-4h-4v4zm10 0h4v-4h-4v4zM4 13h4V9H4v4zm10 0h4V9h-4v4zm10-4v4h4V9h-4zM9 8h4V4H9v4zm5 0h4V4h-4v4zm5 0h4V4h-4v4z"},{"opacity":".5","d":"M19 24h4v4h-4v-4zm0-11h4V9h-4v4zM4 8h4V4H4v4zm20-4v4h4V4h-4z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M1 10h14V7H1v3zm10-2h3v1h-3V8zM2 8h8v1H2V8zm-1 7h14v-3H1v3zm13-1H8v-1h6v1zM2 13h5v1H2v-1zM1 2v3h14V2H1zm2 2H2V3h1v1zm11 0H4V3h10v1z"},{"opacity":".25","d":"M3 4H2V3h1v1zm7 4H2v1h8V8zm-3 5H2v1h5v-1z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M1 4v4h22V4H1zm3 3H2V5h2v2zm18 0H5V5h17v2zM1 20h22v-4H1v4zm21-1H12v-2h10v2zM2 17h9v2H2v-2zm-1-3h22v-4H1v4zm17-3h4v2h-4v-2zM2 11h15v2H2v-2z"},{"opacity":".25","d":"M4 7H2V5h2v2zm13 4H2v2h15v-2zm-6 6H2v2h9v-2z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M2 5v5h28V5H2zm1 1h3v3H3V6zm26 3H7V6h22v3zM2 14v5h28v-5H2zm1 1h18v3H3v-3zm26 3h-7v-3h7v3zM2 23v5h28v-5H2zm1 1h12v3H3v-3zm26 3H16v-3h13v3z"},{"opacity":".25","d":"M6 9H3V6h3v3zm15 6H3v3h18v-3zm-6 9H3v3h12v-3z"}]
@@ -0,0 +1 @@
1
+ "M8.5 0L3 16h11L8.5 0zm0 3.076L12.599 15H4.4L8.5 3.076z"
@@ -0,0 +1 @@
1
+ "M18.946 23H6.054L12.5 1l6.446 22zm-11.56-1h10.228L12.5 4.584 7.386 22z"
@@ -0,0 +1 @@
1
+ "M24.839 31H8.16L16.5 1l8.339 30zM9.474 30h14.052L16.5 4.768 9.474 30z"
@@ -0,0 +1 @@
1
+ "M4.058 16H3L8.5 0 14 16h-1.058L8.5 3.076 4.058 16z"
@@ -0,0 +1 @@
1
+ "M6.054 23L12.5 1l6.446 22h-1.038L12.5 4.584 7.092 23H6.054z"
@@ -0,0 +1 @@
1
+ "M8.161 31L16.5 1l8.339 30h-1.034L16.5 4.768 9.195 31H8.161z"
@@ -0,0 +1 @@
1
+ "M8.5 0L3 16h11L8.5 0zm0 3.076L12.599 15H4.4L8.5 3.076zM11.197 14H5.803L8.5 6.152 11.197 14z"
@@ -0,0 +1 @@
1
+ "M12.5 1.234L6.005 23h12.99L12.5 1.234zm0 3.489L17.67 22H7.33L12.5 4.723zM16.327 21H8.673L12.5 8.21 16.327 21z"
@@ -0,0 +1 @@
1
+ "M16.5 1L8.161 31H24.84L16.5 1zm0 3.768L23.526 30H9.474L16.5 4.768zM22.21 29H10.79L16.5 8.495 22.21 29z"
@@ -0,0 +1 @@
1
+ [{"d":"M8.5 0L3 16h11L8.5 0zm0 3.076L12.599 15H4.4L8.5 3.076z"},{"opacity":".25","d":"M11.197 14H5.803L8.5 6.152 11.197 14z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M12.5 1.234L6.005 23h12.99L12.5 1.234zm0 3.489L17.67 22H7.33L12.5 4.723z"},{"opacity":".25","d":"M16.327 21H8.673L12.5 8.21 16.327 21z"}]
@@ -0,0 +1 @@
1
+ [{"d":"M16.5 1L8.161 31H24.84L16.5 1zm0 3.768L23.526 30H9.474L16.5 4.768z"},{"opacity":".25","d":"M22.21 29H10.79L16.5 8.495 22.21 29z"}]
@@ -0,0 +1 @@
1
+ "M3 16L8.5 0 14 16h-1.058L8.5 3.076 4.058 16H3zm3.173 0L8.5 9.229 10.827 16h1.058L8.5 6.152 5.115 16h1.058z"
@@ -0,0 +1 @@
1
+ "M8.074 23L12.5 8.21 16.926 23h-1.044L12.5 11.7 9.118 23H8.074zm-1.043 0L12.5 4.723 17.97 23h1.025L12.5 1.234 6.005 23h1.026z"
@@ -0,0 +1 @@
1
+ "M10.233 31L16.5 8.495 22.767 31h-1.038L16.5 12.223 11.271 31h-1.038zm-1.038 0L16.5 4.768 23.805 31h1.034L16.5 1 8.161 31h1.034z"
@@ -0,0 +1 @@
1
+ [{"opacity":".25","d":"M5.115 16L8.5 6.152 11.885 16h-6.77z"},{"d":"M4.058 16H3L8.5 0 14 16h-1.058L8.5 3.076 4.058 16z"}]
@@ -0,0 +1 @@
1
+ [{"opacity":".25","d":"M8.074 23L12.5 8.21 16.926 23H8.074z"},{"d":"M6.005 23L12.5 1.234 18.995 23h-1.026L12.5 4.723 7.03 23H6.006z"}]
@@ -0,0 +1 @@
1
+ [{"opacity":".25","d":"M22.767 31H10.233L16.5 8.495 22.767 31z"},{"d":"M8.161 31L16.5 1l8.339 30h-1.034L16.5 4.768 9.195 31H8.161z"}]