@arcgis/core 5.1.0-next.78 → 5.1.0-next.79
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.
- package/analysis/ShadowCast/DiscreteOptions.d.ts +33 -6
- package/analysis/ShadowCast/DiscreteOptions.js +1 -1
- package/analysis/ShadowCast/MinDurationOptions.d.ts +6 -4
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +33 -6
- package/analysis/ShadowCast/TotalDurationOptions.js +1 -1
- package/analysis/ShadowCast/colorStopsUtils.js +2 -0
- package/analysis/ShadowCastAnalysis.d.ts +24 -1
- package/analysis/ShadowCastAnalysis.js +1 -1
- package/analysis/Viewshed.d.ts +27 -0
- package/analysis/Viewshed.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/arcade/FunctionWrapper.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/debug.d.ts +139 -0
- package/arcade/debug.js +2 -0
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.d.ts +46 -2
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{1c7183551f5269bdcf13.js → 01bd1b86ba899c6aa4c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{1f8ccf96069ac3a40c3d.js → 01ee18782a50279f907e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f81c6f6ccc201f584970.js → 022067e807905cabeaa1.js} +1 -1
- package/assets/esri/core/workers/chunks/{11ea4be441a26134ce1f.js → 052cdc7aaa803b5873f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{b7bb7072dbee978f3ca3.js → 056fd7847caaff2c9514.js} +1 -1
- package/assets/esri/core/workers/chunks/{8acee3fba488f202f82f.js → 05c3146d87d917606193.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8ca5d8740cc7e39197b.js → 0aebcbf41cb193e76809.js} +5 -5
- package/assets/esri/core/workers/chunks/{54023458195549f66215.js → 0b77c124b743067e4155.js} +1 -1
- package/assets/esri/core/workers/chunks/10408183681fd6c7b4ed.js +2 -0
- package/assets/esri/core/workers/chunks/{7595ceba529ed01c7590.js → 2c87c3112a43db8624f6.js} +1 -1
- package/assets/esri/core/workers/chunks/{13e60f19f436b8d683ae.js → 3c9482764c9e4f8bcbb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{322c54081b25f1c53661.js → 3e37019eee1c49d2bf64.js} +1 -1
- package/assets/esri/core/workers/chunks/45c83eb7c2a06166e3b0.js +1 -0
- package/assets/esri/core/workers/chunks/48acd146bf0241d87647.js +1 -0
- package/assets/esri/core/workers/chunks/5818f1f526577068d6ca.js +2 -0
- package/assets/esri/core/workers/chunks/{34fe97bcacc0dfc5bce6.js → 5ccc325d83cec4f5ccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{30e710ec4d22c43d4e7e.js → 5cffc7b49966201eccdb.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a87e9bbd85ba29b1514.js → 5da2051f548c2942e01a.js} +1 -1
- package/assets/esri/core/workers/chunks/5ec66e39e53c11e75179.js +2 -0
- package/assets/esri/core/workers/chunks/{0b1454a77a6a682541dc.js.LICENSE.txt → 5ec66e39e53c11e75179.js.LICENSE.txt} +9 -1
- package/assets/esri/core/workers/chunks/5f6fd20a7f4e80eafa25.js +1 -0
- package/assets/esri/core/workers/chunks/{abc06d10c7ac8ba5b0e4.js → 67ec1694d6e18b7c234c.js} +1 -1
- package/assets/esri/core/workers/chunks/{32e22d6eee9fed1f70b0.js → 6d696beddcc5fbed5875.js} +1 -1
- package/assets/esri/core/workers/chunks/{f590b60fca607d66001a.js → 716a4d7e8b908b81870b.js} +1 -1
- package/assets/esri/core/workers/chunks/71fe127734f33d020a44.js +1 -0
- package/assets/esri/core/workers/chunks/7cdd0492b2191df95102.js +2 -0
- package/assets/esri/core/workers/chunks/7cea68257d24ffd205bb.js +1 -0
- package/assets/esri/core/workers/chunks/7e530e635325dba07864.js +1 -0
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +596 -0
- package/assets/esri/core/workers/chunks/{d950d5c2844206502ff0.js → 992cd87ba0ab6346f692.js} +1 -1
- package/assets/esri/core/workers/chunks/{73c87eb9bd8f0f848481.js → 9c11e1fe785e1385fdb1.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ed8d8b5336c81fbcda3.js → 9d216e30d04ea21fc8a2.js} +1 -1
- package/assets/esri/core/workers/chunks/a54aa93b6012a2597f82.js +1 -0
- package/assets/esri/core/workers/chunks/{cf14b3a44705dacefac4.js → a9b5ce00323cd5574bf7.js} +1 -1
- package/assets/esri/core/workers/chunks/ae6b3dfe5f757df539d6.js +1 -0
- package/assets/esri/core/workers/chunks/b14c4c3f295970f731ab.js +1 -0
- package/assets/esri/core/workers/chunks/{c70df6ed190f9ebcf6aa.js → bf2c202dec5ab7bc770b.js} +1 -1
- package/assets/esri/core/workers/chunks/c1d4110aa494a1dba3c4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d8c7cc7f8decbe975d.js → c442916805975744dd92.js} +1 -1
- package/assets/esri/core/workers/chunks/dacc2e5fa462495ed1cc.js +2 -0
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +1 -0
- package/assets/esri/core/workers/chunks/{dda2cb5c073d1e65f14f.js → f43d628d47eec7d530c7.js} +1 -1
- package/assets/esri/core/workers/chunks/f7531aa69a87814c60d1.js +1 -0
- package/assets/esri/core/workers/chunks/{4ccb56333de0247dcb6f.js → fb100935fd8948d779f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ee4b630ad39c21d11db.js → fb9e3e7cd532ac4353f1.js} +12 -12
- package/assets/esri/core/workers/chunks/fc6ca7ffb9f1b875059c.js +1 -0
- package/assets/esri/core/workers/chunks/{3d9fcbe95dd22dbe730e.js → ffc4f3406ce383b9bd88.js} +1 -1
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
- package/chunks/ImageMaterial.glsl.js +7 -5
- package/chunks/SlicePlaneMaterial.glsl.js +21 -13
- package/chunks/arcade.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +18 -14
- package/layers/SceneLayer.d.ts +35 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/scene/ModelFileInfo.d.ts +29 -0
- package/layers/scene/ModelFileInfo.js +2 -0
- package/layers/scene/ModelInfo.d.ts +38 -0
- package/layers/scene/ModelInfo.js +2 -0
- package/layers/scene/modelQuerySupport.js +2 -0
- package/layers/scene/types.d.ts +14 -0
- package/layers/support/infoFor3D.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/types.d.ts +13 -1
- package/package.json +3 -3
- package/popup/Features.d.ts +1 -6
- package/popup/Features.js +1 -1
- package/popup/actions.js +1 -1
- package/renderers/visualVariables/support/ColorStop.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/TextShaping.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueProgramCache.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimationUniformInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bloom/BloomTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blur/BlurTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/grid/GridTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/AspectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BandArithmeticTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/BaseRasterProcessorTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ColormapToRGBTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CompositeBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ComputeChangeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ContrastBrightnessTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ConvolutionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/CurvatureTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ExtractBandTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/FocalStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/GrayscaleTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/HillshadeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/LocalTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/MaskTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/NDVITechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/RemapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ReprojectTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/ShadedReliefTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SlopeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/SpectralConversionTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/StretchTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlitShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BloomShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlurShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ColorizeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/DropShadowShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/EntityStorage.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MosaicInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternOutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsMinMaxSumShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsStdDevShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TextureStatisticsSumOfSquaredDiffShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/flow/FlowUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerLUTShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterColorizerStretchShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/RasterXYBandHighlightShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/lut.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/AspectShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/BaseRasterProcessorShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ColormapToRGBShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ConvolutionShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/CurvatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/FocalStatisticsShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/HillshadeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/ShadedReliefShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/SlopeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/stretch.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vvUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/StencilGeometry.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedShapeVisualElement.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubVisualization.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/viewshedToolUtils.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/focusAreaUtils.js +2 -0
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshNormals.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/focusAreaMaskUtils.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/Compositor.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Normals.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
- package/views/View2D.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.d.ts +54 -0
- package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -3
- package/widgets/BatchAttributeForm/templates/AttachmentElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/RelationshipElementTemplate.js +2 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/templateUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +21 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion/support/Format.js +1 -1
- package/widgets/CoordinateConversion/support/coordinateConversionUtils.js +1 -1
- package/widgets/CoordinateConversion.d.ts +21 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/types.d.ts +1 -1
- package/assets/esri/core/workers/chunks/07eff82916681fcff069.js +0 -1
- package/assets/esri/core/workers/chunks/0b1454a77a6a682541dc.js +0 -2
- package/assets/esri/core/workers/chunks/1c7fd0a229a8112b0539.js +0 -596
- package/assets/esri/core/workers/chunks/3697e51e1e4cf442f39a.js +0 -1
- package/assets/esri/core/workers/chunks/3cce9dad8ee0e4971d50.js +0 -1
- package/assets/esri/core/workers/chunks/3df8493b91aa3bce824d.js +0 -1
- package/assets/esri/core/workers/chunks/68a313155ddc29bd024d.js +0 -1
- package/assets/esri/core/workers/chunks/751609831b283903ba48.js +0 -1
- package/assets/esri/core/workers/chunks/7bacdd65a6cc4d284e0a.js +0 -2
- package/assets/esri/core/workers/chunks/7e97684e851274efd11f.js +0 -1
- package/assets/esri/core/workers/chunks/85aac8539996372f1ee8.js +0 -1
- package/assets/esri/core/workers/chunks/99d298d0039c536fcf3e.js +0 -1
- package/assets/esri/core/workers/chunks/9aaf78b831f8739bc127.js +0 -1
- package/assets/esri/core/workers/chunks/9b9916864b6575c42c8a.js +0 -1
- package/assets/esri/core/workers/chunks/bf7e019437a3b6036300.js +0 -2
- package/assets/esri/core/workers/chunks/d304343a781acfa3ff96.js +0 -1
- package/assets/esri/core/workers/chunks/dbb9bb28696ff9536678.js +0 -2
- package/assets/esri/core/workers/chunks/f09a41ad239d467d9438.js +0 -2
- package/assets/esri/core/workers/chunks/f6912532aae1638cbe8f.js +0 -1
- /package/assets/esri/core/workers/chunks/{7bacdd65a6cc4d284e0a.js.LICENSE.txt → 10408183681fd6c7b4ed.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f09a41ad239d467d9438.js.LICENSE.txt → 5818f1f526577068d6ca.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{dbb9bb28696ff9536678.js.LICENSE.txt → 7cdd0492b2191df95102.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{bf7e019437a3b6036300.js.LICENSE.txt → dacc2e5fa462495ed1cc.js.LICENSE.txt} +0 -0
package/arcade/arcadeCompiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{toSymbolId as e,neverAbortedSignal as n}from"./arcadeEnvironment.js";import{ArcadeModule as t}from"./ArcadeModule.js";import{ArcadeModuleLoader as r}from"./ArcadeModuleLoader.js";import{collectDeclaredGlobalNames as o,collectDeclaredLocalNames as l,flattenAccessChain as a}from"./compilerUtils.js";import{getNestedOptionalValue as s,tryGetMember as i,getMember as u,getGeometryMember as c,getGeometryKeys as m}from"./containerUtils.js";import p from"./Dictionary.js";import{ArcadeExecutionError as f,ArcadeCompilationError as d,ArcadeUncompilableError as g}from"./executionError.js";import{Feature as h}from"./Feature.js";import{NativeFunction as y,ArcadeFunction as w,ScopeMarshalledFunction as b,wrapModuleScopedResponse as $}from"./FunctionWrapper.js";import{p as v,q as S,i as x,k as I,j as C,r as F,s as M,v as O,u as j,w as A,x as k,h as E,n as N,y as B}from"../chunks/languageUtils.js";import{addFunctionDeclaration as _}from"./treeAnalysis.js";import{A as V}from"../chunks/aiServices.js";import{A as T}from"../chunks/array.js";import{registerFunctions as L}from"./functions/date.js";import{registerFunctions as R}from"./functions/feature.js";import{registerFunctions as U}from"./functions/geometry.js";import{registerFunctions as D}from"./functions/geomsync.js";import{registerFunctions as G}from"./functions/maths.js";import{registerFunctions as q}from"./functions/stats.js";import{registerFunctions as z}from"./functions/string.js";import{registerFunctions as P}from"./functions/track.js";import W from"../core/Logger.js";import{isPromiseLike as K}from"../core/promiseUtils.js";import{addMany as Z}from"../core/SetUtils.js";import J from"../geometry/SpatialReference.js";import{isGraphic as Y}from"../support/graphicInstanceUtils.js";import{isArray as H,isNumber as Q,isString as X,isBoolean as ee}from"../support/guards.js";const ne=()=>W.getLogger("esri.arcade.arcadeCompiler");class te{constructor(){this._symbolCounter=0,this.safeAccessTempVarId="_Tsat"}nextVarId(){return this._symbolCounter+=1,`_T${this._symbolCounter}`}nextTempVarId(){return this._symbolCounter+=1,`_Tvar${this._symbolCounter}`}nextLocalsSymbolMapId(){return this._symbolCounter+=1,`_Locals${this._symbolCounter}`}}function re(e,n){const t=e.localScope?.get(n);if(null!=t)return{scope:"local",name:n,var:t};const r=e.globalScope.get(n);return null!=r?{scope:"global",name:n,var:r}:e.standardGlobals.has(n)?{scope:"global",name:n,var:n}:null}function oe(n,t,r="InvalidIdentifier"){const o=re(n,e(t));if(null!=o)return o;throw new d(null,r,t)}function le(n,t,r){const o=re(n,e(t));if(null==o)throw ne().error(`Internal error: Symbol "${t.name}" not declared.`),new d(null,"NeverReach",t);if(null!=r&&o.scope!==r)throw ne().error(`Internal error: Expected to resolve "${t.name}" in the ${r} scope but is in the ${o.scope} scope.`),new d(null,"NeverReach",t);return o}function ae(n,t){const r=e(t),o=n.symbolMetadata;if(n.localStack.length>0){const e=n.localStack[n.localStack.length-1],t=o.locals.get(e._SymbolsMapId);if(null==t)return void ne().error(`Internal error: no reflection metadata for ${e._SymbolsMapId}`);const l=t.get(r);if(null!=l)return on.requireInitialized(e[l])}const l=o.globals.get(r);if(null!=l)return on.requireInitialized(n.globalScope[l]);if(o.standardGlobals.has(r))return on.requireInitialized(n.globalScope[r]);throw new f(null,"InvalidIdentifier",null)}class se extends w{constructor(e,n){super(),this.paramCount=n,this.fn=e}createFunction(e){return(...n)=>{if(n.length!==this.paramCount)throw new f(e,"WrongNumberOfParameters",null);return this.fn(...n)}}call(e,n){return this.fn(...n.arguments)}marshalledCall(e,n,t,r){return r(e,n,(n,o,l)=>{l=l.map(n=>!x(n)||n instanceof b?n:$(n,e,r));const a=this.call(t,{arguments:l});return K(a)?a.then(e=>$(e,t,r)):a})}}function ie(e,n,t){try{return t(e,null,n.arguments)}catch(r){throw r}}function ue(e,n,t,r,l,a){const{globals:s,exports:i}=o(e);Z(s,t);const u=new te,c=[],m=new Map;for(const o of s)if(t.has(o)||n.has(o))m.set(o,o);else{const e=u.nextVarId();m.set(o,e),c.push(`gscope[${JSON.stringify(e)}] = ${tn};`)}const p=new Map,f=Object.create(null),d={isAsync:r,symbols:u,standardGlobals:n,globalScope:m,exports:i,localScope:null,allLocalSymbolMetadata:p,moduleFactory:a,moduleFactoryMap:f,libraryResolver:l};return{body:[...c,`var ${u.safeAccessTempVarId};`,"var lastStatement = lc.voidOperation;",Ce(d,e),"return lastStatement;"].join("\n"),symbolMetadata:{standardGlobals:n,exports:i,globals:m,locals:p},moduleFactoryMap:f}}function ce(e,n){switch(n.type){case"AssignmentExpression":return ve(e,n);case"UpdateExpression":return be(e,n);case"TemplateLiteral":return Re(e,n);case"Identifier":return Ge(e,n);case"MemberExpression":return Ee(e,n);case"Literal":return null===n.value||void 0===n.value?"null":JSON.stringify(n.value);case"CallExpression":return qe(e,n);case"UnaryExpression":return Te(e,n);case"BinaryExpression":return Ue(e,n);case"LogicalExpression":return De(e,n);case"ArrayExpression":return Le(e,n);case"ObjectExpression":return pe(e,n);case"MemberAccessChainExpression":return Ve(e,n);case"SafeMemberExpression":throw ne().error("SafeMemberExpression outside of MemberAccessChainExpression"),new d(null,"Unrecognized",n);default:throw new d(null,"Unrecognized",n)}}function me(e,n){switch(n.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclaration":return Ae(e,n);case"BlockStatement":return Ce(e,n);case"FunctionDeclaration":return je(e,n);case"ImportDeclaration":return Me(e,n);case"ExportNamedDeclaration":return me(e,n.declaration);case"ReturnStatement":return Fe(e,n);case"IfStatement":return Ie(e,n);case"ExpressionStatement":return Se(e,n);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"ForStatement":return we(e,n);case"ForInStatement":return he(e,n);case"ForOfStatement":return ye(e,n);case"WhileStatement":return $e(e,n);default:throw new d(null,"Unrecognized",n)}}function pe(e,n){let t="lang.dictionary([";for(let r=0;r<n.properties.length;r++){const o=n.properties[r];let l;l="Identifier"===o.key.type?"'"+o.key.name+"'":ce(e,o.key);r>0&&(t+=","),t+="lang.strCheck("+l+",'ObjectExpression'),lang.aCheck("+ce(e,o.value)+", 'ObjectExpression')"}return t+="])",t}function fe(e,n,t,r,o=(e,n)=>`${e} = ${n}`){const l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId();return[`var ${l} = ${t};`,`for (var ${a} = 0; ${a} < ${l}; ${a}++) {`,` ${o(n,a)}`,` ${me(e,r)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function de(e,n,t,r,o=e=>e){const l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId();return[`var ${l} = ${t};`,`for (var ${a} of ${l}) {`,` ${n} = ${o(a)};`,` ${me(e,r)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function ge(e,n,t,r){const o=e.symbols.nextTempVarId(),l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId(),s=e.symbols.nextTempVarId();return[`var ${o} = yield ${t}.queryAll(runtimeCtx.abortSignal);`,`var ${l} = { done: false, value: [] };`,`for (var ${a} = 0; ${a} < ${l}.value.length || ((${a} = 0), !(${l} = yield ${o}.next()).done); ${a}++) {`,` if (${l}.value.length === 0) continue;`,` var ${s} = ${l}.value[${a}];`,` ${n} = lang.createFeature(${s}, ${t}, runtimeCtx);`,` ${me(e,r)}`,"}"].join("\n")}function he(e,n){const t=e.symbols.nextTempVarId();let r,o,l="var "+t+" = "+ce(e,n.right)+";\n";switch("VariableDeclaration"===n.left.type?(r=le(e,n.left.declarations[0].id),l+=me(e,n.left)):r=oe(e,n.left),r.scope){case"local":o=`lscope['${r.var}']`;break;case"global":o=`gscope['${r.var}']`;break;default:throw r.scope,new d(null,"NeverReach",n.left)}return l+="if ("+t+"===null) { lastStatement = lc.voidOperation; }\n ",l+="else if (lc.isArray("+t+") || lc.isString("+t+")) {\n",l+=fe(e,o,`${t}.length`,n.body),l+="}\n",l+="else if (lc.isImmutableArray("+t+")) {\n",l+=fe(e,o,`${t}.length()`,n.body),l+="}\n",l+="else if (( "+t+" instanceof lang.Dictionary) || lc.isDictionaryLike("+t+")) {\n",l+=de(e,o,`${t}.keys()`,n.body),l+="}\n",e.isAsync&&(l+="else if (lc.isFeatureSet("+t+")) {\n",l+=ge(e,o,t,n.body),l+="}\n"),l+=`else if (lc.isGeometry(${t})) {\n`,l+=de(e,o,`lang.getGeometryKeys(${t})`,n.body),l+="}\n",l+="else { lastStatement = lc.voidOperation; } \n",l}function ye(e,n){const t=e.symbols.nextTempVarId();let r,o,l="var "+t+" = "+ce(e,n.right)+";\n";switch("VariableDeclaration"===n.left.type?(r=le(e,n.left.declarations[0].id),l+=me(e,n.left)):r=oe(e,n.left),r.scope){case"local":o=`lscope['${r.var}']`;break;case"global":o=`gscope['${r.var}']`;break;default:throw r.scope,new d(null,"NeverReach",n.left)}return l+="if ("+t+"===null) { lastStatement = lc.voidOperation; }\n ",l+="else if (lc.isArray("+t+") || lc.isString("+t+")) {\n",l+=fe(e,o,`${t}.length`,n.body,(e,n)=>[`if (${n} >= ${t}.length) {`," lang.error('OutOfBounds');","}",`${e} = ${t}[${n}];`].join("\n")),l+="}\n",l+="else if (lc.isImmutableArray("+t+")) {\n",l+=fe(e,o,`${t}.length()`,n.body,(e,n)=>`${e} = ${t}.get(${n});`),l+="}\n",l+="else if (( "+t+" instanceof lang.Dictionary) || lc.isDictionaryLike("+t+")) {\n",l+=de(e,o,`${t}.keys()`,n.body,e=>`lang.entry(${e}, ${t}.field(${e}))`),l+="}\n",e.isAsync&&(l+="else if (lc.isFeatureSet("+t+")) {\n",l+=ge(e,o,t,n.body),l+="}\n"),l+=`else if (lc.isGeometry(${t})) {\n`,l+=de(e,o,`lang.getGeometryKeys(${t})`,n.body,e=>`lang.entry(${e}, lang.getGeometryMember(${t}, ${e}, runtimeCtx))`),l+="}\n",l+="else { lastStatement = lc.voidOperation; } \n",l}function we(e,n){let t="lastStatement = lc.voidOperation; \n";null!==n.init&&("VariableDeclaration"===n.init.type?t+=me(e,n.init):t+=ce(e,n.init)+"; ");const r=e.symbols.nextTempVarId(),o=e.symbols.nextTempVarId();return t+="var "+r+" = true; ",t+="\n do { ",null!==n.update&&(t+=" if ("+r+"===false) {\n "+ce(e,n.update)+" \n}\n "+r+"=false; \n"),null!==n.test&&(t+="var "+o+" = "+ce(e,n.test)+"; ",t+="if ("+o+"===false) { break; } else if ("+o+"!==true) { lang.error('BooleanConditionRequired'); }\n"),t+=me(e,n.body),null!==n.update&&(t+="\n "+ce(e,n.update)),t+="\n"+r+" = true; \n} while(true); lastStatement = lc.voidOperation; ",t}function be(e,n){if("CallExpression"===n.argument.type)throw new d(null,"NeverReach",n);let t;if("MemberExpression"===n.argument.type){const r=ce(e,n.argument.object);return t=!0===n.argument.computed?ce(e,n.argument.property):"'"+n.argument.property.name+"'","lang.memberupdate("+r+","+t+",'"+n.operator+"',"+n.prefix+")"}const r=oe(e,n.argument);switch(Oe(r),r.scope){case"local":return`lang.update(lscope, '${r.var}', '${n.operator}', ${n.prefix})`;case"global":return`lang.update(gscope, '${r.var}', '${n.operator}', ${n.prefix})`;default:throw r.scope,new d(null,"NeverReach",n.argument)}}function $e(e,n){let t="lastStatement = lc.voidOperation; \n";const r=e.symbols.nextTempVarId();return t+=`\n var ${r} = true;\n do {\n ${r} = ${ce(e,n.test)};\n if (${r}==false) {\n break;\n }\n if (${r}!==true) {\n lang.error('BooleanConditionRequired');\n }\n ${me(e,n.body)}\n }\n while (${r} !== false);\n lastStatement = lc.voidOperation;\n `,t}function ve(e,n){const t=ce(e,n.right);if("MemberExpression"===n.left.type){let r;const o=ce(e,n.left.object);return r=!0===n.left.computed?ce(e,n.left.property):"'"+n.left.property.name+"'","lang.assignmember("+o+","+r+",'"+n.operator+"',"+t+")"}const r=oe(e,n.left);switch(Oe(r),r.scope){case"local":return`lscope['${r.var}']=lang.assign(${t},'${n.operator}', ${"="===n.operator?"null":rn(`lscope['${r.var}']`)})`;case"global":return`gscope['${r.var}']=lang.assign(${t},'${n.operator}', ${"="===n.operator?"null":rn(`gscope['${r.var}']`)})`;default:throw r.scope,new d(null,"NeverReach",n.left)}}function Se(e,n){return"AssignmentExpression"===n.expression.type?"lastStatement = lc.voidOperation; "+ce(e,n.expression)+"; \n ":"lastStatement = "+ce(e,n.expression)+"; "}function xe(e,n){return"BlockStatement"===n.type?me(e,n):"ReturnStatement"===n.type||"BreakStatement"===n.type||"ContinueStatement"===n.type?me(e,n)+"; ":"ExpressionStatement"===n.type?me(e,n):me(e,n)+"; "}function Ie(e,n){return`if (lang.mustBoolean(${ce(e,n.test)}, runtimeCtx) === true) {\n ${xe(e,n.consequent)}\n } `+(null!==n.alternate?"IfStatement"===n.alternate.type?" else "+Ie(e,n.alternate):` else {\n ${xe(e,n.alternate)}\n }\n`:" else {\n lastStatement = lc.voidOperation;\n }\n")}function Ce(e,n){let t="";for(let r=0;r<n.body.length;r++)"EmptyStatement"!==n.body[r].type&&("ReturnStatement"===n.body[r].type||"BreakStatement"===n.body[r].type||"ContinueStatement"===n.body[r].type?t+=me(e,n.body[r])+"; \n":t+=me(e,n.body[r])+" \n");return t}function Fe(e,n){if(null===n.argument)return"return lc.voidOperation";return"return "+ce(e,n.argument)}function Me(e,n){const t=le(e,n.specifiers[0].local,"global"),r=e.libraryResolver?.loadLibrary(t.name),o=e.symbols.nextVarId();void 0===e.moduleFactory[r.uri]&&(e.moduleFactory[r.uri]=cn(r.syntax,e.moduleFactory,e.isAsync)),e.moduleFactoryMap[o]=r.uri;let l="";return l=e.isAsync?"(yield lang.loadModule('"+o+"', runtimeCtx) ); ":"lang.loadModule('"+o+"', runtimeCtx); ",Oe(t),`gscope['${t.var}']=${l}`}function Oe(e){if("global"===e.scope)switch(e.name){case"iif":case"when":case"defaultvalue":case"decode":throw new g}}function je(n,t){const r=new Set(t.params.map(n=>e(n))),o=l(t);Z(o,r);const a=n.symbols,s=new Map;for(const e of o)s.set(e,a.nextVarId());const i=a.nextLocalsSymbolMapId();n.allLocalSymbolMetadata.set(i,s);const u={...n,localScope:s},c=[`lscope._SymbolsMapId = ${JSON.stringify(i)};`];for(let e=0;e<t.params.length;e++){const n=le(u,t.params[e],"local");Oe(n),c.push(`lscope['${n.var}'] = arguments[${e}];`)}for(const[e,l]of s)r.has(e)||c.push(`lscope['${l}'] = ${tn};`);const m=Ce(u,t.body),p=!0===n.isAsync?["return lang.__awaiter(this, void 0, void 0, function* () {",` ${m}`," return lastStatement;","});"]:[m,"return lastStatement;"],f=["new lang.UserDefinedCompiledFunction("," lang.functionDepthchecker("," function() {"," var lastStatement = lc.voidOperation;"," var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];",...c,...p," },"," runtimeCtx,"," ),",` ${t.params.length},`,")"].join("\n"),d=le(n,t.id,"global");return Oe(d),`gscope['${d.var}']=${f}; lastStatement = lc.voidOperation;`}function Ae(e,n){const t=[];for(let r=0;r<n.declarations.length;r++)t.push(ke(e,n.declarations[r]));return t.join("\n")+" \n lastStatement= lc.voidOperation; \n"}function ke(e,n){const t=null===n.init?"null":ce(e,n.init),r=le(e,n.id);switch(Oe(r),r.scope){case"local":return`lscope['${r.var}']=${t};`;case"global":return`gscope['${r.var}']=${t};`;default:throw r.scope,new d(null,"NeverReach",n.id)}}function Ee(e,n){return Ne(e,ce(e,n.object),n)}function Ne(e,n,t){return`lang.member(${n}, ${t.computed?ce(e,t.property):`'${t.property.name}'`})`}function Be(e,n,t){for(const r of t)switch(r.type){case"MemberExpression":n=Ne(e,n,r);break;case"CallExpression":n=ze(e,n,r.arguments);break;default:throw new d(null,"Unrecognized",r)}return n}function _e(e,n,t){return`lang.tryMember(${n}, ${t.computed?ce(e,t.property):`'${t.property.name}'`})`}function Ve(e,n){const t=a(n);let r="",o=ce(e,t.root);for(const l of t.sections)r+=`(${e.symbols.safeAccessTempVarId} = ${_e(e,o,l.checked)}) == null ? null : `,o=Be(e,e.symbols.safeAccessTempVarId,l.unchecked);return`(${r}${o})`}function Te(e,n){try{return"lang.unary("+ce(e,n.argument)+",'"+n.operator+"')"}catch(t){throw t}}function Le(e,n){try{const t=[];for(let r=0;r<n.elements.length;r++)"Literal"===n.elements[r].type?t.push(ce(e,n.elements[r])):t.push("lang.aCheck("+ce(e,n.elements[r])+",'ArrayExpression')");return"["+t.join(",")+"]"}catch(t){throw t}}function Re(e,n){try{const t=[];let r=0;for(const o of n.quasis)t.push(o.value?JSON.stringify(o.value.cooked):JSON.stringify("")),!1===o.tail&&(t.push(n.expressions[r]?"lang.castString(lang.aCheck("+ce(e,n.expressions[r])+", 'TemplateLiteral'))":""),r++);return"(["+t.join(",")+"]).join('')"}catch(t){throw t}}function Ue(e,n){try{return"lang.binary("+ce(e,n.left)+","+ce(e,n.right)+",'"+n.operator+"')"}catch(t){throw t}}function De(e,n){try{if("AssignmentExpression"===n.left.type||"UpdateExpression"===n.left.type)throw new d(null,"LogicalExpressionOnlyBoolean",n);if("AssignmentExpression"===n.right.type||"UpdateExpression"===n.right.type)throw new d(null,"LogicalExpressionOnlyBoolean",n);if("&&"===n.operator||"||"===n.operator)return"(lang.logicalCheck("+ce(e,n.left)+") "+n.operator+" lang.logicalCheck("+ce(e,n.right)+"))";throw new d(null,"LogicExpressionOrAnd",null)}catch(t){throw t}}function Ge(e,n){const t=oe(e,n);switch(Oe(t),t.scope){case"local":return rn(`lscope['${t.var}']`);case"global":return rn(`gscope['${t.var}']`);default:throw t.scope,new d(null,"NeverReach",n)}}function qe(e,n){if("Identifier"===n.callee.type){const t=oe(e,n.callee,"FunctionNotFound");if("global"===t.scope)switch(t.name){case"iif":return Pe(e,n);case"when":return Ke(e,n);case"defaultvalue":return We(e,n);case"decode":return Ze(e,n)}}return ze(e,ce(e,n.callee),n.arguments)}function ze(e,n,t){const r=`lang.callfunc(${n}, [${t.map(n=>ce(e,n)).join(", ")}], runtimeCtx)`;return e.isAsync?`(yield ${r})`:r}function Pe(e,n){try{if(3!==n.arguments.length)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n\n if (${t} === true) {\n return ${ce(e,n.arguments[1])};\n }\n else if (${t} === false) {\n return ${ce(e,n.arguments[2])};\n }\n else {\n lang.error('ExecutionErrorCodes.BooleanConditionRequired');\n }\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function We(e,n){try{if(n.arguments.length<2||n.arguments.length>3)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId(),r=e.symbols.nextTempVarId();return 3===n.arguments.length?`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n var ${r} = ${ce(e,n.arguments[1])};\n ${t} = lang.getNestedOptionalValue(${t}, ${r});\n return ${t} != null && ${t} !== "" ? ${t} : ${ce(e,n.arguments[2])};\n ${e.isAsync?"})}()))":"}()"}`:`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n if (${t} === null) {\n return ${ce(e,n.arguments[1])};\n }\n if (${t} === "") {\n return ${ce(e,n.arguments[1])};\n }\n if (${t} === undefined) {\n return ${ce(e,n.arguments[1])};\n }\n return ${t};\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ke(e,n){try{if(n.arguments.length<3)throw new d(null,"WrongNumberOfParameters",n);if(n.arguments.length%2==0)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();let r="var ";for(let o=0;o<n.arguments.length-1;o+=2)r+=`${t} = lang.mustBoolean(${ce(e,n.arguments[o])}, runtimeCtx);\n if (${t} === true ) {\n return ${ce(e,n.arguments[o+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n ${r}\n return ${ce(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ze(e,n){try{if(n.arguments.length<2)throw new d(null,"WrongNumberOfParameters",n);if(2===n.arguments.length)return`(${ce(e,n.arguments[1])})`;if((n.arguments.length-1)%2==0)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();let r;if(n.arguments.every((e,n)=>n%2==0||"Literal"===e.type)){r=`switch (${t}) {`;for(let t=1;t<n.arguments.length-1;t+=2){const o=n.arguments[t],l=n.arguments[t+1];null==o.value?r+="\n case null:\n case lc.voidOperation:\n ":r+=`\n case ${JSON.stringify(o.value)}:\n `,r+=`return ${ce(e,l)}`}r+="}"}else{const o=e.symbols.nextTempVarId();r="var ";for(let l=1;l<n.arguments.length-1;l+=2){const a=n.arguments[l],s=n.arguments[l+1];r+=`${o} = ${ce(e,a)};\n if (lang.binary(${o}, ${t}, "==") === true ) {\n return ${ce(e,s)}\n }\n `}}return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n ${r}\n return ${ce(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Je(e,n){try{return ie(e,n,(e,n)=>{throw new f(e,"Unrecognized",n)})}catch(t){throw t}}function Ye(e){const n=function(){this.textformatting=p.textFormatting()};n.prototype=Object.create(null),n.provided=new Set(["textformatting","infinity","pi"]),n.prototype.infinity=Number.POSITIVE_INFINITY,n.prototype.pi=Math.PI;for(const[t,r]of Object.entries(e))n.prototype[t]=new y(r),n.provided.add(t);return n}function He(){const e=Object.create(null);L(e,ie),z(e,ie),R(e,ie,ae),G(e,ie),U(e,ie),q(e,ie),P(e,ie),e.iif=Je,e.decode=Je,e.when=Je,e.defaultvalue=Je;const n=Ye(e);D(e,ie);return{ScopeSync:Ye(e),ScopeAsync:n}}const{ScopeSync:Qe,ScopeAsync:Xe}=He();function en(e,n){const t={mode:n,compiled:!0,functions:Object.create(null),signatures:[],standardFunction:ie,standardFunctionAsync:ie,evaluateIdentifier:ae};for(const r of e)r.registerFunctions(t);if("sync"===n)for(const[r,o]of Object.entries(t.functions))Qe.prototype[r]=new y(o),Qe.provided.add(r);else for(const[r,o]of Object.entries(t.functions))Xe.prototype[r]=new y(o),Xe.provided.add(r);for(const r of t.signatures)_(r,n)}en([T],"sync"),en([T],"async"),en([V],"async");const nn=Symbol("uninitialized"),tn="lang.uninitialized";function rn(e){return`lang.requireInitialized(${e})`}const on={uninitialized:nn,requireInitialized(e){if(e===nn)throw new f(null,"InvalidIdentifier",null);return e},isNumber:e=>Q(e),isArray:e=>H(e),isImmutableArray:e=>C(e),isDictionaryLike:e=>B(e),isString:e=>X(e),isDictionary:e=>N(e),isGeometry:e=>E(e),getGeometryKeys:e=>m(e),getGeometryMember:(e,n,t)=>c(e,n,t,null),error(e){throw new f(null,e,null)},__awaiter(e,n,t,r){const o=r.apply(e,n||[]);let l=o.next();for(;!l.done&&!K(l.value);)l=o.next(l.value);return l.done?l.value:new Promise((e,n)=>{function t(r){for(;!r.done;){if(K(r.value))return void Promise.resolve(r.value).then(e=>{try{t(o.next(e))}catch(r){n(r)}},e=>{try{t(o.throw(e))}catch(r){n(r)}});try{r=o.next(r.value)}catch(l){return void n(l)}}e(r.value)}t(l)})},functionDepthchecker:(e,n)=>function(){if(n.depthCounter.depth++,n.localStack.push({}),n.depthCounter.depth>64)throw new f(null,"MaximumCallDepth",null);const t=e.apply(this,arguments);return K(t)?t.then(e=>(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,e)):(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,t)},mustBoolean(e,n){if(!0===e||!1===e)return e;throw new f(n,"BooleanConditionRequired",null)},castString:e=>M(e),aCheck(e,n){if(x(e)){if("ArrayExpression"===n)throw new f(null,"NoFunctionInArray",null);if("ObjectExpression"===n)throw new f(null,"NoFunctionInDictionary",null);throw new f(null,"NoFunctionInTemplateLiteral",null)}return e===O?null:e},Dictionary:p,Feature:h,UserDefinedCompiledFunction:se,dictionary(e){const n=Object.create(null),t=new Map;for(let o=0;o<e.length;o+=2){if(x(e[o+1]))throw new f(null,"NoFunctionInDictionary",null);if(!1===X(e[o]))throw new f(null,"KeyMustBeString",null);let r=e[o].toString();const l=r.toLowerCase();t.has(l)?r=t.get(l):t.set(l,r),e[o+1]===O?n[r]=null:n[r]=e[o+1]}const r=new p(n);return r.immutable=!1,r},entry:(e,n)=>p.containerEntry(e,n),strCheck(e){if(!1===X(e))throw new f(null,"KeyMustBeString",null);return e},unary(e,n){if(ee(e)){if("!"===n)return!e;if("-"===n)return-1*F(e);if("+"===n)return 1*F(e);if("~"===n)return~F(e);throw new f(null,"UnsupportUnaryOperator",null)}if("-"===n)return-1*F(e);if("+"===n)return 1*F(e);if("~"===n)return~F(e);throw new f(null,"UnsupportUnaryOperator",null)},logicalCheck(e){if(!1===ee(e))throw new f(null,"LogicExpressionOrAnd",null);return e},logical(e,n,t){if(ee(e)&&ee(n))switch(t){case"||":return e||n;case"&&":return e&&n;default:throw new f(null,"LogicExpressionOrAnd",null)}throw new f(null,"LogicExpressionOrAnd",null)},binary(e,n,t){switch(t){case"|":case"<<":case">>":case">>>":case"^":case"&":return k(F(e),F(n),t);case"==":return A(e,n);case"!=":return!A(e,n);case"<":case">":case"<=":case">=":return j(e,n,t);case"+":return X(e)||X(n)?M(e)+M(n):F(e)+F(n);case"-":return F(e)-F(n);case"*":return F(e)*F(n);case"/":return F(e)/F(n);case"%":return F(e)%F(n);default:throw new f(null,"UnsupportedOperator",null)}},assign(e,n,t){switch(n){case"=":return e===O?null:e;case"/=":return F(t)/F(e);case"*=":return F(t)*F(e);case"-=":return F(t)-F(e);case"+=":return X(t)||X(e)?M(t)+M(e):F(t)+F(e);case"%=":return F(t)%F(e);default:throw new f(null,"UnsupportedOperator",null)}},update(e,n,t,r){const o=F(this.requireInitialized(e[n]));return e[n]="++"===t?o+1:o-1,!1===r?o:"++"===t?o+1:o-1},createFeature:(e,n,t)=>h.createFromGraphicLikeObject(e.geometry,e.attributes,n,t.timeZone),memberupdate(e,n,t,r){let o;if(H(e)){if(!Q(n))throw new f(null,"ArrayAccessMustBeNumber",null);if(n<0&&(n=e.length+n),n<0||n>=e.length)throw new f(null,"OutOfBounds",null);o=F(e[n]),e[n]="++"===t?o+1:o-1}else if(e instanceof p){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0!==e.hasField(n))throw new f(null,"FieldNotFound",null,{key:n});o=F(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else if(I(e)){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0!==e.hasField(n))throw new f(null,"FieldNotFound",null);o=F(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else{if(C(e))throw new f(null,"Immutable",null);if(!(e instanceof un))throw new f(null,"InvalidIdentifier",null);if(!1===X(n))throw new f(null,"ModuleAccessorMustBeString",null);if(!0!==e.hasGlobal(n))throw new f(null,"ModuleExportNotFound",null);o=F(e.global(n)),e.setGlobal(n,"++"===t?o+1:o-1)}return!1===r?o:"++"===t?o+1:o-1},assignmember(e,n,t,r){if(H(e)){if(!Q(n))throw new f(null,"ArrayAccessMustBeNumber",null);if(n<0&&(n=e.length+n),n<0||n>e.length)throw new f(null,"OutOfBounds",null);if(n===e.length){if("="!==t)throw new f(null,"OutOfBounds",null);e[n]=this.assign(r,t,e[n])}else e[n]=this.assign(r,t,e[n])}else if(e instanceof p){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0===e.hasField(n))e.setField(n,this.assign(r,t,e.field(n)));else{if("="!==t)throw new f(null,"FieldNotFound",null);e.setField(n,this.assign(r,t,null))}}else if(I(e)){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0===e.hasField(n))e.setField(n,this.assign(r,t,e.field(n)));else{if("="!==t)throw new f(null,"FieldNotFound",null);e.setField(n,this.assign(r,t,null))}}else{if(C(e))throw new f(null,"Immutable",null);if(!(e instanceof un))throw new f(null,"InvalidIdentifier",null);if(!1===X(n))throw new f(null,"ModuleAccessorMustBeString",null);if(!e.hasGlobal(n))throw new f(null,"ModuleExportNotFound",null);e.setGlobal(n,this.assign(r,t,e.global(n)))}},member:(e,n)=>u(e,n),tryMember:(e,n)=>i(e,n),callfunc(e,n,t){if(x(e))return e.call(t,{arguments:n,preparsed:!0});throw new f(null,"CallNonFunction",null)},loadModule(e,n){const t=n.moduleFactoryMap[e];if(n.moduleSingletons[t])return n.moduleSingletons[t];const r=n.moduleFactory[t]({moduleSingletons:n.moduleSingletons,depthCounter:n.depthCounter,lrucache:n.lrucache,interceptor:n.interceptor,services:n.services,console:n.console,abortSignal:n.abortSignal,timeZone:n.timeZone??null,spatialReference:n.spatialReference});return n.moduleSingletons[t]=r,r},getNestedOptionalValue:(e,n)=>s(e,n)};function ln(e){console.log(e)}function an(t,o,l=!1){let a=null;t.usesModules&&(a=new r(null,t.loadedModules));const s=Object.create(null),i=new Set(Object.keys(o?.vars||{}).map(n=>e(n))),u=new Set(Object.keys(o?.customfunctions||{}).map(n=>e(n))),c=ue(t,l?Xe.provided:Qe.provided,new Set([...i,...u]),l,a,s);let m;m=l?["var runtimeCtx = this.prepare(context, true);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","return lang.__awaiter(this, void 0, void 0, function* () {"," function mainBody() {"," return lang.__awaiter(this, void 0, void 0, function* () {",` ${c.body}`," });"," }"," return this.postProcess(yield mainBody());","});"].join("\n"):["var runtimeCtx = this.prepare(context, false);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","function mainBody() {",` ${c.body}`,"}","return this.postProcess(mainBody());"].join("\n");const{symbolMetadata:p,moduleFactoryMap:d}=c,g={lc:v,lang:on,postProcess(e){if(S(e))return null;if(x(e))throw new f(null,"IllegalResult",null);return e},prepare(e,t){const r=e.spatialReference??J.WebMercator,o=t?new Xe:new Qe;for(const n of u)null!=e.customfunctions&&n in e.customfunctions?o[n]=e.customfunctions[n]??null:o[n]=nn;for(const n of i){if(null==e.vars||!(n in e.vars)){n in o||(o[n]=nn);continue}const t=e.vars[n]??null;Y(t)?o[n]=h.createFromGraphic(t,e.timeZone??null):o[n]=t}return{lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??ln,abortSignal:e.abortSignal??n,timeZone:e.timeZone??null,spatialReference:r,track:e.track,globalScope:o,localStack:[],depthCounter:{depth:1},symbolMetadata:p,moduleFactory:s,moduleFactoryMap:d,moduleSingletons:Object.create(null)}}};return new Function("context",m).bind(g)}async function sn(){return en([await import("./functions/geomasync.js")],"async"),!0}class un extends t{constructor(e){super(),this.moduleContext=e}hasGlobal(n){const t=this.moduleContext.symbolMetadata.exports;return t.has(n)||t.has(e(n))}setGlobal(n,t){if(x(t))throw new f(null,"AssignModuleFunction",null);const r=this.moduleContext.symbolMetadata.globals.get(e(n));if(null==r)throw new f(null,"ModuleExportNotFound",null);this.moduleContext.globalScope[r]=t}global(n){const t=this.moduleContext.symbolMetadata.globals.get(e(n));if(null==t)throw new f(null,"ModuleExportNotFound",null);const r=this.moduleContext.globalScope,o=on.requireInitialized(r[t]);if(x(o)&&!(o instanceof b)){const e=new b;return e.fn=o,e.parameterEvaluator=ie,e.context=this.moduleContext,r[t]=e,e}return o}}function cn(e,t,o){const l=new r(null,e.loadedModules),a=ue(e,o?Xe.provided:Qe.provided,new Set,o,l,t);let s;s=o?["var runtimeCtx = this.prepare(context, true);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","return lang.__awaiter(this, void 0, void 0, function* () {"," function mainBody() {"," return lang.__awaiter(this, void 0, void 0, function* () {",` ${a.body}`," });"," }"," yield mainBody();"," return this.prepareModule(runtimeCtx);","});"].join("\n"):["var runtimeCtx = this.prepare(context, false);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","function mainBody() {",` ${a.body}`,"}","mainBody();","return this.prepareModule(runtimeCtx);"].join("\n");const{symbolMetadata:i,moduleFactoryMap:u}=a,c={lc:v,lang:on,prepareModule:e=>new un(e),prepare(e,r){const o=e.spatialReference??J.WebMercator,l=r?new Xe:new Qe;return{lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??ln,abortSignal:e.abortSignal??n,timeZone:e.timeZone??null,spatialReference:o,track:null,globalScope:l,localStack:[],depthCounter:e.depthCounter,symbolMetadata:i,moduleFactory:t,moduleFactoryMap:u,moduleSingletons:e.moduleSingletons}}};return new Function("context",s).bind(c)}export{se as UserDefinedCompiledFunction,an as compileScript,sn as enableAsyncSupport,en as extend};
|
|
2
|
+
import{toSymbolId as e,neverAbortedSignal as n}from"./arcadeEnvironment.js";import{ArcadeModule as t}from"./ArcadeModule.js";import{ArcadeModuleLoader as r}from"./ArcadeModuleLoader.js";import{collectDeclaredGlobalNames as o,collectDeclaredLocalNames as l,flattenAccessChain as a}from"./compilerUtils.js";import{getNestedOptionalValue as s,tryGetMember as i,getMember as u,getGeometryMember as c,getGeometryKeys as m}from"./containerUtils.js";import p from"./Dictionary.js";import{ArcadeExecutionError as f,ArcadeCompilationError as d,ArcadeUncompilableError as g}from"./executionError.js";import{Feature as h}from"./Feature.js";import{NativeFunction as y,ArcadeFunction as w,ScopeMarshalledFunction as b,wrapModuleScopedResponse as $}from"./FunctionWrapper.js";import{p as v,q as S,i as x,k as I,j as C,r as F,s as M,v as O,u as j,w as A,x as k,h as E,n as N,y as B}from"../chunks/languageUtils.js";import{addFunctionDeclaration as _}from"./treeAnalysis.js";import{A as V}from"../chunks/aiServices.js";import{A as T}from"../chunks/array.js";import{registerFunctions as L}from"./functions/date.js";import{registerFunctions as R}from"./functions/feature.js";import{registerFunctions as U}from"./functions/geometry.js";import{registerFunctions as D}from"./functions/geomsync.js";import{registerFunctions as G}from"./functions/maths.js";import{registerFunctions as q}from"./functions/stats.js";import{registerFunctions as z}from"./functions/string.js";import{registerFunctions as P}from"./functions/track.js";import W from"../core/Logger.js";import{isPromiseLike as K}from"../core/promiseUtils.js";import{addMany as Z}from"../core/SetUtils.js";import J from"../geometry/SpatialReference.js";import{isGraphic as Y}from"../support/graphicInstanceUtils.js";import{isArray as H,isNumber as Q,isString as X,isBoolean as ee}from"../support/guards.js";const ne=()=>W.getLogger("esri.arcade.arcadeCompiler");class te{constructor(){this._symbolCounter=0,this.safeAccessTempVarId="_Tsat"}nextVarId(){return this._symbolCounter+=1,`_T${this._symbolCounter}`}nextTempVarId(){return this._symbolCounter+=1,`_Tvar${this._symbolCounter}`}nextLocalsSymbolMapId(){return this._symbolCounter+=1,`_Locals${this._symbolCounter}`}}function re(e,n){const t=e.localScope?.get(n);if(null!=t)return{scope:"local",name:n,var:t};const r=e.globalScope.get(n);return null!=r?{scope:"global",name:n,var:r}:e.standardGlobals.has(n)?{scope:"global",name:n,var:n}:null}function oe(n,t,r="InvalidIdentifier"){const o=re(n,e(t));if(null!=o)return o;throw new d(null,r,t)}function le(n,t,r){const o=re(n,e(t));if(null==o)throw ne().error(`Internal error: Symbol "${t.name}" not declared.`),new d(null,"NeverReach",t);if(null!=r&&o.scope!==r)throw ne().error(`Internal error: Expected to resolve "${t.name}" in the ${r} scope but is in the ${o.scope} scope.`),new d(null,"NeverReach",t);return o}function ae(n,t){const r=e(t),o=n.symbolMetadata;if(n.localStack.length>0){const e=n.localStack[n.localStack.length-1],t=o.locals.get(e._SymbolsMapId);if(null==t)return void ne().error(`Internal error: no reflection metadata for ${e._SymbolsMapId}`);const l=t.get(r);if(null!=l)return on.requireInitialized(e[l])}const l=o.globals.get(r);if(null!=l)return on.requireInitialized(n.globalScope[l]);if(o.standardGlobals.has(r))return on.requireInitialized(n.globalScope[r]);throw new f(null,"InvalidIdentifier",null)}class se extends w{constructor(e,n){super(),this.paramCount=n,this.fn=e}get debugName(){return null}createFunction(e){return(...n)=>{if(n.length!==this.paramCount)throw new f(e,"WrongNumberOfParameters",null);return this.fn(...n)}}call(e,n){return this.fn(...n.arguments)}marshalledCall(e,n,t,r){return r(e,n,(n,o,l)=>{l=l.map(n=>!x(n)||n instanceof b?n:$(n,e,r));const a=this.call(t,{arguments:l});return K(a)?a.then(e=>$(e,t,r)):a})}}function ie(e,n,t){try{return t(e,null,n.arguments)}catch(r){throw r}}function ue(e,n,t,r,l,a){const{globals:s,exports:i}=o(e);Z(s,t);const u=new te,c=[],m=new Map;for(const o of s)if(t.has(o)||n.has(o))m.set(o,o);else{const e=u.nextVarId();m.set(o,e),c.push(`gscope[${JSON.stringify(e)}] = ${tn};`)}const p=new Map,f=Object.create(null),d={isAsync:r,symbols:u,standardGlobals:n,globalScope:m,exports:i,localScope:null,allLocalSymbolMetadata:p,moduleFactory:a,moduleFactoryMap:f,libraryResolver:l};return{body:[...c,`var ${u.safeAccessTempVarId};`,"var lastStatement = lc.voidOperation;",Ce(d,e),"return lastStatement;"].join("\n"),symbolMetadata:{standardGlobals:n,exports:i,globals:m,locals:p},moduleFactoryMap:f}}function ce(e,n){switch(n.type){case"AssignmentExpression":return ve(e,n);case"UpdateExpression":return be(e,n);case"TemplateLiteral":return Re(e,n);case"Identifier":return Ge(e,n);case"MemberExpression":return Ee(e,n);case"Literal":return null===n.value||void 0===n.value?"null":JSON.stringify(n.value);case"CallExpression":return qe(e,n);case"UnaryExpression":return Te(e,n);case"BinaryExpression":return Ue(e,n);case"LogicalExpression":return De(e,n);case"ArrayExpression":return Le(e,n);case"ObjectExpression":return pe(e,n);case"MemberAccessChainExpression":return Ve(e,n);case"SafeMemberExpression":throw ne().error("SafeMemberExpression outside of MemberAccessChainExpression"),new d(null,"Unrecognized",n);default:throw new d(null,"Unrecognized",n)}}function me(e,n){switch(n.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclaration":return Ae(e,n);case"BlockStatement":return Ce(e,n);case"FunctionDeclaration":return je(e,n);case"ImportDeclaration":return Me(e,n);case"ExportNamedDeclaration":return me(e,n.declaration);case"ReturnStatement":return Fe(e,n);case"IfStatement":return Ie(e,n);case"ExpressionStatement":return Se(e,n);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"ForStatement":return we(e,n);case"ForInStatement":return he(e,n);case"ForOfStatement":return ye(e,n);case"WhileStatement":return $e(e,n);default:throw new d(null,"Unrecognized",n)}}function pe(e,n){let t="lang.dictionary([";for(let r=0;r<n.properties.length;r++){const o=n.properties[r];let l;l="Identifier"===o.key.type?"'"+o.key.name+"'":ce(e,o.key);r>0&&(t+=","),t+="lang.strCheck("+l+",'ObjectExpression'),lang.aCheck("+ce(e,o.value)+", 'ObjectExpression')"}return t+="])",t}function fe(e,n,t,r,o=(e,n)=>`${e} = ${n}`){const l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId();return[`var ${l} = ${t};`,`for (var ${a} = 0; ${a} < ${l}; ${a}++) {`,` ${o(n,a)}`,` ${me(e,r)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function de(e,n,t,r,o=e=>e){const l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId();return[`var ${l} = ${t};`,`for (var ${a} of ${l}) {`,` ${n} = ${o(a)};`,` ${me(e,r)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function ge(e,n,t,r){const o=e.symbols.nextTempVarId(),l=e.symbols.nextTempVarId(),a=e.symbols.nextTempVarId(),s=e.symbols.nextTempVarId();return[`var ${o} = yield ${t}.queryAll(runtimeCtx.abortSignal);`,`var ${l} = { done: false, value: [] };`,`for (var ${a} = 0; ${a} < ${l}.value.length || ((${a} = 0), !(${l} = yield ${o}.next()).done); ${a}++) {`,` if (${l}.value.length === 0) continue;`,` var ${s} = ${l}.value[${a}];`,` ${n} = lang.createFeature(${s}, ${t}, runtimeCtx);`,` ${me(e,r)}`,"}"].join("\n")}function he(e,n){const t=e.symbols.nextTempVarId();let r,o,l="var "+t+" = "+ce(e,n.right)+";\n";switch("VariableDeclaration"===n.left.type?(r=le(e,n.left.declarations[0].id),l+=me(e,n.left)):r=oe(e,n.left),r.scope){case"local":o=`lscope['${r.var}']`;break;case"global":o=`gscope['${r.var}']`;break;default:throw r.scope,new d(null,"NeverReach",n.left)}return l+="if ("+t+"===null) { lastStatement = lc.voidOperation; }\n ",l+="else if (lc.isArray("+t+") || lc.isString("+t+")) {\n",l+=fe(e,o,`${t}.length`,n.body),l+="}\n",l+="else if (lc.isImmutableArray("+t+")) {\n",l+=fe(e,o,`${t}.length()`,n.body),l+="}\n",l+="else if (( "+t+" instanceof lang.Dictionary) || lc.isDictionaryLike("+t+")) {\n",l+=de(e,o,`${t}.keys()`,n.body),l+="}\n",e.isAsync&&(l+="else if (lc.isFeatureSet("+t+")) {\n",l+=ge(e,o,t,n.body),l+="}\n"),l+=`else if (lc.isGeometry(${t})) {\n`,l+=de(e,o,`lang.getGeometryKeys(${t})`,n.body),l+="}\n",l+="else { lastStatement = lc.voidOperation; } \n",l}function ye(e,n){const t=e.symbols.nextTempVarId();let r,o,l="var "+t+" = "+ce(e,n.right)+";\n";switch("VariableDeclaration"===n.left.type?(r=le(e,n.left.declarations[0].id),l+=me(e,n.left)):r=oe(e,n.left),r.scope){case"local":o=`lscope['${r.var}']`;break;case"global":o=`gscope['${r.var}']`;break;default:throw r.scope,new d(null,"NeverReach",n.left)}return l+="if ("+t+"===null) { lastStatement = lc.voidOperation; }\n ",l+="else if (lc.isArray("+t+") || lc.isString("+t+")) {\n",l+=fe(e,o,`${t}.length`,n.body,(e,n)=>[`if (${n} >= ${t}.length) {`," lang.error('OutOfBounds');","}",`${e} = ${t}[${n}];`].join("\n")),l+="}\n",l+="else if (lc.isImmutableArray("+t+")) {\n",l+=fe(e,o,`${t}.length()`,n.body,(e,n)=>`${e} = ${t}.get(${n});`),l+="}\n",l+="else if (( "+t+" instanceof lang.Dictionary) || lc.isDictionaryLike("+t+")) {\n",l+=de(e,o,`${t}.keys()`,n.body,e=>`lang.entry(${e}, ${t}.field(${e}))`),l+="}\n",e.isAsync&&(l+="else if (lc.isFeatureSet("+t+")) {\n",l+=ge(e,o,t,n.body),l+="}\n"),l+=`else if (lc.isGeometry(${t})) {\n`,l+=de(e,o,`lang.getGeometryKeys(${t})`,n.body,e=>`lang.entry(${e}, lang.getGeometryMember(${t}, ${e}, runtimeCtx))`),l+="}\n",l+="else { lastStatement = lc.voidOperation; } \n",l}function we(e,n){let t="lastStatement = lc.voidOperation; \n";null!==n.init&&("VariableDeclaration"===n.init.type?t+=me(e,n.init):t+=ce(e,n.init)+"; ");const r=e.symbols.nextTempVarId(),o=e.symbols.nextTempVarId();return t+="var "+r+" = true; ",t+="\n do { ",null!==n.update&&(t+=" if ("+r+"===false) {\n "+ce(e,n.update)+" \n}\n "+r+"=false; \n"),null!==n.test&&(t+="var "+o+" = "+ce(e,n.test)+"; ",t+="if ("+o+"===false) { break; } else if ("+o+"!==true) { lang.error('BooleanConditionRequired'); }\n"),t+=me(e,n.body),null!==n.update&&(t+="\n "+ce(e,n.update)),t+="\n"+r+" = true; \n} while(true); lastStatement = lc.voidOperation; ",t}function be(e,n){if("CallExpression"===n.argument.type)throw new d(null,"NeverReach",n);let t;if("MemberExpression"===n.argument.type){const r=ce(e,n.argument.object);return t=!0===n.argument.computed?ce(e,n.argument.property):"'"+n.argument.property.name+"'","lang.memberupdate("+r+","+t+",'"+n.operator+"',"+n.prefix+")"}const r=oe(e,n.argument);switch(Oe(r),r.scope){case"local":return`lang.update(lscope, '${r.var}', '${n.operator}', ${n.prefix})`;case"global":return`lang.update(gscope, '${r.var}', '${n.operator}', ${n.prefix})`;default:throw r.scope,new d(null,"NeverReach",n.argument)}}function $e(e,n){let t="lastStatement = lc.voidOperation; \n";const r=e.symbols.nextTempVarId();return t+=`\n var ${r} = true;\n do {\n ${r} = ${ce(e,n.test)};\n if (${r}==false) {\n break;\n }\n if (${r}!==true) {\n lang.error('BooleanConditionRequired');\n }\n ${me(e,n.body)}\n }\n while (${r} !== false);\n lastStatement = lc.voidOperation;\n `,t}function ve(e,n){const t=ce(e,n.right);if("MemberExpression"===n.left.type){let r;const o=ce(e,n.left.object);return r=!0===n.left.computed?ce(e,n.left.property):"'"+n.left.property.name+"'","lang.assignmember("+o+","+r+",'"+n.operator+"',"+t+")"}const r=oe(e,n.left);switch(Oe(r),r.scope){case"local":return`lscope['${r.var}']=lang.assign(${t},'${n.operator}', ${"="===n.operator?"null":rn(`lscope['${r.var}']`)})`;case"global":return`gscope['${r.var}']=lang.assign(${t},'${n.operator}', ${"="===n.operator?"null":rn(`gscope['${r.var}']`)})`;default:throw r.scope,new d(null,"NeverReach",n.left)}}function Se(e,n){return"AssignmentExpression"===n.expression.type?"lastStatement = lc.voidOperation; "+ce(e,n.expression)+"; \n ":"lastStatement = "+ce(e,n.expression)+"; "}function xe(e,n){return"BlockStatement"===n.type?me(e,n):"ReturnStatement"===n.type||"BreakStatement"===n.type||"ContinueStatement"===n.type?me(e,n)+"; ":"ExpressionStatement"===n.type?me(e,n):me(e,n)+"; "}function Ie(e,n){return`if (lang.mustBoolean(${ce(e,n.test)}, runtimeCtx) === true) {\n ${xe(e,n.consequent)}\n } `+(null!==n.alternate?"IfStatement"===n.alternate.type?" else "+Ie(e,n.alternate):` else {\n ${xe(e,n.alternate)}\n }\n`:" else {\n lastStatement = lc.voidOperation;\n }\n")}function Ce(e,n){let t="";for(let r=0;r<n.body.length;r++)"EmptyStatement"!==n.body[r].type&&("ReturnStatement"===n.body[r].type||"BreakStatement"===n.body[r].type||"ContinueStatement"===n.body[r].type?t+=me(e,n.body[r])+"; \n":t+=me(e,n.body[r])+" \n");return t}function Fe(e,n){if(null===n.argument)return"return lc.voidOperation";return"return "+ce(e,n.argument)}function Me(e,n){const t=le(e,n.specifiers[0].local,"global"),r=e.libraryResolver?.loadLibrary(t.name),o=e.symbols.nextVarId();void 0===e.moduleFactory[r.uri]&&(e.moduleFactory[r.uri]=cn(r.syntax,e.moduleFactory,e.isAsync)),e.moduleFactoryMap[o]=r.uri;let l="";return l=e.isAsync?"(yield lang.loadModule('"+o+"', runtimeCtx) ); ":"lang.loadModule('"+o+"', runtimeCtx); ",Oe(t),`gscope['${t.var}']=${l}`}function Oe(e){if("global"===e.scope)switch(e.name){case"iif":case"when":case"defaultvalue":case"decode":throw new g}}function je(n,t){const r=new Set(t.params.map(n=>e(n))),o=l(t);Z(o,r);const a=n.symbols,s=new Map;for(const e of o)s.set(e,a.nextVarId());const i=a.nextLocalsSymbolMapId();n.allLocalSymbolMetadata.set(i,s);const u={...n,localScope:s},c=[`lscope._SymbolsMapId = ${JSON.stringify(i)};`];for(let e=0;e<t.params.length;e++){const n=le(u,t.params[e],"local");Oe(n),c.push(`lscope['${n.var}'] = arguments[${e}];`)}for(const[e,l]of s)r.has(e)||c.push(`lscope['${l}'] = ${tn};`);const m=Ce(u,t.body),p=!0===n.isAsync?["return lang.__awaiter(this, void 0, void 0, function* () {",` ${m}`," return lastStatement;","});"]:[m,"return lastStatement;"],f=["new lang.UserDefinedCompiledFunction("," lang.functionDepthchecker("," function() {"," var lastStatement = lc.voidOperation;"," var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];",...c,...p," },"," runtimeCtx,"," ),",` ${t.params.length},`,")"].join("\n"),d=le(n,t.id,"global");return Oe(d),`gscope['${d.var}']=${f}; lastStatement = lc.voidOperation;`}function Ae(e,n){const t=[];for(let r=0;r<n.declarations.length;r++)t.push(ke(e,n.declarations[r]));return t.join("\n")+" \n lastStatement= lc.voidOperation; \n"}function ke(e,n){const t=null===n.init?"null":ce(e,n.init),r=le(e,n.id);switch(Oe(r),r.scope){case"local":return`lscope['${r.var}']=${t};`;case"global":return`gscope['${r.var}']=${t};`;default:throw r.scope,new d(null,"NeverReach",n.id)}}function Ee(e,n){return Ne(e,ce(e,n.object),n)}function Ne(e,n,t){return`lang.member(${n}, ${t.computed?ce(e,t.property):`'${t.property.name}'`})`}function Be(e,n,t){for(const r of t)switch(r.type){case"MemberExpression":n=Ne(e,n,r);break;case"CallExpression":n=ze(e,n,r.arguments);break;default:throw new d(null,"Unrecognized",r)}return n}function _e(e,n,t){return`lang.tryMember(${n}, ${t.computed?ce(e,t.property):`'${t.property.name}'`})`}function Ve(e,n){const t=a(n);let r="",o=ce(e,t.root);for(const l of t.sections)r+=`(${e.symbols.safeAccessTempVarId} = ${_e(e,o,l.checked)}) == null ? null : `,o=Be(e,e.symbols.safeAccessTempVarId,l.unchecked);return`(${r}${o})`}function Te(e,n){try{return"lang.unary("+ce(e,n.argument)+",'"+n.operator+"')"}catch(t){throw t}}function Le(e,n){try{const t=[];for(let r=0;r<n.elements.length;r++)"Literal"===n.elements[r].type?t.push(ce(e,n.elements[r])):t.push("lang.aCheck("+ce(e,n.elements[r])+",'ArrayExpression')");return"["+t.join(",")+"]"}catch(t){throw t}}function Re(e,n){try{const t=[];let r=0;for(const o of n.quasis)t.push(o.value?JSON.stringify(o.value.cooked):JSON.stringify("")),!1===o.tail&&(t.push(n.expressions[r]?"lang.castString(lang.aCheck("+ce(e,n.expressions[r])+", 'TemplateLiteral'))":""),r++);return"(["+t.join(",")+"]).join('')"}catch(t){throw t}}function Ue(e,n){try{return"lang.binary("+ce(e,n.left)+","+ce(e,n.right)+",'"+n.operator+"')"}catch(t){throw t}}function De(e,n){try{if("AssignmentExpression"===n.left.type||"UpdateExpression"===n.left.type)throw new d(null,"LogicalExpressionOnlyBoolean",n);if("AssignmentExpression"===n.right.type||"UpdateExpression"===n.right.type)throw new d(null,"LogicalExpressionOnlyBoolean",n);if("&&"===n.operator||"||"===n.operator)return"(lang.logicalCheck("+ce(e,n.left)+") "+n.operator+" lang.logicalCheck("+ce(e,n.right)+"))";throw new d(null,"LogicExpressionOrAnd",null)}catch(t){throw t}}function Ge(e,n){const t=oe(e,n);switch(Oe(t),t.scope){case"local":return rn(`lscope['${t.var}']`);case"global":return rn(`gscope['${t.var}']`);default:throw t.scope,new d(null,"NeverReach",n)}}function qe(e,n){if("Identifier"===n.callee.type){const t=oe(e,n.callee,"FunctionNotFound");if("global"===t.scope)switch(t.name){case"iif":return Pe(e,n);case"when":return Ke(e,n);case"defaultvalue":return We(e,n);case"decode":return Ze(e,n)}}return ze(e,ce(e,n.callee),n.arguments)}function ze(e,n,t){const r=`lang.callfunc(${n}, [${t.map(n=>ce(e,n)).join(", ")}], runtimeCtx)`;return e.isAsync?`(yield ${r})`:r}function Pe(e,n){try{if(3!==n.arguments.length)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n\n if (${t} === true) {\n return ${ce(e,n.arguments[1])};\n }\n else if (${t} === false) {\n return ${ce(e,n.arguments[2])};\n }\n else {\n lang.error('ExecutionErrorCodes.BooleanConditionRequired');\n }\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function We(e,n){try{if(n.arguments.length<2||n.arguments.length>3)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId(),r=e.symbols.nextTempVarId();return 3===n.arguments.length?`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n var ${r} = ${ce(e,n.arguments[1])};\n ${t} = lang.getNestedOptionalValue(${t}, ${r});\n return ${t} != null && ${t} !== "" ? ${t} : ${ce(e,n.arguments[2])};\n ${e.isAsync?"})}()))":"}()"}`:`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n if (${t} === null) {\n return ${ce(e,n.arguments[1])};\n }\n if (${t} === "") {\n return ${ce(e,n.arguments[1])};\n }\n if (${t} === undefined) {\n return ${ce(e,n.arguments[1])};\n }\n return ${t};\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ke(e,n){try{if(n.arguments.length<3)throw new d(null,"WrongNumberOfParameters",n);if(n.arguments.length%2==0)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();let r="var ";for(let o=0;o<n.arguments.length-1;o+=2)r+=`${t} = lang.mustBoolean(${ce(e,n.arguments[o])}, runtimeCtx);\n if (${t} === true ) {\n return ${ce(e,n.arguments[o+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n ${r}\n return ${ce(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ze(e,n){try{if(n.arguments.length<2)throw new d(null,"WrongNumberOfParameters",n);if(2===n.arguments.length)return`(${ce(e,n.arguments[1])})`;if((n.arguments.length-1)%2==0)throw new d(null,"WrongNumberOfParameters",n);const t=e.symbols.nextTempVarId();let r;if(n.arguments.every((e,n)=>n%2==0||"Literal"===e.type)){r=`switch (${t}) {`;for(let t=1;t<n.arguments.length-1;t+=2){const o=n.arguments[t],l=n.arguments[t+1];null==o.value?r+="\n case null:\n case lc.voidOperation:\n ":r+=`\n case ${JSON.stringify(o.value)}:\n `,r+=`return ${ce(e,l)}`}r+="}"}else{const o=e.symbols.nextTempVarId();r="var ";for(let l=1;l<n.arguments.length-1;l+=2){const a=n.arguments[l],s=n.arguments[l+1];r+=`${o} = ${ce(e,a)};\n if (lang.binary(${o}, ${t}, "==") === true ) {\n return ${ce(e,s)}\n }\n `}}return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ce(e,n.arguments[0])};\n ${r}\n return ${ce(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Je(e,n){try{return ie(e,n,(e,n)=>{throw new f(e,"Unrecognized",n)})}catch(t){throw t}}function Ye(e){const n=function(){this.textformatting=p.textFormatting()};n.prototype=Object.create(null),n.provided=new Set(["textformatting","infinity","pi"]),n.prototype.infinity=Number.POSITIVE_INFINITY,n.prototype.pi=Math.PI;for(const[t,r]of Object.entries(e))n.prototype[t]=new y(r),n.provided.add(t);return n}function He(){const e=Object.create(null);L(e,ie),z(e,ie),R(e,ie,ae),G(e,ie),U(e,ie),q(e,ie),P(e,ie),e.iif=Je,e.decode=Je,e.when=Je,e.defaultvalue=Je;const n=Ye(e);D(e,ie);return{ScopeSync:Ye(e),ScopeAsync:n}}const{ScopeSync:Qe,ScopeAsync:Xe}=He();function en(e,n){const t={mode:n,compiled:!0,functions:Object.create(null),signatures:[],standardFunction:ie,standardFunctionAsync:ie,evaluateIdentifier:ae};for(const r of e)r.registerFunctions(t);if("sync"===n)for(const[r,o]of Object.entries(t.functions))Qe.prototype[r]=new y(o),Qe.provided.add(r);else for(const[r,o]of Object.entries(t.functions))Xe.prototype[r]=new y(o),Xe.provided.add(r);for(const r of t.signatures)_(r,n)}en([T],"sync"),en([T],"async"),en([V],"async");const nn=Symbol("uninitialized"),tn="lang.uninitialized";function rn(e){return`lang.requireInitialized(${e})`}const on={uninitialized:nn,requireInitialized(e){if(e===nn)throw new f(null,"InvalidIdentifier",null);return e},isNumber:e=>Q(e),isArray:e=>H(e),isImmutableArray:e=>C(e),isDictionaryLike:e=>B(e),isString:e=>X(e),isDictionary:e=>N(e),isGeometry:e=>E(e),getGeometryKeys:e=>m(e),getGeometryMember:(e,n,t)=>c(e,n,t,null),error(e){throw new f(null,e,null)},__awaiter(e,n,t,r){const o=r.apply(e,n||[]);let l=o.next();for(;!l.done&&!K(l.value);)l=o.next(l.value);return l.done?l.value:new Promise((e,n)=>{function t(r){for(;!r.done;){if(K(r.value))return void Promise.resolve(r.value).then(e=>{try{t(o.next(e))}catch(r){n(r)}},e=>{try{t(o.throw(e))}catch(r){n(r)}});try{r=o.next(r.value)}catch(l){return void n(l)}}e(r.value)}t(l)})},functionDepthchecker:(e,n)=>function(){if(n.depthCounter.depth++,n.localStack.push({}),n.depthCounter.depth>64)throw new f(null,"MaximumCallDepth",null);const t=e.apply(this,arguments);return K(t)?t.then(e=>(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,e)):(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,t)},mustBoolean(e,n){if(!0===e||!1===e)return e;throw new f(n,"BooleanConditionRequired",null)},castString:e=>M(e),aCheck(e,n){if(x(e)){if("ArrayExpression"===n)throw new f(null,"NoFunctionInArray",null);if("ObjectExpression"===n)throw new f(null,"NoFunctionInDictionary",null);throw new f(null,"NoFunctionInTemplateLiteral",null)}return e===O?null:e},Dictionary:p,Feature:h,UserDefinedCompiledFunction:se,dictionary(e){const n=Object.create(null),t=new Map;for(let o=0;o<e.length;o+=2){if(x(e[o+1]))throw new f(null,"NoFunctionInDictionary",null);if(!1===X(e[o]))throw new f(null,"KeyMustBeString",null);let r=e[o].toString();const l=r.toLowerCase();t.has(l)?r=t.get(l):t.set(l,r),e[o+1]===O?n[r]=null:n[r]=e[o+1]}const r=new p(n);return r.immutable=!1,r},entry:(e,n)=>p.containerEntry(e,n),strCheck(e){if(!1===X(e))throw new f(null,"KeyMustBeString",null);return e},unary(e,n){if(ee(e)){if("!"===n)return!e;if("-"===n)return-1*F(e);if("+"===n)return 1*F(e);if("~"===n)return~F(e);throw new f(null,"UnsupportUnaryOperator",null)}if("-"===n)return-1*F(e);if("+"===n)return 1*F(e);if("~"===n)return~F(e);throw new f(null,"UnsupportUnaryOperator",null)},logicalCheck(e){if(!1===ee(e))throw new f(null,"LogicExpressionOrAnd",null);return e},logical(e,n,t){if(ee(e)&&ee(n))switch(t){case"||":return e||n;case"&&":return e&&n;default:throw new f(null,"LogicExpressionOrAnd",null)}throw new f(null,"LogicExpressionOrAnd",null)},binary(e,n,t){switch(t){case"|":case"<<":case">>":case">>>":case"^":case"&":return k(F(e),F(n),t);case"==":return A(e,n);case"!=":return!A(e,n);case"<":case">":case"<=":case">=":return j(e,n,t);case"+":return X(e)||X(n)?M(e)+M(n):F(e)+F(n);case"-":return F(e)-F(n);case"*":return F(e)*F(n);case"/":return F(e)/F(n);case"%":return F(e)%F(n);default:throw new f(null,"UnsupportedOperator",null)}},assign(e,n,t){switch(n){case"=":return e===O?null:e;case"/=":return F(t)/F(e);case"*=":return F(t)*F(e);case"-=":return F(t)-F(e);case"+=":return X(t)||X(e)?M(t)+M(e):F(t)+F(e);case"%=":return F(t)%F(e);default:throw new f(null,"UnsupportedOperator",null)}},update(e,n,t,r){const o=F(this.requireInitialized(e[n]));return e[n]="++"===t?o+1:o-1,!1===r?o:"++"===t?o+1:o-1},createFeature:(e,n,t)=>h.createFromGraphicLikeObject(e.geometry,e.attributes,n,t.timeZone),memberupdate(e,n,t,r){let o;if(H(e)){if(!Q(n))throw new f(null,"ArrayAccessMustBeNumber",null);if(n<0&&(n=e.length+n),n<0||n>=e.length)throw new f(null,"OutOfBounds",null);o=F(e[n]),e[n]="++"===t?o+1:o-1}else if(e instanceof p){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0!==e.hasField(n))throw new f(null,"FieldNotFound",null,{key:n});o=F(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else if(I(e)){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0!==e.hasField(n))throw new f(null,"FieldNotFound",null);o=F(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else{if(C(e))throw new f(null,"Immutable",null);if(!(e instanceof un))throw new f(null,"InvalidIdentifier",null);if(!1===X(n))throw new f(null,"ModuleAccessorMustBeString",null);if(!0!==e.hasGlobal(n))throw new f(null,"ModuleExportNotFound",null);o=F(e.global(n)),e.setGlobal(n,"++"===t?o+1:o-1)}return!1===r?o:"++"===t?o+1:o-1},assignmember(e,n,t,r){if(H(e)){if(!Q(n))throw new f(null,"ArrayAccessMustBeNumber",null);if(n<0&&(n=e.length+n),n<0||n>e.length)throw new f(null,"OutOfBounds",null);if(n===e.length){if("="!==t)throw new f(null,"OutOfBounds",null);e[n]=this.assign(r,t,e[n])}else e[n]=this.assign(r,t,e[n])}else if(e instanceof p){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0===e.hasField(n))e.setField(n,this.assign(r,t,e.field(n)));else{if("="!==t)throw new f(null,"FieldNotFound",null);e.setField(n,this.assign(r,t,null))}}else if(I(e)){if(!1===X(n))throw new f(null,"KeyAccessorMustBeString",null);if(!0===e.hasField(n))e.setField(n,this.assign(r,t,e.field(n)));else{if("="!==t)throw new f(null,"FieldNotFound",null);e.setField(n,this.assign(r,t,null))}}else{if(C(e))throw new f(null,"Immutable",null);if(!(e instanceof un))throw new f(null,"InvalidIdentifier",null);if(!1===X(n))throw new f(null,"ModuleAccessorMustBeString",null);if(!e.hasGlobal(n))throw new f(null,"ModuleExportNotFound",null);e.setGlobal(n,this.assign(r,t,e.global(n)))}},member:(e,n)=>u(e,n),tryMember:(e,n)=>i(e,n),callfunc(e,n,t){if(x(e))return e.call(t,{arguments:n,preparsed:!0});throw new f(null,"CallNonFunction",null)},loadModule(e,n){const t=n.moduleFactoryMap[e];if(n.moduleSingletons[t])return n.moduleSingletons[t];const r=n.moduleFactory[t]({moduleSingletons:n.moduleSingletons,depthCounter:n.depthCounter,lrucache:n.lrucache,interceptor:n.interceptor,services:n.services,console:n.console,abortSignal:n.abortSignal,timeZone:n.timeZone??null,spatialReference:n.spatialReference});return n.moduleSingletons[t]=r,r},getNestedOptionalValue:(e,n)=>s(e,n)};function ln(e){console.log(e)}function an(t,o,l=!1){let a=null;t.usesModules&&(a=new r(null,t.loadedModules));const s=Object.create(null),i=new Set(Object.keys(o?.vars||{}).map(n=>e(n))),u=new Set(Object.keys(o?.customfunctions||{}).map(n=>e(n))),c=ue(t,l?Xe.provided:Qe.provided,new Set([...i,...u]),l,a,s);let m;m=l?["var runtimeCtx = this.prepare(context, true);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","return lang.__awaiter(this, void 0, void 0, function* () {"," function mainBody() {"," return lang.__awaiter(this, void 0, void 0, function* () {",` ${c.body}`," });"," }"," return this.postProcess(yield mainBody());","});"].join("\n"):["var runtimeCtx = this.prepare(context, false);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","function mainBody() {",` ${c.body}`,"}","return this.postProcess(mainBody());"].join("\n");const{symbolMetadata:p,moduleFactoryMap:d}=c,g={lc:v,lang:on,postProcess(e){if(S(e))return null;if(x(e))throw new f(null,"IllegalResult",null);return e},prepare(e,t){const r=e.spatialReference??J.WebMercator,o=t?new Xe:new Qe;for(const n of u)null!=e.customfunctions&&n in e.customfunctions?o[n]=e.customfunctions[n]??null:o[n]=nn;for(const n of i){if(null==e.vars||!(n in e.vars)){n in o||(o[n]=nn);continue}const t=e.vars[n]??null;Y(t)?o[n]=h.createFromGraphic(t,e.timeZone??null):o[n]=t}return{lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??ln,abortSignal:e.abortSignal??n,timeZone:e.timeZone??null,spatialReference:r,track:e.track,globalScope:o,localStack:[],depthCounter:{depth:1},symbolMetadata:p,moduleFactory:s,moduleFactoryMap:d,moduleSingletons:Object.create(null)}}};return new Function("context",m).bind(g)}async function sn(){return en([await import("./functions/geomasync.js")],"async"),!0}class un extends t{constructor(e){super(),this.moduleContext=e}hasGlobal(n){const t=this.moduleContext.symbolMetadata.exports;return t.has(n)||t.has(e(n))}setGlobal(n,t){if(x(t))throw new f(null,"AssignModuleFunction",null);const r=this.moduleContext.symbolMetadata.globals.get(e(n));if(null==r)throw new f(null,"ModuleExportNotFound",null);this.moduleContext.globalScope[r]=t}global(n){const t=this.moduleContext.symbolMetadata.globals.get(e(n));if(null==t)throw new f(null,"ModuleExportNotFound",null);const r=this.moduleContext.globalScope,o=on.requireInitialized(r[t]);if(x(o)&&!(o instanceof b)){const e=new b;return e.fn=o,e.parameterEvaluator=ie,e.context=this.moduleContext,r[t]=e,e}return o}}function cn(e,t,o){const l=new r(null,e.loadedModules),a=ue(e,o?Xe.provided:Qe.provided,new Set,o,l,t);let s;s=o?["var runtimeCtx = this.prepare(context, true);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","return lang.__awaiter(this, void 0, void 0, function* () {"," function mainBody() {"," return lang.__awaiter(this, void 0, void 0, function* () {",` ${a.body}`," });"," }"," yield mainBody();"," return this.prepareModule(runtimeCtx);","});"].join("\n"):["var runtimeCtx = this.prepare(context, false);","var lc = this.lc;","var lang = this.lang;","var gscope = runtimeCtx.globalScope;","function mainBody() {",` ${a.body}`,"}","mainBody();","return this.prepareModule(runtimeCtx);"].join("\n");const{symbolMetadata:i,moduleFactoryMap:u}=a,c={lc:v,lang:on,prepareModule:e=>new un(e),prepare(e,r){const o=e.spatialReference??J.WebMercator,l=r?new Xe:new Qe;return{lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??ln,abortSignal:e.abortSignal??n,timeZone:e.timeZone??null,spatialReference:o,track:null,globalScope:l,localStack:[],depthCounter:e.depthCounter,symbolMetadata:i,moduleFactory:t,moduleFactoryMap:u,moduleSingletons:e.moduleSingletons}}};return new Function("context",s).bind(c)}export{se as UserDefinedCompiledFunction,an as compileScript,sn as enableAsyncSupport,en as extend};
|
package/arcade/arcadeRuntime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{toSymbolId as e,neverAbortedSignal as t}from"./arcadeEnvironment.js";import{ArcadeModule as r}from"./ArcadeModule.js";import{ArcadeModuleLoader as n}from"./ArcadeModuleLoader.js";import{collectDeclaredGlobalNames as o,collectDeclaredLocalNames as s,flattenAccessChain as i}from"./compilerUtils.js";import{getNestedOptionalValue as a,getGeometryKeys as l,getGeometryMember as c,tryGetMember as u,getMember as f}from"./containerUtils.js";import p from"./Dictionary.js";import{ArcadeExecutionError as h,ensureArcadeExecutionError as d}from"./executionError.js";import{Feature as w}from"./Feature.js";import{NativeFunction as m,ArcadeFunction as g,ScopeMarshalledFunction as b,wrapModuleScopedResponse as y}from"./FunctionWrapper.js";import{R as v,I as x,q as S,i as R,z as F,A as j,v as k,B as I,j as O,y as A,h as C,w as M,r as E,s as N,u as B,x as U,k as G}from"../chunks/languageUtils.js";import{addFunctionDeclaration as z}from"./treeAnalysis.js";import{A as D}from"../chunks/array.js";import{registerFunctions as L}from"./functions/date.js";import{registerFunctions as _}from"./functions/feature.js";import{registerFunctions as Z}from"./functions/geometry.js";import{registerFunctions as q}from"./functions/geomsync.js";import{registerFunctions as W}from"./functions/maths.js";import{registerFunctions as P}from"./functions/stats.js";import{registerFunctions as V}from"./functions/string.js";import{registerFunctions as T}from"./functions/track.js";import K from"../core/Logger.js";import Y from"../geometry/SpatialReference.js";import{isGraphic as $}from"../support/graphicInstanceUtils.js";import{isBoolean as H,isArray as J,isString as Q,isNumber as X}from"../support/guards.js";const ee=()=>K.getLogger("esri.arcade.arcadeRuntime"),te=Symbol("uninitialized");function re(e){if(e===te)throw new h(null,"InvalidIdentifier",null)}function ne(e){return re(e),e}function oe(t,r){const n=e(r);if(null!==t.localScope){const e=t.localScope[n];if(void 0!==e)return{scope:t.localScope,id:n,var:e}}const o=t.globalScope[n];if(void 0!==o)return{scope:t.globalScope,id:n,var:o};throw new h(t,"InvalidIdentifier",r)}function se(t,r,n="InvalidIdentifier"){const o=e(r);if(null!==t.localScope){const e=t.localScope[o];if(void 0!==e)return re(e),e.value}const s=t.globalScope[o];if(void 0!==s)return re(s),s.value;throw new h(t,n,r)}const ie=function(){};ie.prototype=Object.freeze(Object.create(null));class ae extends g{constructor(e,t,r,n){super(),this.definition=e,this.context=t,this._params=r,this._locals=n}createFunction(e){return(...t)=>{const r={spatialReference:this.context.spatialReference,console:this.context.console,services:this.context.services,timeZone:this.context.timeZone??null,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,abortSignal:this.context.abortSignal,localScope:new ie,depthCounter:{depth:e.depthCounter.depth+1},globalScope:this.context.globalScope,track:this.context.track};if(r.depthCounter.depth>64)throw new h(e,"MaximumCallDepth",null);return le(r,this.definition.body,this._params,this._locals,t,null)}}call(e,t){return fe(e,t,(r,n,o)=>{const s={spatialReference:e.spatialReference,services:e.services,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,timeZone:e.timeZone??null,console:e.console,lrucache:e.lrucache,interceptor:e.interceptor,abortSignal:e.abortSignal,localScope:new ie,track:e.track};if(s.depthCounter.depth>64)throw new h(e,"MaximumCallDepth",t);return le(s,this.definition.body,this._params,this._locals,o,t)})}marshalledCall(e,t,r,n){return n(e,t,(o,s,i)=>{const a={spatialReference:e.spatialReference,globalScope:r.globalScope,services:e.services,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,timeZone:e.timeZone??null,lrucache:e.lrucache,interceptor:e.interceptor,abortSignal:e.abortSignal,localScope:new ie,track:e.track};return i=i.map(t=>!R(t)||t instanceof b?t:y(t,e,n)),y(le(a,this.definition.body,this._params,this._locals,i,t),r,n)})}}function le(e,t,r,n,o,s){try{if(r.length!==o.length)throw new h(e,"WrongNumberOfParameters",s);if(null!=e.localScope){for(let t=0;t<r.length;t++)e.localScope[r[t]]={value:o[t]};for(const t of n)e.localScope[t]=te}const i=he(e,t);if(i instanceof v)return i.value;if(i===F)throw new h(e,"UnexpectedToken",s);if(i===j)throw new h(e,"UnexpectedToken",s);return i instanceof x?i.value:i}catch(i){throw i}}class ce extends r{constructor(e){super(),this.moduleGlobalContext=e}global(t){const r=e(t);if(!this.moduleGlobalContext.exports.has(r))throw new h(null,"ModuleExportNotFound",null);const n=this.moduleGlobalContext.globalScope[r];if(re(n),R(n.value)&&!(n.value instanceof b)){const e=new b;return e.fn=n.value,e.parameterEvaluator=fe,e.context=this.moduleGlobalContext,this.moduleGlobalContext.globalScope[r]={value:e},e}return n.value}setGlobal(t,r){if(R(r))throw new h(null,"AssignModuleFunction",null);const n=e(t);if(!this.moduleGlobalContext.exports.has(n))throw new h(null,"ModuleExportNotFound",null);this.moduleGlobalContext.globalScope[n]={value:r}}hasGlobal(t){return this.moduleGlobalContext.exports.has(e(t))}static load(e,r){const{globals:s,exports:i}=o(r),a=new Xe;for(const t of s)t in a||(a[t]=te);const l=e.spatialReference??Y.WebMercator,c={lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??tt,abortSignal:t,timeZone:e.timeZone??null,spatialReference:l,track:e.track,depthCounter:{depth:1},libraryResolver:new n(e.libraryResolver._moduleSingletons,r.loadedModules),exports:i,localScope:null,globalScope:a};return je(c,r),new ce(c)}}function ue(e,t){const r=[];for(let n=0;n<t.arguments.length;n++)r.push(pe(e,t.arguments[n]));return r}function fe(e,t,r){try{return!0===t.preparsed?r(e,null,t.arguments):r(e,t,ue(e,t))}catch(n){throw n}}function pe(e,t){try{switch(t.type){case"AssignmentExpression":return Se(e,t);case"UpdateExpression":return ve(e,t);case"TemplateLiteral":return qe(e,t);case"Identifier":return We(e,t);case"MemberExpression":return Ee(e,t);case"Literal":return t.value;case"CallExpression":return Pe(e,t);case"UnaryExpression":return ze(e,t);case"BinaryExpression":return Le(e,t);case"LogicalExpression":return _e(e,t);case"ArrayExpression":return De(e,t);case"ObjectExpression":return de(e,t);case"MemberAccessChainExpression":return Ge(e,t);case"SafeMemberExpression":throw ee().error("SafeMemberExpression outside of MemberAccessChainExpression"),new h(null,"Unrecognized",t);default:throw new h(e,"Unrecognized",t)}}catch(r){throw d(e,t,r)}}function he(e,t){switch(t.type){case"EmptyStatement":return k;case"VariableDeclaration":return Ce(e,t);case"ImportDeclaration":return Oe(e,t);case"ExportNamedDeclaration":return Ae(e,t);case"BlockStatement":return je(e,t);case"FunctionDeclaration":return Ie(e,t);case"ReturnStatement":return ke(e,t);case"IfStatement":return Fe(e,t);case"ExpressionStatement":return Re(e,t);case"BreakStatement":return F;case"ContinueStatement":return j;case"ForStatement":return ge(e,t);case"ForInStatement":return we(e,t);case"ForOfStatement":return me(e,t);case"WhileStatement":return be(e,t);default:throw new h(e,"Unrecognized",t)}}function de(e,t){const r=Object.create(null),n=new Map;for(let s=0;s<t.properties.length;s++){const o=t.properties[s],i="Identifier"===o.key.type?o.key.name:pe(e,o.key),a=pe(e,o.value);if(R(a))throw new h(e,"NoFunctionInDictionary",t);if(!1===Q(i))throw new h(e,"KeyMustBeString",t);let l=i.toString();const c=l.toLowerCase();n.has(c)?l=n.get(c):n.set(c,l),r[l]=a===k?null:a}const o=new p(r);return o.immutable=!1,o}function we(e,t){const r=pe(e,t.right);"VariableDeclaration"===t.left.type&&Ce(e,t.left);const n=oe(e,"VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);if(J(r)||Q(r)){const o=r.length;for(let r=0;r<o;r++){n.scope[n.id]={value:r};const o=he(e,t.body);if(o===F)break;if(o instanceof v)return o}return k}if(O(r)){for(let o=0;o<r.length();o++){n.scope[n.id]={value:o};const r=he(e,t.body);if(r===F)break;if(r instanceof v)return r}return k}if(r instanceof p||A(r)){const o=r.keys();for(let r=0;r<o.length;r++){n.scope[n.id]={value:o[r]};const s=he(e,t.body);if(s===F)break;if(s instanceof v)return s}return k}if(C(r)){for(const o of l(r)){n.scope[n.id]={value:o};const r=he(e,t.body);if(r===F)break;if(r instanceof v)return r}return k}return k}function me(e,t){const r=pe(e,t.right);"VariableDeclaration"===t.left.type&&he(e,t.left);const n=oe(e,"VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);if(J(r)||Q(r)){const o=r.length;for(let s=0;s<o;s++){if(s>=r.length)throw new h(e,"OutOfBounds",t);n.scope[n.id]={value:r[s]};const o=he(e,t.body);if(o===F)break;if(o instanceof v)return o}return k}if(O(r)){for(let o=0;o<r.length();o++){n.scope[n.id]={value:r.get(o)};const s=he(e,t.body);if(s===F)break;if(s instanceof v)return s}return k}if(r instanceof p||A(r)){for(const o of r.keys()){const s=r.field(o);n.scope[n.id]={value:p.containerEntry(o,s)};const i=he(e,t.body);if(i===F)break;if(i instanceof v)return i}return k}if(C(r)){for(const o of l(r)){const s=c(r,o,e,t);n.scope[n.id]={value:p.containerEntry(o,s)};const i=he(e,t.body);if(i===F)break;if(i instanceof v)return i}return k}return k}function ge(e,t){null!==t.init&&("VariableDeclaration"===t.init.type?he(e,t.init):pe(e,t.init));const r={testResult:!0,lastAction:k};do{ye(e,t,r)}while(!0===r.testResult);return r.lastAction instanceof v?r.lastAction:k}function be(e,t){const r={testResult:!0,lastAction:k};if(r.testResult=pe(e,t.test),!1===r.testResult)return k;if(!0!==r.testResult)throw new h(e,"BooleanConditionRequired",t);for(;!0===r.testResult&&(r.lastAction=he(e,t.body),r.lastAction!==F)&&!(r.lastAction instanceof v);)if(r.testResult=pe(e,t.test),!0!==r.testResult&&!1!==r.testResult)throw new h(e,"BooleanConditionRequired",t);return r.lastAction instanceof v?r.lastAction:k}function ye(e,t,r){if(null!==t.test){if(r.testResult=pe(e,t.test),!1===r.testResult)return;if(!0!==r.testResult)throw new h(e,"BooleanConditionRequired",t)}r.lastAction=he(e,t.body),r.lastAction!==F?r.lastAction instanceof v?r.testResult=!1:null!==t.update&&pe(e,t.update):r.testResult=!1}function ve(e,t){if("CallExpression"===t.argument.type)throw new h(e,"NeverReach",t);let r;if("MemberExpression"===t.argument.type){const n=pe(e,t.argument.object);let o;if(!0===t.argument.computed)o=pe(e,t.argument.property);else{if("Identifier"!==t.argument.property.type)throw new h(e,"Unrecognized",t);o=t.argument.property.name}if(J(n)){if(!X(o))throw new h(e,"ArrayAccessMustBeNumber",t);if(o<0&&(o=n.length+o),o<0||o>=n.length)throw new h(e,"OutOfBounds",t);r=E(n[o]),n[o]="++"===t.operator?r+1:r-1}else if(n instanceof p){if(!1===Q(o))throw new h(e,"KeyAccessorMustBeString",t);if(!0!==n.hasField(o))throw new h(e,"FieldNotFound",t);r=E(n.field(o)),n.setField(o,"++"===t.operator?r+1:r-1)}else if(G(n)){if(!1===Q(o))throw new h(e,"KeyAccessorMustBeString",t);if(!0!==n.hasField(o))throw new h(e,"FieldNotFound",t);r=E(n.field(o)),n.setField(o,"++"===t.operator?r+1:r-1)}else{if(O(n))throw new h(e,"Immutable",t);if(!(n instanceof ce))throw new h(e,"InvalidParameter",t);if(!1===Q(o))throw new h(e,"ModuleAccessorMustBeString",t);if(!0!==n.hasGlobal(o))throw new h(e,"ModuleExportNotFound",t);r=E(n.global(o)),n.setGlobal(o,"++"===t.operator?r+1:r-1)}return!1===t.prefix?r:"++"===t.operator?r+1:r-1}const n=oe(e,t.argument);r=E(ne(n.var).value);const o="++"===t.operator?r+1:r-1;return n.scope[n.id]={value:o},!1===t.prefix?r:"++"===t.operator?r+1:r-1}function xe(e,t,r,n,o){switch(t){case"=":return e===k?null:e;case"/=":return E(r)/E(e);case"*=":return E(r)*E(e);case"-=":return E(r)-E(e);case"+=":return Q(r)||Q(e)?N(r)+N(e):E(r)+E(e);case"%=":return E(r)%E(e);default:throw new h(o,"UnsupportedOperator",n)}}function Se(e,t){if("MemberExpression"===t.left.type){const r=pe(e,t.left.object);let n;if(!0===t.left.computed)n=pe(e,t.left.property);else{if("Identifier"!==t.left.property.type)throw new h(e,"InvalidIdentifier",t);n=t.left.property.name}const o=pe(e,t.right);if(J(r)){if(!X(n))throw new h(e,"ArrayAccessMustBeNumber",t);if(n<0&&(n=r.length+n),n<0||n>r.length)throw new h(e,"OutOfBounds",t);if(n===r.length){if("="!==t.operator)throw new h(e,"OutOfBounds",t);r[n]=xe(o,t.operator,r[n],t,e)}else r[n]=xe(o,t.operator,r[n],t,e)}else if(r instanceof p){if(!1===Q(n))throw new h(e,"KeyAccessorMustBeString",t);if(!0===r.hasField(n))r.setField(n,xe(o,t.operator,r.field(n),t,e));else{if("="!==t.operator)throw new h(e,"FieldNotFound",t,{key:n});r.setField(n,xe(o,t.operator,null,t,e))}}else if(G(r)){if(!1===Q(n))throw new h(e,"KeyAccessorMustBeString",t);if(!0===r.hasField(n))r.setField(n,xe(o,t.operator,r.field(n),t,e));else{if("="!==t.operator)throw new h(e,"FieldNotFound",t,{key:n});r.setField(n,xe(o,t.operator,null,t,e))}}else{if(O(r))throw new h(e,"Immutable",t);if(!(r instanceof ce))throw new h(e,"InvalidIdentifier",t);if(!1===Q(n))throw new h(e,"ModuleAccessorMustBeString",t);if(!0!==r.hasGlobal(n))throw new h(e,"ModuleExportNotFound",t);r.setGlobal(n,xe(o,t.operator,r.global(n),t,e))}return k}const r=oe(e,t.left),n=pe(e,t.right);return r.scope[r.id]={value:xe(n,t.operator,"="!==t.operator?ne(r.var).value:null,t,e)},k}function Re(e,t){const r=pe(e,t.expression);return r===k?k:new x(r)}function Fe(e,t){const r=pe(e,t.test);if(!0===r)return he(e,t.consequent);if(!1===r)return null!==t.alternate?he(e,t.alternate):k;throw new h(e,"BooleanConditionRequired",t)}function je(e,t){let r=k;for(let n=0;n<t.body.length;n++)if(r=he(e,t.body[n]),r instanceof v||r===F||r===j)return r;return r}function ke(e,t){if(null===t.argument)return new v(k);const r=pe(e,t.argument);return new v(r)}function Ie(t,r){if(null!=t.localScope)throw ee().error("Function declarations are only valid in global scope."),new h(t,"NeverReach",r);const n=e(r.id);if(!(n in t.globalScope))throw ee().error(`Function "${n}" not declared.`),new h(t,"NeverReach",r);const o=s(r),i=r.params.map(t=>e(t)),a=Array.from(o).filter(e=>!i.includes(e));return t.globalScope[n]={value:new ae(r,t,i,a)},k}function Oe(e,t){const r=oe(e,t.specifiers[0].local),n=e.libraryResolver;if(null==n)throw ee().error("Internal error: module loader not initialized"),new h(e,"NeverReach",t);const o=n.loadLibrary(r.id);let s;return n._moduleSingletons?.has(o.uri)?s=n._moduleSingletons.get(o.uri):(s=ce.load(e,o.syntax),n._moduleSingletons?.set(o.uri,s)),r.scope[r.id]={value:s},k}function Ae(e,t){return he(e,t.declaration),k}function Ce(e,t){for(let r=0;r<t.declarations.length;r++)Me(e,t.declarations[r]);return k}function Me(e,t){let r=null===t.init?null:pe(e,t.init);if(r===k&&(r=null),"Identifier"!==t.id.type)throw new h(e,"InvalidIdentifier",t);const n=oe(e,t.id);n.scope[n.id]={value:r}}function Ee(e,t){return Ne(e,pe(e,t.object),t)}function Ne(e,t,r){const n=r.computed?pe(e,r.property):r.property.name;return f(t,n)}function Be(e,t,r){for(const n of r)switch(n.type){case"MemberExpression":t=Ne(e,t,n);break;case"CallExpression":t=Ve(e,t,n);break;default:throw new h(null,"Unrecognized",n)}return t}function Ue(e,t,r){const n=r.computed?pe(e,r.property):r.property.name;return u(t,n)}function Ge(e,t){const r=i(t);let n=pe(e,r.root);for(const o of r.sections){const t=Ue(e,n,o.checked);if(null==t)return null;n=Be(e,t,o.unchecked)}return n}function ze(e,t){try{const r=pe(e,t.argument);if(H(r)){if("!"===t.operator)return!r;if("-"===t.operator)return-1*E(r);if("+"===t.operator)return 1*E(r);if("~"===t.operator)return~E(r);throw new h(e,"UnsupportUnaryOperator",t)}if("~"===t.operator)return~E(r);if("-"===t.operator)return-1*E(r);if("+"===t.operator)return 1*E(r);throw new h(e,"UnsupportUnaryOperator",t)}catch(r){throw r}}function De(e,t){try{const r=[];for(let n=0;n<t.elements.length;n++){const o=pe(e,t.elements[n]);if(R(o))throw new h(e,"NoFunctionInArray",t);o===k?r.push(null):r.push(o)}return r}catch(r){throw r}}function Le(e,t){try{const r=pe(e,t.left),n=pe(e,t.right);switch(t.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return U(E(r),E(n),t.operator);case"==":return M(r,n);case"!=":return!M(r,n);case"<":case">":case"<=":case">=":return B(r,n,t.operator);case"+":return Q(r)||Q(n)?N(r)+N(n):E(r)+E(n);case"-":return E(r)-E(n);case"*":return E(r)*E(n);case"/":return E(r)/E(n);case"%":return E(r)%E(n);default:throw t.operator,new h(e,"UnsupportedOperator",t)}}catch(r){throw r}}function _e(e,t){try{const r=pe(e,t.left);if(H(r))switch(t.operator){case"||":{if(!0===r)return r;const n=pe(e,t.right);if(H(n))return n;throw new h(e,"LogicExpressionOrAnd",t)}case"&&":{if(!1===r)return r;const n=pe(e,t.right);if(H(n))return n;throw new h(e,"LogicExpressionOrAnd",t)}default:throw t.operator,new h(e,"LogicExpressionOrAnd",t)}throw new h(e,"LogicalExpressionOnlyBoolean",t)}catch(r){throw r}}function Ze(e,t,r){if(R(e))throw new h(t,"NoFunctionInTemplateLiteral",r);return e}function qe(e,t){let r="",n=0;for(const o of t.quasis)if(r+=o.value?o.value.cooked:"",!1===o.tail){r+=t.expressions[n]?N(Ze(pe(e,t.expressions[n]),e,t)):"",n++}return r}function We(e,t){return se(e,t)}function Pe(e,t){return Ve(e,"Identifier"===t.callee.type?se(e,t.callee,"FunctionNotFound"):pe(e,t.callee),t)}function Ve(e,t,r){if(R(t))return t.call(e,r);throw new h(e,"CallNonFunction",r)}function Te(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;I(null===r?[]:r,3,3,e,t);const n=pe(e,r[0]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",t);return pe(e,!0===n?r[1]:r[2])}catch(r){throw r}}function Ke(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;I(null===r?[]:r,2,3,e,t);const n=pe(e,r[0]);if(3===r.length){const t=pe(e,r[1]),o=a(n,t);return null!=o&&""!==o?o:pe(e,r[2])}return null===n||""===n||void 0===n?pe(e,r[1]):n}catch(r){throw r}}function Ye(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;if(r.length<2)throw new h(e,"WrongNumberOfParameters",t);if(2===r.length)return pe(e,r[1]);{if((r.length-1)%2==0)throw new h(e,"WrongNumberOfParameters",t);const n=pe(e,r[0]);return $e(e,t,1,n)}}catch(r){throw r}}function $e(e,t,r,n){try{const o=t.arguments,s=pe(e,o[r]);if(M(s,n))return pe(e,o[r+1]);{const s=o.length-r;return 1===s?pe(e,o[r]):2===s?null:3===s?pe(e,o[r+2]):$e(e,t,r+2,n)}}catch(o){throw o}}function He(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;if(r.length<3)throw new h(e,"WrongNumberOfParameters",t);if(r.length%2==0)throw new h(e,"WrongNumberOfParameters",t);const n=pe(e,r[0]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",r[0]);return Je(e,t,0,n)}catch(r){throw r}}function Je(e,t,r,n){try{const o=t.arguments;if(!0===n)return pe(e,o[r+1]);if(3===o.length-r)return pe(e,o[r+2]);{const n=pe(e,o[r+2]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",o[r+2]);return Je(e,t,r+2,n)}}catch(o){throw o}}function Qe(){const e=Object.create(null);L(e,fe),V(e,fe),_(e,fe,We),W(e,fe),Z(e,fe),P(e,fe),q(e,fe),T(e,fe),e.iif=Te,e.defaultvalue=Ke,e.decode=Ye,e.when=He;const t=function(){this.textformatting={value:p.textFormatting()}};t.prototype=Object.create(null),t.prototype.infinity=Object.freeze({value:Number.POSITIVE_INFINITY}),t.prototype.pi=Object.freeze({value:Math.PI});for(const[r,n]of Object.entries(e))t.prototype[r]=Object.freeze({value:new m(n)});return t}const Xe=Qe();function et(e){const t={mode:"sync",compiled:!1,functions:Object.create(null),signatures:[],standardFunction:fe,evaluateIdentifier:We};for(let r=0;r<e.length;r++)e[r].registerFunctions(t);for(const[r,n]of Object.entries(t.functions))Xe.prototype[r]=Object.freeze({value:new m(n)});for(let r=0;r<t.signatures.length;r++)z(t.signatures[r],"sync")}function tt(e){console.log(e)}function rt(r,s){const i=new Set(Object.keys(s?.vars||{}).map(t=>e(t))),a=new Set(Object.keys(s?.customfunctions||{}).map(t=>e(t))),{globals:l,exports:c}=o(r);return e=>{const o=e.spatialReference??Y.WebMercator;let s=null;r.usesModules&&(s=new n(new Map,r.loadedModules));const u=new Xe;for(const t of a)null!=e.customfunctions&&t in e.customfunctions?u[t]={value:new m(e.customfunctions[t])}:u[t]=te;for(const t of i){if(null==e.vars||!(t in e.vars)){t in u||(u[t]=te);continue}const r=e.vars[t]??null;$(r)?u[t]={value:w.createFromGraphic(r,e.timeZone??null)}:u[t]={value:r}}for(const t of l)t in u||(u[t]=te);const f={lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??tt,abortSignal:t,timeZone:e.timeZone??null,spatialReference:o,track:e.track,depthCounter:{depth:1},libraryResolver:s,exports:c,localScope:null,globalScope:u},p=je(f,r);if(p instanceof v||p instanceof x){const e=p.value;if(S(e))return null;if(R(e))throw new h(f,"IllegalResult",null);return e}if(S(p))return null;if(p===F)throw new h(f,"IllegalResult",null);if(p===j)throw new h(f,"IllegalResult",null);throw new h(f,"NeverReach",null)}}function nt(e,t){return rt(e,t)(t)}et([D]);export{nt as executeScript,et as extend,rt as prepareScript};
|
|
2
|
+
import{toSymbolId as e,neverAbortedSignal as t}from"./arcadeEnvironment.js";import{ArcadeModule as r}from"./ArcadeModule.js";import{ArcadeModuleLoader as n}from"./ArcadeModuleLoader.js";import{collectDeclaredGlobalNames as o,collectDeclaredLocalNames as s,flattenAccessChain as i}from"./compilerUtils.js";import{getNestedOptionalValue as a,getGeometryKeys as l,getGeometryMember as c,tryGetMember as u,getMember as f}from"./containerUtils.js";import p from"./Dictionary.js";import{ArcadeExecutionError as h,ensureArcadeExecutionError as d}from"./executionError.js";import{Feature as w}from"./Feature.js";import{NativeFunction as m,ArcadeFunction as g,ScopeMarshalledFunction as b,wrapModuleScopedResponse as y}from"./FunctionWrapper.js";import{R as v,I as x,q as S,i as R,z as F,A as j,v as k,B as I,j as O,y as A,h as C,w as M,r as E,s as N,u as B,x as U,k as G}from"../chunks/languageUtils.js";import{addFunctionDeclaration as z}from"./treeAnalysis.js";import{A as D}from"../chunks/array.js";import{registerFunctions as L}from"./functions/date.js";import{registerFunctions as _}from"./functions/feature.js";import{registerFunctions as Z}from"./functions/geometry.js";import{registerFunctions as q}from"./functions/geomsync.js";import{registerFunctions as W}from"./functions/maths.js";import{registerFunctions as P}from"./functions/stats.js";import{registerFunctions as V}from"./functions/string.js";import{registerFunctions as T}from"./functions/track.js";import K from"../core/Logger.js";import Y from"../geometry/SpatialReference.js";import{isGraphic as $}from"../support/graphicInstanceUtils.js";import{isBoolean as H,isArray as J,isString as Q,isNumber as X}from"../support/guards.js";const ee=()=>K.getLogger("esri.arcade.arcadeRuntime"),te=Symbol("uninitialized");function re(e){if(e===te)throw new h(null,"InvalidIdentifier",null)}function ne(e){return re(e),e}function oe(t,r){const n=e(r);if(null!==t.localScope){const e=t.localScope[n];if(void 0!==e)return{scope:t.localScope,id:n,var:e}}const o=t.globalScope[n];if(void 0!==o)return{scope:t.globalScope,id:n,var:o};throw new h(t,"InvalidIdentifier",r)}function se(t,r,n="InvalidIdentifier"){const o=e(r);if(null!==t.localScope){const e=t.localScope[o];if(void 0!==e)return re(e),e.value}const s=t.globalScope[o];if(void 0!==s)return re(s),s.value;throw new h(t,n,r)}const ie=function(){};ie.prototype=Object.freeze(Object.create(null));class ae extends g{constructor(e,t,r,n){super(),this.definition=e,this.context=t,this._params=r,this._locals=n}get debugName(){return null}createFunction(e){return(...t)=>{const r={spatialReference:this.context.spatialReference,console:this.context.console,services:this.context.services,timeZone:this.context.timeZone??null,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,abortSignal:this.context.abortSignal,localScope:new ie,depthCounter:{depth:e.depthCounter.depth+1},globalScope:this.context.globalScope,track:this.context.track};if(r.depthCounter.depth>64)throw new h(e,"MaximumCallDepth",null);return le(r,this.definition.body,this._params,this._locals,t,null)}}call(e,t){return fe(e,t,(r,n,o)=>{const s={spatialReference:e.spatialReference,services:e.services,globalScope:e.globalScope,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,timeZone:e.timeZone??null,console:e.console,lrucache:e.lrucache,interceptor:e.interceptor,abortSignal:e.abortSignal,localScope:new ie,track:e.track};if(s.depthCounter.depth>64)throw new h(e,"MaximumCallDepth",t);return le(s,this.definition.body,this._params,this._locals,o,t)})}marshalledCall(e,t,r,n){return n(e,t,(o,s,i)=>{const a={spatialReference:e.spatialReference,globalScope:r.globalScope,services:e.services,depthCounter:{depth:e.depthCounter.depth+1},libraryResolver:e.libraryResolver,exports:e.exports,console:e.console,timeZone:e.timeZone??null,lrucache:e.lrucache,interceptor:e.interceptor,abortSignal:e.abortSignal,localScope:new ie,track:e.track};return i=i.map(t=>!R(t)||t instanceof b?t:y(t,e,n)),y(le(a,this.definition.body,this._params,this._locals,i,t),r,n)})}}function le(e,t,r,n,o,s){try{if(r.length!==o.length)throw new h(e,"WrongNumberOfParameters",s);if(null!=e.localScope){for(let t=0;t<r.length;t++)e.localScope[r[t]]={value:o[t]};for(const t of n)e.localScope[t]=te}const i=he(e,t);if(i instanceof v)return i.value;if(i===F)throw new h(e,"UnexpectedToken",s);if(i===j)throw new h(e,"UnexpectedToken",s);return i instanceof x?i.value:i}catch(i){throw i}}class ce extends r{constructor(e){super(),this.moduleGlobalContext=e}global(t){const r=e(t);if(!this.moduleGlobalContext.exports.has(r))throw new h(null,"ModuleExportNotFound",null);const n=this.moduleGlobalContext.globalScope[r];if(re(n),R(n.value)&&!(n.value instanceof b)){const e=new b;return e.fn=n.value,e.parameterEvaluator=fe,e.context=this.moduleGlobalContext,this.moduleGlobalContext.globalScope[r]={value:e},e}return n.value}setGlobal(t,r){if(R(r))throw new h(null,"AssignModuleFunction",null);const n=e(t);if(!this.moduleGlobalContext.exports.has(n))throw new h(null,"ModuleExportNotFound",null);this.moduleGlobalContext.globalScope[n]={value:r}}hasGlobal(t){return this.moduleGlobalContext.exports.has(e(t))}static load(e,r){const{globals:s,exports:i}=o(r),a=new Xe;for(const t of s)t in a||(a[t]=te);const l=e.spatialReference??Y.WebMercator,c={lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??tt,abortSignal:t,timeZone:e.timeZone??null,spatialReference:l,track:e.track,depthCounter:{depth:1},libraryResolver:new n(e.libraryResolver._moduleSingletons,r.loadedModules),exports:i,localScope:null,globalScope:a};return je(c,r),new ce(c)}}function ue(e,t){const r=[];for(let n=0;n<t.arguments.length;n++)r.push(pe(e,t.arguments[n]));return r}function fe(e,t,r){try{return!0===t.preparsed?r(e,null,t.arguments):r(e,t,ue(e,t))}catch(n){throw n}}function pe(e,t){try{switch(t.type){case"AssignmentExpression":return Se(e,t);case"UpdateExpression":return ve(e,t);case"TemplateLiteral":return qe(e,t);case"Identifier":return We(e,t);case"MemberExpression":return Ee(e,t);case"Literal":return t.value;case"CallExpression":return Pe(e,t);case"UnaryExpression":return ze(e,t);case"BinaryExpression":return Le(e,t);case"LogicalExpression":return _e(e,t);case"ArrayExpression":return De(e,t);case"ObjectExpression":return de(e,t);case"MemberAccessChainExpression":return Ge(e,t);case"SafeMemberExpression":throw ee().error("SafeMemberExpression outside of MemberAccessChainExpression"),new h(null,"Unrecognized",t);default:throw new h(e,"Unrecognized",t)}}catch(r){throw d(e,t,r)}}function he(e,t){switch(t.type){case"EmptyStatement":return k;case"VariableDeclaration":return Ce(e,t);case"ImportDeclaration":return Oe(e,t);case"ExportNamedDeclaration":return Ae(e,t);case"BlockStatement":return je(e,t);case"FunctionDeclaration":return Ie(e,t);case"ReturnStatement":return ke(e,t);case"IfStatement":return Fe(e,t);case"ExpressionStatement":return Re(e,t);case"BreakStatement":return F;case"ContinueStatement":return j;case"ForStatement":return ge(e,t);case"ForInStatement":return we(e,t);case"ForOfStatement":return me(e,t);case"WhileStatement":return be(e,t);default:throw new h(e,"Unrecognized",t)}}function de(e,t){const r=Object.create(null),n=new Map;for(let s=0;s<t.properties.length;s++){const o=t.properties[s],i="Identifier"===o.key.type?o.key.name:pe(e,o.key),a=pe(e,o.value);if(R(a))throw new h(e,"NoFunctionInDictionary",t);if(!1===Q(i))throw new h(e,"KeyMustBeString",t);let l=i.toString();const c=l.toLowerCase();n.has(c)?l=n.get(c):n.set(c,l),r[l]=a===k?null:a}const o=new p(r);return o.immutable=!1,o}function we(e,t){const r=pe(e,t.right);"VariableDeclaration"===t.left.type&&Ce(e,t.left);const n=oe(e,"VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);if(J(r)||Q(r)){const o=r.length;for(let r=0;r<o;r++){n.scope[n.id]={value:r};const o=he(e,t.body);if(o===F)break;if(o instanceof v)return o}return k}if(O(r)){for(let o=0;o<r.length();o++){n.scope[n.id]={value:o};const r=he(e,t.body);if(r===F)break;if(r instanceof v)return r}return k}if(r instanceof p||A(r)){const o=r.keys();for(let r=0;r<o.length;r++){n.scope[n.id]={value:o[r]};const s=he(e,t.body);if(s===F)break;if(s instanceof v)return s}return k}if(C(r)){for(const o of l(r)){n.scope[n.id]={value:o};const r=he(e,t.body);if(r===F)break;if(r instanceof v)return r}return k}return k}function me(e,t){const r=pe(e,t.right);"VariableDeclaration"===t.left.type&&he(e,t.left);const n=oe(e,"VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);if(J(r)||Q(r)){const o=r.length;for(let s=0;s<o;s++){if(s>=r.length)throw new h(e,"OutOfBounds",t);n.scope[n.id]={value:r[s]};const o=he(e,t.body);if(o===F)break;if(o instanceof v)return o}return k}if(O(r)){for(let o=0;o<r.length();o++){n.scope[n.id]={value:r.get(o)};const s=he(e,t.body);if(s===F)break;if(s instanceof v)return s}return k}if(r instanceof p||A(r)){for(const o of r.keys()){const s=r.field(o);n.scope[n.id]={value:p.containerEntry(o,s)};const i=he(e,t.body);if(i===F)break;if(i instanceof v)return i}return k}if(C(r)){for(const o of l(r)){const s=c(r,o,e,t);n.scope[n.id]={value:p.containerEntry(o,s)};const i=he(e,t.body);if(i===F)break;if(i instanceof v)return i}return k}return k}function ge(e,t){null!==t.init&&("VariableDeclaration"===t.init.type?he(e,t.init):pe(e,t.init));const r={testResult:!0,lastAction:k};do{ye(e,t,r)}while(!0===r.testResult);return r.lastAction instanceof v?r.lastAction:k}function be(e,t){const r={testResult:!0,lastAction:k};if(r.testResult=pe(e,t.test),!1===r.testResult)return k;if(!0!==r.testResult)throw new h(e,"BooleanConditionRequired",t);for(;!0===r.testResult&&(r.lastAction=he(e,t.body),r.lastAction!==F)&&!(r.lastAction instanceof v);)if(r.testResult=pe(e,t.test),!0!==r.testResult&&!1!==r.testResult)throw new h(e,"BooleanConditionRequired",t);return r.lastAction instanceof v?r.lastAction:k}function ye(e,t,r){if(null!==t.test){if(r.testResult=pe(e,t.test),!1===r.testResult)return;if(!0!==r.testResult)throw new h(e,"BooleanConditionRequired",t)}r.lastAction=he(e,t.body),r.lastAction!==F?r.lastAction instanceof v?r.testResult=!1:null!==t.update&&pe(e,t.update):r.testResult=!1}function ve(e,t){if("CallExpression"===t.argument.type)throw new h(e,"NeverReach",t);let r;if("MemberExpression"===t.argument.type){const n=pe(e,t.argument.object);let o;if(!0===t.argument.computed)o=pe(e,t.argument.property);else{if("Identifier"!==t.argument.property.type)throw new h(e,"Unrecognized",t);o=t.argument.property.name}if(J(n)){if(!X(o))throw new h(e,"ArrayAccessMustBeNumber",t);if(o<0&&(o=n.length+o),o<0||o>=n.length)throw new h(e,"OutOfBounds",t);r=E(n[o]),n[o]="++"===t.operator?r+1:r-1}else if(n instanceof p){if(!1===Q(o))throw new h(e,"KeyAccessorMustBeString",t);if(!0!==n.hasField(o))throw new h(e,"FieldNotFound",t);r=E(n.field(o)),n.setField(o,"++"===t.operator?r+1:r-1)}else if(G(n)){if(!1===Q(o))throw new h(e,"KeyAccessorMustBeString",t);if(!0!==n.hasField(o))throw new h(e,"FieldNotFound",t);r=E(n.field(o)),n.setField(o,"++"===t.operator?r+1:r-1)}else{if(O(n))throw new h(e,"Immutable",t);if(!(n instanceof ce))throw new h(e,"InvalidParameter",t);if(!1===Q(o))throw new h(e,"ModuleAccessorMustBeString",t);if(!0!==n.hasGlobal(o))throw new h(e,"ModuleExportNotFound",t);r=E(n.global(o)),n.setGlobal(o,"++"===t.operator?r+1:r-1)}return!1===t.prefix?r:"++"===t.operator?r+1:r-1}const n=oe(e,t.argument);r=E(ne(n.var).value);const o="++"===t.operator?r+1:r-1;return n.scope[n.id]={value:o},!1===t.prefix?r:"++"===t.operator?r+1:r-1}function xe(e,t,r,n,o){switch(t){case"=":return e===k?null:e;case"/=":return E(r)/E(e);case"*=":return E(r)*E(e);case"-=":return E(r)-E(e);case"+=":return Q(r)||Q(e)?N(r)+N(e):E(r)+E(e);case"%=":return E(r)%E(e);default:throw new h(o,"UnsupportedOperator",n)}}function Se(e,t){if("MemberExpression"===t.left.type){const r=pe(e,t.left.object);let n;if(!0===t.left.computed)n=pe(e,t.left.property);else{if("Identifier"!==t.left.property.type)throw new h(e,"InvalidIdentifier",t);n=t.left.property.name}const o=pe(e,t.right);if(J(r)){if(!X(n))throw new h(e,"ArrayAccessMustBeNumber",t);if(n<0&&(n=r.length+n),n<0||n>r.length)throw new h(e,"OutOfBounds",t);if(n===r.length){if("="!==t.operator)throw new h(e,"OutOfBounds",t);r[n]=xe(o,t.operator,r[n],t,e)}else r[n]=xe(o,t.operator,r[n],t,e)}else if(r instanceof p){if(!1===Q(n))throw new h(e,"KeyAccessorMustBeString",t);if(!0===r.hasField(n))r.setField(n,xe(o,t.operator,r.field(n),t,e));else{if("="!==t.operator)throw new h(e,"FieldNotFound",t,{key:n});r.setField(n,xe(o,t.operator,null,t,e))}}else if(G(r)){if(!1===Q(n))throw new h(e,"KeyAccessorMustBeString",t);if(!0===r.hasField(n))r.setField(n,xe(o,t.operator,r.field(n),t,e));else{if("="!==t.operator)throw new h(e,"FieldNotFound",t,{key:n});r.setField(n,xe(o,t.operator,null,t,e))}}else{if(O(r))throw new h(e,"Immutable",t);if(!(r instanceof ce))throw new h(e,"InvalidIdentifier",t);if(!1===Q(n))throw new h(e,"ModuleAccessorMustBeString",t);if(!0!==r.hasGlobal(n))throw new h(e,"ModuleExportNotFound",t);r.setGlobal(n,xe(o,t.operator,r.global(n),t,e))}return k}const r=oe(e,t.left),n=pe(e,t.right);return r.scope[r.id]={value:xe(n,t.operator,"="!==t.operator?ne(r.var).value:null,t,e)},k}function Re(e,t){const r=pe(e,t.expression);return r===k?k:new x(r)}function Fe(e,t){const r=pe(e,t.test);if(!0===r)return he(e,t.consequent);if(!1===r)return null!==t.alternate?he(e,t.alternate):k;throw new h(e,"BooleanConditionRequired",t)}function je(e,t){let r=k;for(let n=0;n<t.body.length;n++)if(r=he(e,t.body[n]),r instanceof v||r===F||r===j)return r;return r}function ke(e,t){if(null===t.argument)return new v(k);const r=pe(e,t.argument);return new v(r)}function Ie(t,r){if(null!=t.localScope)throw ee().error("Function declarations are only valid in global scope."),new h(t,"NeverReach",r);const n=e(r.id);if(!(n in t.globalScope))throw ee().error(`Function "${n}" not declared.`),new h(t,"NeverReach",r);const o=s(r),i=r.params.map(t=>e(t)),a=Array.from(o).filter(e=>!i.includes(e));return t.globalScope[n]={value:new ae(r,t,i,a)},k}function Oe(e,t){const r=oe(e,t.specifiers[0].local),n=e.libraryResolver;if(null==n)throw ee().error("Internal error: module loader not initialized"),new h(e,"NeverReach",t);const o=n.loadLibrary(r.id);let s;return n._moduleSingletons?.has(o.uri)?s=n._moduleSingletons.get(o.uri):(s=ce.load(e,o.syntax),n._moduleSingletons?.set(o.uri,s)),r.scope[r.id]={value:s},k}function Ae(e,t){return he(e,t.declaration),k}function Ce(e,t){for(let r=0;r<t.declarations.length;r++)Me(e,t.declarations[r]);return k}function Me(e,t){let r=null===t.init?null:pe(e,t.init);if(r===k&&(r=null),"Identifier"!==t.id.type)throw new h(e,"InvalidIdentifier",t);const n=oe(e,t.id);n.scope[n.id]={value:r}}function Ee(e,t){return Ne(e,pe(e,t.object),t)}function Ne(e,t,r){const n=r.computed?pe(e,r.property):r.property.name;return f(t,n)}function Be(e,t,r){for(const n of r)switch(n.type){case"MemberExpression":t=Ne(e,t,n);break;case"CallExpression":t=Ve(e,t,n);break;default:throw new h(null,"Unrecognized",n)}return t}function Ue(e,t,r){const n=r.computed?pe(e,r.property):r.property.name;return u(t,n)}function Ge(e,t){const r=i(t);let n=pe(e,r.root);for(const o of r.sections){const t=Ue(e,n,o.checked);if(null==t)return null;n=Be(e,t,o.unchecked)}return n}function ze(e,t){try{const r=pe(e,t.argument);if(H(r)){if("!"===t.operator)return!r;if("-"===t.operator)return-1*E(r);if("+"===t.operator)return 1*E(r);if("~"===t.operator)return~E(r);throw new h(e,"UnsupportUnaryOperator",t)}if("~"===t.operator)return~E(r);if("-"===t.operator)return-1*E(r);if("+"===t.operator)return 1*E(r);throw new h(e,"UnsupportUnaryOperator",t)}catch(r){throw r}}function De(e,t){try{const r=[];for(let n=0;n<t.elements.length;n++){const o=pe(e,t.elements[n]);if(R(o))throw new h(e,"NoFunctionInArray",t);o===k?r.push(null):r.push(o)}return r}catch(r){throw r}}function Le(e,t){try{const r=pe(e,t.left),n=pe(e,t.right);switch(t.operator){case"|":case"<<":case">>":case">>>":case"^":case"&":return U(E(r),E(n),t.operator);case"==":return M(r,n);case"!=":return!M(r,n);case"<":case">":case"<=":case">=":return B(r,n,t.operator);case"+":return Q(r)||Q(n)?N(r)+N(n):E(r)+E(n);case"-":return E(r)-E(n);case"*":return E(r)*E(n);case"/":return E(r)/E(n);case"%":return E(r)%E(n);default:throw t.operator,new h(e,"UnsupportedOperator",t)}}catch(r){throw r}}function _e(e,t){try{const r=pe(e,t.left);if(H(r))switch(t.operator){case"||":{if(!0===r)return r;const n=pe(e,t.right);if(H(n))return n;throw new h(e,"LogicExpressionOrAnd",t)}case"&&":{if(!1===r)return r;const n=pe(e,t.right);if(H(n))return n;throw new h(e,"LogicExpressionOrAnd",t)}default:throw t.operator,new h(e,"LogicExpressionOrAnd",t)}throw new h(e,"LogicalExpressionOnlyBoolean",t)}catch(r){throw r}}function Ze(e,t,r){if(R(e))throw new h(t,"NoFunctionInTemplateLiteral",r);return e}function qe(e,t){let r="",n=0;for(const o of t.quasis)if(r+=o.value?o.value.cooked:"",!1===o.tail){r+=t.expressions[n]?N(Ze(pe(e,t.expressions[n]),e,t)):"",n++}return r}function We(e,t){return se(e,t)}function Pe(e,t){return Ve(e,"Identifier"===t.callee.type?se(e,t.callee,"FunctionNotFound"):pe(e,t.callee),t)}function Ve(e,t,r){if(R(t))return t.call(e,r);throw new h(e,"CallNonFunction",r)}function Te(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;I(null===r?[]:r,3,3,e,t);const n=pe(e,r[0]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",t);return pe(e,!0===n?r[1]:r[2])}catch(r){throw r}}function Ke(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;I(null===r?[]:r,2,3,e,t);const n=pe(e,r[0]);if(3===r.length){const t=pe(e,r[1]),o=a(n,t);return null!=o&&""!==o?o:pe(e,r[2])}return null===n||""===n||void 0===n?pe(e,r[1]):n}catch(r){throw r}}function Ye(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;if(r.length<2)throw new h(e,"WrongNumberOfParameters",t);if(2===r.length)return pe(e,r[1]);{if((r.length-1)%2==0)throw new h(e,"WrongNumberOfParameters",t);const n=pe(e,r[0]);return $e(e,t,1,n)}}catch(r){throw r}}function $e(e,t,r,n){try{const o=t.arguments,s=pe(e,o[r]);if(M(s,n))return pe(e,o[r+1]);{const s=o.length-r;return 1===s?pe(e,o[r]):2===s?null:3===s?pe(e,o[r+2]):$e(e,t,r+2,n)}}catch(o){throw o}}function He(e,t){try{if(!0===t.preparsed)throw new h(e,"NeverReach",t);const r=t.arguments;if(r.length<3)throw new h(e,"WrongNumberOfParameters",t);if(r.length%2==0)throw new h(e,"WrongNumberOfParameters",t);const n=pe(e,r[0]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",r[0]);return Je(e,t,0,n)}catch(r){throw r}}function Je(e,t,r,n){try{const o=t.arguments;if(!0===n)return pe(e,o[r+1]);if(3===o.length-r)return pe(e,o[r+2]);{const n=pe(e,o[r+2]);if(!1===H(n))throw new h(e,"BooleanConditionRequired",o[r+2]);return Je(e,t,r+2,n)}}catch(o){throw o}}function Qe(){const e=Object.create(null);L(e,fe),V(e,fe),_(e,fe,We),W(e,fe),Z(e,fe),P(e,fe),q(e,fe),T(e,fe),e.iif=Te,e.defaultvalue=Ke,e.decode=Ye,e.when=He;const t=function(){this.textformatting={value:p.textFormatting()}};t.prototype=Object.create(null),t.prototype.infinity=Object.freeze({value:Number.POSITIVE_INFINITY}),t.prototype.pi=Object.freeze({value:Math.PI});for(const[r,n]of Object.entries(e))t.prototype[r]=Object.freeze({value:new m(n)});return t}const Xe=Qe();function et(e){const t={mode:"sync",compiled:!1,functions:Object.create(null),signatures:[],standardFunction:fe,evaluateIdentifier:We};for(let r=0;r<e.length;r++)e[r].registerFunctions(t);for(const[r,n]of Object.entries(t.functions))Xe.prototype[r]=Object.freeze({value:new m(n)});for(let r=0;r<t.signatures.length;r++)z(t.signatures[r],"sync")}function tt(e){console.log(e)}function rt(r,s){const i=new Set(Object.keys(s?.vars||{}).map(t=>e(t))),a=new Set(Object.keys(s?.customfunctions||{}).map(t=>e(t))),{globals:l,exports:c}=o(r);return e=>{const o=e.spatialReference??Y.WebMercator;let s=null;r.usesModules&&(s=new n(new Map,r.loadedModules));const u=new Xe;for(const t of a)null!=e.customfunctions&&t in e.customfunctions?u[t]={value:new m(e.customfunctions[t])}:u[t]=te;for(const t of i){if(null==e.vars||!(t in e.vars)){t in u||(u[t]=te);continue}const r=e.vars[t]??null;$(r)?u[t]={value:w.createFromGraphic(r,e.timeZone??null)}:u[t]={value:r}}for(const t of l)t in u||(u[t]=te);const f={lrucache:e.lrucache,interceptor:e.interceptor,services:e.services,console:e.console??tt,abortSignal:t,timeZone:e.timeZone??null,spatialReference:o,track:e.track,depthCounter:{depth:1},libraryResolver:s,exports:c,localScope:null,globalScope:u},p=je(f,r);if(p instanceof v||p instanceof x){const e=p.value;if(S(e))return null;if(R(e))throw new h(f,"IllegalResult",null);return e}if(S(p))return null;if(p===F)throw new h(f,"IllegalResult",null);if(p===j)throw new h(f,"IllegalResult",null);throw new h(f,"NeverReach",null)}}function nt(e,t){return rt(e,t)(t)}et([D]);export{nt as executeScript,et as extend,rt as prepareScript};
|
package/arcade/compilerUtils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{toSymbolId as e}from"./arcadeEnvironment.js";import{ArcadeCompilationError as t}from"./executionError.js";import r from"../core/Logger.js";import{isSubsetOf as
|
|
2
|
+
import{toSymbolId as e}from"./arcadeEnvironment.js";import{ArcadeCompilationError as t}from"./executionError.js";import r from"../core/Logger.js";import{isSubsetOf as n,difference as a}from"../core/SetUtils.js";const o=()=>r.getLogger("esri.arcade.compilerUtils");function s(t,r,n){switch(t.type){case"VariableDeclaration":for(const n of t.declarations)r.add(e(n.id));return;case"BlockStatement":for(const e of t.body)s(e,r,n);return;case"ExportNamedDeclaration":{const e=new Set;s(t.declaration,e,n);for(const t of e)r.add(t),n.add(t);return}case"ForInStatement":case"ForOfStatement":return"VariableDeclaration"===t.left.type&&s(t.left,r,n),void s(t.body,r,n);case"ForStatement":return"VariableDeclaration"===t.init?.type&&s(t.init,r,n),void s(t.body,r,n);case"FunctionDeclaration":return void r.add(e(t.id));case"IfStatement":return s(t.consequent,r,n),void(t.alternate&&s(t.alternate,r,n));case"ImportDeclaration":for(const n of t.specifiers)r.add(e(n.local));return;case"WhileStatement":return void s(t.body,r,n);case"BreakStatement":case"ContinueStatement":case"EmptyStatement":case"ExpressionStatement":case"ReturnStatement":return}}function c(e){const r=new Set,c=new Set;for(const t of e.body)s(t,r,c);if(!n(c,r))throw o().error(`Internal error: exported undeclared symbols {${Array.from(a(c,r)).join(", ")}}`),new t(null,"NeverReach",null);return{globals:r,exports:c}}function i(e){const r=new Set,n=new Set;if(s(e.body,r,n),n.size>0)throw o().error(`Internal error: cannot export locals {${Array.from(n.values()).join(", ")}}`),new t(null,"NeverReach",null);return r}function l(e){const t=[];let r=[],n=e.expression;for(;;)switch(n.type){case"MemberExpression":r.push(n),n=n.object;break;case"CallExpression":r.push(n),n=n.callee;break;case"SafeMemberExpression":t.push({checked:n,unchecked:r.reverse()}),r=[],n=n.object;break;default:return{root:r.at(0)??n,sections:t.reverse()}}}function u(e,t){switch(e.type){case"VariableDeclaration":for(const r of e.declarations)if(null!=r.init&&u(r.init,t)||t(r))return!0;return!1;case"BlockStatement":for(const r of e.body)if(u(r,t))return!0;return!1;case"ExportNamedDeclaration":return u(e.declaration,t);case"ForInStatement":case"ForOfStatement":if(u(e.right,t))return!0;if("VariableDeclaration"===e.left.type){if(u(e.left,t))return!0}else e.left.type;return u(e.body,t);case"ForStatement":return!(null==e.init||!u(e.init,t))||(!(null==e.test||!u(e.test,t))||(!!u(e.body,t)||!(null==e.update||!u(e.update,t))));case"FunctionDeclaration":return!!t(e)||u(e.body,t);case"IfStatement":return!!u(e.test,t)||(!!u(e.consequent,t)||!(null==e.alternate||!u(e.alternate,t)));case"WhileStatement":return u(e.test,t)||u(e.body,t);case"ImportDeclaration":case"BreakStatement":case"ContinueStatement":case"Identifier":case"Literal":return t(e);case"EmptyStatement":default:return!1;case"ReturnStatement":return null!=e.argument&&u(e.argument,t)||t(e);case"ExpressionStatement":case"MemberAccessChainExpression":return u(e.expression,t);case"UpdateExpression":return u(e.argument,t)||t(e);case"AssignmentExpression":if("MemberExpression"===e.left.type){if(u(e.left.object,t))return!0;if(e.left.computed&&u(e.left.property,t))return!0}else e.left.type;return t(e.right)||u(e.right,t);case"TemplateLiteral":for(const r of e.expressions)if(u(r,t))return!0;return!1;case"MemberExpression":case"SafeMemberExpression":return u(e.object,t)||e.computed&&u(e.property,t);case"CallExpression":return u(e.callee,t)||e.arguments.some(e=>u(e,t))||t(e);case"UnaryExpression":return u(e.argument,t);case"BinaryExpression":case"LogicalExpression":return u(e.left,t)||u(e.right,t);case"ArrayExpression":return t(e)||e.elements.some(e=>u(e,t));case"ObjectExpression":return t(e)||e.properties.some(e=>u(e.value,t))}}function f(e,t){const r=new Map(e.map(e=>[e.line,e])),n=new Map;for(const a of t.body)u(a,e=>{const t=e.loc.start.line;if(r.has(t)){const a=r.get(t);return r.delete(t),n.set(e,a),r.size<=0}return!1});return n}export{c as collectDeclaredGlobalNames,i as collectDeclaredLocalNames,l as flattenAccessChain,f as resolveBreakpoints};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export interface Breakpoint {
|
|
3
|
+
/** @internal */
|
|
4
|
+
line: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** @internal */
|
|
8
|
+
export interface ProgramState {
|
|
9
|
+
/**
|
|
10
|
+
* Uninitialized variables are represented as `null`. A variable with a `null` value will have that value represented
|
|
11
|
+
* as a `DebugValue` with `value: null`.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
globals: Map<string, DebugValue | null>;
|
|
16
|
+
/**
|
|
17
|
+
* Only defined when the program is paused in a function. Otherwise there is no local state.
|
|
18
|
+
*
|
|
19
|
+
* Uninitialized variables are represented as `null`. A variable with a `null` value will have that value represented
|
|
20
|
+
* as a `DebugValue` with `value: null`.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
locals?: Map<string, DebugValue | null> | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** @internal */
|
|
28
|
+
export interface Debugger {
|
|
29
|
+
/**
|
|
30
|
+
* @param at - the breakpoint that the script is paused on.
|
|
31
|
+
* @param state - current program state.
|
|
32
|
+
* @returns a promise that, when resolved, will allow the script to resume.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
pause(at: Breakpoint, state: ProgramState): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export interface BaseDebugValue {
|
|
40
|
+
/**
|
|
41
|
+
* `TypeOf()` type name
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
arcadeType: string;
|
|
46
|
+
/**
|
|
47
|
+
* `true` if mutable, `false` if immutable, `undefined` if not relevant for the type.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
mutable?: boolean | null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export interface MinimalDebugValue extends BaseDebugValue {
|
|
56
|
+
/** @internal */
|
|
57
|
+
type: "minimal";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export interface PrimitiveDebugValue extends BaseDebugValue {
|
|
62
|
+
/** @internal */
|
|
63
|
+
type: "primitive";
|
|
64
|
+
/** @internal */
|
|
65
|
+
value: string | number | boolean | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** @internal */
|
|
69
|
+
export interface SimpleDebugValue extends BaseDebugValue {
|
|
70
|
+
/** @internal */
|
|
71
|
+
type: "simple";
|
|
72
|
+
/** @internal */
|
|
73
|
+
render(): string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
export interface SequenceContainerDebugValue extends BaseDebugValue {
|
|
78
|
+
/** @internal */
|
|
79
|
+
type: "sequence-container";
|
|
80
|
+
/** @internal */
|
|
81
|
+
length: number;
|
|
82
|
+
/** @internal */
|
|
83
|
+
expand(): DebugValue[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export interface AssociativeContainerDebugValue extends BaseDebugValue {
|
|
88
|
+
/** @internal */
|
|
89
|
+
type: "associative-container";
|
|
90
|
+
/** @internal */
|
|
91
|
+
expand(): Map<string, DebugValue>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export interface FeatureSetDebugValue extends BaseDebugValue {
|
|
96
|
+
/** @internal */
|
|
97
|
+
type: "feature-set";
|
|
98
|
+
/**
|
|
99
|
+
* Wrapped `Schema()`.
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
schema(): Promise<DebugValue>;
|
|
104
|
+
/**
|
|
105
|
+
* Query an arbitrary batch of the features in this feature set. The size and order is unspecified but for example an
|
|
106
|
+
* implementation may fetch the first 100 features from a service. The result features should include all available
|
|
107
|
+
* fields and list them in display order in the `fields` property. The returned `features` are wrapped arcade features
|
|
108
|
+
* which each include values for all returned `fields` in their
|
|
109
|
+
* [expand()](https://developers.arcgis.com/javascript/latest/references/core/arcade/debug/#AssociativeContainerDebugValue-expand) result.
|
|
110
|
+
*
|
|
111
|
+
* @param abortSignal
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
querySample?(abortSignal?: AbortSignal): Promise<{
|
|
115
|
+
fields: string[];
|
|
116
|
+
features: AssociativeContainerDebugValue[];
|
|
117
|
+
}>;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** @internal */
|
|
121
|
+
export interface FeatureSetCollectionItem {
|
|
122
|
+
/** @internal */
|
|
123
|
+
id: string;
|
|
124
|
+
/** @internal */
|
|
125
|
+
name?: string | null;
|
|
126
|
+
/** @internal */
|
|
127
|
+
featureSet: FeatureSetDebugValue;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** @internal */
|
|
131
|
+
export interface FeatureSetCollectionDebugValue extends BaseDebugValue {
|
|
132
|
+
/** @internal */
|
|
133
|
+
type: "feature-set-collection";
|
|
134
|
+
/** @internal */
|
|
135
|
+
load(): Promise<FeatureSetCollectionItem[]>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @internal */
|
|
139
|
+
export type DebugValue = MinimalDebugValue | PrimitiveDebugValue | SimpleDebugValue | SequenceContainerDebugValue | AssociativeContainerDebugValue | FeatureSetDebugValue | FeatureSetCollectionDebugValue;
|
package/arcade/debug.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{neverAbortedSignal as e}from"./arcadeEnvironment.js";import{getGeometryKeys as a,getGeometryMember as t}from"./containerUtils.js";import n from"./Dictionary.js";import{ArcadeExecutionError as r}from"./executionError.js";import{q as i,e as o,g as c,f as u,i as p,j as l,n as s,a2 as m,a3 as y,h as d,k as f,_ as T,Z as v,m as g,l as h,o as w,M as b}from"../chunks/languageUtils.js";import{getLocale as j}from"../intl/locale.js";import{isNumber as F,isString as x,isBoolean as S,isArray as Z}from"../support/guards.js";const A=Object.freeze({type:"primitive",arcadeType:"",value:null}),k=Object.freeze({type:"minimal",arcadeType:"Unrecognized Type"}),q=Object.freeze({type:"minimal",arcadeType:"KnowledgeGraph"}),M=Object.freeze({type:"minimal",arcadeType:"Module"});function z(e){return{type:"simple",arcadeType:"Date",render:()=>e.toFormat(e.isUnknownTimeZone?"FF":"FF ZZZZZ",{locale:j()})}}function D(e){return{type:"simple",arcadeType:"Time",render:()=>e.toString()}}function O(e){return{type:"simple",arcadeType:"DateOnly",render:()=>e.toString()}}function N(e,a){return{type:"sequence-container",arcadeType:"Array",mutable:!0,length:e.length,expand:()=>e.map(e=>R(e,a))}}function U(e,a){return{type:"sequence-container",arcadeType:"Array",mutable:!1,length:e.length(),expand:()=>e.toArray().map(e=>R(e,a))}}function B(e,a,t){return{type:"associative-container",arcadeType:a,mutable:"Dictionary"===a?!e.immutable:void 0,expand(){const a=e.values().map(e=>R(e,t));return new Map(e.keys().map((e,t)=>[e,a[t]]))}}}function E(e,n){return{type:"associative-container",arcadeType:t(e,"type",null,null),expand(){const r=a(e);return new Map(r.map(a=>[a,R(t(e,a,null,null),n)]))}}}function G(e,a){return{type:"associative-container",arcadeType:"Feature",expand(){const t=e.keys(),n=new Map(t.map(t=>[t,R(e.field(t),a)])),r=e.geometry();return null!=r&&n.set("Geometry()",E(r,a)),n}}}function P(e,a,t){return{type:"associative-container",arcadeType:a,expand:()=>new Map(e.keys().map(a=>[a,R(e.field(a),t)]))}}function C(a,t){return{type:"feature-set",arcadeType:"FeatureSet",async schema(){await a.load();return R(n.convertJsonToArcade(a.schema(),t.defaultTimeZone,!0),t)},querySample:async n=>({fields:(await a.load()).fields.map(e=>e.name),features:(await a.iterator(n??e).nextBatchAsArcadeFeatures(100,t.defaultTimeZone)??[]).map(e=>G(e,t))})}}function I(e,a,t){let n;async function i(){if(null==n){const i=await e.featureSetById(t,!0,["*"]);if(null==i)throw new r(null,"NeverReach",null);n=C(i,a)}return n}return{type:"feature-set",arcadeType:"FeatureSet",schema:async()=>(await i()).schema(),querySample:async e=>(await i()).querySample(e)}}function J(e,a){return{type:"feature-set-collection",arcadeType:"FeatureSetCollection",load:async()=>(await e.listAll()).map(({id:t,name:n})=>({id:t,name:n,featureSet:I(e,a,t)}))}}function K(e){return null!=e.debugName?`ƒ ${e.debugName}(...)`:"ƒ <anonymous>(...)"}function R(e,a){return null==e||i(e)?A:F(e)?{type:"primitive",arcadeType:"Number",value:e}:x(e)?{type:"primitive",arcadeType:"String",value:e}:S(e)?{type:"primitive",arcadeType:"Boolean",value:e}:o(e)?z(e):c(e)?D(e):u(e)?O(e):p(e)?{type:"simple",arcadeType:"Function",render:(a.renderFunction??K).bind(null,e)}:Z(e)?N(e,a):l(e)?U(e,a):s(e)?B(e,"Dictionary",a):m(e)?B(e,"Portal",a):y(e)?B(e,"Attachment",a):d(e)?E(e,a):f(e)?G(e,a):T(e)?P(e,"Pixel",a):v(e)?P(e,"Voxel",a):g(e)?C(e,a):h(e)?J(e,a):w(e)?q:b(e)?M:k}export{K as renderFunctionDebugName,R as wrapDebugValue};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
class e{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection"
|
|
2
|
+
class e{constructor(){this.declaredRootClass="esri.arcade.featureSetCollection"}castToText(e=!1){return"object, FeatureSetCollection"}}export{e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../request.js";import t from"./featureSetCollection.js";import{m as a,a2 as r}from"../chunks/languageUtils.js";import n from"./featureset/actions/AttributeFilter.js";import l from"./featureset/sources/FeatureLayerDynamic.js";import s from"./featureset/sources/FeatureLayerMemory.js";import i from"./featureset/sources/FeatureLayerRelated.js";import o from"./featureset/support/cache.js";import{FeatureSetError as u}from"./featureset/support/errorsupport.js";import{isSupportedLayer as c,extractServiceUrl as d}from"./featureset/support/shared.js";import{isLoadable as p}from"../core/Loadable.js";import f from"../core/sql/WhereClause.js";import y from"../layers/FeatureLayer.js";import h from"../layers/Layer.js";import m from"../portal/PortalItem.js";function w(){null===o.applicationCache&&(o.applicationCache=new o)}async function I(e,t,a){if(o.applicationCache){const a=o.applicationCache.getLayerInfo(e);if(a){const r=await a;return new y({url:e,outFields:t,sourceJSON:r})}const n=new y({url:e,outFields:t}),l=(async()=>(await n.load(),n.sourceJSON))();if(o.applicationCache){o.applicationCache.setLayerInfo(e,l);try{return await l,n}catch(r){throw o.applicationCache.clearLayerInfo(e),r}}return await l,n}if(null!=a){const r=a.getCachedLayerMetadata(e);if(r){const a=await r;return new y({url:e,outFields:t,sourceJSON:a})}const l=new y({url:e,outFields:t}),s=(async()=>(await l.load(),l.sourceJSON))();a.setCachedLayerMetadata(e,s);try{return await s,l}catch(n){throw a.removeCachedLayerMetadata(e,s),n}}return new y({url:e,outFields:t})}async function L(e,t,a,r,n,l=null){return S(await I(e,["*"],n),t,a,r,n,l)}function S(e,t=null,a=null,r=!0,i=null,o=null){switch(e.type){case"catalog-footprint":return S(e.parent,t,a,r,i,o);case"subtype-sublayer":{const l=S(e.parent,t,a,r,i,o);return new n({parentfeatureset:l,whereclause:f.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:l.dateFieldsTimeZoneDefaultUTC})})}case"csv":case"geojson":case"knowledge-graph-sublayer":case"wfs":return new s({layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:i,interceptor:o});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const n={layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:i,interceptor:o};return!e.url&&e.source?new s(n):new l(n)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function _(t){if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(t);if(null!==e)return e}const a=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});return a.data?a.data:null})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(t,a);try{return await a}catch(r){throw o.applicationCache.clearLayerInfo(t),r}}return a}async function C(t,a){const r="QUERYDATAELEMTS:"+a.toString()+":"+t;if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(r);if(null!==e)return e}const n=(async()=>{const r=await e(t+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([a.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new u("DataElementsNotFound")})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(r,n);try{return await n}catch(l){throw o.applicationCache.clearLayerInfo(r),l}}return n}async function k(t,a){if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(t);if(null!==e)return e}if(null!=a){const e=a.getCachedServiceMetadata(t);if(null!=e)return e}const r=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"},authMode:"no-prompt"});if(a.data){const e=a.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(t,r);try{return await r}catch(n){throw o.applicationCache.clearLayerInfo(t),n}}if(null!=a){a.setCachedServiceMetadata(t,r);try{return await r}catch(l){throw a.removeCachedServiceMetadata(t,r),l}}return r}async function g(e,t,a){const r={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},l=await k(e,null);if(r.metadata=l,void 0!==l.controllerDatasetLayers?.utilityNetworkLayerId&&null!==l.controllerDatasetLayers.utilityNetworkLayerId){if(l.layers)for(const e of l.layers)r.layerNameLkp[e.id]=e.name;if(l.tables)for(const e of l.tables)r.layerNameLkp[e.id]=e.name;const s=l.controllerDatasetLayers.utilityNetworkLayerId;r.networkId=s;const i=await C(e,s);if(i){r.queryelem=i,r.queryelem?.dataElement&&void 0!==r.queryelem.dataElement.schemaGeneration&&(r.unVersion=r.queryelem.dataElement.schemaGeneration),r.lkp={},r.queryelem.dataElement.domainNetworks||(r.queryelem.dataElement.domainNetworks=[]);for(const e of r.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:r.layerNameLkp[t.layerId]??null};r.layerIdLookup.set(e.layerId,e),r.sourceIdLookup.set(e.sourceId,e),e.className&&(r.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:r.layerNameLkp[t.layerId]??null};r.layerIdLookup.set(e.layerId,e),r.sourceIdLookup.set(e.sourceId,e),e.className&&(r.lkp[e.className]=e)}}if(r.queryelem.dataElement.terminalConfigurations)for(const e of r.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)r.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const l=await _(e+"/"+s);if(void 0!==l.systemLayers?.associationsTableId&&null!==l.systemLayers.associationsTableId){let s=null;if(a&&r.unVersion<8){const a=[];r.unVersion>=4&&(a.push("STATUS"),a.push("PERCENTALONG")),s=await L(e+"/"+l.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...a],!1,null,null),await s.load(),r.unVersion>=4&&(s=new n({parentfeatureset:s,whereclause:f.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",{fieldsIndex:s.getFieldsIndex(),timeZone:s.dateFieldsTimeZoneDefaultUTC})}),await s.load())}return{lkp:r.lkp,associations:s,unVersion:r.unVersion,terminals:r.terminals,layerIdLookup:r.layerIdLookup,sourceIdLookup:r.sourceIdLookup}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function F(e,t,a,r=null,n=null,l=!0,s=null,o=null){let u=e.serviceUrl();if(!u)return null;u=u.endsWith("/")?u+t.relatedTableId.toString():u+"/"+t.relatedTableId.toString();const c=await L(u,r,n,l,s,o);return new i({layer:e,relatedLayer:c,relationship:t,objectId:a,spatialReference:r,outFields:n,includeGeometry:l,lrucache:s,interceptor:o})}class N extends t{constructor(e,t=null,a=null,r=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=a,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,a=null){const r=S(e,this._overrideSpatialReference,null===a?["*"]:a,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async featureSetByName(e,t=!0,a=null){if(p(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,a);null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let l=0;l<this._instantLayers.length;l++){const a=this._instantLayers[l];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[l].featureset}const n=this._map.allLayers.find(t=>c(t)&&t.title===e);if(null!=n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.allTables){const r=this._map.allTables.find(t=>c(t)&&t.title===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){if(p(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,a);null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let l=0;l<this._instantLayers.length;l++){const a=this._instantLayers[l];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[l].featureset}const n=this._map.allLayers.find(t=>c(t)&&t.id===e);if(n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.allTables){const r=this._map.allTables.find(t=>c(t)&&t.id===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,a)}return null}}class T extends t{constructor(e,t=null,a=null,r=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=a,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,a=null){const r=S(e,this._overrideSpatialReference,null===a?["*"]:a,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async _loadMetaData(){const e=await k(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new T(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async featureSetByName(e,t=!0,a=null){null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let l=null;for(const s of n.layers??[])s.name===e&&(l=s);if(!l)for(const s of n.tables??[])s.name===e&&(l=s);if(l){const e=await I(this._url+"/"+l.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);e=null!=e?e.toString():"";for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let l=null;for(const s of n.layers??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(l=s);if(!l)for(const s of n.tables??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(l=s);if(l){const e=await I(this._url+"/"+l.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}}function O(e,t,a=null,r=null){return new N(e,t,a,r)}function A(e,t,a=null,r=null){return new T(e,t,a,r)}function E(e,t,n,l,s){if(null===e)return null;if(a(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof h&&c(e)){switch(t){case"datasource":return S(e,s,"outFields"in e?e.outFields:null,!0,n,l).getDataSourceFeatureSet();case"parent":case"root":return S(e,s,"outFields"in e?e.outFields:null,!0,n,l)}return null}if(r(e)){switch(t){case"datasource":return S(e.parent,s,e.parent.outFields,!0,n,l).getDataSourceFeatureSet();case"parent":case"root":return S(e,s,e.parent.outFields,!0,n,l)}return null}return null}async function M(e,t,a,r,n,l,s,i=null){if(o.applicationCache){const u=o.applicationCache.getLayerInfo(e+":"+l.url);if(u)return D(await u,t,a,r,n,s,i)}if(null!=s){const o=s.getCachedPortalItem(l.url,e);if(null!=o)return await D(await o,t,a,r,n,s,i)}const u=new m({id:e,portal:l}).load();o.applicationCache?o.applicationCache.setLayerInfo(e+":"+l.url,u):null!=s&&s.setCachedPortalItem(l.url,e,u);try{return await D(await u,t,a,r,n,s,i)}catch(c){throw o.applicationCache&&o.applicationCache.clearLayerInfo(e+":"+l.url),null!=s&&s.removeCachedPortalItem(l.url,e,u),c}}async function D(e,t,a,r,n,l,s){let i;if("Feature Service"===e.type||"Map Service"===e.type)i=await I(d(e.url??"")+"/"+t,["*"],l);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=l){const t=l.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)i=await t;else{const t=h.fromPortalItem(e);l.setCachedPortalItemLayer(e.portal.url,e.id,t);try{i=await t}catch(o){throw l.removeCachedPortalItemLayer(e.portal.url,e.id,t),o}}}else i=await h.fromPortalItem(e)}return S(i,a,r,n,l,s)}export{g as constructAssociationMetaDataFeatureSetFromUrl,S as constructFeatureSet,M as constructFeatureSetFromPortalItem,F as constructFeatureSetFromRelationship,L as constructFeatureSetFromUrl,E as convertToFeatureSet,O as createFeatureSetCollectionFromMap,A as createFeatureSetCollectionFromService,w as initialiseMetaDataCache};
|
|
2
|
+
import e from"../request.js";import t from"./featureSetCollection.js";import{m as a,a4 as r}from"../chunks/languageUtils.js";import n from"./featureset/actions/AttributeFilter.js";import l from"./featureset/sources/FeatureLayerDynamic.js";import s from"./featureset/sources/FeatureLayerMemory.js";import i from"./featureset/sources/FeatureLayerRelated.js";import o from"./featureset/support/cache.js";import{FeatureSetError as u}from"./featureset/support/errorsupport.js";import{isSupportedLayer as c,extractServiceUrl as d}from"./featureset/support/shared.js";import{isLoadable as p}from"../core/Loadable.js";import f from"../core/sql/WhereClause.js";import y from"../layers/FeatureLayer.js";import m from"../layers/Layer.js";import h from"../portal/PortalItem.js";function w(){null===o.applicationCache&&(o.applicationCache=new o)}async function I(e,t,a){if(o.applicationCache){const a=o.applicationCache.getLayerInfo(e);if(a){const r=await a;return new y({url:e,outFields:t,sourceJSON:r})}const n=new y({url:e,outFields:t}),l=(async()=>(await n.load(),n.sourceJSON))();if(o.applicationCache){o.applicationCache.setLayerInfo(e,l);try{return await l,n}catch(r){throw o.applicationCache.clearLayerInfo(e),r}}return await l,n}if(null!=a){const r=a.getCachedLayerMetadata(e);if(r){const a=await r;return new y({url:e,outFields:t,sourceJSON:a})}const l=new y({url:e,outFields:t}),s=(async()=>(await l.load(),l.sourceJSON))();a.setCachedLayerMetadata(e,s);try{return await s,l}catch(n){throw a.removeCachedLayerMetadata(e,s),n}}return new y({url:e,outFields:t})}async function L(e,t,a,r,n,l=null){return _(await I(e,["*"],n),t,a,r,n,l)}function _(e,t=null,a=null,r=!0,i=null,o=null){switch(e.type){case"catalog-footprint":return _(e.parent,t,a,r,i,o);case"subtype-sublayer":{const l=_(e.parent,t,a,r,i,o);return new n({parentfeatureset:l,whereclause:f.create(e.parent.subtypeField+"="+e.subtypeCode.toString(),{fieldsIndex:e.parent.fieldsIndex,timeZone:l.dateFieldsTimeZoneDefaultUTC})})}case"csv":case"geojson":case"knowledge-graph-sublayer":case"wfs":return new s({layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:i,interceptor:o});case"catalog":case"feature":case"oriented-imagery":case"subtype-group":{const n={layer:e,spatialReference:t,outFields:a,includeGeometry:r,lrucache:i,interceptor:o};return!e.url&&e.source?new s(n):new l(n)}default:throw new Error(`Unsupported layer type: ${e.type}`)}}async function S(t){if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(t);if(null!==e)return e}const a=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"}});return a.data?a.data:null})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(t,a);try{return await a}catch(r){throw o.applicationCache.clearLayerInfo(t),r}}return a}async function C(t,a){const r="QUERYDATAELEMTS:"+a.toString()+":"+t;if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(r);if(null!==e)return e}const n=(async()=>{const r=await e(t+"/queryDataElements",{method:"post",responseType:"json",query:{layers:JSON.stringify([a.toString()]),f:"json"}});if(r.data){const e=r.data;if(e.layerDataElements?.[0])return e.layerDataElements[0]}throw new u("DataElementsNotFound")})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(r,n);try{return await n}catch(l){throw o.applicationCache.clearLayerInfo(r),l}}return n}async function k(t,a){if(null!==o.applicationCache){const e=o.applicationCache.getLayerInfo(t);if(null!==e)return e}if(null!=a){const e=a.getCachedServiceMetadata(t);if(null!=e)return e}const r=(async()=>{const a=await e(t,{responseType:"json",query:{f:"json"},authMode:"no-prompt"});if(a.data){const e=a.data;return e.layers||(e.layers=[]),e.tables||(e.tables=[]),e}return{layers:[],tables:[]}})();if(null!==o.applicationCache){o.applicationCache.setLayerInfo(t,r);try{return await r}catch(n){throw o.applicationCache.clearLayerInfo(t),n}}if(null!=a){a.setCachedServiceMetadata(t,r);try{return await r}catch(l){throw a.removeCachedServiceMetadata(t,r),l}}return r}async function g(e,t,a){const r={metadata:null,networkId:-1,unVersion:3,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map,queryelem:null,layerNameLkp:{},lkp:null},l=await k(e,null);if(r.metadata=l,void 0!==l.controllerDatasetLayers?.utilityNetworkLayerId&&null!==l.controllerDatasetLayers.utilityNetworkLayerId){if(l.layers)for(const e of l.layers)r.layerNameLkp[e.id]=e.name;if(l.tables)for(const e of l.tables)r.layerNameLkp[e.id]=e.name;const s=l.controllerDatasetLayers.utilityNetworkLayerId;r.networkId=s;const i=await C(e,s);if(i){r.queryelem=i,r.queryelem?.dataElement&&void 0!==r.queryelem.dataElement.schemaGeneration&&(r.unVersion=r.queryelem.dataElement.schemaGeneration),r.lkp={},r.queryelem.dataElement.domainNetworks||(r.queryelem.dataElement.domainNetworks=[]);for(const e of r.queryelem.dataElement.domainNetworks){for(const t of e.edgeSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:r.layerNameLkp[t.layerId]??null};r.layerIdLookup.set(e.layerId,e),r.sourceIdLookup.set(e.sourceId,e),e.className&&(r.lkp[e.className]=e)}for(const t of e.junctionSources??[]){const e={layerId:t.layerId,sourceId:t.sourceId,className:r.layerNameLkp[t.layerId]??null};r.layerIdLookup.set(e.layerId,e),r.sourceIdLookup.set(e.sourceId,e),e.className&&(r.lkp[e.className]=e)}}if(r.queryelem.dataElement.terminalConfigurations)for(const e of r.queryelem.dataElement.terminalConfigurations)for(const t of e.terminals)r.terminals.push({terminalId:t.terminalId,terminalName:t.terminalName});const l=await S(e+"/"+s);if(void 0!==l.systemLayers?.associationsTableId&&null!==l.systemLayers.associationsTableId){let s=null;if(a&&r.unVersion<8){const a=[];r.unVersion>=4&&(a.push("STATUS"),a.push("PERCENTALONG")),s=await L(e+"/"+l.systemLayers.associationsTableId,t,["OBJECTID","FROMNETWORKSOURCEID","TONETWORKSOURCEID","FROMGLOBALID","TOGLOBALID","TOTERMINALID","FROMTERMINALID","ASSOCIATIONTYPE","ISCONTENTVISIBLE","GLOBALID",...a],!1,null,null),await s.load(),r.unVersion>=4&&(s=new n({parentfeatureset:s,whereclause:f.create("STATUS NOT IN (1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63)",{fieldsIndex:s.getFieldsIndex(),timeZone:s.dateFieldsTimeZoneDefaultUTC})}),await s.load())}return{lkp:r.lkp,associations:s,unVersion:r.unVersion,terminals:r.terminals,layerIdLookup:r.layerIdLookup,sourceIdLookup:r.sourceIdLookup}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}return{associations:null,unVersion:r.unVersion,lkp:null,terminals:[],layerIdLookup:new Map,sourceIdLookup:new Map}}async function F(e,t,a,r=null,n=null,l=!0,s=null,o=null){let u=e.serviceUrl();if(!u)return null;u=u.endsWith("/")?u+t.relatedTableId.toString():u+"/"+t.relatedTableId.toString();const c=await L(u,r,n,l,s,o);return new i({layer:e,relatedLayer:c,relationship:t,objectId:a,spatialReference:r,outFields:n,includeGeometry:l,lrucache:s,interceptor:o})}class N extends t{constructor(e,t=null,a=null,r=null){super(),this._map=e,this._overrideSpatialReference=t,this._lrucache=a,this._interceptor=r,this._instantLayers=[]}_makeAndAddFeatureSet(e,t=!0,a=null){const r=_(e,this._overrideSpatialReference,null===a?["*"]:a,t,this._lrucache,this._interceptor);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async listAll(){p(this._map)&&!this._map.loaded&&await this._map.load();const e=this._map.allLayers.toArray().filter(e=>c(e)).map(e=>({id:e.id,name:e.title})),t=this._map.allTables.toArray().filter(e=>c(e)).map(e=>({id:e.id,name:e.title}));return e.concat(t)}async featureSetByName(e,t=!0,a=null){if(p(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetByName(e,t,a);null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let l=0;l<this._instantLayers.length;l++){const a=this._instantLayers[l];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[l].featureset}const n=this._map.allLayers.find(t=>c(t)&&t.title===e);if(null!=n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.allTables){const r=this._map.allTables.find(t=>c(t)&&t.title===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){if(p(this._map)&&!this._map.loaded)return await this._map.load(),this.featureSetById(e,t,a);null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let l=0;l<this._instantLayers.length;l++){const a=this._instantLayers[l];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[l].featureset}const n=this._map.allLayers.find(t=>c(t)&&t.id===e);if(n)return this._makeAndAddFeatureSet(n,t,a);if(this._map.allTables){const r=this._map.allTables.find(t=>c(t)&&t.id===e);if(null!=r)return this._makeAndAddFeatureSet(r,t,a)}return null}}class T extends t{constructor(e,t=null,a=null,r=null){super(),this._url=e,this._overrideSpatialReference=t,this._lrucache=a,this._interceptor=r,this.metadata=null,this._instantLayers=[]}get url(){return this._url}_makeAndAddFeatureSet(e,t=!0,a=null){const r=_(e,this._overrideSpatialReference,null===a?["*"]:a,t,this._lrucache);return this._instantLayers.push({featureset:r,opitem:e,includeGeometry:t,outFields:JSON.stringify(a)}),r}async _loadMetaData(){const e=await k(this._url,this._lrucache);return this.metadata=e,e}load(){return this._loadMetaData()}clone(){return new T(this._url,this._overrideSpatialReference,this._lrucache,this._interceptor)}async listAll(){const e=await this._loadMetaData();return e.layers.concat(e.tables)}async featureSetByName(e,t=!0,a=null){null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.title===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let l=null;for(const s of n.layers??[])s.name===e&&(l=s);if(!l)for(const s of n.tables??[])s.name===e&&(l=s);if(l){const e=await I(this._url+"/"+l.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}async featureSetById(e,t=!0,a=["*"]){null===a&&(a=["*"]),a=(a=a.slice()).sort();const r=JSON.stringify(a);e=null!=e?e.toString():"";for(let s=0;s<this._instantLayers.length;s++){const a=this._instantLayers[s];if(a.opitem.id===e&&a.includeGeometry===t&&a.outFields===r)return this._instantLayers[s].featureset}const n=await this._loadMetaData();let l=null;for(const s of n.layers??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(l=s);if(!l)for(const s of n.tables??[])null!==s.id&&void 0!==s.id&&s.id.toString()===e&&(l=s);if(l){const e=await I(this._url+"/"+l.id,["*"],this._lrucache);return this._makeAndAddFeatureSet(e,t,a)}return null}}function A(e,t,a=null,r=null){return new N(e,t,a,r)}function O(e,t,a=null,r=null){return new T(e,t,a,r)}function E(e,t,n,l,s){if(null===e)return null;if(a(e)){switch(t){case"datasource":return e.getDataSourceFeatureSet();case"parent":return e;case"root":return e.getRootFeatureSet()}return null}if(e instanceof m&&c(e)){switch(t){case"datasource":return _(e,s,"outFields"in e?e.outFields:null,!0,n,l).getDataSourceFeatureSet();case"parent":case"root":return _(e,s,"outFields"in e?e.outFields:null,!0,n,l)}return null}if(r(e)){switch(t){case"datasource":return _(e.parent,s,e.parent.outFields,!0,n,l).getDataSourceFeatureSet();case"parent":case"root":return _(e,s,e.parent.outFields,!0,n,l)}return null}return null}async function M(e,t,a,r,n,l,s,i=null){if(o.applicationCache){const u=o.applicationCache.getLayerInfo(e+":"+l.url);if(u)return b(await u,t,a,r,n,s,i)}if(null!=s){const o=s.getCachedPortalItem(l.url,e);if(null!=o)return await b(await o,t,a,r,n,s,i)}const u=new h({id:e,portal:l}).load();o.applicationCache?o.applicationCache.setLayerInfo(e+":"+l.url,u):null!=s&&s.setCachedPortalItem(l.url,e,u);try{return await b(await u,t,a,r,n,s,i)}catch(c){throw o.applicationCache&&o.applicationCache.clearLayerInfo(e+":"+l.url),null!=s&&s.removeCachedPortalItem(l.url,e,u),c}}async function b(e,t,a,r,n,l,s){let i;if("Feature Service"===e.type||"Map Service"===e.type)i=await I(d(e.url??"")+"/"+t,["*"],l);else{if(t)throw new Error(`layerId=${t} provided for ${e.type} item`);if(null!=l){const t=l.getCachedPortalItemLayer(e.portal.url,e.id);if(null!=t)i=await t;else{const t=m.fromPortalItem(e);l.setCachedPortalItemLayer(e.portal.url,e.id,t);try{i=await t}catch(o){throw l.removeCachedPortalItemLayer(e.portal.url,e.id,t),o}}}else i=await m.fromPortalItem(e)}return _(i,a,r,n,l,s)}export{g as constructAssociationMetaDataFeatureSetFromUrl,_ as constructFeatureSet,M as constructFeatureSetFromPortalItem,F as constructFeatureSetFromRelationship,L as constructFeatureSetFromUrl,E as convertToFeatureSet,A as createFeatureSetCollectionFromMap,O as createFeatureSetCollectionFromService,w as initialiseMetaDataCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{StringEnum as t}from"../../enum.js";import{
|
|
2
|
+
import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{StringEnum as t}from"../../enum.js";import{a5 as s}from"../../../chunks/languageUtils.js";import{SqlExpressionAdapted as i,OriginalField as r,AdaptedFeatureSet as o}from"./Adapted.js";import a from"./AttributeFilter.js";import n from"./OrderBy.js";import{FeatureSetError as l,throwIfCancelled as d}from"../support/errorsupport.js";import{FeatureSet as u,emptyFeaturesResult as p}from"../support/FeatureSet.js";import f from"../support/OrderbyClause.js";import{isSingleField as c,toWhereClause as h,predictType as g,scanForField as m,reformulateWithoutField as _}from"../support/sqlUtils.js";import y from"../support/StatsField.js";import{createMD5Hash as F,outputTypes as w}from"../../../core/MD5.js";import{aggregateFunction as b}from"../../../core/sql/AggregateFunctions.js";import{DateOnly as S}from"../../../core/sql/DateOnly.js";import{SqlTimeStampOffset as A}from"../../../core/sql/SqlTimestampOffset.js";import{TimeOnly as x}from"../../../core/sql/TimeOnly.js";import I from"../../../core/sql/WhereClause.js";import G from"../../../layers/support/Field.js";const B=new t(["MIN","MAX","VAR","STDDEV","COUNT","SUM","AVG"],[["VARIANCE","VAR"],["AVERAGE","AVG"],["MEAN","AVG"],["STDEV","STDDEV"]]);class j extends u{constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.Aggregate",this._decodedStatsFields=[],this._decodedGroupByFields=[],this._canDoSimpleGroupBy=!0,this._physicalGroupByFields=[],this.objectIdField="ROW__ID",this._adaptedFields=[],this._uniqueIds=1,this._maxQuery=10,this._maxProcessing=10,this._parent=e.parentfeatureset,this._config=e}isTable(){return!0}_nextUniqueName(e){for(;1===e["T"+this._uniqueIds.toString()];)this._uniqueIds++;const t="T"+this._uniqueIds.toString();return e[t]=1,t}_convertToEsriFieldType(e){return e}_initialiseFeatureSet(){const e=this._parent.getFieldsIndex();this.objectIdField="ROW__ID",this.globalIdField="";let t=!1,s=1;for(;!1===t;){let e=!1;for(const t of this._config.groupbyfields)if(t.name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}if(!1===e)for(const t of this._config.statsfields)if(t.name.toLowerCase()===this.objectIdField.toLowerCase()){e=!0;break}!1===e?t=!0:(this.objectIdField="ROW__ID"+s.toString(),s++)}for(const i of this._config.statsfields){const t=new y;t.field=i.name,t.tofieldname=i.name,t.workingexpr=i.expression instanceof I?i.expression:I.create(i.expression,{fieldsIndex:e,timeZone:this.dateFieldsTimeZoneDefaultUTC}),t.typeofstat=B.lookup(i.statistic)??"COUNT",this._decodedStatsFields.push(t)}this._decodedGroupByFields=[];for(const i of this._config.groupbyfields){const t={name:i.name,singlefield:null,tofieldname:i.name,expression:i.expression instanceof I?i.expression:I.create(i.expression,{fieldsIndex:e,timeZone:this.dateFieldsTimeZoneDefaultUTC}),sqlType:null};this._decodedGroupByFields.push(t)}const o={};this.geometryType=this._parent.geometryType,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField="";for(const i of this._parent.fields)o[i.name.toUpperCase()]=1;this.types=null,this.subtypes=null,this.subtypeField="",this.fields=[];const a=new y;a.field=this._nextUniqueName(o),a.tofieldname=this.objectIdField,a.workingexpr=I.create(this._parent.objectIdField,{fieldsIndex:this._parent.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),a.typeofstat="MIN",this._decodedStatsFields.push(a);for(const r of this._decodedGroupByFields){const e=new G;if(r.name=this._nextUniqueName(o),e.name=r.tofieldname,e.alias=e.name,c(r.expression)){const t=this._parent.getField(h(r.expression,0));if(!t)throw new l("AggregationFieldNotFound");r.name=t.name,r.singlefield=t.name,this._physicalGroupByFields.push(t.name),e.type=t.type,r.sqlType=t.type}else{e.type=this._convertToEsriFieldType(g(r.expression,this._parent.fields));const t=new G;t.name=r.name,t.alias=t.name,this._physicalGroupByFields.push(r.name),this._adaptedFields.push(new i(t,r.expression)),this._canDoSimpleGroupBy=!1,r.sqlType=e.type}this.fields.push(e)}if(this._adaptedFields.length>0)for(const i of this._parent.fields)this._adaptedFields.push(new r(i));for(const i of this._decodedStatsFields){const e=new G;let t=null;i.field=this._nextUniqueName(o),e.name=i.tofieldname,e.alias=e.name;const s=null!==i.workingexpr&&c(i.workingexpr)?h(i.workingexpr,0):"";switch(i.typeofstat){case"SUM":if(""!==s){if(t=this._parent.getField(s),!t)throw new l("AggregationFieldNotFound");e.type=t.type}else e.type="double";break;case"MIN":case"MAX":if(""!==s){if(t=this._parent.getField(s),!t)throw new l("AggregationFieldNotFound");e.type=t.type}else e.type="double";break;case"COUNT":e.type="integer";break;case"STDDEV":case"VAR":case"AVG":if(""!==s&&(t=this._parent.getField(s),!t))throw new l("AggregationFieldNotFound");e.type="double"}this.fields.push(e)}}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){if(null!=e.spatialFilter)return p;const t={ordered:!1,nowhereclause:!1};await this._ensureLoaded();let s=e.where;if(null!=s)for(const o of this._decodedStatsFields)if(!0===m(s,o.tofieldname)){t.nowhereclause=!0,s=null;break}let i=e.orderBy;if(null!=i){t.ordered=!0;for(const e of this._decodedStatsFields)if(!0===i.scanForField(e.tofieldname)){i=null,t.ordered=!1;break}if(null!==i)for(const e of this._decodedGroupByFields)if(null===e.singlefield&&!0===i.scanForField(e.tofieldname)){i=null,t.ordered=!1;break}}if(!1!==this._canDoSimpleGroupBy&&await this._parent.canQueryAggregate({groupBy:this._physicalGroupByFields,statistics:this._decodedStatsFields,where:null,spatialFilter:null,abortSignal:e.abortSignal})){const r=await this._parent.queryAggregate({groupBy:this._physicalGroupByFields,statistics:this._decodedStatsFields,where:s?this._reformulateWhereClauseWithoutGroupByFields(s):null,spatialFilter:null,orderBy:i?this._reformulateOrderClauseWithoutGroupByFields(i):null,abortSignal:e.abortSignal});return d(e.abortSignal),{...r,filterApplied:!t.nowhereclause&&r.filterApplied,ordered:!0===t.ordered&&r.ordered,features:this._fixAggregateAttributeNames(r.features)}}const r=this._adaptedFields.length>0?new o({parentfeatureset:this._parent,adaptedFields:this._adaptedFields,extraFilter:null}):this._parent;if(!0===t.nowhereclause){const t=new n({parentfeatureset:r,orderbyclause:new f(this._physicalGroupByFields.join(",")+","+this._parent.objectIdField+" ASC")});return{filterApplied:!1,spatialFilterApplied:!1,ordered:!1,features:this._aggregateSortedFeatureGroups((await t.query({abortSignal:e.abortSignal})).features,this._maxQuery,e.abortSignal)}}let l=r;null!=s&&(l=new a({parentfeatureset:l,whereclause:this._reformulateWhereClauseWithoutGroupByFields(s)}));const u=new n({parentfeatureset:l,orderbyclause:new f(this._physicalGroupByFields.join(",")+","+this._parent.objectIdField+" ASC")});return{filterApplied:!1,spatialFilterApplied:!1,ordered:!1,features:this._aggregateSortedFeatureGroups((await u.query({abortSignal:e.abortSignal})).features,this._maxQuery,e.abortSignal)}}async*_fixAggregateAttributeNames(e){for await(const t of e)yield t.map(e=>{const t={geometry:e.geometry,attributes:{}},s={};for(const i in e.attributes)s[i.toLowerCase()]=e.attributes[i];for(const i of this._decodedGroupByFields)t.attributes[i.tofieldname]=s[i.name.toLowerCase()];for(const i of this._decodedStatsFields)t.attributes[i.tofieldname]=s[i.field.toLowerCase()];return t})}async*_aggregateSortedFeatureGroups(e,t,i){let r=null,o=[];for await(const a of e){await s(),d(i);for(const e of a){const t=this._generateAggregateHash(e);null==r?r={features:[e],id:t}:t!==r.id?(o.push(this._calculateAndAppendAggregateItem(r)),r={features:[e],id:t}):r.features.push(e)}o.length>=t&&(yield o,o=[])}null!=r&&(o.push(this._calculateAndAppendAggregateItem(r)),yield o)}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new l("NeverReach")}_reformulateWhereClauseWithoutStatsFields(e){for(const t of this._decodedStatsFields)e=_(e,t.tofieldname,h(t.workingexpr,0),this._parent.getFieldsIndex());return e}_reformulateWhereClauseWithoutGroupByFields(e){for(const t of this._decodedGroupByFields)t.tofieldname!==t.name&&(e=_(e,t.tofieldname,h(t.expression,0),this._parent.getFieldsIndex()));return e}_reformulateOrderClauseWithoutGroupByFields(e){const t=[];for(const s of this._decodedGroupByFields)s.tofieldname!==s.name&&t.push({field:s.tofieldname,newfield:s.name});return t.length>0?e.replaceFields(t):e}_calculateFieldStat(e,t,s){const i=[];for(const r of e.features)if(null!==t.workingexpr){const e=t.workingexpr.calculateValue(r);null!==e&&(e instanceof S||e instanceof x?i.push(e.toNumber()):e instanceof A?i.push(e.toMilliseconds()):i.push(e))}else i.push(null);s.attributes[t.tofieldname]=b(t.typeofstat,[i])}_calculateAndAppendAggregateItem(e){const t={attributes:{}};for(const s of this._decodedGroupByFields){const i=s.singlefield?e.features[0].attributes[s.singlefield]:I.convertValueToStorageFormat(s.expression.calculateValue(e.features[0]),s.sqlType);t.attributes[s.tofieldname]=i}for(const s of this._decodedStatsFields)this._calculateFieldStat(e,s,t);return t}_generateAggregateHash(e){let t="";for(const s of this._decodedGroupByFields){const i=s.singlefield?e.attributes[s.singlefield]:s.expression.calculateValue(e);t+=null==i?":":":"+i.toString()}return F(t,w.String)}async getFeatureByObjectId(){throw new l("NotImplemented")}}export{j as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import{
|
|
2
|
+
import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import{a5 as t}from"../../../chunks/languageUtils.js";import{throwIfCancelled as e}from"../support/errorsupport.js";import{FeatureSet as a}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import{splitIntoChunks as i,insertSortedStableTopN as o}from"../../../core/arrayUtils.js";class n extends a{constructor(r){super(),this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._parent=r.parentfeatureset,this._orderByClause=r.orderbyclause}async _queryAll(){return(await this.query({abortSignal:r})).features}async query(r){if(null!=r.orderBy)return this._parent.query(r);await this._ensureLoaded();const t=await this._parent.query({...r,orderBy:this._orderByClause});return e(r.abortSignal),!1===t.ordered?{...t,ordered:!0,features:null!=r.limit&&r.limit<=5e3?this._topNFeatures(t.features,r.limit,r.abortSignal):this._sortFeatures(t.features,r.abortSignal)}:t}async*_sortFeatures(r,a){const s=[];for await(const i of r)s.push(i),await t(),e(a);const o=s.flat();this._orderByClause.order(o),yield*i(o,this._maxQueryRate())}async*_topNFeatures(r,a,s){const n=[],u=this._orderByClause.toComparator();for await(const i of r){for(const r of i)o(n,r,a,u);await t(),e(s)}yield*i(n,this._maxQueryRate())}async queryStat(r){const t=await this._parent.queryStat(r);return t.calculated?t:null==r.where&&null==r.spatialFilter?this._manualStat(r.stat,r.field,r.limit??s,r.abortSignal):{calculated:!1}}async canQueryAggregate(r){return this._parent.canQueryAggregate(r)}async queryAggregate(r){return this._parent.queryAggregate(r)}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{n as default};
|