@arcgis/core 4.33.0-next.20250306 → 4.33.0-next.20250308
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/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.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/aiServices.js +5 -0
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/028e2e0fa6971aaaaae8.js +1 -0
- package/assets/esri/core/workers/chunks/0576b035c1654a43ad5c.js +1 -0
- package/assets/esri/core/workers/chunks/081699532b183db1e7c2.js +1 -0
- package/assets/esri/core/workers/chunks/087a09b4c41abef6b516.js +1 -0
- package/assets/esri/core/workers/chunks/{7ec2f531217718e76469.js → 0b4e63e705db09dbe171.js} +1 -1
- package/assets/esri/core/workers/chunks/0c9e933b392616460e62.js +1 -0
- package/assets/esri/core/workers/chunks/{c3d23c45db427a29d596.js → 0f4a2bdf5bb2f4303b7f.js} +1 -1
- package/assets/esri/core/workers/chunks/{f995a74bd9b58c069c07.js → 10631680abe7607616ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{567aa24d7e99e0b5a6cb.js → 1263391920fbb8926ced.js} +1 -1
- package/assets/esri/core/workers/chunks/186387a561364a11e574.js +1 -0
- package/assets/esri/core/workers/chunks/1cc7bbd0f4a8cf06050a.js +1 -0
- package/assets/esri/core/workers/chunks/1d0473dd43c88ab5776d.js +1 -0
- package/assets/esri/core/workers/chunks/{ef46613c3aa363dc1cfc.js → 285e573aa6f3acf70b32.js} +1 -1
- package/assets/esri/core/workers/chunks/2bb508701ad8ccc3d6ab.js +1 -0
- package/assets/esri/core/workers/chunks/36fe6b8228e622407ec2.js +1 -0
- package/assets/esri/core/workers/chunks/37a3533f004bf2e888da.js +1 -0
- package/assets/esri/core/workers/chunks/3be465c653236d6d8c1f.js +1 -0
- package/assets/esri/core/workers/chunks/3e4204502f6e09483c60.js +1 -0
- package/assets/esri/core/workers/chunks/3e9cd82325c473ddbf1f.js +1 -0
- package/assets/esri/core/workers/chunks/{1e7a70a1871fea29169e.js → 400951e3e742452a5fe2.js} +16 -16
- package/assets/esri/core/workers/chunks/{370ab4b33fb7292bb3b8.js → 424e2058228e5f6a183d.js} +1 -1
- package/assets/esri/core/workers/chunks/4496ef270c700078df0c.js +1 -0
- package/assets/esri/core/workers/chunks/458f4c6c8820c1f62f69.js +1 -0
- package/assets/esri/core/workers/chunks/49c346d2fb8538990f45.js +1 -0
- package/assets/esri/core/workers/chunks/4bb65ef7b3a02ebe416e.js +1 -0
- package/assets/esri/core/workers/chunks/4c765464288b6d096d08.js +1 -0
- package/assets/esri/core/workers/chunks/4eb1a2433f675bde12ad.js +1 -0
- package/assets/esri/core/workers/chunks/4ffdff269aae8c293cb4.js +1 -0
- package/assets/esri/core/workers/chunks/55f7b1de8882569861c0.js +1 -0
- package/assets/esri/core/workers/chunks/564cc81c232c97646833.js +1 -0
- package/assets/esri/core/workers/chunks/5a6f7360183693f8490d.js +1 -0
- package/assets/esri/core/workers/chunks/5f8028928ae8e5d27dda.js +1 -0
- package/assets/esri/core/workers/chunks/{c03e6e35082beaec02a6.js → 5fa5bfc70512994f5ec1.js} +1 -1
- package/assets/esri/core/workers/chunks/605eddec7aac891ed141.js +1 -0
- package/assets/esri/core/workers/chunks/66cba22c09f595bba3bf.js +1 -0
- package/assets/esri/core/workers/chunks/6cb5ce0a6bb85c624a21.js +1 -0
- package/assets/esri/core/workers/chunks/{bf9b45604249520b596a.js → 74c01de62ccaed0666e0.js} +1 -1
- package/assets/esri/core/workers/chunks/7a4413a188a8f1affb2f.js +1 -0
- package/assets/esri/core/workers/chunks/{b66e8a48ce7098ca43d5.js → 7c3cd6aefd16fcc1a7fd.js} +1 -1
- package/assets/esri/core/workers/chunks/7e0e9ca84490a0c67197.js +1 -0
- package/assets/esri/core/workers/chunks/{3315de71eb8791189c05.js → 835fa4484c58d9b31c78.js} +1 -1
- package/assets/esri/core/workers/chunks/88a7780b1c689afff8bd.js +1 -0
- package/assets/esri/core/workers/chunks/8d636075e5aa053940fc.js +1 -0
- package/assets/esri/core/workers/chunks/{7ca33e03a2fd217b9443.js → 9dfdd8e91897d166d888.js} +1 -1
- package/assets/esri/core/workers/chunks/{790f86ddf57be50e0dd5.js → 9ef509e0853ad41f7690.js} +1 -1
- package/assets/esri/core/workers/chunks/a2377969f76640f1d6fe.js +1 -0
- package/assets/esri/core/workers/chunks/aa3a45e8228216c1739b.js +1 -0
- package/assets/esri/core/workers/chunks/b2289c18c02c868a2939.js +1 -0
- package/assets/esri/core/workers/chunks/b5f44cf03c4e5cc07bc4.js +1 -0
- package/assets/esri/core/workers/chunks/b948fe33b4d650eea796.js +1 -0
- package/assets/esri/core/workers/chunks/bdeac9196f28aff93e68.js +1 -0
- package/assets/esri/core/workers/chunks/c591527543fd75a917d4.js +1 -0
- package/assets/esri/core/workers/chunks/{ca4af35af02e3804042e.js → c6580fdcdc33153008b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe8ee1938d196a70d809.js → ca0572fe5614005acceb.js} +1 -1
- package/assets/esri/core/workers/chunks/{67c1e2c17ea3ca27248c.js → cbbbaccc0d3683e1c0fe.js} +1 -1
- package/assets/esri/core/workers/chunks/ccc6f6f7052985bebdab.js +1 -0
- package/assets/esri/core/workers/chunks/d72d993b36daf6ec2a10.js +1 -0
- package/assets/esri/core/workers/chunks/eb9d2bb8b44a93347274.js +1 -0
- package/assets/esri/core/workers/chunks/f809cbfb744adb4fad29.js +1 -0
- package/assets/esri/core/workers/chunks/fa011ad649c05201e92a.js +1 -0
- package/assets/esri/core/workers/chunks/fa7ddf3c89cdb8052b26.js +1 -0
- package/assets/esri/core/workers/chunks/fdc9bd8f309af610fa62.js +1 -0
- package/assets/esri/themes/base/widgets/_ElevationProfile.scss +2 -2
- 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/chunks/LineMarker.glsl.js +2 -2
- package/chunks/aiServices.js +5 -0
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/copyright.txt +38 -0
- package/core/MapUtils.js +1 -1
- package/editing/sharedTemplates/executor/createTemplateExecutor.js +1 -1
- package/interfaces.d.ts +11 -3
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/labelFormatUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/ClassBreaksRenderer.js +1 -1
- package/renderers/DictionaryRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/DictionaryControlString.js +5 -0
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/DictionaryScriptEvaluator.js +5 -0
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/print.js +1 -1
- package/rest/support/TranslateContent.js +5 -0
- package/rest/support/TranslateParameters.js +5 -0
- package/rest/support/TranslateResult.js +5 -0
- package/rest/translate.js +5 -0
- package/rest/utils.js +1 -1
- package/smartMapping/statistics/support/attributeDensity.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/ArcadeExpression.js +5 -0
- package/support/loadArcade.js +5 -0
- package/support/revision.js +1 -1
- package/symbols/cim/OverrideHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/views/2d/arcade/callExpressionWithCursor.js +1 -1
- package/views/2d/arcade/callExpressionWithFeature.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createGraphicSymbolMeshSchemas.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterInputEvaluator.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterRegistry.js +1 -1
- package/views/2d/engine/webgl/util/DictionaryMatcher.js +1 -1
- package/views/2d/engine/webgl/util/MatcherContext.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/ComputedAttributeStorage.js +1 -1
- package/views/2d/layers/features/support/ComputedExpression.js +1 -1
- package/views/2d/layers/features/support/DictionaryTemplate.js +5 -0
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
- package/views/3d/layers/graphics/queryForSymbologySnapping.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SMeshViewFilter.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +7 -7
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/overlay/CrosshairOverlayItem.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/support/dependencySort.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/assets/esri/core/workers/chunks/0121702bc9a1f3a85f1f.js +0 -1
- package/assets/esri/core/workers/chunks/05b7c739115be0490583.js +0 -1
- package/assets/esri/core/workers/chunks/0ce1bfcdcccb679569f8.js +0 -1
- package/assets/esri/core/workers/chunks/1007c1a908b6e503e0db.js +0 -1
- package/assets/esri/core/workers/chunks/1439f1d84e21e6295e3f.js +0 -1
- package/assets/esri/core/workers/chunks/1912d25f8007685c7aee.js +0 -1
- package/assets/esri/core/workers/chunks/1bd58eaac6f4906bbdae.js +0 -1
- package/assets/esri/core/workers/chunks/2c091edee3601f345f5f.js +0 -1
- package/assets/esri/core/workers/chunks/2e40f2527345ad85d800.js +0 -1
- package/assets/esri/core/workers/chunks/30f271bbc34f66cbfc23.js +0 -1
- package/assets/esri/core/workers/chunks/36b406131cd864567033.js +0 -1
- package/assets/esri/core/workers/chunks/4395b7263a299a8020d4.js +0 -1
- package/assets/esri/core/workers/chunks/4c15de6b2b8eefd76b61.js +0 -1
- package/assets/esri/core/workers/chunks/4c596cb20baaae5166de.js +0 -1
- package/assets/esri/core/workers/chunks/4d16b1e50caad0da7838.js +0 -1
- package/assets/esri/core/workers/chunks/5802406d0a239a27a9a3.js +0 -1
- package/assets/esri/core/workers/chunks/5c86df2a5e16877ba614.js +0 -1
- package/assets/esri/core/workers/chunks/62c9171a58160ea099f8.js +0 -1
- package/assets/esri/core/workers/chunks/6a4731b47629604a9ca0.js +0 -1
- package/assets/esri/core/workers/chunks/7975ada96e4540a37c83.js +0 -1
- package/assets/esri/core/workers/chunks/81c507c0d901448835f4.js +0 -1
- package/assets/esri/core/workers/chunks/8278d9263e9b7e3bf2d1.js +0 -1
- package/assets/esri/core/workers/chunks/8926f672397620591740.js +0 -1
- package/assets/esri/core/workers/chunks/8bf623f560b1ed440004.js +0 -1
- package/assets/esri/core/workers/chunks/924176d9ab2e070248a8.js +0 -1
- package/assets/esri/core/workers/chunks/988efc508c33ca341e49.js +0 -1
- package/assets/esri/core/workers/chunks/98cbfc72430a378a9451.js +0 -1
- package/assets/esri/core/workers/chunks/9fde9309cb64f1a9301c.js +0 -1
- package/assets/esri/core/workers/chunks/a901c445d36f1a9e7df8.js +0 -1
- package/assets/esri/core/workers/chunks/ab525991f71240d68471.js +0 -1
- package/assets/esri/core/workers/chunks/af27a3f646a4404d3b8d.js +0 -1
- package/assets/esri/core/workers/chunks/c15c3fec95f365580902.js +0 -1
- package/assets/esri/core/workers/chunks/c1e343cdf85da40ac10e.js +0 -1
- package/assets/esri/core/workers/chunks/c3806be4a760735e6082.js +0 -1
- package/assets/esri/core/workers/chunks/c3dc8d1958ddc71e1129.js +0 -1
- package/assets/esri/core/workers/chunks/c7b0f58550e63ce6ad5b.js +0 -1
- package/assets/esri/core/workers/chunks/ccf8a423eee7ef4ffe4c.js +0 -1
- package/assets/esri/core/workers/chunks/d24321b1eeabe9ec553c.js +0 -1
- package/assets/esri/core/workers/chunks/dd913cb7cf3bb172b34c.js +0 -1
- package/assets/esri/core/workers/chunks/e3e049311bced533c853.js +0 -1
- package/assets/esri/core/workers/chunks/e3e5a215dcd531b1196f.js +0 -1
- package/assets/esri/core/workers/chunks/e8a19f9144df8f155e30.js +0 -1
- package/assets/esri/core/workers/chunks/f31986ea5cadfade8344.js +0 -1
- package/assets/esri/core/workers/chunks/f350aefc5e348ebad1da.js +0 -1
- package/support/arcadeOnDemand.js +0 -5
- package/views/3d/layers/support/projectExtentUtils.js +0 -5
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{markerTextureSize as e,markerSymbolSize as r,markerTipThicknessFactor as i}from"../views/3d/support/engineContent/marker.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{MarkerSizing as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{terrainDepthTest as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{addProjViewLocalOrigin as p,addViewNormal as d,addPixelRatio as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as u,If as w}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DPassUniform as b}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{VertexAttribute as y}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{LineMarkerSpace as x,LineMarkerAnchor as P}from"../views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{outputColorHighlightOID as z}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as j}from"../views/webgl/ShaderBuilder.js";function L(L){const k=new j,{space:M,anchor:C,hasTip:D}=L,O=M===x.World;k.include(t,L),k.include(n,L),k.include(s,L);const{vertex:$,fragment:T,varyings:W}=k;T.include(l),p($,L),k.attributes.add(y.POSITION,"vec3"),k.attributes.add(y.PREVPOSITION,"vec3"),k.attributes.add(y.UV0,"vec2"),W.add("vColor","vec4"),W.add("vpos","vec3",{invariant:!0}),W.add("vUV","vec2"),W.add("vSize","float"),D&&W.add("vLineWidth","float"),$.uniforms.add(new m("nearFar",(({camera:e})=>e.nearFar)),new h("viewport",(({camera:e})=>e.fullViewport)))
|
|
5
|
+
import{markerTextureSize as e,markerSymbolSize as r,markerTipThicknessFactor as i}from"../views/3d/support/engineContent/marker.js";import{SliceDraw as o}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{OutputHighlight as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{MarkerSizing as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{terrainDepthTest as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js";import{ColorConversion as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{RgbaFloatEncoding as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{addProjViewLocalOrigin as p,addViewNormal as d,addPixelRatio as v}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as u,If as w}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as S}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Texture2DPassUniform as b}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{VertexAttribute as y}from"../views/3d/webgl-engine/lib/VertexAttribute.js";import{LineMarkerSpace as x,LineMarkerAnchor as P}from"../views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{outputColorHighlightOID as z}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js";import{ShaderBuilder as j}from"../views/webgl/ShaderBuilder.js";function L(L){const k=new j,{space:M,anchor:C,hasTip:D}=L,O=M===x.World;k.include(t,L),k.include(n,L),k.include(s,L);const{vertex:$,fragment:T,varyings:W}=k;T.include(l),p($,L),k.attributes.add(y.POSITION,"vec3"),k.attributes.add(y.PREVPOSITION,"vec3"),k.attributes.add(y.UV0,"vec2"),W.add("vColor","vec4"),W.add("vpos","vec3",{invariant:!0}),W.add("vUV","vec2"),W.add("vSize","float"),D&&W.add("vLineWidth","float"),$.uniforms.add(new m("nearFar",(({camera:e})=>e.nearFar)),new h("viewport",(({camera:e})=>e.fullViewport))).code.add(u`vec4 projectAndScale(vec4 pos) {
|
|
6
6
|
vec4 posNdc = proj * pos;
|
|
7
7
|
posNdc.xy *= viewport.zw / posNdc.w;
|
|
8
8
|
return posNdc;
|
|
@@ -131,7 +131,7 @@ return abs(cos) > 0.001 && t > 0.0;
|
|
|
131
131
|
vpos = pos.xyz;
|
|
132
132
|
|
|
133
133
|
gl_Position = displacedPosScreen;
|
|
134
|
-
}`),
|
|
134
|
+
}`),T.include(o,L),k.include(z,L),T.include(c),T.uniforms.add(new f("intrinsicColor",(({color:e})=>e)),new b("tex",(({markerTexture:e})=>e))).constants.add("texelSize","float",1/e).code.add(u`float markerAlpha(vec2 samplePos) {
|
|
135
135
|
samplePos += vec2(0.5, -0.5) * texelSize;
|
|
136
136
|
float sdf = rgbaTofloat(texture(tex, samplePos)) - 0.5;
|
|
137
137
|
float distance = sdf * vSize;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{toSymbolId as r}from"../arcade/arcadeEnvironment.js";import t from"../arcade/Dictionary.js";import{ArcadeExecutionError as e,ExecutionErrorCodes as s}from"../arcade/executionError.js";import{D as o,m as n,M as a}from"./languageUtils.js";import i from"../core/Logger.js";import c from"../portal/Portal.js";import{translate as l}from"../rest/translate.js";import m from"../rest/support/TranslateContent.js";import u from"../rest/support/TranslateParameters.js";import p from"../rest/support/TranslateResult.js";import{isString as f,isArray as d}from"../support/guards.js";function w(w){"async"===w.mode&&(w.functions[r("TranslateText")]=function(r,g){return w.standardFunctionAsync(r,g,(async(r,w,g)=>{if(o(g,2,3,r,w),!f(g[0])&&!d(g[0])&&!n(g[0]))throw new e(r,s.InvalidParameter,w);const j=a(g[0]);if(!f(g[1])&&!d(g[1])&&!n(g[1]))throw new e(r,s.InvalidParameter,w);const v=a(g[1]);let y=null;if(g.length>=3){if(!f(g[2]))throw new e(r,s.InvalidParameter,w);y=g[2]}const S=r.services?.portal??c.getDefault(),T=new u({to:v,contents:j.map(((r,t)=>new m({key:String(t),text:r}))),from:y,portalUrl:S.url});if(null!=r.services?.translation){const e=await r.services.translation.translate(T);return e.success?t.convertJsonToArcade(e.results.map((r=>p.fromJSON(r).toJSON())),r.timeZone??"system",!0):new t({success:!1})}S.loaded||await S.load();const h=S.helperServices?.aiUtilityServices;if(null==h)return new t({success:!1});const P=h.url+h.translateUtility;try{const e=await l(P,T);return new t({success:!0,results:t.convertJsonToArcade(e?.map((r=>r.toJSON())),r.timeZone??"system",!0)})}catch(J){return i.getLogger("esri.arcade.functions.aiServices").error(J),new t({success:!1})}}))})}const g=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:w},Symbol.toStringTag,{value:"Module"}));export{g as A,w as r};
|
package/chunks/array.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{D as o,K as i,m as u,t as a,w as c,B as s,i as l,
|
|
5
|
+
import{deepClone as n}from"../arcade/deepClone.js";import{ArcadeExecutionError as t,ExecutionErrorCodes as r}from"../arcade/executionError.js";import e from"../arcade/ImmutableArray.js";import{D as o,K as i,m as u,t as a,w as c,B as s,i as l,N as f,f as d}from"./languageUtils.js";import{isPromiseLike as h}from"../core/promiseUtils.js";import{isArray as w,isBoolean as g,isInteger as m}from"../support/guards.js";function F(F){function p(n,o,i){if(n instanceof e)return n.toArray();if(w(n))return n;throw new t(o,r.InvalidParameter,i)}function y(n,t){const r=n.length,e=Math.floor(r/2);return 0===r?[]:1===r?[n[0]]:v(y(n.slice(0,e),t),y(n.slice(e,r),t),t)}function v(n,t,r){const e=[];for(;n.length>0||t.length>0;)if(n.length>0&&t.length>0){let o=r(n[0],t[0]);isNaN(o)&&(o=0),o<=0?(e.push(n[0]),n=n.slice(1)):(e.push(t[0]),t=t.slice(1))}else n.length>0?(e.push(n[0]),n=n.slice(1)):t.length>0&&(e.push(t[0]),t=t.slice(1));return e}async function P(n,t){const r=n.length,e=Math.floor(r/2);if(0===r)return[];if(1===r)return[n[0]];const o=[await P(n.slice(0,e),t),await P(n.slice(e,r),t)];return I(o[0],o[1],t,[])}async function I(n,t,r,e){const o=e;if(n.length>0||t.length>0){if(n.length>0&&t.length>0){let i=await r(n[0],t[0]);return isNaN(i)&&(i=1),i<=0?(o.push(n[0]),n=n.slice(1)):(o.push(t[0]),t=t.slice(1)),I(n,t,r,e)}return n.length>0?(o.push(n[0]),I(n=n.slice(1),t,r,e)):(o.push(t[0]),I(n,t=t.slice(1),r,e))}return e}function N(n,e,i,a){o(i,1,2,n,e);let s=i[0];if(u(s)&&(s=s.toArray()),!1===w(s))throw new t(n,r.InvalidParameter,e);if(i.length>1){if(!1===l(i[1]))throw new t(n,r.InvalidParameter,e);let o=s;const u=i[1].createFunction(n);return a?P(o,u):(o=y(o,((n,t)=>u(n,t))),o)}let h=s;if(0===h.length)return[];const g={};for(let t=0;t<h.length;t++){const n=f(h[t]);""!==n&&(g[n]=!0)}if(!0===g.Array||!0===g.Dictionary||!0===g.Feature||!0===g.Voxel||!0===g.Point||!0===g.Polygon||!0===g.Polyline||!0===g.Multipoint||!0===g.Extent||!0===g.Function)return h.slice();let m=0,F="";for(const t in g)m++,F=t;return h=m>1||"String"===F?y(h,((n,t)=>{if(null==n||n===c)return null==t||t===c?0:1;if(null==t||t===c)return-1;const r=d(n),e=d(t);return r<e?-1:r===e?0:1})):"Number"===F?y(h,((n,t)=>n-t)):"Boolean"===F?y(h,((n,t)=>n===t?0:t?-1:1)):"Date"===F?y(h,((n,t)=>n.toNumber()-t.toNumber())):h.slice(),h}F.functions.array=function(e,c){return F.standardFunction(e,c,((s,l,f)=>{if(o(f,0,2,e,c),0===f.length)return[];if(1===f.length&&null===f[0])return[];if(w(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].slice()}if(u(f[0])){if(2===f.length&&!1===g(f[1]))throw new t(e,r.InvalidParameter,c);return!0===i(f[1],!1)?n(f[0]):f[0].toArray().slice()}const d=a(f[0]);if(isNaN(d)||!1===m(d))throw new t(e,r.InvalidParameter,c);const h=i(f[1],null),F=new Array(d);return F.fill(h),F}))},F.functions.front=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(0)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][0]}throw new t(n,r.InvalidParameter,e)}))},F.functions.back=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,1,1,n,e),u(c[0])){if(c[0].length()<=0)throw new t(n,r.OutOfBounds,e);return c[0].get(c[0].length()-1)}if(w(c[0])){if(c[0].length<=0)throw new t(n,r.OutOfBounds,e);return c[0][c[0].length-1]}throw new t(n,r.InvalidParameter,e)}))},F.functions.push=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,2,n,e),w(a[0]))return a[0][a[0].length]=a[1],a[0].length;throw new t(n,r.InvalidParameter,e)}))},F.functions.pop=function(n,e){return F.standardFunction(n,e,((i,u,a)=>{if(o(a,1,1,n,e),w(a[0])){if(a[0].length<=0)throw new t(n,r.OutOfBounds,e);const o=a[0][a[0].length-1];return a[0].length=a[0].length-1,o}throw new t(n,r.InvalidParameter,e)}))},F.functions.erase=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,2,2,n,e),w(s[0])){let o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[0];if(i.length<=0)throw new t(n,r.OutOfBounds,e);if(o<0&&(o=i.length+o),o<0)throw new t(n,r.OutOfBounds,e);if(o>=i.length)throw new t(n,r.OutOfBounds,e);return i.splice(o,1),c}throw new t(n,r.InvalidParameter,e)}))},F.functions.insert=function(n,e){return F.standardFunction(n,e,((i,u,s)=>{if(o(s,3,3,n,e),w(s[0])){const o=a(s[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);const i=s[2],u=s[0];if(o>u.length)throw new t(n,r.OutOfBounds,e);if(o<0&&o<-1*u.length)throw new t(n,r.OutOfBounds,e);return o===u.length?(u[o]=i,c):(u.splice(o,0,i),c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.resize=function(n,e){return F.standardFunction(n,e,((u,s,l)=>{if(o(l,2,3,n,e),w(l[0])){const o=a(l[1]);if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(o<0)throw new t(n,r.InvalidParameter,e);const u=i(l[2],null),s=l[0];if(s.length>=o)return s.length=o,c;const f=s.length;s.length=o;for(let n=f;n<s.length;n++)s[n]=u;return c}throw new t(n,r.InvalidParameter,e)}))},F.functions.includes=function(n,e){return F.standardFunction(n,e,((i,a,c)=>{if(o(c,2,2,n,e),w(c[0])){const n=c[1];return!!c[0].some((t=>s(t,n)))}if(u(c[0])){const n=c[1];return!!c[0].toArray().some((t=>s(t,n)))}throw new t(n,r.InvalidParameter,e)}))},F.functions.slice=function(n,e){return F.standardFunction(n,e,((c,s,l)=>{if(o(l,1,3,n,e),w(l[0])){const o=a(i(l[1],0)),u=a(i(l[2],l[0].length));if(isNaN(o)||!1===m(o))throw new t(n,r.InvalidParameter,e);if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);return l[0].slice(o,u)}if(u(l[0])){const o=l[0],u=a(i(l[1],0)),c=a(i(l[2],o.length()));if(isNaN(u)||!1===m(u))throw new t(n,r.InvalidParameter,e);if(isNaN(c)||!1===m(c))throw new t(n,r.InvalidParameter,e);return o.toArray().slice(u,c)}throw new t(n,r.InvalidParameter,e)}))},F.functions.splice=function(n,t){return F.standardFunction(n,t,((n,t,r)=>{const e=[];for(let o=0;o<r.length;o++)w(r[o])?e.push(...r[o]):u(r[o])?e.push(...r[o].toArray()):e.push(r[o]);return e}))},F.functions.top=function(n,e){return F.standardFunction(n,e,((i,c,s)=>{if(o(s,2,2,n,e),w(s[0]))return a(s[1])>=s[0].length?s[0].slice():s[0].slice(0,a(s[1]));if(u(s[0]))return a(s[1])>=s[0].length()?s[0].slice():s[0].slice(0,a(s[1]));throw new t(n,r.InvalidParameter,e)}))},F.functions.first=function(n,t){return F.standardFunction(n,t,((r,e,i)=>(o(i,1,1,n,t),w(i[0])?0===i[0].length?null:i[0][0]:u(i[0])?0===i[0].length()?null:i[0].get(0):null)))},"sync"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunction(n,t,((t,r,e)=>N(n,r,e,!1)))},F.functions.any=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=i(n);if(g(t)&&!0===t)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0!==i(n))return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){if(!0===i(n))return!1}return!0}))},F.functions.reduce=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,3,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);return 2===e.length?0===u.length?null:u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null})):u.reduce(((n,t)=>{const r=i(n,t);return n=void 0!==r&&r!==c?r:null}),e[2])}))},F.functions.map=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=i(n);void 0!==t&&t!==c?a.push(t):a.push(null)}return a}))},F.functions.filter=function(n,t){return F.standardFunction(n,t,((t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){!0===i(n)&&a.push(n)}return a}))}),"async"===F.mode&&(F.functions.sort=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>N(n,r,e,!0)))},F.functions.any=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,g(r)&&!0===r)return!0}return!1}))},F.functions.all=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0!==r)return!1}return!0}))},F.functions.none=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r);for(const n of u){const t=await i(n);let r=null;if(r=h(r)?await t:t,!0===r)return!1}return!0}))},F.functions.filter=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,!0===r&&a.push(n)}return a}))},F.functions.reduce=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,3,n,r);const u=e[1].createFunction(n),a=p(e[0],n,r);let s;if(e.length>2){const n=i(e[2],null);s=a.reduce((async(n,t)=>{let r=await n;return void 0!==r&&r!==c||(r=null),u(r,t)}),Promise.resolve(n))}else{if(0===a.length)return null;s=a.reduce((async(n,t,r)=>{if(r<=1)return u(n,t);let e=await n;return void 0!==e&&e!==c||(e=null),u(e,t)}))}return s.then((n=>void 0!==n&&n!==c?n:null))}))},F.functions.map=function(n,t){return F.standardFunctionAsync(n,t,(async(t,r,e)=>{o(e,2,2,n,r);const i=e[1].createFunction(n),u=p(e[0],n,r),a=[];for(const n of u){const t=await i(n);let r=null;r=h(r)?await t:t,void 0!==r&&r!==c?a.push(r):a.push(null)}return a}))})}const p=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:F},Symbol.toStringTag,{value:"Module"}));export{p as A,F as r};
|
package/chunks/languageUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../config.js";import{version as t}from"../kernel.js";import{ArcadeDate as n,createDateTimeZone as r}from"../arcade/ArcadeDate.js";import{ArcadeModule as i}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as o,ExecutionErrorCodes as a}from"../arcade/executionError.js";import{ArcadeFunction as u}from"../arcade/FunctionWrapper.js";import s from"../arcade/ImmutableArray.js";import l from"../arcade/ImmutablePathArray.js";import f from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as c,layerGeometryEsriRestConstants as m}from"../arcade/featureset/support/shared.js";import{format as d,parse as y}from"../core/number.js";import{DateOnly as p}from"../core/sql/DateOnly.js";import{TimeOnly as g}from"../core/sql/TimeOnly.js";import h from"../geometry/Extent.js";import b from"../geometry/Geometry.js";import N from"../geometry/Multipoint.js";import S from"../geometry/Point.js";import Z from"../geometry/Polygon.js";import T from"../geometry/Polyline.js";import A from"../geometry/SpatialReference.js";import{isClockwise as k}from"../geometry/support/coordsUtils.js";import{fromJSON as j}from"../geometry/support/jsonUtils.js";import{getLocale as D}from"../intl/locale.js";import{isString as O,isNumber as C,isBoolean as x,isArray as F,isDate as w,isGraphic as J,isInteger as M}from"../support/guards.js";import{DateTime as R}from"luxon";class _{constructor(e){this.value=e}}class I{constructor(e){this.value=e}}const v={type:"VOID"},Y=Symbol("BREAK"),L=Symbol("CONTINUE");function P(e,t,n){return""===t||null==t||t===n||t===n?e:e=e.split(t).join(n)}function G(e){return e instanceof u}function V(e){return e instanceof i}function z(e){return!!O(e)||(!!C(e)||(!!ne(e)||(!!re(e)||(!!ie(e)||(!!x(e)||(null===e||(e===v||"number"==typeof e)))))))}function q(e,t){return void 0===e?t:e}function E(e){return null==e?"":F(e)||te(e)?"Array":ne(e)?"Date":ie(e)?"Time":re(e)?"DateOnly":O(e)?"String":x(e)?"Boolean":C(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":ee(e)?"KnowledgeGraph":e instanceof i?"Module":$(e)?"Feature":e instanceof S?"Point":e instanceof Z?"Polygon":e instanceof T?"Polyline":e instanceof N?"Multipoint":e instanceof h?"Extent":G(e)?"Function":K(e)?"FeatureSet":X(e)?"FeatureSetCollection":B(e)?"Voxel":e===v?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function U(e){return e===v}function H(e){return e instanceof b}function $(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function B(e){return"esri.arcade.Voxel"===e?.arcadeDeclaredClass}function K(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function W(e){return"esri.arcade.Dictionary"===e?.declaredClass}function Q(e){return W(e)||$(e)||B(e)}function X(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function ee(e){return"esri.rest.knowledgeGraph.KnowledgeGraph"===e?.declaredClass}function te(e){return e instanceof s}function ne(e){return e instanceof n}function re(e){return e instanceof p}function ie(e){return e instanceof g}function oe(e){return null!=e&&"object"==typeof e}function ae(e,t,n,r,i){if(e.length<t||e.length>n)throw new o(r,a.WrongNumberOfParameters,i)}function ue(e){return e<0?-Math.round(-e):Math.round(e)}function se(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=P(t,"‰",""),t=P(t,"¤",""),d(e,{pattern:t}))}function le(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(fe(t),{locale:D(),numberingSystem:"latn"})}function fe(e,t=!1){e=e.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let n="";const r=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const i of e.match(r)||[])switch(i){case"D":n+="d";break;case"DD":n+="dd";break;case"DDD":n+="o";break;case"d":n+="c";break;case"ddd":n+="ccc";break;case"dddd":n+="cccc";break;case"M":n+="L";break;case"MM":n+="LL";break;case"MMM":n+="LLL";break;case"MMMM":n+="LLLL";break;case"YY":n+="yy";break;case"Y":case"YYYY":n+="yyyy";break;case"Q":n+="q";break;case"Z":n+="Z";break;case"ZZ":n+="ZZ";break;case"ZZZ":n+="ZZZ";break;case"ZZZZ":n+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":n+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":n+="'S'";break;case"SS":n+="'SS'";break;case"SSS":n+="u";break;case"A":case"a":n+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":n+=i;break;default:i.length>=2&&"["===i.slice(0,1)&&"]"===i.slice(-1)?n+=`'${i.slice(1,-1)}'`:n+=`'${i}'`}return n}function ce(e,t,n){switch(n){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function me(e,t,r){if(null===e){if(null===t||t===v)return ce(null,null,r);if(C(t))return ce(0,t,r);if(O(t))return ce(0,Ne(t),r);if(x(t))return ce(0,Ne(t),r);if(ne(t))return ce(0,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}if(e===v){if(null===t||t===v)return ce(null,null,r);if(C(t))return ce(0,t,r);if(O(t))return ce(0,Ne(t),r);if(x(t))return ce(0,Ne(t),r);if(ne(t))return ce(0,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}else if(C(e)){if(C(t))return ce(e,t,r);if(x(t))return ce(e,Ne(t),r);if(null===t||t===v)return ce(e,0,r);if(O(t))return ce(e,Ne(t),r);if(ne(t))return ce(e,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}else if(O(e)){if(O(t))return ce(pe(e),pe(t),r);if(ne(t))return ce(Ne(e),t.toNumber(),r);if(ie(t))return ce(Ne(e),t.toNumber(),r);if(re(t))return ce(Ne(e),t.toNumber(),r);if(C(t))return ce(Ne(e),t,r);if(null===t||t===v)return ce(Ne(e),0,r);if(x(t))return ce(Ne(e),Ne(t),r)}else if(ne(e)){if(ne(t))return e.timeZone!==t.timeZone&&(e.isUnknownTimeZone?e=n.arcadeDateAndZoneToArcadeDate(e,t.timeZone):t.isUnknownTimeZone&&(t=n.arcadeDateAndZoneToArcadeDate(t,e.timeZone))),ce(e.toNumber(),t.toNumber(),r);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))throw new o(null,a.CannotCompareDateAndTime,null);if(re(t))return ce(e.toNumber(),t.toNumber(),r)}else if(x(e)){if(x(t))return ce(e,t,r);if(C(t))return ce(Ne(e),Ne(t),r);if(ne(t))return ce(Ne(e),t.toNumber(),r);if(ie(t))return ce(Ne(e),t.toNumber(),r);if(re(t))return ce(Ne(e),t.toNumber(),r);if(null===t||t===v)return ce(Ne(e),0,r);if(O(t))return ce(Ne(e),Ne(t),r)}else if(re(e)){if(ne(t))return ce(e.toNumber(),t.toNumber(),r);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))throw new o(null,a.CannotCompareDateAndTime,null);if(re(t))return ce(e.toNumber(),t.toNumber(),r)}else if(ie(e)){if(ne(t))throw new o(null,a.CannotCompareDateAndTime,null);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))return ce(e.toNumber(),t.toNumber(),r);if(re(t))throw new o(null,a.CannotCompareDateAndTime,null)}return!!de(e,t)&&("<="===r||">="===r)}function de(e,t){if(e===t)return!0;if(null===e&&t===v||null===t&&e===v)return!0;if(ne(e)&&ne(t))return e.equals(t);if(ie(e)&&ie(t))return e.equals(t);if(re(e)&&re(t))return e.equals(t);if(e instanceof l)return e.equalityTest(t);if(e instanceof f)return e.equalityTest(t);if(e instanceof S&&t instanceof S){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(null!=n)return n===r}if(oe(e)&&oe(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function ye(e,{useNumbersForDates:t}){let n="";for(const r in e){""!==n&&(n+=",");const i=e[r];null==i?n+=JSON.stringify(r)+":null":x(i)||C(i)||O(i)?n+=JSON.stringify(r)+":"+JSON.stringify(i):H(i)?n+=JSON.stringify(r)+":"+he(i):ie(i)||re(i)?n+=`${JSON.stringify(r)}:${JSON.stringify(i.toString())}`:te(i)||Array.isArray(i)?n+=JSON.stringify(r)+":"+he(i,null,t):ne(i)?n+=t?JSON.stringify(r)+":"+JSON.stringify(i.getTime()):JSON.stringify(r)+":"+i.stringify():null!==i&&"object"==typeof i&&"castToText"in i&&(n+=JSON.stringify(r)+":"+i.castToText(t))}return"{"+n+"}"}function pe(e,t){if(O(e))return e;if(null===e)return"";if(C(e))return se(e,t);if(x(e))return e.toString();if(ne(e))return le(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof b)return JSON.stringify(e.toJSON());if(F(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=be(e[n]);return"["+t.join(",")+"]"}if(e instanceof s){const t=[];for(let n=0;n<e.length();n++)t[n]=be(e.get(n));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText():G(e)?"object, Function":e===v?"":V(e)?"object, Module":""}function ge(e){const t=[];if(e instanceof s){for(let n=0;n<e.length();n++)t[n]=Ne(e.get(n));return t}if(!F(e))return null;for(let n=0;n<e.length;n++)t[n]=Ne(e[n]);return t}function he(e,t,n=!1){if(O(e))return e;if(null===e)return"";if(C(e))return se(e,t);if(x(e))return e.toString();if(ne(e))return le(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof b)return e instanceof h?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Fe(e.spatialReference)+"}":Fe(e.toJSON(),((e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0));if(F(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=be(e[r],n);return"["+t.join(",")+"]"}if(e instanceof s){const t=[];for(let r=0;r<e.length();r++)t[r]=be(e.get(r),n);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText(n):G(e)?"object, Function":e===v?"":V(e)?"object, Module":""}function be(e,t=!1){if(null===e)return"null";if(x(e)||C(e)||O(e))return JSON.stringify(e);if(e instanceof b)return he(e,null,t);if(e instanceof s)return he(e,null,t);if(Array.isArray(e))return he(e,null,t);if(ne(e))return t?JSON.stringify(e.getTime()):JSON.stringify(le(e,""));if(ie(e))return JSON.stringify(e.toString());if(re(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if("castToText"in e)return e.castToText(t)}else if(e===v)return"null";return"null"}function Ne(e,t){return C(e)?e:null===e||""===e?0:ne(e)||re(e)||ie(e)?NaN:x(e)?e?1:0:F(e)||""===e||void 0===e?NaN:void 0!==t&&O(e)?(t=P(t,"‰",""),t=P(t,"¤",""),y(e,{pattern:t})):e===v?0:Number(e)}function Se(e,t){if(ne(e))return e;if(O(e)){const r=Ze(e,t);if(r)return n.dateTimeToArcadeDate(r)}return null}function Ze(e,t){const n=/ (\d\d)/,i=r(t);let o=R.fromISO(e,{zone:i});return o.isValid||n.test(e)&&(e=e.replace(n,"T$1"),o=R.fromISO(e,{zone:t}),o.isValid)?o:null}function Te(e){return x(e)?e:O(e)?"true"===(e=e.toLowerCase()):!!C(e)&&(0!==e&&!isNaN(e))}function Ae(e,t){const n=JSON.parse(e);return n&&!n.spatialReference&&(n.spatialReference=t),j(n)}function ke(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function je(e){if(null===e)return null;if(e instanceof S)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof Z){if(0===e.rings.length)return null;for(const t of e.rings)if(t.length>0)return e;return null}if(e instanceof T){if(0===e.paths.length)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof N?0===e.points.length?null:e:e instanceof h?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function De(e,t){if(!e)return t;if(!e.domain)return t;let n=null,r=null;if(ne(t))n=t.toNumber();else if(re(t))n=t.toString();else if(ie(t))n=t.toStorageString();else if("string"===e.field.type||"esriFieldTypeString"===e.field.type)n=pe(t);else{if(null==t)return null;if(""===t)return t;n=Ne(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===n&&(r=t)}return null===r?pe(t):r.name}function Oe(e,t){if(!e)return t;if(!e.domain)return t;let n=null;const r=pe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===r&&(n=t)}return null===n?t:n.code}function Ce(e,t,n=null,r=null){if(!t)return null;if(!t.fields)return null;let i,u,s=null;for(let o=0;o<t.fields.length;o++){const n=t.fields[o];n.name.toLowerCase()===e.toString().toLowerCase()&&(s=n)}if(null===s)throw new o(null,a.FieldNotFound,null,{key:e});let l=t.typeIdField,f="id",c=t.types;if(t.subtypeField&&(l=t.subtypeField,f="code",c=t.subtypes??[]),null===r&&n&&l)r=n.hasField(l)?n.field(l):null;else if(l&&null!==r){let e=!1;for(const t of c||[])if(r===t[f]){e=!0;break}if(!e)for(const t of c||[])if(r===t.name){r=t[f],e=!0;break}e||(r=null,n&&l&&(r=n.hasField(l)?n.field(l):null))}return null!=r&&c.some((e=>e[f]===r&&(i=e.domains?.[s.name],i&&"inherited"===i.type&&(i=xe(s.name,t),u=!0),!0))),u||i||(i=xe(e,t)),{field:s,domain:i}}function xe(e,t){let n;return t.fields.some((t=>(t.name.toLowerCase()===e.toLowerCase()&&(n=t.domain),!!n))),n}function Fe(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const n="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(i=t.cmp,function(e){return function(t,n){const r={key:t,value:e[t]},o={key:n,value:e[n]};return i(r,o)}});var i;const o=[];return function e(t){if(t?.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,a;if(Array.isArray(t)){for(a="[",i=0;i<t.length;i++)i&&(a+=","),a+=e(t[i])||"null";return a+"]"}if(null===t)return"null";if(o.includes(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=o.push(t)-1,s=Object.keys(t).sort(r?.(t));for(a="",i=0;i<s.length;i++){const n=s[i],r=e(t[n]);r&&(a&&(a+=","),a+=JSON.stringify(n)+":"+r)}return o.splice(u,1),"{"+a+"}"}(e)}function we(e){if(null===e)return null;const t=[];for(const n of e)$(n)?t.push(n.geometry()):t.push(n);return t}function Je(e,t){if(!(t instanceof S))throw new o(null,a.InvalidParameter,null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Me(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],u=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!te(e))throw new o(null,a.InvalidParameter,null);for(const t of e.toArray())Je(i,t);i.length>0&&(u=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}if(0===i.length)return null;return k(i)||(i=i.slice().reverse()),new Z({rings:[i],spatialReference:u,hasZ:n,hasM:r})}return e}function Re(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],o=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(o=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,o=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(o=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new T({paths:[i],spatialReference:o,hasZ:n,hasM:r})}return e}function _e(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],o=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(o=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,o=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(o=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new N({points:i,spatialReference:o,hasZ:n,hasM:r})}return e}function Ie(e,t=!1){const n=[];if(null===e)return n;if(!0===F(e)){for(let r=0;r<e.length;r++){const i=pe(e[r]);""===i&&!0!==t||n.push(i)}return n}if(e instanceof s){for(let r=0;r<e.length();r++){const i=pe(e.get(r));""===i&&!0!==t||n.push(i)}return n}if(z(e)){const r=pe(e);return""===r&&!0!==t||n.push(r),n}return[]}let ve=0;function Ye(e){return ve++,ve%100==0?(ve=0,new Promise((t=>{setTimeout((()=>{t(e)}),0)}))):e}function Le(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function Pe(e,t=null){return null==e?null:x(e)||C(e)||O(e)?e:e instanceof b?!0===t?.keepGeometryType?e:e.toJSON():e instanceof s?e.toArray().map((e=>Pe(e,t))):Array.isArray(e)?e.map((e=>Pe(e,t))):w(e)?e:ne(e)?e.toJSDate():ie(e)?e.toString():re(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function Ge(e,t,n,r,i){const o=await Ve(e,t,n);i[r]=o}async function Ve(e,t=null,n=null){if(e instanceof s&&(e=e.toArray()),null==e)return null;if(z(e)||e instanceof b||w(e)||ne(e))return Pe(e,n);if(Array.isArray(e)){const r=[],i=[];for(const o of e)null===o||z(o)||o instanceof b||w(o)||ne(o)?i.push(Pe(o,n)):(i.push(null),r.push(Ge(o,t,n,i.length-1,i)));return r.length>0&&await Promise.all(r),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,n):null}function ze(e){return qe(e)?e.parent:e}function qe(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ee(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ue(e,t,n){const r=ze(e.fullSchema());if(null===r)return null;if(!r.fields)return null;return Ce(t,r,e,n)}function He(e){const t=ze(e.fullSchema());return null===t?null:t.fields?t.subtypeField?{subtypeField:t.subtypeField,subtypes:t.subtypes?t.subtypes.map((e=>({name:e.name,code:e.code}))):[]}:t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map((e=>({name:e.name,code:e.id}))):[]}:null:null}function $e(e,t,n,r){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const o=Ce(t,i,e,r);if(void 0===n)try{n=e.field(t)}catch(a){return null}return De(o,n)}function Be(e,t,n,r){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===n){try{n=e.field(t)}catch(o){return null}return n}return Oe(Ce(t,i,e,r),n)}function Ke(e){return e?.timeZone??"system"}function We(e){const t=ze(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const n=[];for(const r of t.fields)n.push(c(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===m[t.geometryType]?"":m[t.geometryType],fields:n}}function Qe(r,i){const o=n.systemTimeZoneCanonicalName;return"system"===r&&(r=o),{version:Xe,engineVersion:t,timeZone:r,userTimeZone:o,spatialReference:i instanceof A?i.toJSON():i,application:e.applicationName??"",engine:"web",locale:D()}}const Xe="1.30",et=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:I,ReturnResult:_,absRound:ue,arcadeVersion:Xe,autoCastArrayOfPointsToMultiPoint:_e,autoCastArrayOfPointsToPolygon:Me,autoCastArrayOfPointsToPolyline:Re,autoCastFeatureToGeometry:we,binaryOperator:Le,breakResult:Y,castAsJson:Pe,castAsJsonAsync:Ve,castRecordToText:ye,continueResult:L,defaultExecutingContext:Qe,defaultTimeZone:Ke,defaultUndefined:q,equalityTest:de,featureDomainCodeLookup:Be,featureDomainValueLookup:$e,featureFullDomain:Ue,featureSchema:We,featureSubtypes:He,fixNullGeometry:je,fixSpatialReference:ke,formatDate:le,formatNumber:se,getDomain:Ce,getDomainCode:Oe,getDomainValue:De,getType:E,greaterThanLessThan:me,isArray:F,isBoolean:x,isDate:ne,isDateOnly:re,isDictionary:W,isDictionaryLike:Q,isFeature:$,isFeatureSet:K,isFeatureSetCollection:X,isFunctionParameter:G,isGeometry:H,isGraphic:J,isImmutableArray:te,isInteger:M,isJsDate:w,isKnowledgeGraph:ee,isModule:V,isNumber:C,isObject:oe,isSimpleType:z,isString:O,isSubtypeGrouplayer:Ee,isSubtypeSublayer:qe,isTime:ie,isVoid:U,isVoxel:B,multiReplace:P,parseGeometryFromJson:Ae,pcCheck:ae,stableStringify:Fe,standardiseDateFormat:fe,tick:Ye,toBoolean:Te,toDate:Se,toNumber:Ne,toNumberArray:ge,toString:pe,toStringArray:Ie,toStringExplicit:he,voidOperation:v},Symbol.toStringTag,{value:"Module"}));export{Ye as $,me as A,de as B,Le as C,ae as D,U as E,we as F,Me as G,Re as H,I,_e as J,q as K,Ke as L,E as M,fe as N,ue as O,Ue as P,Be as Q,_ as R,$e as S,We as T,He as U,je as V,B as W,P as X,Qe as Y,ge as Z,qe as _,Pe as a,Ie as a0,Ce as a1,De as a2,Oe as a3,V as a4,oe as a5,se as a6,le as a7,Ae as a8,Fe as a9,Ee as aa,Xe as ab,Ve as b,ye as c,z as d,Te as e,pe as f,ne as g,Se as h,G as i,re as j,ie as k,H as l,te as m,$ as n,X as o,K as p,W as q,ee as r,he as s,Ne as t,ke as u,et as v,v as w,Y as x,L as y,Q as z};
|
|
5
|
+
import e from"../config.js";import{version as t}from"../kernel.js";import{ArcadeDate as n,createDateTimeZone as r}from"../arcade/ArcadeDate.js";import{ArcadeModule as i}from"../arcade/ArcadeModule.js";import{ArcadeExecutionError as o,ExecutionErrorCodes as a}from"../arcade/executionError.js";import{ArcadeFunction as u}from"../arcade/FunctionWrapper.js";import s from"../arcade/ImmutableArray.js";import l from"../arcade/ImmutablePathArray.js";import f from"../arcade/ImmutablePointArray.js";import{esriFieldToJson as c,layerGeometryEsriRestConstants as m}from"../arcade/featureset/support/shared.js";import{format as d,parse as y}from"../core/number.js";import{DateOnly as p}from"../core/sql/DateOnly.js";import{TimeOnly as g}from"../core/sql/TimeOnly.js";import h from"../geometry/Extent.js";import b from"../geometry/Geometry.js";import N from"../geometry/Multipoint.js";import S from"../geometry/Point.js";import Z from"../geometry/Polygon.js";import T from"../geometry/Polyline.js";import A from"../geometry/SpatialReference.js";import{isClockwise as k}from"../geometry/support/coordsUtils.js";import{fromJSON as j}from"../geometry/support/jsonUtils.js";import{getLocale as D}from"../intl/locale.js";import{isString as O,isNumber as C,isBoolean as x,isArray as F,isDate as w,isGraphic as J,isInteger as M}from"../support/guards.js";import{DateTime as R}from"luxon";class _{constructor(e){this.value=e}}class I{constructor(e){this.value=e}}const v={type:"VOID"},Y=Symbol("BREAK"),L=Symbol("CONTINUE");function P(e,t,n){return""===t||null==t||t===n||t===n?e:e=e.split(t).join(n)}function G(e){return e instanceof u}function V(e){return e instanceof i}function z(e){return!!O(e)||(!!C(e)||(!!ne(e)||(!!re(e)||(!!ie(e)||(!!x(e)||(null===e||(e===v||"number"==typeof e)))))))}function q(e,t){return void 0===e?t:e}function E(e){return null==e?"":F(e)||te(e)?"Array":ne(e)?"Date":ie(e)?"Time":re(e)?"DateOnly":O(e)?"String":x(e)?"Boolean":C(e)?"Number":"esri.arcade.Attachment"===e?.declaredClass?"Attachment":"esri.arcade.Portal"===e?.declaredClass?"Portal":"esri.arcade.Dictionary"===e?.declaredClass?"Dictionary":ee(e)?"KnowledgeGraph":e instanceof i?"Module":$(e)?"Feature":e instanceof S?"Point":e instanceof Z?"Polygon":e instanceof T?"Polyline":e instanceof N?"Multipoint":e instanceof h?"Extent":G(e)?"Function":K(e)?"FeatureSet":X(e)?"FeatureSetCollection":B(e)?"Voxel":e===v?"":"number"==typeof e&&isNaN(e)?"Number":"Unrecognized Type"}function U(e){return e===v}function H(e){return e instanceof b}function $(e){return"esri.arcade.Feature"===e?.arcadeDeclaredClass}function B(e){return"esri.arcade.Voxel"===e?.arcadeDeclaredClass}function K(e){return"esri.arcade.featureset.support.FeatureSet"===e?.declaredRootClass}function W(e){return"esri.arcade.Dictionary"===e?.declaredClass}function Q(e){return W(e)||$(e)||B(e)}function X(e){return"esri.arcade.featureSetCollection"===e?.declaredRootClass}function ee(e){return"esri.rest.knowledgeGraph.KnowledgeGraph"===e?.declaredClass}function te(e){return e instanceof s}function ne(e){return e instanceof n}function re(e){return e instanceof p}function ie(e){return e instanceof g}function oe(e){return null!=e&&"object"==typeof e}function ae(e,t,n,r,i){if(e.length<t||e.length>n)throw new o(r,a.WrongNumberOfParameters,i)}function ue(e){return e<0?-Math.round(-e):Math.round(e)}function se(e,t){return isNaN(e)||null==t||""===t?e.toString():(t=P(t,"‰",""),t=P(t,"¤",""),d(e,{pattern:t}))}function le(e,t){return null==t||""===t?e.toISOString(!0):e.toFormat(fe(t),{locale:D(),numberingSystem:"latn"})}function fe(e,t=!1){e=e.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$&]");let n="";const r=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g;for(const i of e.match(r)||[])switch(i){case"D":n+="d";break;case"DD":n+="dd";break;case"DDD":n+="o";break;case"d":n+="c";break;case"ddd":n+="ccc";break;case"dddd":n+="cccc";break;case"M":n+="L";break;case"MM":n+="LL";break;case"MMM":n+="LLL";break;case"MMMM":n+="LLLL";break;case"YY":n+="yy";break;case"Y":case"YYYY":n+="yyyy";break;case"Q":n+="q";break;case"Z":n+="Z";break;case"ZZ":n+="ZZ";break;case"ZZZ":n+="ZZZ";break;case"ZZZZ":n+=t?"[ZZZZ]":"ZZZZ";break;case"ZZZZZ":n+=t?"[ZZZZZ]":"ZZZZZ";break;case"S":n+="'S'";break;case"SS":n+="'SS'";break;case"SSS":n+="u";break;case"A":case"a":n+="a";break;case"m":case"mm":case"h":case"hh":case"H":case"HH":case"s":case"ss":case"X":case"x":n+=i;break;default:i.length>=2&&"["===i.slice(0,1)&&"]"===i.slice(-1)?n+=`'${i.slice(1,-1)}'`:n+=`'${i}'`}return n}function ce(e,t,n){switch(n){case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}return!1}function me(e,t,r){if(null===e){if(null===t||t===v)return ce(null,null,r);if(C(t))return ce(0,t,r);if(O(t))return ce(0,Ne(t),r);if(x(t))return ce(0,Ne(t),r);if(ne(t))return ce(0,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}if(e===v){if(null===t||t===v)return ce(null,null,r);if(C(t))return ce(0,t,r);if(O(t))return ce(0,Ne(t),r);if(x(t))return ce(0,Ne(t),r);if(ne(t))return ce(0,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}else if(C(e)){if(C(t))return ce(e,t,r);if(x(t))return ce(e,Ne(t),r);if(null===t||t===v)return ce(e,0,r);if(O(t))return ce(e,Ne(t),r);if(ne(t))return ce(e,t.toNumber(),r);if(ie(t))return ce(e,t.toNumber(),r);if(re(t))return ce(e,t.toNumber(),r)}else if(O(e)){if(O(t))return ce(pe(e),pe(t),r);if(ne(t))return ce(Ne(e),t.toNumber(),r);if(ie(t))return ce(Ne(e),t.toNumber(),r);if(re(t))return ce(Ne(e),t.toNumber(),r);if(C(t))return ce(Ne(e),t,r);if(null===t||t===v)return ce(Ne(e),0,r);if(x(t))return ce(Ne(e),Ne(t),r)}else if(ne(e)){if(ne(t))return e.timeZone!==t.timeZone&&(e.isUnknownTimeZone?e=n.arcadeDateAndZoneToArcadeDate(e,t.timeZone):t.isUnknownTimeZone&&(t=n.arcadeDateAndZoneToArcadeDate(t,e.timeZone))),ce(e.toNumber(),t.toNumber(),r);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))throw new o(null,a.CannotCompareDateAndTime,null);if(re(t))return ce(e.toNumber(),t.toNumber(),r)}else if(x(e)){if(x(t))return ce(e,t,r);if(C(t))return ce(Ne(e),Ne(t),r);if(ne(t))return ce(Ne(e),t.toNumber(),r);if(ie(t))return ce(Ne(e),t.toNumber(),r);if(re(t))return ce(Ne(e),t.toNumber(),r);if(null===t||t===v)return ce(Ne(e),0,r);if(O(t))return ce(Ne(e),Ne(t),r)}else if(re(e)){if(ne(t))return ce(e.toNumber(),t.toNumber(),r);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))throw new o(null,a.CannotCompareDateAndTime,null);if(re(t))return ce(e.toNumber(),t.toNumber(),r)}else if(ie(e)){if(ne(t))throw new o(null,a.CannotCompareDateAndTime,null);if(null===t||t===v)return ce(e.toNumber(),0,r);if(C(t))return ce(e.toNumber(),t,r);if(x(t))return ce(e.toNumber(),Ne(t),r);if(O(t))return ce(e.toNumber(),Ne(t),r);if(ie(t))return ce(e.toNumber(),t.toNumber(),r);if(re(t))throw new o(null,a.CannotCompareDateAndTime,null)}return!!de(e,t)&&("<="===r||">="===r)}function de(e,t){if(e===t)return!0;if(null===e&&t===v||null===t&&e===v)return!0;if(ne(e)&&ne(t))return e.equals(t);if(ie(e)&&ie(t))return e.equals(t);if(re(e)&&re(t))return e.equals(t);if(e instanceof l)return e.equalityTest(t);if(e instanceof f)return e.equalityTest(t);if(e instanceof S&&t instanceof S){const n=e.cache._arcadeCacheId,r=t.cache._arcadeCacheId;if(null!=n)return n===r}if(oe(e)&&oe(t)){if(e._arcadeCacheId===t._arcadeCacheId&&void 0!==e._arcadeCacheId&&null!==e._arcadeCacheId)return!0;if(e._underlyingGraphic===t._underlyingGraphic&&void 0!==e._underlyingGraphic&&null!==e._underlyingGraphic)return!0}return!1}function ye(e,{useNumbersForDates:t}){let n="";for(const r in e){""!==n&&(n+=",");const i=e[r];null==i?n+=JSON.stringify(r)+":null":x(i)||C(i)||O(i)?n+=JSON.stringify(r)+":"+JSON.stringify(i):H(i)?n+=JSON.stringify(r)+":"+he(i):ie(i)||re(i)?n+=`${JSON.stringify(r)}:${JSON.stringify(i.toString())}`:te(i)||Array.isArray(i)?n+=JSON.stringify(r)+":"+he(i,null,t):ne(i)?n+=t?JSON.stringify(r)+":"+JSON.stringify(i.getTime()):JSON.stringify(r)+":"+i.stringify():null!==i&&"object"==typeof i&&"castToText"in i&&(n+=JSON.stringify(r)+":"+i.castToText(t))}return"{"+n+"}"}function pe(e,t){if(O(e))return e;if(null===e)return"";if(C(e))return se(e,t);if(x(e))return e.toString();if(ne(e))return le(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof b)return JSON.stringify(e.toJSON());if(F(e)){const t=[];for(let n=0;n<e.length;n++)t[n]=be(e[n]);return"["+t.join(",")+"]"}if(e instanceof s){const t=[];for(let n=0;n<e.length();n++)t[n]=be(e.get(n));return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText():G(e)?"object, Function":e===v?"":V(e)?"object, Module":""}function ge(e){const t=[];if(e instanceof s){for(let n=0;n<e.length();n++)t[n]=Ne(e.get(n));return t}if(!F(e))return null;for(let n=0;n<e.length;n++)t[n]=Ne(e[n]);return t}function he(e,t,n=!1){if(O(e))return e;if(null===e)return"";if(C(e))return se(e,t);if(x(e))return e.toString();if(ne(e))return le(e,t);if(ie(e))return e.toFormat(t);if(re(e))return e.toFormat(t);if(e instanceof b)return e instanceof h?'{"xmin":'+e.xmin.toString()+',"ymin":'+e.ymin.toString()+","+(e.hasZ?'"zmin":'+e.zmin.toString()+",":"")+(e.hasM?'"mmin":'+e.mmin.toString()+",":"")+'"xmax":'+e.xmax.toString()+',"ymax":'+e.ymax.toString()+","+(e.hasZ?'"zmax":'+e.zmax.toString()+",":"")+(e.hasM?'"mmax":'+e.mmax.toString()+",":"")+'"spatialReference":'+Fe(e.spatialReference)+"}":Fe(e.toJSON(),((e,t)=>e.key===t.key?0:"spatialReference"===e.key?1:"spatialReference"===t.key||e.key<t.key?-1:e.key>t.key?1:0));if(F(e)){const t=[];for(let r=0;r<e.length;r++)t[r]=be(e[r],n);return"["+t.join(",")+"]"}if(e instanceof s){const t=[];for(let r=0;r<e.length();r++)t[r]=be(e.get(r),n);return"["+t.join(",")+"]"}return null!==e&&"object"==typeof e&&"castToText"in e?e.castToText(n):G(e)?"object, Function":e===v?"":V(e)?"object, Module":""}function be(e,t=!1){if(null===e)return"null";if(x(e)||C(e)||O(e))return JSON.stringify(e);if(e instanceof b)return he(e,null,t);if(e instanceof s)return he(e,null,t);if(Array.isArray(e))return he(e,null,t);if(ne(e))return t?JSON.stringify(e.getTime()):JSON.stringify(le(e,""));if(ie(e))return JSON.stringify(e.toString());if(re(e))return JSON.stringify(e.toString());if(null!==e&&"object"==typeof e){if("castToText"in e)return e.castToText(t)}else if(e===v)return"null";return"null"}function Ne(e,t){return C(e)?e:null===e||""===e?0:ne(e)||re(e)||ie(e)?NaN:x(e)?e?1:0:F(e)||""===e||void 0===e?NaN:void 0!==t&&O(e)?(t=P(t,"‰",""),t=P(t,"¤",""),y(e,{pattern:t})):e===v?0:Number(e)}function Se(e,t){if(ne(e))return e;if(O(e)){const r=Ze(e,t);if(r)return n.dateTimeToArcadeDate(r)}return null}function Ze(e,t){const n=/ (\d\d)/,i=r(t);let o=R.fromISO(e,{zone:i});return o.isValid||n.test(e)&&(e=e.replace(n,"T$1"),o=R.fromISO(e,{zone:t}),o.isValid)?o:null}function Te(e){return x(e)?e:O(e)?"true"===(e=e.toLowerCase()):!!C(e)&&(0!==e&&!isNaN(e))}function Ae(e,t){const n=JSON.parse(e);return n&&!n.spatialReference&&(n.spatialReference=t),j(n)}function ke(e,t){return null==e?null:(null!==e.spatialReference&&void 0!==e.spatialReference||(e.spatialReference=t),e)}function je(e){if(null===e)return null;if(e instanceof S)return"NaN"===e.x||null===e.x||isNaN(e.x)?null:e;if(e instanceof Z){if(0===e.rings.length)return null;for(const t of e.rings)if(t.length>0)return e;return null}if(e instanceof T){if(0===e.paths.length)return null;for(const t of e.paths)if(t.length>0)return e;return null}return e instanceof N?0===e.points.length?null:e:e instanceof h?"NaN"===e.xmin||null===e.xmin||isNaN(e.xmin)?null:e:null}function De(e,t){if(!e)return t;if(!e.domain)return t;let n=null,r=null;if(ne(t))n=t.toNumber();else if(re(t))n=t.toString();else if(ie(t))n=t.toStorageString();else if("string"===e.field.type||"esriFieldTypeString"===e.field.type)n=pe(t);else{if(null==t)return null;if(""===t)return t;n=Ne(t)}for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.code===n&&(r=t)}return null===r?pe(t):r.name}function Oe(e,t){if(!e)return t;if(!e.domain)return t;let n=null;const r=pe(t);for(let i=0;i<e.domain.codedValues.length;i++){const t=e.domain.codedValues[i];t.name===r&&(n=t)}return null===n?t:n.code}function Ce(e,t,n=null,r=null){if(!t)return null;if(!t.fields)return null;let i,u,s=null;for(let o=0;o<t.fields.length;o++){const n=t.fields[o];n.name.toLowerCase()===e.toString().toLowerCase()&&(s=n)}if(null===s)throw new o(null,a.FieldNotFound,null,{key:e});let l=t.typeIdField,f="id",c=t.types;if(t.subtypeField&&(l=t.subtypeField,f="code",c=t.subtypes??[]),null===r&&n&&l)r=n.hasField(l)?n.field(l):null;else if(l&&null!==r){let e=!1;for(const t of c||[])if(r===t[f]){e=!0;break}if(!e)for(const t of c||[])if(r===t.name){r=t[f],e=!0;break}e||(r=null,n&&l&&(r=n.hasField(l)?n.field(l):null))}return null!=r&&c.some((e=>e[f]===r&&(i=e.domains?.[s.name],i&&"inherited"===i.type&&(i=xe(s.name,t),u=!0),!0))),u||i||(i=xe(e,t)),{field:s,domain:i}}function xe(e,t){let n;return t.fields.some((t=>(t.name.toLowerCase()===e.toLowerCase()&&(n=t.domain),!!n))),n}function Fe(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});const n="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(i=t.cmp,function(e){return function(t,n){const r={key:t,value:e[t]},o={key:n,value:e[n]};return i(r,o)}});var i;const o=[];return function e(t){if(t?.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===t)return;if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);let i,a;if(Array.isArray(t)){for(a="[",i=0;i<t.length;i++)i&&(a+=","),a+=e(t[i])||"null";return a+"]"}if(null===t)return"null";if(o.includes(t)){if(n)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}const u=o.push(t)-1,s=Object.keys(t).sort(r?.(t));for(a="",i=0;i<s.length;i++){const n=s[i],r=e(t[n]);r&&(a&&(a+=","),a+=JSON.stringify(n)+":"+r)}return o.splice(u,1),"{"+a+"}"}(e)}function we(e){if(null===e)return null;const t=[];for(const n of e)$(n)?t.push(n.geometry()):t.push(n);return t}function Je(e,t){if(!(t instanceof S))throw new o(null,a.InvalidParameter,null);e.push(t.hasZ?t.hasM?[t.x,t.y,t.z,t.m]:[t.x,t.y,t.z]:[t.x,t.y])}function Me(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],u=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(u=e[0].spatialReference,n=e[0].hasZ,r=e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,u=e.get(0).spatialReference);else{if(!te(e))throw new o(null,a.InvalidParameter,null);for(const t of e.toArray())Je(i,t);i.length>0&&(u=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}if(0===i.length)return null;return k(i)||(i=i.slice().reverse()),new Z({rings:[i],spatialReference:u,hasZ:n,hasM:r})}return e}function Re(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],o=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(o=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,o=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(o=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new T({paths:[i],spatialReference:o,hasZ:n,hasM:r})}return e}function _e(e,t){if(F(e)||te(e)){let n=!1,r=!1,i=[],o=t;if(F(e)){for(const t of e)Je(i,t);i.length>0&&(o=e[0].spatialReference,n=!0===e[0].hasZ,r=!0===e[0].hasM)}else if(e instanceof f)i=e._elements,i.length>0&&(n=e._hasZ,r=e._hasM,o=e.get(0).spatialReference);else if(te(e)){for(const t of e.toArray())Je(i,t);i.length>0&&(o=e.get(0).spatialReference,n=!0===e.get(0).hasZ,r=!0===e.get(0).hasM)}return 0===i.length?null:new N({points:i,spatialReference:o,hasZ:n,hasM:r})}return e}function Ie(e,t=!0){if(null==e)return[];if(F(e)){const n=[];for(const r of e){const e=pe(r);(t||""!==e)&&n.push(e)}return n}if(te(e)){const n=[];for(let r=0;r<e.length();r++){const i=pe(e.get(r));(t||""!==i)&&n.push(i)}return n}if(z(e)){const n=pe(e);if(t||""!==n)return[n]}return[]}let ve=0;function Ye(e){return ve++,ve%100==0?(ve=0,new Promise((t=>{setTimeout((()=>{t(e)}),0)}))):e}function Le(e,t,n){switch(n){case"&":return e&t;case"|":return e|t;case"^":return e^t;case"<<":return e<<t;case">>":return e>>t;case">>>":return e>>>t}}function Pe(e,t=null){return null==e?null:x(e)||C(e)||O(e)?e:e instanceof b?!0===t?.keepGeometryType?e:e.toJSON():e instanceof s?e.toArray().map((e=>Pe(e,t))):Array.isArray(e)?e.map((e=>Pe(e,t))):w(e)?e:ne(e)?e.toJSDate():ie(e)?e.toString():re(e)?e.toJSDate():null!==e&&"object"==typeof e&&void 0!==e.castAsJson?e.castAsJson(t):null}async function Ge(e,t,n,r,i){const o=await Ve(e,t,n);i[r]=o}async function Ve(e,t=null,n=null){if(e instanceof s&&(e=e.toArray()),null==e)return null;if(z(e)||e instanceof b||w(e)||ne(e))return Pe(e,n);if(Array.isArray(e)){const r=[],i=[];for(const o of e)null===o||z(o)||o instanceof b||w(o)||ne(o)?i.push(Pe(o,n)):(i.push(null),r.push(Ge(o,t,n,i.length-1,i)));return r.length>0&&await Promise.all(r),i}return null!==e&&"object"==typeof e&&void 0!==e.castAsJsonAsync?e.castAsJsonAsync(t,n):null}function ze(e){return qe(e)?e.parent:e}function qe(e){return e&&"declaredClass"in e&&"esri.layers.support.SubtypeSublayer"===e.declaredClass}function Ee(e){return e&&"declaredClass"in e&&"esri.layers.SubtypeGroupLayer"===e.declaredClass}function Ue(e,t,n){const r=ze(e.fullSchema());if(null===r)return null;if(!r.fields)return null;return Ce(t,r,e,n)}function He(e){const t=ze(e.fullSchema());return null===t?null:t.fields?t.subtypeField?{subtypeField:t.subtypeField,subtypes:t.subtypes?t.subtypes.map((e=>({name:e.name,code:e.code}))):[]}:t.typeIdField?{subtypeField:t.typeIdField,subtypes:t.types?t.types.map((e=>({name:e.name,code:e.id}))):[]}:null:null}function $e(e,t,n,r){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;const o=Ce(t,i,e,r);if(void 0===n)try{n=e.field(t)}catch(a){return null}return De(o,n)}function Be(e,t,n,r){const i=ze(e.fullSchema());if(null===i)return null;if(!i.fields)return null;if(void 0===n){try{n=e.field(t)}catch(o){return null}return n}return Oe(Ce(t,i,e,r),n)}function Ke(e){return e?.timeZone??"system"}function We(e){const t=ze(e.fullSchema());if(null===t)return null;if(!t.fields)return null;const n=[];for(const r of t.fields)n.push(c(r));return{objectIdField:t.objectIdField,globalIdField:t.globalIdField??"",geometryType:void 0===m[t.geometryType]?"":m[t.geometryType],fields:n}}function Qe(r,i){const o=n.systemTimeZoneCanonicalName;return"system"===r&&(r=o),{version:Xe,engineVersion:t,timeZone:r,userTimeZone:o,spatialReference:i instanceof A?i.toJSON():i,application:e.applicationName??"",engine:"web",locale:D()}}const Xe="1.30",et=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResult:I,ReturnResult:_,absRound:ue,arcadeVersion:Xe,autoCastArrayOfPointsToMultiPoint:_e,autoCastArrayOfPointsToPolygon:Me,autoCastArrayOfPointsToPolyline:Re,autoCastFeatureToGeometry:we,binaryOperator:Le,breakResult:Y,castAsJson:Pe,castAsJsonAsync:Ve,castRecordToText:ye,continueResult:L,defaultExecutingContext:Qe,defaultTimeZone:Ke,defaultUndefined:q,equalityTest:de,featureDomainCodeLookup:Be,featureDomainValueLookup:$e,featureFullDomain:Ue,featureSchema:We,featureSubtypes:He,fixNullGeometry:je,fixSpatialReference:ke,formatDate:le,formatNumber:se,getDomain:Ce,getDomainCode:Oe,getDomainValue:De,getType:E,greaterThanLessThan:me,isArray:F,isBoolean:x,isDate:ne,isDateOnly:re,isDictionary:W,isDictionaryLike:Q,isFeature:$,isFeatureSet:K,isFeatureSetCollection:X,isFunctionParameter:G,isGeometry:H,isGraphic:J,isImmutableArray:te,isInteger:M,isJsDate:w,isKnowledgeGraph:ee,isModule:V,isNumber:C,isObject:oe,isSimpleType:z,isString:O,isSubtypeGrouplayer:Ee,isSubtypeSublayer:qe,isTime:ie,isVoid:U,isVoxel:B,multiReplace:P,parseGeometryFromJson:Ae,pcCheck:ae,stableStringify:Fe,standardiseDateFormat:fe,tick:Ye,toBoolean:Te,toDate:Se,toNumber:Ne,toNumberArray:ge,toString:pe,toStringArray:Ie,toStringExplicit:he,voidOperation:v},Symbol.toStringTag,{value:"Module"}));export{qe as $,me as A,de as B,Le as C,ae as D,U as E,we as F,Me as G,Re as H,I,_e as J,q as K,Ke as L,Ie as M,E as N,fe as O,ue as P,Ue as Q,_ as R,Be as S,$e as T,We as U,He as V,je as W,B as X,P as Y,Qe as Z,ge as _,Pe as a,Ye as a0,Ce as a1,De as a2,Oe as a3,V as a4,oe as a5,se as a6,le as a7,Ae as a8,Fe as a9,Ee as aa,Xe as ab,Ve as b,ye as c,z as d,Te as e,pe as f,ne as g,Se as h,G as i,re as j,ie as k,H as l,te as m,$ as n,X as o,K as p,W as q,ee as r,he as s,Ne as t,ke as u,et as v,v as w,Y as x,L as y,Q as z};
|
package/copyright.txt
CHANGED
|
@@ -520,6 +520,44 @@ DEALINGS IN THE SOFTWARE.
|
|
|
520
520
|
|
|
521
521
|
-------------------------------------------------------------------------------
|
|
522
522
|
|
|
523
|
+
topsort/
|
|
524
|
+
|
|
525
|
+
https://github.com/samuelneff/topsort
|
|
526
|
+
|
|
527
|
+
Copyright (c) 2014 samuelneff
|
|
528
|
+
|
|
529
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
530
|
+
you may not use this file except in compliance with the License.
|
|
531
|
+
You may obtain a copy of the License at
|
|
532
|
+
|
|
533
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
534
|
+
|
|
535
|
+
Unless required by applicable law or agreed to in writing, software
|
|
536
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
537
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
538
|
+
See the License for the specific language governing permissions and
|
|
539
|
+
limitations under the License.
|
|
540
|
+
|
|
541
|
+
## tsort
|
|
542
|
+
|
|
543
|
+
https://gist.github.com/shinout/1232505
|
|
544
|
+
|
|
545
|
+
Copyright 2012 Shin Suzuki<shinout310@gmail.com>
|
|
546
|
+
|
|
547
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
548
|
+
you may not use this file except in compliance with the License.
|
|
549
|
+
You may obtain a copy of the License at
|
|
550
|
+
|
|
551
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
552
|
+
|
|
553
|
+
Unless required by applicable law or agreed to in writing, software
|
|
554
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
555
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
556
|
+
See the License for the specific language governing permissions and
|
|
557
|
+
limitations under the License.
|
|
558
|
+
|
|
559
|
+
-------------------------------------------------------------------------------
|
|
560
|
+
|
|
523
561
|
tslib/
|
|
524
562
|
|
|
525
563
|
Copyright (c) Microsoft Corporation
|
package/core/MapUtils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function n(n,t){for(const r of n.values())if(t(r))return!0;return!1}function t(n,t){for(const r of n.values())if(t(r))return r;return null}function
|
|
5
|
+
function n(n,t){for(const r of n.values())if(t(r))return!0;return!1}function t(n,t){if(null==n&&null==t)return!0;if(null==n||null==t||n.size!==t.size)return!1;for(const[r,u]of n)if(!t.has(r)||u!==t.get(r))return!1;return!0}function r(n,t){for(const r of n.values())if(t(r))return r;return null}function u(n,t,r){const u=n.get(t);if(void 0!==u)return u;const e=r();return n.set(t,e),e}function e(n){const t=new Map;return r=>(t.has(r)||t.set(r,n(r)),t.get(r))}export{t as equals,r as findInMap,u as getOrCreateMapValue,e as memoize,n as someMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import t from"../../../core/Error.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{isPromiseLike as i}from"../../../core/promiseUtils.js";import{generateBracedUUID as s}from"../../../core/uuid.js";import{isLoadedSharedTemplate as a,isSharedFeatureTemplate as l,isSharedGroupTemplate as n,isSharedPresetTemplate as u}from"../../templateUtils.js";import{createFeatureServiceEdit as p}from"./support/createFeatureServiceEdit.js";import{calculateExtent as c,groupEditsByLayer as m}from"./support/executorUtils.js";import{getBuilder as d}from"./support/getBuilder.js";import{isPoint as f}from"../../../geometry/support/jsonUtils.js";import{getAssociationsTableFields as y}from"../../../networks/support/networkFieldUtils.js";import{RuleType as T}from"../../../networks/support/typeUtils.js";const g=()=>o.getLogger("esri.editing.sharedTemplates.executor.createTemplateExecutor"),h="globalid";async function w(e){if(!a(e))throw new t("template-executor:template-not-loaded","The template must be loaded before it can be executed.");if(l(e))return I(e);if(n(e))return b(e);if(u(e))return G(e);throw new t("template-executor:unsupported-template-type","The template type is not supported.")}function I(e){return t=>{const o=[],r=[];p({geometry:t,template:e,edits:o,relationships:r});const i=c(o);return{edits:m(o),relationships:r,primary:o[0]??null,featureExtent:i,rotationPoint:i?.center??null}}}async function b(e){const{definition:t}=e,o=await Promise.all(t.allParts.map(k));return(r,s)=>{const a=[],l=[],n=new Set,u=()=>{if(t.createUtilityNetworkAssociations&&"completion"===s){const{utilityNetwork:e,utilityNetworkAssociationsTable:o}=t;e&&o?S({associationGraphics:n,associationsTable:o,edits:a,relationships:l,utilityNetworkHelper:e}):g().warn("Unable to create utility network associations between group template features. The utility network or its associations table is unavailable.")}const e=c(a);return{associationGraphics:n,edits:m(a),relationships:l,primary:a[0]??null,featureExtent:e,rotationPoint:e?.center??null}};if(null==r)return g().warn("No geometry provided to group template executor. Result will be empty."),u();const p=o.map((t=>t({edits:a,mode:s,parentTemplate:e,relationships:l,shape:r}))).filter(i);return 0===p.length?u():Promise.all(p).then((()=>u()))}}async function k(e){const t=await d(e.builderType);return o=>t.execute({...o,templatePart:e})}async function G(e){const{createPresetServiceEdit:o}=await import("./support/createPresetServiceEdit.js");return(r,i,s=0)=>{if(!f(r))throw new t("template-executor:invalid-input-geometry","The input goemetry for a preset template must be a point.");const a=[],l=[],n=o({geometry:r,template:e,edits:a,relationships:l,rotation:s,mode:i});return{edits:m(a),relationships:l,primary:a[0]??null,featureExtent:c(a),rotationPoint:n}}}function S(e){const{edits:t,utilityNetworkHelper:o}=e,i=new Map;for(const s of t)""!==s.tag&&o.layerIdToSourceIdLookup.has(s.id)&&r(i,s.tag,(()=>[])).push(s);for(const r of i.values())if(!(r.length<2))for(let t=0;t<r.length;t++){const o=r[t];for(let i=t+1;i<r.length;i++){A(o,r[i],e)}}}function A(t,o,r){const{associationGraphics:i,associationsTable:a,edits:l,utilityNetworkHelper:n,relationships:u}=r,p=n.findAgat(t.graphic,t.layer),c=n.findAgat(o.graphic,o.layer);if(!p||!c)return;const m=n.findRules(p).map((e=>e.fromNetworkSource?.sourceId!==p.networkSourceId||e.fromAssetGroup?.assetGroupCode!==p.assetGroup||null!==e.fromAssetType?.assetTypeCode&&e.fromAssetType?.assetTypeCode!==p.assetType||e.toNetworkSource.sourceId!==c.networkSourceId||e.toAssetGroup?.assetGroupCode!==c.assetGroup||null!==e.toAssetType&&e.toAssetType?.assetTypeCode!==c.assetType?e.toNetworkSource.sourceId!==p.networkSourceId||e.toAssetGroup?.assetGroupCode!==p.assetGroup||null!==e.toAssetType&&e.toAssetType?.assetTypeCode!==p.assetType||e.fromNetworkSource.sourceId!==c.networkSourceId||e.fromAssetGroup?.assetGroupCode!==c.assetGroup||null!==e.fromAssetType?.assetTypeCode&&e.fromAssetType?.assetTypeCode!==c.assetType?null:{rule:e,from:{agat:c,item:o},to:{agat:p,item:t}}:{rule:e,from:{agat:p,item:t},to:{agat:c,item:o}})).filter((e=>e?.rule.ruleType===T.RTJunctionEdgeConnectivity||e?.rule.ruleType===T.RTEdgeJunctionEdgeConnectivity||e?.rule.ruleType===T.RTContainment?null:e)).filter((e=>null!==e));if(0===m.length)return;const d=y(a),f=new Set;for(const y of m){const t={};t[d.fromNetworkSourceId]=y.rule.fromNetworkSource.sourceId,t[d.fromGlobalId]=y.from.item.graphic.attributes[y.from.item.layer.globalIdField??h],t[d.fromTerminalId]=null,y.rule.fromTerminal&&(t[d.fromTerminalId]=y.rule.fromTerminal.terminalId),t[d.toNetworkSourceId]=y.rule.toNetworkSource.sourceId,t[d.toGlobalId]=y.to.item.graphic.attributes[y.to.item.layer.globalIdField??h],t[d.toTerminalId]=null,y.rule.toTerminal&&(t[d.toTerminalId]=y.rule.toTerminal.terminalId),t[d.associationType]=y.rule.ruleType,t[d.percentAlong]=null,y.rule.ruleType===T.RTContainment
|
|
5
|
+
import e from"../../../Graphic.js";import t from"../../../core/Error.js";import o from"../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../core/MapUtils.js";import{isPromiseLike as i}from"../../../core/promiseUtils.js";import{generateBracedUUID as s}from"../../../core/uuid.js";import{isLoadedSharedTemplate as a,isSharedFeatureTemplate as l,isSharedGroupTemplate as n,isSharedPresetTemplate as u}from"../../templateUtils.js";import{createFeatureServiceEdit as p}from"./support/createFeatureServiceEdit.js";import{calculateExtent as c,groupEditsByLayer as m}from"./support/executorUtils.js";import{getBuilder as d}from"./support/getBuilder.js";import{isPoint as f}from"../../../geometry/support/jsonUtils.js";import{getAssociationsTableFields as y}from"../../../networks/support/networkFieldUtils.js";import{RuleType as T}from"../../../networks/support/typeUtils.js";const g=()=>o.getLogger("esri.editing.sharedTemplates.executor.createTemplateExecutor"),h="globalid";async function w(e){if(!a(e))throw new t("template-executor:template-not-loaded","The template must be loaded before it can be executed.");if(l(e))return I(e);if(n(e))return b(e);if(u(e))return G(e);throw new t("template-executor:unsupported-template-type","The template type is not supported.")}function I(e){return t=>{const o=[],r=[];p({geometry:t,template:e,edits:o,relationships:r});const i=c(o);return{edits:m(o),relationships:r,primary:o[0]??null,featureExtent:i,rotationPoint:i?.center??null}}}async function b(e){const{definition:t}=e,o=await Promise.all(t.allParts.map(k));return(r,s)=>{const a=[],l=[],n=new Set,u=()=>{if(t.createUtilityNetworkAssociations&&"completion"===s){const{utilityNetwork:e,utilityNetworkAssociationsTable:o}=t;e&&o?S({associationGraphics:n,associationsTable:o,edits:a,relationships:l,utilityNetworkHelper:e}):g().warn("Unable to create utility network associations between group template features. The utility network or its associations table is unavailable.")}const e=c(a);return{associationGraphics:n,edits:m(a),relationships:l,primary:a[0]??null,featureExtent:e,rotationPoint:e?.center??null}};if(null==r)return g().warn("No geometry provided to group template executor. Result will be empty."),u();const p=o.map((t=>t({edits:a,mode:s,parentTemplate:e,relationships:l,shape:r}))).filter(i);return 0===p.length?u():Promise.all(p).then((()=>u()))}}async function k(e){const t=await d(e.builderType);return o=>t.execute({...o,templatePart:e})}async function G(e){const{createPresetServiceEdit:o}=await import("./support/createPresetServiceEdit.js");return(r,i,s=0)=>{if(!f(r))throw new t("template-executor:invalid-input-geometry","The input goemetry for a preset template must be a point.");const a=[],l=[],n=o({geometry:r,template:e,edits:a,relationships:l,rotation:s,mode:i});return{edits:m(a),relationships:l,primary:a[0]??null,featureExtent:c(a),rotationPoint:n}}}function S(e){const{edits:t,utilityNetworkHelper:o}=e,i=new Map;for(const s of t)""!==s.tag&&o.layerIdToSourceIdLookup.has(s.id)&&r(i,s.tag,(()=>[])).push(s);for(const r of i.values())if(!(r.length<2))for(let t=0;t<r.length;t++){const o=r[t];for(let i=t+1;i<r.length;i++){A(o,r[i],e)}}}function A(t,o,r){const{associationGraphics:i,associationsTable:a,edits:l,utilityNetworkHelper:n,relationships:u}=r,p=n.findAgat(t.graphic,t.layer),c=n.findAgat(o.graphic,o.layer);if(!p||!c)return;const m=n.findRules(p).map((e=>e.fromNetworkSource?.sourceId!==p.networkSourceId||e.fromAssetGroup?.assetGroupCode!==p.assetGroup||null!==e.fromAssetType?.assetTypeCode&&e.fromAssetType?.assetTypeCode!==p.assetType||e.toNetworkSource.sourceId!==c.networkSourceId||e.toAssetGroup?.assetGroupCode!==c.assetGroup||null!==e.toAssetType&&e.toAssetType?.assetTypeCode!==c.assetType?e.toNetworkSource.sourceId!==p.networkSourceId||e.toAssetGroup?.assetGroupCode!==p.assetGroup||null!==e.toAssetType&&e.toAssetType?.assetTypeCode!==p.assetType||e.fromNetworkSource.sourceId!==c.networkSourceId||e.fromAssetGroup?.assetGroupCode!==c.assetGroup||null!==e.fromAssetType?.assetTypeCode&&e.fromAssetType?.assetTypeCode!==c.assetType?null:{rule:e,from:{agat:c,item:o},to:{agat:p,item:t}}:{rule:e,from:{agat:p,item:t},to:{agat:c,item:o}})).filter((e=>e?.rule.ruleType===T.RTJunctionEdgeConnectivity||e?.rule.ruleType===T.RTEdgeJunctionEdgeConnectivity||e?.rule.ruleType===T.RTContainment?null:e)).filter((e=>null!==e));if(0===m.length)return;const d=y(a),f=new Set;for(const y of m){const t={};t[d.fromNetworkSourceId]=y.rule.fromNetworkSource.sourceId,t[d.fromGlobalId]=y.from.item.graphic.attributes[y.from.item.layer.globalIdField??h],t[d.fromTerminalId]=null,y.rule.fromTerminal&&(t[d.fromTerminalId]=y.rule.fromTerminal.terminalId),t[d.toNetworkSourceId]=y.rule.toNetworkSource.sourceId,t[d.toGlobalId]=y.to.item.graphic.attributes[y.to.item.layer.globalIdField??h],t[d.toTerminalId]=null,y.rule.toTerminal&&(t[d.toTerminalId]=y.rule.toTerminal.terminalId),t[d.associationType]=y.rule.ruleType,t[d.percentAlong]=null,t[d.isContentVisible]=y.rule.ruleType===T.RTContainment?1:0,t[d.status]=0,t[d.globalId]=s();const o=`${t[d.fromNetworkSourceId]}-${t[d.fromGlobalId]}-${t[d.toNetworkSourceId]}-${t[d.toGlobalId]}-${t[d.associationType]}`;if(f.has(o))continue;f.add(o);const r=new e({attributes:t,sourceLayer:a});i.add(r),l.push({id:a.layerId,graphic:r,tag:"",layer:a}),u.push({sourceGraphic:y.to.item.graphic,sourceLayerId:y.to.item.layer.layerId,destinationGraphic:r,destinationLayerId:a.layerId,sourceField:y.to.item.layer.globalIdField??h,destinationField:d.toGlobalId??h}),u.push({sourceGraphic:y.from.item.graphic,sourceLayerId:y.from.item.layer.layerId,destinationGraphic:r,destinationLayerId:a.layerId,sourceField:y.from.item.layer.globalIdField??h,destinationField:d.fromGlobalId??h})}}export{w as createTemplateExecutor};
|
package/interfaces.d.ts
CHANGED
|
@@ -7497,7 +7497,7 @@ declare namespace __esri {
|
|
|
7497
7497
|
*/
|
|
7498
7498
|
intersects(geometry1: GeometryUnion, geometry2: GeometryUnion): boolean;
|
|
7499
7499
|
/**
|
|
7500
|
-
* Indicates if the given geometry is topologically simple.
|
|
7500
|
+
* Indicates if the given geometry is non-OGC topologically simple.
|
|
7501
7501
|
*
|
|
7502
7502
|
* @param geometry The input geometry.
|
|
7503
7503
|
* @deprecated since version 4.32. Use {@link module:esri/geometry/operators/simplifyOperator#isSimple simplifyOperator's isSimple()} method instead.
|
|
@@ -7951,7 +7951,7 @@ declare namespace __esri {
|
|
|
7951
7951
|
*/
|
|
7952
7952
|
intersects(geometry1: GeometryUnion, geometry2: GeometryUnion): Promise<boolean>;
|
|
7953
7953
|
/**
|
|
7954
|
-
* Indicates if the given geometry is topologically simple.
|
|
7954
|
+
* Indicates if the given geometry is non-OGC topologically simple.
|
|
7955
7955
|
*
|
|
7956
7956
|
* @param geometry The input geometry.
|
|
7957
7957
|
* @deprecated since version 4.32. Use {@link module:esri/geometry/operators/simplifyOperator#isSimple simplifyOperator's isSimple()} method instead.
|
|
@@ -10478,7 +10478,7 @@ declare namespace __esri {
|
|
|
10478
10478
|
*/
|
|
10479
10479
|
executeMany(geometries: GeometryUnion[]): (GeometryUnion | nullish)[];
|
|
10480
10480
|
/**
|
|
10481
|
-
* Indicates if the given geometry is topologically simple.
|
|
10481
|
+
* Indicates if the given geometry is non-OGC topologically simple.
|
|
10482
10482
|
*
|
|
10483
10483
|
* @param geometry The input geometry.
|
|
10484
10484
|
*
|
|
@@ -110426,6 +110426,14 @@ declare namespace __esri {
|
|
|
110426
110426
|
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-EditorViewModel.html#deleteFeatureFromWorkflow Read more...}
|
|
110427
110427
|
*/
|
|
110428
110428
|
deleteFeatureFromWorkflow(): Promise<void>;
|
|
110429
|
+
/**
|
|
110430
|
+
* Get all of the editing templates associated with a given layer.
|
|
110431
|
+
*
|
|
110432
|
+
* @param layer The layer whose templates should be retrieved.
|
|
110433
|
+
*
|
|
110434
|
+
* {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-EditorViewModel.html#getTemplatesForLayer Read more...}
|
|
110435
|
+
*/
|
|
110436
|
+
getTemplatesForLayer(layer: GeoJSONLayer | FeatureLayer | OrientedImageryLayer | SceneLayer | SubtypeSublayer): (FeatureTemplate | SharedTemplateMetadata)[];
|
|
110429
110437
|
/**
|
|
110430
110438
|
* Initiates the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor-CreateFeaturesWorkflow.html CreateFeaturesWorkflow} by displaying the panel where feature creation begins.
|
|
110431
110439
|
*
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as l,removeMaybe as n,abortMaybe as u}from"../../../core/maybe.js";import h from"../../../core/Promise.js";import{createAbortError as c,isAbortError as d}from"../../../core/promiseUtils.js";import{initial as p,whenOnce as m,watch as f,syncAndInitial as y,sync as _}from"../../../core/reactiveUtils.js";import{sqlAnd as g}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as x}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import{isHostedAgolService as D}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as w}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as b}from"../../support/layerUtils.js";import{projectGeometry as C}from"../../../portal/support/geometryServiceUtils.js";import S from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as T}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as V}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as H}from"../../../views/3d/support/debugFlags.js";let L=class extends(h.EsriPromiseMixin(t)){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void o.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher?.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get hasAllFeatures(){return this.serviceDataCount===N.noServiceDataCount&&"snapshot"===this.mode&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){const e=this.context.effectiveDisplayFilter?.where||null,t=null!=e&&"1=1"!==e;return("tiles"!==this.mode||!t)&&(this._tileFetcher?.hasAllFeatures??!1)}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if("catalog-footprint"===e.type)return"tiles";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(!1===t.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===N.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>N.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){if("snapshot"===this.mode){const e=new E(0,0,0,this.layerView.view.featureTiles.tilingScheme,"dummy-tile-full-extent");return new r([e])}const e=this.layerView.view.featureTiles;return e?e.tiles:new r}get test(){}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new v,this.serviceDataExtent=null,this.serviceDataCount=N.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add((()=>this.displayFeatureLimit),(e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal)))),this._updatingHandles.add((()=>this.mode),(()=>this._modeChanged()),p),this._updatingHandles.add((()=>this.mode),((e,t)=>{"tiles"===e&&"snapshot"===t&&(this._forceTilesMode=!0)}),p),this.addResolvingPromise(Promise.resolve().then((()=>this._verifyCapabilities())).then((()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo()))).then((()=>this._initializeTileFetcher())))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!b(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=l(this._tileFetcher),this._tilesHandle=n(this._tilesHandle),this._lifeCycleAbortController=u(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){const t=()=>{null!=this._tileFetcher&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=m((()=>e.featureTiles?.tilingScheme),this._lifeCycleAbortController.signal);this._updatingHandles.addPromise(t),t.then((()=>{const{layerView:e,tileDescriptors:t}=this,i=e.layer,r=new T({context:this.context,filterExtent:this.extent,tileDescriptors:t,features:this.graphics});this._tileFetcher=r,this._suspended?r.suspend():r.resume();const s=this.layerView.view;s&&this.addHandles(f((()=>s.quality),(e=>r.memoryFactor=e),y));const a="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;a&&this.addHandles(f((()=>this.layerView.view?.qualitySettings?.graphics3D?.[a]),(e=>r.lodFactor=e||1),p));const o=e=>{r.maximumNumberOfFeatures=e,r.useTileCount=this.serviceDataCount>e},l=e=>{r.useTileCount=e>this.maximumNumberOfFeatures};"ogc-feature"!==i.type&&this._updatingHandles.add((()=>i.createQueryVersion),(()=>this._dataFilterChanged())),this._updatingHandles.add((()=>this.context.effectiveDisplayFilter),(()=>this._effectiveDisplayFilterChanged())),this._updatingHandles.add((()=>e.availableFields),((e,t)=>this._availableFieldsChanged(t,e))),this._updatingHandles.add((()=>e.requiredFields),((e,t)=>this._requiredFieldsChanged(t,e))),"customParameters"in i&&this._updatingHandles.add((()=>i.customParameters),(()=>this.restart())),this.addHandles([i.on("apply-edits",(e=>this._applyEdits(e))),f((()=>this.extent),(e=>r.filterExtent=e),_),f((()=>this.tileDescriptors),(e=>r.tileDescriptors=e),_),f((()=>this.maximumNumberOfFeatures),o,y),f((()=>this.serviceDataCount),l,y),f((()=>H.FEATURE_TILE_FETCH_SHOW_TILES),(e=>{e&&r&&!r.debugger?(r.debugger=new V(r,s.featureTiles.tilingScheme.toTileInfo(),s),r.debugger.update()):!e&&this._tileFetcher&&r.debugger&&(r.debugger.destroy(),r.debugger=null)}),p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add((()=>this.maxTotalSnapshotVertices),(()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal))))})).catch((()=>{}))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:o.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){"snapshot"!==this.mode&&this._refetch({resetForceTilesMode:!1})}_applyEdits(e){const t=this.layerView.layer;null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then((e=>{if(e){if(!this._lifeCycleAbortController)throw c();e.exceededTransferLimit&&"refresh"in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}})).catch((e=>{if(!d(e))throw e}))}_availableFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new S({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=this.layerView,i=e.createQuery();return i.returnGeometry=!1,i.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),t.effectiveDisplayFilter&&(i.where=g(i.where,t.effectiveDisplayFilter.where)),i}_fullExtentIsAccurate(){const e=this.layerView.layer;if("definitionExpression"in e&&e.definitionExpression)return!1;switch(e.type){case"feature":case"catalog-footprint":case"oriented-imagery":return D(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){d(t)||this._set("serviceDataExtent",a(this.layerView.fullExtentInLocalViewSpatialReference))}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=a(t.fullExtentInLocalViewSpatialReference),o=i.fullExtent,l=this._fullExtentIsAccurate(),n=this.serviceDataCount;if(r&&n<=N.maxFeatureCountForExtent&&(!s||!l)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:N.queryExtentTimeout,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=o){const r="portalItem"in i?i.portalItem:null,s=await C(o,t.view.spatialReference,r,e);this._set("serviceDataExtent",s)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",N.noServiceDataCount);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:N.queryStatisticsTimeout,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(d(r.error))throw r.error;this._set("serviceDataCount",N.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,r){if(null==e?.averageSymbolComplexity)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:s,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:l}=a,n=o<=0,u=this._minimumNumberOfVerticesForGeometry>1;if(!n&&!u)return void(this._snapshotLimitExceeded=!1);0!==o&&null!=t&&await t;const h=Math.min(s,I),c=this.serviceDataCount,p=c!==N.noServiceDataCount;let m=p?Math.ceil((h-c*o)/(l||1)):Math.ceil(h/(l||1));if(u&&(m=Math.min(m,j)),p&&this._minimumNumberOfVerticesForGeometry*c>m)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m);const f=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:N.queryStatisticsTimeout,signal:r}));if(!1===f.ok){if(d(f.error))throw f.error;return void(this._snapshotLimitExceeded=!1)}const y=f.value.features[0];this._snapshotLimitExceeded=!!y?.attributes&&!!y.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await w(this.layerView.layer);let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),s=r.then((()=>this._updateServiceDataExtent(t))).catch((e=>{d(e)||o.getLogger(this).error("#fetchServiceDataInfo()",e)})).then((()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null}));return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then((()=>{}),(()=>{}))}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([F({readOnly:!0})],L.prototype,"type",void 0),e([F({constructOnly:!0})],L.prototype,"graphics",void 0),e([F({constructOnly:!0})],L.prototype,"layerView",void 0),e([F({constructOnly:!0})],L.prototype,"context",void 0),e([F({readOnly:!0})],L.prototype,"dataUpdating",null),e([F()],L.prototype,"extent",null),e([F()],L.prototype,"updating",null),e([F({readOnly:!0})],L.prototype,"_updatingHandles",void 0),e([F()],L.prototype,"updatingTotal",null),e([F()],L.prototype,"updatingRemaining",null),e([F()],L.prototype,"expectedFeatureDiff",null),e([F()],L.prototype,"memoryForUnusedFeatures",null),e([F()],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([F({readOnly:!0})],L.prototype,"serviceDataExtent",void 0),e([F({readOnly:!0})],L.prototype,"serviceDataCount",void 0),e([F()],L.prototype,"_snapshotLimitExceeded",void 0),e([F()],L.prototype,"displayFeatureLimit",void 0),e([F({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([F({readOnly:!0})],L.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],L.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],L.prototype,"hasFullGeometries",null),e([F()],L.prototype,"_forceTilesMode",void 0),e([F({readOnly:!0})],L.prototype,"mode",null),e([F({readOnly:!0})],L.prototype,"maxTotalSnapshotVertices",null),e([F({readOnly:!0})],L.prototype,"tileDescriptors",null),e([F()],L.prototype,"_tileFetcher",void 0),e([F()],L.prototype,"_fetchDataInfoPromise",void 0),L=e([x("esri.layers.graphics.controllers.FeatureTileController3D")],L);const O=1e4,I=1e6,A=12e3,q=1e4,j=5e6;function P(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}var N;!function(e){function t(){e.maxFeatureCountForExtent=O,e.queryStatisticsTimeout=A,e.queryExtentTimeout=q}e.noServiceDataCount=1/0,e.maxSnapshotMinScaleFactor=5,e.reset=t}(N||(N={})),N.reset();export{L as FeatureTileController3D,N as FeatureTileController3DConstants};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{result as i}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import has from"../../../core/has.js";import s from"../../../core/Error.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as l,removeMaybe as n,abortMaybe as u}from"../../../core/maybe.js";import h from"../../../core/Promise.js";import{createAbortError as c,isAbortError as d}from"../../../core/promiseUtils.js";import{initial as p,whenOnce as m,watch as f,syncAndInitial as y,sync as _}from"../../../core/reactiveUtils.js";import{sqlAnd as g}from"../../../core/sql.js";import{property as F}from"../../../core/accessorSupport/decorators/property.js";import{subclass as x}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import{projectWithZConversion as D}from"../../../geometry/projection.js";import{isHostedAgolService as w}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as b}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as C}from"../../support/layerUtils.js";import S from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as T}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as V}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as H}from"../../../views/3d/support/debugFlags.js";let L=class extends(h.EsriPromiseMixin(t)){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(null!=e&&!e.spatialReference.equals(this.layerView.view.spatialReference))return void o.getLogger(this).error("#extent=","extent needs to be in the same spatial reference as the view");const t=this._get("extent");if(t===e)return;if(null!=t&&e&&t.equals(e))return;const i=null!=e?e.clone():null;this._set("extent",i)}get updating(){return!!(this._tileFetcher?.updating||null!=this._fetchDataInfoPromise||"tiles"===this.mode&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&null!=this._tileFetcher?this._tileFetcher.expectedFeatureDiff:0}get memoryForUnusedFeatures(){return null!=this._tileFetcher?this._tileFetcher.memoryForUnusedFeatures:0}get maximumNumberOfFeaturesExceeded(){return!(null==this._tileFetcher||!this._tileFetcher.maximumNumberOfFeaturesExceeded)}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome("maximumNumberOfFeatures",e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden("maximumNumberOfFeatures")}get hasAllFeatures(){return this.serviceDataCount===N.noServiceDataCount&&"snapshot"===this.mode&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){const e=this.context.effectiveDisplayFilter?.where||null,t=null!=e&&"1=1"!==e;return("tiles"!==this.mode||!t)&&(this._tileFetcher?.hasAllFeatures??!1)}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){const e=this.layerView.layer;if("feature"===e.type&&null!=e.infoFor3D)return"snapshot";if("catalog-footprint"===e.type)return"tiles";if(this._forceTilesMode)return"tiles";const t=this.layerView.view;if(!1===t.qualitySettings?.graphics3D?.snapshotAvailable||this.serviceDataCount===N.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return"tiles";const i=t&&t.featureTiles,r=i&&i.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&r){const t=this._approximateExtentSizeAtScale(e.minScale,r);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>N.maxSnapshotMinScaleFactor)return"tiles"}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?"snapshot":"tiles"}get maxTotalSnapshotVertices(){const e=this._get("maxTotalSnapshotVertices")||0,t="snapshot"===this.mode&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){const i=this.layerView.view,r=Math.ceil((i.width/t.pixelSize+i.height/t.pixelSize)/2),s=t.levels[0];return r*((s.tileSize[0]/(s.scale/e)+s.tileSize[1]/(s.scale/e))/2)}get tileDescriptors(){if("snapshot"===this.mode){const e=new E(0,0,0,this.layerView.view.featureTiles.tilingScheme,"dummy-tile-full-extent");return new r([e])}const e=this.layerView.view.featureTiles;return e?e.tiles:new r}get test(){}constructor(e){super(e),this.type="feature-tile-3d",this._updatingHandles=new v,this.serviceDataExtent=null,this.serviceDataCount=N.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add((()=>this.displayFeatureLimit),(e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal)))),this._updatingHandles.add((()=>this.mode),(()=>this._modeChanged()),p),this._updatingHandles.add((()=>this.mode),((e,t)=>{"tiles"===e&&"snapshot"===t&&(this._forceTilesMode=!0)}),p),this.addResolvingPromise(Promise.resolve().then((()=>this._verifyCapabilities())).then((()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo()))).then((()=>this._initializeTileFetcher())))}_verifyCapabilities(){const e=this.layerView.layer;if("ogc-feature"!==e.type&&!C(e)?.operations.supportsQuery)throw new s("graphicscontroller:query-capability-required","Service requires query capabilities to be used as a feature layer",{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=l(this._tileFetcher),this._tilesHandle=n(this._tilesHandle),this._lifeCycleAbortController=u(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set("_updatingHandles",null)}suspend(){this._suspended||(this._suspended=!0,null!=this._tileFetcher&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,null!=this._tileFetcher&&this._tileFetcher.resume())}restart(){const e=()=>{null!=this._tileFetcher&&this._tileFetcher.restart()};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){const t=()=>{null!=this._tileFetcher&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.addPromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){const e=this.layerView.view;if(!e)return;const t=m((()=>e.featureTiles?.tilingScheme),this._lifeCycleAbortController.signal);this._updatingHandles.addPromise(t),t.then((()=>{const{layerView:e,tileDescriptors:t}=this,i=e.layer,r=new T({context:this.context,filterExtent:this.extent,tileDescriptors:t,features:this.graphics});this._tileFetcher=r,this._suspended?r.suspend():r.resume();const s=this.layerView.view;s&&this.addHandles(f((()=>s.quality),(e=>r.memoryFactor=e),y));const a="polygon"===this.context.geometryType?"polygonLodFactor":"polyline"===this.context.geometryType?"polylineLodFactor":null;a&&this.addHandles(f((()=>this.layerView.view?.qualitySettings?.graphics3D?.[a]),(e=>r.lodFactor=e||1),p));const o=e=>{r.maximumNumberOfFeatures=e,r.useTileCount=this.serviceDataCount>e},l=e=>{r.useTileCount=e>this.maximumNumberOfFeatures};"ogc-feature"!==i.type&&this._updatingHandles.add((()=>i.createQueryVersion),(()=>this._dataFilterChanged())),this._updatingHandles.add((()=>this.context.effectiveDisplayFilter),(()=>this._effectiveDisplayFilterChanged())),this._updatingHandles.add((()=>e.availableFields),((e,t)=>this._availableFieldsChanged(t,e))),this._updatingHandles.add((()=>e.requiredFields),((e,t)=>this._requiredFieldsChanged(t,e))),"customParameters"in i&&this._updatingHandles.add((()=>i.customParameters),(()=>this.restart())),this.addHandles([i.on("apply-edits",(e=>this._applyEdits(e))),f((()=>this.extent),(e=>r.filterExtent=e),_),f((()=>this.tileDescriptors),(e=>r.tileDescriptors=e),_),f((()=>this.maximumNumberOfFeatures),o,y),f((()=>this.serviceDataCount),l,y),f((()=>H.FEATURE_TILE_FETCH_SHOW_TILES),(e=>{e&&r&&!r.debugger?(r.debugger=new V(r,s.featureTiles.tilingScheme.toTileInfo(),s),r.debugger.update()):!e&&this._tileFetcher&&r.debugger&&(r.debugger.destroy(),r.debugger=null)}),p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add((()=>this.maxTotalSnapshotVertices),(()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal))))})).catch((()=>{}))}_modeChanged(){switch(this.mode){case"tiles":this._tilesHandle||(this._tilesHandle=this.layerView.view.featureTiles.addClient());break;default:o.getLogger(this).warn("Unhandled feature layer mode "+this.mode);case"snapshot":null!=this._tilesHandle&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set("maxTotalSnapshotVertices",0),this.notifyChange("maxTotalSnapshotVertices"),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){"snapshot"!==this.mode&&this._refetch({resetForceTilesMode:!1})}_applyEdits(e){const t=this.layerView.layer;null!=this._tileFetcher&&this._tileFetcher.applyEdits(e).then((e=>{if(e){if(!this._lifeCycleAbortController)throw c();e.exceededTransferLimit&&"refresh"in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.addPromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}})).catch((e=>{if(!d(e))throw e}))}_availableFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){null!=this._tileFetcher&&P(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){const t=this.layerView.layer,i=t.createQuery();return i.returnGeometry=!1,i.outStatistics=[new S({statisticType:"exceedslimit",maxVertexCount:e,outStatisticFieldName:"exceedslimit",maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),i}_createDataInfoQuery(){const e=this.layerView.layer,t=this.layerView,i=e.createQuery();return i.returnGeometry=!1,i.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(i.cacheHint=!0),t.effectiveDisplayFilter&&(i.where=g(i.where,t.effectiveDisplayFilter.where)),i}_fullExtentIsAccurate(){const e=this.layerView.layer;if("definitionExpression"in e&&e.definitionExpression)return!1;switch(e.type){case"feature":case"catalog-footprint":case"oriented-imagery":return w(e.url);case"csv":case"geojson":case"ogc-feature":case"wfs":return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(t){d(t)||this._set("serviceDataExtent",a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){const t=this.layerView,i=t.layer,r=i.capabilities?.query.supportsExtent??!1,s=a(t.fullExtentInLocalViewSpatialReference),o=i.fullExtent,l=this._fullExtentIsAccurate(),n=this.serviceDataCount;if(r&&n<=N.maxFeatureCountForExtent&&(!s||!l)&&"queryExtent"in i){const t=this._createDataInfoQuery(),r=await i.queryExtent(t,{timeout:N.queryExtentTimeout,signal:e});this._set("serviceDataExtent",r.extent)}else if(s)this._set("serviceDataExtent",s);else if(null!=o){const e=o.spatialReference?await D(o,t.view.spatialReference):null;this._set("serviceDataExtent",e??null)}else this._set("serviceDataExtent",null)}async _updateServiceDataCount(e){const t=this.layerView.layer;if(!("queryFeatureCount"in t)||!has("featurelayer-snapshot-enabled"))return void this._set("serviceDataCount",N.noServiceDataCount);const r=await i(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:N.queryStatisticsTimeout,signal:e}));if(!0===r.ok)this._set("serviceDataCount",r.value);else{if(d(r.error))throw r.error;this._set("serviceDataCount",N.noServiceDataCount)}}get _supportsExceedsLimitQuery(){const e=this.layerView.layer;return null!=e.capabilities&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case"point":case"multipoint":return 1;case"polygon":return 4;case"polyline":return 2;case"multipatch":case"mesh":return 3;default:return 0}}async _updateSnapshotLimit(e,t,r){if(null==e?.averageSymbolComplexity)return void(this._snapshotLimitExceeded=!1);const{maximumTotalNumberOfVertices:s,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:l}=a,n=o<=0,u=this._minimumNumberOfVerticesForGeometry>1;if(!n&&!u)return void(this._snapshotLimitExceeded=!1);0!==o&&null!=t&&await t;const h=Math.min(s,I),c=this.serviceDataCount,p=c!==N.noServiceDataCount;let m=p?Math.ceil((h-c*o)/(l||1)):Math.ceil(h/(l||1));if(u&&(m=Math.min(m,q)),p&&this._minimumNumberOfVerticesForGeometry*c>m)return void(this._snapshotLimitExceeded=!0);if(!this._supportsExceedsLimitQuery||!has("featurelayer-snapshot-enabled"))return void(this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m);const f=await i(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:N.queryStatisticsTimeout,signal:r}));if(!1===f.ok){if(d(f.error))throw f.error;return void(this._snapshotLimitExceeded=!1)}const y=f.value.features[0];this._snapshotLimitExceeded=!!y?.attributes&&!!y.attributes.exceedslimit}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await b(this.layerView.layer);let e=new AbortController;const t=e.signal,i=this._updateServiceDataCount(t),r=Promise.allSettled([i,this._updateSnapshotLimit(this.displayFeatureLimit,i,t)]),s=r.then((()=>this._updateServiceDataExtent(t))).catch((e=>{d(e)||o.getLogger(this).error("#fetchServiceDataInfo()",e)})).then((()=>{s===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null}));return e&&(this._fetchDataInfoPromise=s),this._fetchDataInfoAbortController=e,r.then((()=>{}),(()=>{}))}_cancelFetchServiceDataInfo(){const e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([F({readOnly:!0})],L.prototype,"type",void 0),e([F({constructOnly:!0})],L.prototype,"graphics",void 0),e([F({constructOnly:!0})],L.prototype,"layerView",void 0),e([F({constructOnly:!0})],L.prototype,"context",void 0),e([F({readOnly:!0})],L.prototype,"dataUpdating",null),e([F()],L.prototype,"extent",null),e([F()],L.prototype,"updating",null),e([F({readOnly:!0})],L.prototype,"_updatingHandles",void 0),e([F()],L.prototype,"updatingTotal",null),e([F()],L.prototype,"updatingRemaining",null),e([F()],L.prototype,"expectedFeatureDiff",null),e([F()],L.prototype,"memoryForUnusedFeatures",null),e([F()],L.prototype,"maximumNumberOfFeaturesExceeded",null),e([F({readOnly:!0})],L.prototype,"serviceDataExtent",void 0),e([F({readOnly:!0})],L.prototype,"serviceDataCount",void 0),e([F()],L.prototype,"_snapshotLimitExceeded",void 0),e([F()],L.prototype,"displayFeatureLimit",void 0),e([F({type:Number})],L.prototype,"maximumNumberOfFeatures",null),e([F({readOnly:!0})],L.prototype,"hasAllFeatures",null),e([F({readOnly:!0})],L.prototype,"hasAllFeaturesInView",null),e([F({readOnly:!0})],L.prototype,"hasFullGeometries",null),e([F()],L.prototype,"_forceTilesMode",void 0),e([F({readOnly:!0})],L.prototype,"mode",null),e([F({readOnly:!0})],L.prototype,"maxTotalSnapshotVertices",null),e([F({readOnly:!0})],L.prototype,"tileDescriptors",null),e([F()],L.prototype,"_tileFetcher",void 0),e([F()],L.prototype,"_fetchDataInfoPromise",void 0),L=e([x("esri.layers.graphics.controllers.FeatureTileController3D")],L);const O=1e4,I=1e6,A=12e3,j=1e4,q=5e6;function P(e,t){if(!t)return!1;for(const i of t)if(!e.has(i))return!0;return!1}var N;!function(e){function t(){e.maxFeatureCountForExtent=O,e.queryStatisticsTimeout=A,e.queryExtentTimeout=j}e.noServiceDataCount=1/0,e.maxSnapshotMinScaleFactor=5,e.reset=t}(N||(N={})),N.reset();export{L as FeatureTileController3D,N as FeatureTileController3DConstants};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getExpressionFromFieldName as t,getWhereClause as e,getAliasFromFieldName as i}from"./attributeSupport.js";import{getGeometry as s}from"./geometryUtils.js";import{isDateOnlyField as a,isTimestampOffsetField as l,isTimeOnlyField as r}from"../../support/fieldUtils.js";import{timeOnlyToMilliseconds as n}from"../../../smartMapping/statistics/support/utils.js";import{processNullValue as u,getNormalizedValue as o}from"../../../statistics/utils.js";import{loadArcade as d}from"../../../support/
|
|
5
|
+
import{getExpressionFromFieldName as t,getWhereClause as e,getAliasFromFieldName as i}from"./attributeSupport.js";import{getGeometry as s}from"./geometryUtils.js";import{isDateOnlyField as a,isTimestampOffsetField as l,isTimeOnlyField as r}from"../../support/fieldUtils.js";import{timeOnlyToMilliseconds as n}from"../../../smartMapping/statistics/support/utils.js";import{processNullValue as u,getNormalizedValue as o}from"../../../statistics/utils.js";import{loadArcade as d}from"../../../support/loadArcade.js";class c{constructor(s,a,l){this._fieldDataCache=new Map,this._returnDistinctMap=new Map,this.returnDistinctValues=s.returnDistinctValues??!1,this.fieldsIndex=l,this.featureAdapter=a;const r=s.outFields;if(r&&!r.includes("*")){this.outFields=r;let s=0;for(const a of r){const r=t(a),n=this.fieldsIndex.get(r),u=n?null:e(r,l),o=n?n.name:i(a)||"FIELD_EXP_"+s++;this._fieldDataCache.set(a,{alias:o,clause:u})}}}countDistinctValues(t){return this.returnDistinctValues?(t.forEach((t=>this.getAttributes(t))),this._returnDistinctMap.size):t.length}getAttributes(t){const e=this._processAttributesForOutFields(t);return this._processAttributesForDistinctValues(e)}getFieldValue(t,i,s){const a=s?s.name:i;let l=null;return this._fieldDataCache.has(a)?l=this._fieldDataCache.get(a)?.clause:s||(l=e(i,this.fieldsIndex),this._fieldDataCache.set(a,{alias:a,clause:l})),s?this.featureAdapter.getAttribute(t,a):l?.calculateValue(t,this.featureAdapter)}getDataValues(t,e,i=!0){const s=e.normalizationType,d=e.normalizationTotal,c=this.fieldsIndex.get(e.field),h=a(c)||l(c),f=r(c);return t.map((t=>{let a=e.field&&this.getFieldValue(t,e.field,this.fieldsIndex.get(e.field));if(e.field2?(a=`${u(a)}${e.fieldDelimiter}${u(this.getFieldValue(t,e.field2,this.fieldsIndex.get(e.field2)))}`,e.field3&&(a=`${a}${e.fieldDelimiter}${u(this.getFieldValue(t,e.field3,this.fieldsIndex.get(e.field3)))}`)):"string"==typeof a&&i&&(h?a=a?new Date(a).getTime():null:f&&(a=a?n(a):null)),s&&Number.isFinite(a)){const i="field"===s&&e.normalizationField?this.getFieldValue(t,e.normalizationField,this.fieldsIndex.get(e.normalizationField)):null;a=o(a,s,i,d)}return a}))}async getExpressionValues(t,e,i,a,l){const{arcadeUtils:r}=await d(),n=r.hasGeometryOperations(e);n&&await r.enableGeometryOperations();const u=r.createFunction(e),o=r.getViewInfo(i),c={fields:this.fieldsIndex.fields};return t.map((t=>{const e={attributes:this.featureAdapter.getAttributes(t),layer:c,geometry:n?{...s(a.geometryType,a.hasZ,a.hasM,this.featureAdapter.getGeometry(t)),spatialReference:i?.spatialReference}:null},d=r.createExecContext(e,o,l);return r.executeFunction(u,d)}))}validateItem(t,i){return this._fieldDataCache.has(i)||this._fieldDataCache.set(i,{alias:i,clause:e(i,this.fieldsIndex)}),this._fieldDataCache.get(i)?.clause?.testFeature(t,this.featureAdapter)??!1}validateItems(t,i){return this._fieldDataCache.has(i)||this._fieldDataCache.set(i,{alias:i,clause:e(i,this.fieldsIndex)}),this._fieldDataCache.get(i)?.clause?.testSet(t,this.featureAdapter)??!1}_processAttributesForOutFields(t){const e=this.outFields;if(!e?.length)return this.featureAdapter.getAttributes(t);const i={};for(const s of e){const{alias:e,clause:a}=this._fieldDataCache.get(s);i[e]=a?a.calculateValue(t,this.featureAdapter):this.featureAdapter.getAttribute(t,e)}return i}_processAttributesForDistinctValues(t){if(null==t||!this.returnDistinctValues)return t;const e=this.outFields,i=[];if(e)for(const l of e){const{alias:e}=this._fieldDataCache.get(l);i.push(t[e])}else for(const l in t)i.push(t[l]);const s=`${(e||["*"]).join(",")}=${i.join(",")}`;let a=this._returnDistinctMap.get(s)||0;return this._returnDistinctMap.set(s,++a),a>1?null:t}}export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clone as e}from"../../../core/lang.js";import{millisecondsPerTimeUnit as t}from"../../../core/timeUtils.js";import{polygonCentroid as i,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as r}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as n}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import u from"./AttributesBuilder.js";import{cleanFromGeometryEngine as c,getGeometry as m,transformCentroid as d}from"./geometryUtils.js";import{project as h}from"./projectionSupport.js";import{getDateInNumber as p}from"./queryUtils.js";import{makeEdgeCandidate as f,makeVertexCandidate as y}from"./SnappingCandidate.js";import{isDateField as g,isDateOnlyField as x,isTimestampOffsetField as I,isStringField as T,isTimeOnlyField as F}from"../../support/fieldUtils.js";import _ from"../../../rest/support/AutoIntervalBinParameters.js";import V from"../../../rest/support/DateBinParameters.js";import v from"../../../rest/support/FixedBoundariesBinParameters.js";import b from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as A,createUVResult as w,calculateClassBreaks as M,resolveCBResult as D,calculateHistogram as P,getAttributeComparator as q,calculatePercentile as N,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";const G="bin";class C{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new u(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=c({spatialReference:this.query.outSR,...h(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=c({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const i=this.featureAdapter,s=O(this.hasZ,this.hasM),{point:a,mode:r}=e,n="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c="esriGeometryPolyline"===this.geometryType,m=this._getPointCreator(r,this.spatialReference,t),d=new H(null,0),h=new H(null,0),p={x:0,y:0,z:0};for(const g of this.items){const t=i.getGeometry(g);if(null==t)continue;const{coords:r}=t,x=t.isPoint?Q:t.lengths;if(d.coords=r,h.coords=r,e.returnEdge){let e=0;for(let t=0;t<x.length;t++){const r=x[t],c=e;for(let t=0;t<r;t++,e+=s){if(!u&&t===r-1)continue;const y=d;y.coordsIndex=e;const x=h;x.coordsIndex=t===r-1?c:e+s;const I=p;if(!E(p,a,y,x))continue;const T=(a.x-I.x)/n,F=(a.y-I.y)/o,_=T*T+F*F;_<=1&&l.candidates.push(f(i.getObjectId(g),m(I),Math.sqrt(_),m(y),m(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<x.length;t++){const r=x[t],c=e,p=h;p.coordsIndex=c;for(let t=0;t<r;t++,e+=s){const s=d;if(s.coordsIndex=e,u&&t===r-1&&s.x===p.x&&s.y===p.y)continue;const c=(a.x-s.x)/n,h=(a.y-s.y)/o,f=c*c+h*h;f<=1&&l.candidates.push(y(i.getObjectId(g),m(s),Math.sqrt(f)))}}}else if(c&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<x.length;i++){t.push(e);const a=x[i];e+=a*s,!u&&a>1&&t.push(e-s)}for(const s of t){const e=d;e.coordsIndex=s;const t=(a.x-e.x)/n,r=(a.y-e.y)/o,u=t*t+r*r;u<=1&&l.candidates.push(y(i.getObjectId(g),m(e),Math.sqrt(u)))}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,i){const s=null==i||l(t,i)?e=>e:e=>h(e,t,i),{hasZ:a}=this,r=0;return"3d"===e?a?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r}):({x:e,y:t})=>s({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=g(m)||x(m)||I(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),f={value:.5,fieldType:m?.type},y=T(m)?R({values:h,supportsNullCount:p,percentileParams:f,outStatisticTypes:c}):B({values:h,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f,outStatisticTypes:c});return z(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=A(o);return w(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=M(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return D(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return P(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=q(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:r,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:p,returnM:f}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:r,spatialReference:c(u||o),transform:m&&n(m)||null}}_createFeatures(e,t){const i=new u(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:o,returnGeometry:l,returnCentroid:c,maxAllowableOffset:h,resultOffset:p,resultRecordCount:f,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,I=s&&g;let T=[],F=0;const _=[...t];if(this._sortFeatures(_,r,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(l||c)){const e=n(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!c)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:m(this.geometryType,this.hasZ,this.hasM,a,h,e,x,I)};t&&a&&!r.geometry&&(r.centroid=d(this,this.featureAdapter.getCentroid(s,this),e)),T[F++]=r}else if(!l&&c)for(const s of _)T[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)T[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e),geometry:m(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),h,e,x,I)}}else for(const n of _){const e=i.getAttributes(n);e&&(T[F++]={attributes:e})}const V=p||0;if(null!=f){const e=V+f;T=T.slice(V,Math.min(T.length,e))}return T}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=O(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new u(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:p}=e,f=m?.length,y=!!f,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const u of c??[]){const{outStatisticFieldName:e,statisticType:c}=u,h=u,p="exceedslimit"!==c?u.onStatisticField:void 0,I="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===f&&(p===g||x)&&"count"===c;if(y){if(!n.has(p)){const e=[];for(const i of m){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:u,itemPositions:c}=i[r],f=n.join(",");if(!d||l.validateItems(u,d)){const i=o.get(f)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,u);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(l,p,t,a),i=c.map((t=>e[t]));r=I&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,l.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(f,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(l,p,t,a);i.attributes[e]=I&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,r,l.returnDistinctValues)}const V="min"!==c&&"max"!==c||!T(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const I=y?Array.from(o.values()):[i];return this._sortFeatures(I,h,((e,t)=>e.attributes[t])),p&&(I.length=Math.min(p,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return g(t)||x(t)||I(t)||F(t)}async _getAggregateGeometry(e,t){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:d,geometryType:h,hasZ:p,hasM:f}=this,y=t.map((e=>m(h,p,f,c.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?a(g):r(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?i(g):s(r(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):T(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return N(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new u(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:G,alias:G,type:"esriFieldTypeInteger"}],o=new u(e,this.featureAdapter,this.fieldsIndex),l=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,l),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const u in d){const{items:t}=d[u],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:u}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(_.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(V.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(v.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(b.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:p(l,!1),maxValue:p(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,i,s){const{field:a,interval:r,start:n,end:o}=e,l=r.unit,u="quarters"===l?3*t.months:t[l],c=r.value*u/t.milliseconds,m=await this._getDataValues({field:e.field,timeZone:i.outTimeReference?.ianaTimeZone},s),d=F(this.fieldsIndex.get(a)),h=j(m,{field:a,classificationMethod:"defined-interval",definedInterval:c,minValue:p(n,d),maxValue:p(o,d)},!0),f=await this._calculateHistogramBins(m,h,s);return this._createFeaturesFromHistogramBins(f,i)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=F(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>p(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=F(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:p(r,l),maxValue:p(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:G,alias:G,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;for(const m of e){const{minValue:e,maxValue:i,items:s}=m,d={attributes:{}};let h;if(d.attributes[a]=e,d.attributes[r]=i,l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),d.attributes[G]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...d.attributes}:{...t,...d.attributes}})))):(d.stackedAttributes=h.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(d))):(t.bin?.splitBy&&(d.attributes[G]=++c),h=await this._createStatisticsQueryResponse(t,s,d),n.push(d)),h.fields)for(const t of h.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function E(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function O(e,t){return e?t?4:3:t?3:2}class H{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const Q=[1];export{C as QueryEngineResult};
|
|
5
|
+
import{clone as e}from"../../../core/lang.js";import{millisecondsPerTimeUnit as t}from"../../../core/timeUtils.js";import{polygonCentroid as i,extentCentroid as s}from"../../../geometry/support/centroid.js";import{getPolygonExtent as a,getGeometryExtent as r}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as n}from"../../../geometry/support/quantizationUtils.js";import{isValid as o,equals as l}from"../../../geometry/support/spatialReferenceUtils.js";import u from"./AttributesBuilder.js";import{cleanFromGeometryEngine as c,getGeometry as m,transformCentroid as d}from"./geometryUtils.js";import{project as h}from"./projectionSupport.js";import{getDateInNumber as p}from"./queryUtils.js";import{makeEdgeCandidate as f,makeVertexCandidate as y}from"./SnappingCandidate.js";import{isDateField as g,isDateOnlyField as x,isTimestampOffsetField as T,isStringField as I,isTimeOnlyField as F}from"../../support/fieldUtils.js";import _ from"../../../rest/support/AutoIntervalBinParameters.js";import V from"../../../rest/support/DateBinParameters.js";import v from"../../../rest/support/FixedBoundariesBinParameters.js";import b from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as S,calculateStringStatistics as R,calculateStatistics as B,processSummaryStatisticsResult as z,calculateUniqueValuesCount as A,createUVResult as w,calculateClassBreaks as M,resolveCBResult as P,calculateHistogram as D,getAttributeComparator as q,calculatePercentile as N,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";const G="bin";class C{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasM=i.hasM,this.hasZ=i.hasZ,this.fieldsIndex=i.fieldsIndex,this.objectIdField=i.objectIdField,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter}get size(){return this.items.length}createQueryResponseForCount(){const e=new u(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some((e=>"exceedslimit"===e.statisticType))?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;o(this.query.outSR)&&!l(t.spatialReference,this.query.outSR)?e.queryGeometry=c({spatialReference:this.query.outSR,...h(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=c({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t){const i=this.featureAdapter,s=O(this.hasZ,this.hasM),{point:a,mode:r}=e,n="number"==typeof e.distance?e.distance:e.distance.x,o="number"==typeof e.distance?e.distance:e.distance.y,l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,m=this._getPointCreator(r,this.spatialReference,t),d=new H(null,0),h=new H(null,0),p={x:0,y:0,z:0};for(const g of this.items){const t=i.getGeometry(g);if(null==t)continue;const{coords:r}=t,x=t.isPoint?Q:t.lengths;if(d.coords=r,h.coords=r,e.returnEdge){let e=0;for(let t=0;t<x.length;t++){const r=x[t],c=e;for(let t=0;t<r;t++,e+=s){if(!u&&t===r-1)continue;const y=d;y.coordsIndex=e;const x=h;x.coordsIndex=t===r-1?c:e+s;const T=p;if(!E(p,a,y,x))continue;const I=(a.x-T.x)/n,F=(a.y-T.y)/o,_=I*I+F*F;_<=1&&l.candidates.push(f(i.getObjectId(g),m(T),Math.sqrt(_),m(y),m(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<x.length;t++){const r=x[t],c=e,p=h;p.coordsIndex=c;for(let t=0;t<r;t++,e+=s){const s=d;if(s.coordsIndex=e,u&&t===r-1&&s.x===p.x&&s.y===p.y)continue;const c=(a.x-s.x)/n,h=(a.y-s.y)/o,f=c*c+h*h;f<=1&&l.candidates.push(y(i.getObjectId(g),m(s),Math.sqrt(f)))}}}else if(c&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<x.length;i++){t.push(e);const a=x[i];e+=a*s,!u&&a>1&&t.push(e-s)}for(const s of t){const e=d;e.coordsIndex=s;const t=(a.x-e.x)/n,r=(a.y-e.y)/o,u=t*t+r*r;u<=1&&l.candidates.push(y(i.getObjectId(g),m(e),Math.sqrt(u)))}}}return l.candidates.sort(((e,t)=>e.distance-t.distance)),l}_getPointCreator(e,t,i){const s=null==i||l(t,i)?e=>e:e=>h(e,t,i),{hasZ:a}=this,r=0;return"3d"===e?a?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r}):({x:e,y:t})=>s({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=g(m)||x(m)||T(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=S({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),f={value:.5,fieldType:m?.type},y=I(m)?R({values:h,supportsNullCount:p,percentileParams:f,outStatisticTypes:c}):B({values:h,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:f,outStatisticTypes:c});return z(y,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=A(o);return w(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=M(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return P(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return D(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const t=s.split(" "),a=t[0],r=this.fieldsIndex.get(a),n=!!t[1]&&"desc"===t[1].toLowerCase(),o=q(r?.type,n);e.sort(((e,t)=>{const s=i(e,a,r),n=i(t,a,r);return o(s,n)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:r,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:p,returnM:f}=e,y=null!=d&&t.length>(h||0)+d,g=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:y,features:this._createFeatures(e,t),fields:g,geometryType:i,hasM:s&&f,hasZ:a&&p,objectIdFieldName:r,spatialReference:c(u||o),transform:m&&n(m)||null}}_createFeatures(e,t){const i=new u(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:o,returnGeometry:l,returnCentroid:c,maxAllowableOffset:h,resultOffset:p,resultRecordCount:f,returnZ:y=!1,returnM:g=!1}=e,x=a&&y,T=s&&g;let I=[],F=0;const _=[...t];if(this._sortFeatures(_,r,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(l||c)){const e=n(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!c)for(const s of _){const a=this.featureAdapter.getGeometry(s),r={attributes:i.getAttributes(s),geometry:m(this.geometryType,this.hasZ,this.hasM,a,h,e,x,T)};t&&a&&!r.geometry&&(r.centroid=d(this,this.featureAdapter.getCentroid(s,this),e)),I[F++]=r}else if(!l&&c)for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e)};else for(const s of _)I[F++]={attributes:i.getAttributes(s),centroid:d(this,this.featureAdapter.getCentroid(s,this),e),geometry:m(this.geometryType,this.hasZ,this.hasM,this.featureAdapter.getGeometry(s),h,e,x,T)}}else for(const n of _){const e=i.getAttributes(n);e&&(I[F++]={attributes:e})}const V=p||0;if(null!=f){const e=V+f;I=I.slice(V,Math.min(I.length,e))}return I}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{const t=O(this.hasZ,this.hasM),i=this.featureAdapter;e=this.items.reduce(((e,t)=>{const s=i.getGeometry(t);return e+(null!=s&&s.coords.length||0)}),0)/t>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new u(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:p}=e,f=m?.length,y=!!f,g=y?m[0]:null,x=y&&!this.fieldsIndex.get(g);for(const u of c??[]){const{outStatisticFieldName:e,statisticType:c}=u,h=u,p="exceedslimit"!==c?u.onStatisticField:void 0,T="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=y&&1===f&&(p===g||x)&&"count"===c;if(y){if(!n.has(p)){const e=[];for(const i of m){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(p,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=n.get(p);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:u,itemPositions:c}=i[r],f=n.join(",");if(!d||l.validateItems(u,d)){const i=o.get(f)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,u);i.aggregateGeometries[t]=e}else{let r=null;if(_)r=s;else{const e=this._getAttributeValues(l,p,t,a),i=c.map((t=>e[t]));r=T&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,l.returnDistinctValues)}i.attributes[e]=r}let r=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t])),o.set(f,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(h,t);i.aggregateGeometries[s]=e}else{const s=this._getAttributeValues(l,p,t,a);i.attributes[e]=T&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,r,l.returnDistinctValues)}const V="min"!==c&&"max"!==c||!I(this.fieldsIndex.get(p))&&!this._isAnyDateField(p)?null:this.fieldsIndex.get(p)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const T=y?Array.from(o.values()):[i];return this._sortFeatures(T,h,((e,t)=>e.attributes[t])),p&&(T.length=Math.min(p,T.length)),{fields:s,features:T}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return g(t)||x(t)||T(t)||F(t)}async _getAggregateGeometry(e,t){const{convexHull:n,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:d,geometryType:h,hasZ:p,hasM:f}=this,y=t.map((e=>m(h,p,f,c.getGeometry(e)))),g=n(d,y,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=g?a(g):r(o(d,y));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=g?i(g):s(r(o(d,y)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=g,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):I(this.fieldsIndex.get(a))||this._isAnyDateField(a)?R({values:t,returnDistinct:s}):B({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return N(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(t,i,s=!0){const a=new u(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:r,scale:n,timeZone:o}=t;return r?a.getExpressionValues(i,r,{viewingMode:"map",scale:n,spatialReference:this.query.outSR||this.spatialReference},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},o):a.getDataValues(i,e(t),s)}async _calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map((([e,t])=>({minValue:e,maxValue:t,count:0,items:[]})));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:G,alias:G,type:"esriFieldTypeInteger"}],o=new u(e,this.featureAdapter,this.fieldsIndex),l=new Map,c=[...this.items];this._sortFeatures(c,[i],((e,t,i)=>o.getFieldValue(e,t,i)));const m=this._getAttributeValues(o,i,c,l),d=this._calculateUniqueValues([m],c,o.returnDistinctValues);for(const u in d){const{items:t}=d[u],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map((e=>({...e,attributes:{...e.attributes,[s??i]:u}})))),a.fields)for(const e of a.fields)n.some((t=>t.name===e.name))||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(_.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(V.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(v.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(b.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=j(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:p(l,!1),maxValue:p(u,!1)}),d=await this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,i,s){const{field:a,interval:r,start:n,end:o}=e,l=r.unit,u="quarters"===l?3*t.months:t[l],c=r.value*u/t.milliseconds,m=await this._getDataValues({field:e.field,timeZone:i.outTimeReference?.ianaTimeZone},s),d=F(this.fieldsIndex.get(a)),h=j(m,{field:a,classificationMethod:"defined-interval",definedInterval:c,minValue:p(n,d),maxValue:p(o,d)},!0),f=await this._calculateHistogramBins(m,h,s);return this._createFeaturesFromHistogramBins(f,i)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s,timeZone:t.outTimeReference?.ianaTimeZone},i),r=F(this.fieldsIndex.get(s)),n=e.boundaries.map((e=>p(e,r))).sort(((e,t)=>e-t)),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=await this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n}=e,o=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),l=F(this.fieldsIndex.get(s)),u=j(o,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:p(r,l),maxValue:p(n,l)},!0),c=await this._calculateHistogramBins(o,u,i);return this._createFeaturesFromHistogramBins(c,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:G,alias:G,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;for(const m of e){const{minValue:e,maxValue:i,items:s}=m,d={attributes:{}};let h;if(d.attributes[a]=e,d.attributes[r]=i,l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),d.attributes[G]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map((({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...d.attributes}:{...t,...d.attributes}})))):(d.stackedAttributes=h.features.map((({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t)),n.push(d))):(t.bin?.splitBy&&(d.attributes[G]=++c),h=await this._createStatisticsQueryResponse(t,s,d),n.push(d)),h.fields)for(const t of h.fields)o.some((e=>e.name===t.name))||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function E(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}function O(e,t){return e?t?4:3:t?3:2}class H{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const Q=[1];export{C as QueryEngineResult};
|