@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250108
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/AttributeBinsGraphic.js +5 -0
- package/README.md +1 -1
- package/WebLinkChart.js +1 -1
- package/applications/MapViewer/templateUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
- package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
- package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
- package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
- package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
- package/assets/esri/core/workers/chunks/{07304287ed5244fa4e12.js → 12b2c8251ec2d0e2ca46.js} +1 -1
- package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
- package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
- package/assets/esri/core/workers/chunks/24a597ae32a2083a50a5.js +1 -0
- package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
- package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
- package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
- package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
- package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
- package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
- package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
- package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
- package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
- package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
- package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
- package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
- package/assets/esri/core/workers/chunks/510cb8647841fec436c8.js +1 -0
- package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → 58485909e1cfeb52c01e.js} +1 -1
- package/assets/esri/core/workers/chunks/5b61a1e7ac60a02a906d.js +1 -0
- package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
- package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
- package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
- package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
- package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
- package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
- package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/76a7114a69264f5c07b0.js +2 -0
- package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → 76a7114a69264f5c07b0.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
- package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
- package/assets/esri/core/workers/chunks/{ca1e186f136abb23ae4b.js → 7d0fc25ce1f74adcfeb6.js} +1 -1
- package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → 7df076d15b7b7a66dcee.js} +1 -1
- package/assets/esri/core/workers/chunks/{955421ee2247965244f0.js → 7fe92f072d3641ec4662.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
- package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 89286d8f59844724cd16.js} +1 -1
- package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
- package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
- package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
- package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
- package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
- package/assets/esri/core/workers/chunks/a8ec4189ec3b37d5ff74.js +1 -0
- package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
- package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
- package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
- package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
- package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/cd92b80de7e9f982f9a9.js +1 -0
- package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
- package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
- package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
- package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
- package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
- package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
- package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
- package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
- package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
- package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
- package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/bufferOperator.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/geodesicBufferOperator.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/terrainUtilsSpherical.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/geometry/operators/graphicBufferOperator.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/geometry/support/meshVertexSpaceUtils.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/interfaces.d.ts +186 -96
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapNotesLayer.js +1 -1
- package/layers/MediaLayer.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/graphics/sources/WFSSource.js +1 -1
- package/layers/support/ImageElement.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/linkChart/OrganicLayoutSettings.js +1 -1
- package/package.json +4 -4
- package/renderers/RasterStretchRenderer.js +1 -1
- package/rest/query/executeAttributeBinsQuery.js +1 -1
- package/rest/support/AttributeBinsFeatureSet.js +5 -0
- package/rest/support/AttributeBinsQuery.js +1 -1
- package/rest/support/BinParametersAttributes.js +1 -1
- package/rest/support/BinParametersBase.js +1 -1
- package/rest/support/DateBinParameters.js +1 -1
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/NormalizationBinParametersMixin.js +1 -1
- package/rest/support/Query.js +1 -1
- package/rest/support/TopFeaturesQuery.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
- package/support/mediaLayerUtils.js +5 -0
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
- package/views/2d/AnimationManager.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/BitmapContainer.js +1 -1
- package/views/2d/engine/BitmapTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/FillBucket.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/support/HighlightGroup.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/Slice/ShiftManipulator.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/placementUtils.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/HighlightGroup.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TilePerLayerInfo.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
- package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/support/HighlightHelper.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/MediaLayerView.js +1 -1
- package/views/support/HighlightGroup.d.ts +4 -0
- package/views/support/HighlightGroup.js +5 -0
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/textureUtils.js +5 -0
- package/webscene/Slide.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/support/exportUtils.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/assets/esri/core/workers/chunks/005727711cca0614c2ab.js +0 -2
- package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
- package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
- package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +0 -1
- package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
- package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
- package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
- package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
- package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
- package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
- package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
- package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
- package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +0 -1
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +0 -1
- package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
- package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
- package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
- package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
- package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
- package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
- package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
- package/views/2d/support/HighlightGroup.d.ts +0 -4
package/layers/LinkChartLayer.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import a from"../core/Collection.js";import i from"../core/Error.js";import o from"../core/Logger.js";import{getOrCreateMapValue as n}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import y from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import v from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as D,getRelationshipEndNodeIds as x}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{OperationalLayer as E}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as _,LCSimpleLayout as A,LCSmartTreeLayout as j,LCRadialTreeLayout as R,LCHierarchicalLayout as G,LCCommunityLayout as P,LCForceDirectedLayout as F,NodeFlag as U,load as B,CallStatus as O,LinkType as z}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as W}from"../rest/knowledgeGraphService.js";import Q from"../geometry/Extent.js";import $ from"../geometry/Point.js";import H from"../geometry/Polyline.js";let K=class extends(E(S(I(r(y))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.defaultLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(a.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(a.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.inclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.inclusionModeDefinition)throw new i("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}=e;return{url:t,title:a,dataPreloadedInLocalCache:i,defaultLinkChartConfig:o}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let a=[],n=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new i("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((i,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),n.push(s)):"entity"===s.type?t.has(r)||(t.add(r),a.push(s)):(o.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(a=e.knowledgeGraph.dataModel.entityTypes??[],n=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=a,this.memberRelationshipTypes=n,this.dataManager=r}load(e){const a=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((a=>{t.push(a.refreshCachedQueryEngine()),e.push(new Promise((e=>{a.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((i=>{W(this.url).then((async o=>{o.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),o.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===g.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(o.dataModel),this.defaultLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:D(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:o,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=v.getInstance();for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const i of a.members?.values()??[]){const a=e.readFromStoreById(`${t}__${i.id}`);if(a){n(this.dataManager.sublayerCaches,t,(()=>new Map)).set(i.id,a)}}await a()}else{const t="geographic-organic-standard"===this.defaultLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await a()})))}i(null)}))}))),Promise.resolve(this)}set inclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("inclusionModeDefinition",e):o.getLogger(this).error("#inclusionModeDefinition","inclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let a=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(a=await x(e,this.dataManager.knowledgeGraph));const i=e.concat(a).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));i.length>0&&(this.membershipModified=!0),await this._handleNewRecords(i,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:a=!1,overrideMembershipCheck:i=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let o=[];for(const r of e)(i||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&o.push(r);if(t){const e=new Set,t=[];for(const a of o)if(this.dataManager.nodeConnectionsLookup.has(a.id))for(const t of this.dataManager.nodeConnectionsLookup.get(a.id))e.add(t);for(const a of e)if(this.dataManager.memberIdTypeLookup.has(a))for(const e of this.dataManager.memberIdTypeLookup.get(a))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:a,typeName:e});o=o.concat(t)}this.dataManager.removeFromLayer(o);for(const r of o)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);a&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),o.length>0&&(this.membershipModified=!0);const n=[];return this.layers.forEach((e=>{n.push(e.refreshCachedQueryEngine())})),await Promise.all(n),this._refreshNamedTypes(),o}async expand(e,t){let a=[];try{const i=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);a=i.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(i){throw l(i)&&a.length>0&&this.removeRecords(a,{overrideMembershipCheck:!0}),i}return{records:a}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===g.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===g.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const a=n(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:i})=>{if(a.add(e),i){const a="coords"in i&&"lengths"in i?i:m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,a):this.entityLinkChartDiagramLookup.set(e,a)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const a=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{a.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,g=new Uint8Array(a.length),y=new Float64Array(a.length),f=new Float64Array(a.length),L=new Float64Array(a.length),b=new Float64Array(a.length),N=new Uint32Array(r.length),v=new Uint32Array(r.length),D=new Float64Array(r.length),x=new Float64Array(r.length),S=[],E="organic-standard",I=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let W,K="organic-standard",q=0,J=0;const V=_.apply;switch(K="geographic-organic-standard"===e?E:e,K){case"organic-standard":W=F.apply;break;case"organic-community":W=P.apply;break;case"hierarchical-bottom-to-top":W=G.apply;break;case"radial-root-centric":W=R.apply;break;case"tree-left-to-right":W=j.apply;break;default:W=A.apply}let X=!1;a.forEach((({typeName:a,feature:i})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(i.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)?g[q]=U.IsGeographic:g[q]=U.None;const o=t.lockedNodeLocations.get(i.attributes[w]);y[q]=o.x,f[q]=o.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(a)){g[q]=U.IsGeographic;let e=null;const t=i.attributes[this.dataManager.geographicLookup.get(a).name],o=this.dataManager.geographicLookup.get(a)?.geometryType;switch(o){case"esriGeometryPoint":y[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=U.IsMovable;break;default:g[q]=U.IsMovable}(null==y[q]||null==f[q]||Number.isNaN(y[q])||Number.isNaN(f[q]))&&(g[q]=U.IsMovable,y[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(i.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(a),o=e?.startField,n=o&&e?.startField?i.attributes[o]:null;L[q]=n?new Date(n).getTime():NaN;const r=e?.endField,s=r&&e?.endField?i.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,y[q]=0,f[q]=0,g[q]=U.IsMovable}else g[q]=U.IsMovable,y[q]=0,f[q]=0;u.set(i.attributes[w],q),S[q]={feature:i,typeName:a},q++})),X&&o.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((a=>{const i=a.feature.attributes[M],o=a.feature.attributes[k],n=u.get(i),r=u.get(o),s=t?.timeInfoByTypeName?.get(a.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?a.feature.attributes[h]:null,c=s?.endField,p=c?a.feature.attributes[c]:null;if(void 0!==n&&void 0!==r){let t=i+"-"+o;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(a.typeName);h||(N[J]=n,v[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(D[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[a.typeName,J]])):s.set(a.typeName,J),J++),l.push(a)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(i,null)})),Y&&o.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t?.layoutSettings),te=this._convertLayoutSettingsToCalculationSettings(ee);await B();let ae=O.Error,ie=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let a;({status:ae,links:ie,graphics:a}=V((()=>t?.signal?.aborted??!1),g,y,f,L,b,N.subarray(0,J),v.subarray(0,J),D.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings??{})),ae===O.Success&&(this.chronologicalAuxiliaryGraphics=a)}else({status:ae,links:ie}=W((()=>t?.signal?.aborted??!1),g,y,f,N.subarray(0,J),v.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ae===O.Error)throw new i("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ae===O.Canceled)throw h();for(let i=0;i<S.length;i++){if(f[i]>84.9999?f[i]=84.9999:f[i]<-84.9999&&(f[i]=-84.9999),y[i]>179.9999?y[i]=179.9999:y[i]<-179.9999&&(y[i]=-179.9999),S[i].feature.attributes[C]=new $(y[i],f[i]),d.has(S[i].typeName)){const e=d.get(S[i].typeName);e?.set(S[i].feature.attributes[w],S[i].feature)}else{const e=new Map;e.set(S[i].feature.attributes[w],S[i].feature),d.set(S[i].typeName,e)}p.set(S[i].feature.attributes[w],S[i].feature);const e=m(S[i].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[i].feature.attributes[w],S[i].feature.attributes[C]?e:null);const t=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[i].typeName,(()=>({useAllData:!1,members:new Map})));n(t.members,S[i].feature.attributes[w],(()=>({id:S[i].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[i].feature.attributes[C],S[i].feature.attributes[C].x<I.xmin&&(I.xmin=S[i].feature.attributes[C].x),S[i].feature.attributes[C].x>I.xmax&&(I.xmax=S[i].feature.attributes[C].x),S[i].feature.attributes[C].y<I.ymin&&(I.ymin=S[i].feature.attributes[C].y),S[i].feature.attributes[C].y>I.ymax&&(I.ymax=S[i].feature.attributes[C].y)}if(this.linkChartExtent.xmin=I.xmin,this.linkChartExtent.xmax=I.xmax,this.linkChartExtent.ymin=I.ymin,this.linkChartExtent.ymax=I.ymax,!ie)throw new i("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const oe=new Map,ne=new Map,re=new Map,se=new Set;for(let i=0;i<l.length;i++){const a=[],r=l[i],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),a=t?.timeInfoByTypeName?e?.startField:null,i=a?r.feature.attributes[a]:null,o=e?.endField;d+="-"+i+"-"+(o?r.feature.attributes[o]:null)}const g=Z.get(d).get(r.typeName),y=0===g?0:ie?.vertexEndIndex[g-1];if(!se.has(g)){if(se.add(g),ie.types[g]===z.Recursive){const e=[ie.vertices[2*y],ie.vertices[2*y+1]],t=[ie.vertices[2*(y+1)],ie.vertices[2*(y+1)+1]],i=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],o=[i[0]-e[0],i[1]-e[1]],n=[i[0]+o[1],i[1]-o[0]],r=[i[0]-o[1],i[1]+o[0]];a.push(e),a.push(n),a.push(t),a.push(r),a.push(e)}else{if(ie.types[g]!==z.Regular){o.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=y;e<ie.vertexEndIndex[g];e++)a.push([ie.vertices[2*e],ie.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];a[0][0]===e.x&&a[0][1]===e.y||(a[0]=[e.x,e.y]),a[a.length-1][0]===t.x&&a[a.length-1][1]===t.y||(a[a.length-1]=[t.x,t.y])}for(let e=1;e<a.length-1;e++)a[e][1]>85.5?a[e][1]=85.5:a[e][1]<-85.5&&(a[e][1]=-85.5),a[e][0]>179.9999?a[e][0]=179.9999:a[e][0]<-179.9999&&(a[e][0]=-179.9999);oe.has(d)?oe.get(d).push(a):oe.set(d,[a])}const f=oe.get(d);ne.has(d)||(ne.set(d,new Map),re.set(d,new Map));const L=ne.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new H({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const v=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?v:null);const D=n(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));n(D.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const i of l)i.feature.attributes[T]=re.get(i.feature.attributes[M]+"-"+i.feature.attributes[k])?.get(i.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const a=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{a.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(a),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,a]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||a?.members?.forEach((t=>{const a=t.linkChartLocation;let i;const o=t.id;a&&(i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]},e.set(o,new $({x:i.x,y:i.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}a=await this.dataManager.getRelationshipsBetweenNodes(e,i,t),await this._handleNewRecords(a,t),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let a=[];try{let i=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(i=i.concat(Array.from(t.keys())))}let o=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(o=o.concat(Array.from(t)))}a=await this.dataManager.getRelationshipsFromNodes(e,o,i,t),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t)}catch(i){throw l(i)&&this.removeRecords(a),i}return{records:a}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const a=new Map;this.layers.forEach((e=>{a.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:a,...t})}async _handleNewRecords(e,t){const a=[];this.dataManager.addToLayer(e);for(const o of e)this.sublayerIdsCache.has(o.typeName)||(this.sublayerIdsCache.set(o.typeName,new Set),a.push(o.typeName)),this.sublayerIdsCache.get(o.typeName).add(o.id);for(const o of a){const e=this._graphTypeLookup.get(o);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(o):this.dataManager.relationshipTypeNames.add(o),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(o,new Map)}}await N(this,a,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const i=Object.assign({},this._currentLinkChartConfig.layoutSettings);i.lockedNodeLocations=new Map;for(const[o,n]of this.entityLinkChartDiagramLookup.entries())n&&i.lockedNodeLocations.set(o,new $(n.coords[0],n.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{layoutSettings:i})}_createSublayers(e,t,a){e.forEach((e=>{const i=this._createSublayer(e);a(i)&&t.push(i),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const a=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));a&&(t.objectType=a,t.read({title:a.name},{origin:"service"}),this._updateSublayerCaches(a))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.defaultLinkChartConfig?this.defaultLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const a=e.linkChartLocation;let i;const o=e.id;if(!a)return;i="x"in a?{x:a.x,y:a.y}:{x:a.coords[0],y:a.coords[1]};const n=m(i);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(o,n):this.entityLinkChartDiagramLookup.set(o,n),this.linkChartExtent.xmin>i.x&&(this.linkChartExtent.xmin=i.x),this.linkChartExtent.xmax<i.x&&(this.linkChartExtent.xmax=i.x),this.linkChartExtent.ymin>i.y&&(this.linkChartExtent.ymin=i.y),this.linkChartExtent.ymax<i.y&&(this.linkChartExtent.ymax=i.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),a=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&a){const i=m(new H({paths:[[[t.coords[0],t.coords[1]],[a.coords[0],a.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],i)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.defaultLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.defaultLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const a=e=>"number"==typeof e&&!isNaN(e),i=e=>a(e)&&e>=1,n=e=>a(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>a(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;n(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&o.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),i(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&o.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p||void 0!==u)&&(r(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&o.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===u&&s(c)?l.organicLayoutSettings.absoluteIdealEdgeLength=c:"absolute-value"===u&&void 0!==c?o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===u&&s(p)?l.organicLayoutSettings.multiplicativeIdealEdgeLength=p:"multiplier"===u&&void 0!==p&&o.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&o.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE?e.organicLayoutSettings.absoluteIdealEdgeLength:e.organicLayoutSettings.multiplicativeIdealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier??void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),i=new Set((e.entityTypes??[]).map((e=>e.name))),n=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=i.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?i.has(e.graphTypeName):n.has(e.graphTypeName))))}else this.layers=new a;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],a=this.layers.map((e=>e.graphTypeName)).concat(t);for(const o of a)e.has(o)||this._originalInclusionList.namedTypeDefinitions.set(o,{useAllData:!1,members:new Map});const i=[];for(const n of this._originalInclusionList.namedTypeDefinitions.keys())a.includes(n)||(o.getLogger(this).warn(`A named type, ${n}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),i.push(n));for(const o of i)this._originalInclusionList.namedTypeDefinitions.delete(o)}}};e([p()],K.prototype,"dataPreloadedInLocalCache",void 0),e([p()],K.prototype,"defaultLinkChartConfig",void 0),e([p()],K.prototype,"membershipModified",void 0),e([p()],K.prototype,"dataManager",void 0),e([p()],K.prototype,"inclusionModeDefinition",null),e([p()],K.prototype,"knowledgeGraph",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([p()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],K.prototype,"linkChartExtent",void 0),e([p()],K.prototype,"memberEntityTypes",void 0),e([p()],K.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([p()],K.prototype,"sublayerIdsCache",void 0),e([p({type:a.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([p({json:{read:!1}})],K.prototype,"type",void 0),e([p({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const q=K;export{q as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import{serializationUtilsModuleWrapper as t}from"../applications/KnowledgeStudio/resourceSerializationUtils.js";import i from"../core/Collection.js";import a from"../core/Error.js";import n from"../core/Logger.js";import{getOrCreateMapValue as o}from"../core/MapUtils.js";import{MultiOriginJSONMixin as r}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as s,isAbortError as l,createAbortError as h}from"../core/promiseUtils.js";import{watch as d,sync as c}from"../core/reactiveUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{OriginId as g}from"../core/accessorSupport/PropertyOrigin.js";import y from"./Layer.js";import{convertFromGeometry as m}from"./graphics/featureConversionUtils.js";import{IdealEdgeLengthTypeOptions as f}from"./knowledgeGraph/IdealEdgeLengthTypeOptions.js";import{KnowledgeGraphLayerDataManager as L}from"./knowledgeGraph/KnowledgeGraphLayerDataManager.js";import b from"./knowledgeGraph/KnowledgeGraphSublayer.js";import{systemOidFieldName as w,systemOriginIdFieldName as M,systemDestinationIdFieldName as k,systemLayoutGeometryFieldName as C,systemAggregationCountFieldName as T,initializeLayersFromClientData as N}from"./knowledgeGraph/layerUtils.js";import v from"./knowledgeGraph/SessionMemoryStorage.js";import{convertLayoutTypeToWebSupportedFormat as D,getRelationshipEndNodeIds as x}from"./knowledgeGraph/supportUtils.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{ScaleRangeLayer as E}from"./mixins/ScaleRangeLayer.js";import{LCChronologicalLayout as _,LCSimpleLayout as A,LCSmartTreeLayout as R,LCRadialTreeLayout as j,LCHierarchicalLayout as G,LCCommunityLayout as z,LCForceDirectedLayout as P,NodeFlag as F,load as U,CallStatus as B,LinkType as O}from"../libs/linkchartlayout/LinkChartLayout.js";import{fetchKnowledgeGraph as W}from"../rest/knowledgeGraphService.js";import Q from"../geometry/Extent.js";import $ from"../geometry/Point.js";import H from"../geometry/Polyline.js";let K=class extends(I(S(E(r(y))))){constructor(e){if(super(e),this.dataPreloadedInLocalCache=!1,this.initializationLinkChartConfig=null,this.membershipModified=!0,this._currentLinkChartConfig={layoutMode:"radial-root-centric"},this._graphTypeLookup=new Map,this.dataManager=null,this.knowledgeGraph=null,this.layers=new(i.ofType(b)),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map,this.linkChartExtent=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7}),this.memberEntityTypes=null,this.memberRelationshipTypes=null,this.operationalLayerType="LinkChartLayer",this.sublayerIdsCache=new Map,this.tables=new(i.ofType(b)),this.type="link-chart",this.chronologicalAuxiliaryGraphics=null,this._originalInclusionList=e?.initializationInclusionModeDefinition,e?.dataPreloadedInLocalCache&&!e?.initializationInclusionModeDefinition)throw new a("knowledge-graph:linkchart-layer-constructor","If creating a link chart composite layer and configured that data is already loaded in the cache, you must specify an inclusion list so the Composite Layer knows what records belong to it");this.addHandles(d((()=>this.layers.concat(this.tables)),((e,t)=>this._handleSublayersChange(e,t)),c))}normalizeCtorArgs(e){if(!e)return{};const{url:t,title:i,dataPreloadedInLocalCache:a,initializationLinkChartConfig:n}=e;return{url:t,title:i,dataPreloadedInLocalCache:a,initializationLinkChartConfig:n}}_initializeLayerProperties(e){if(!this.title&&this.url){const e=this.url.split("/");this.title=e[e.length-2]}const t=new Set;let i=[],o=[];if(e.inclusionModeDefinition&&(!e.inclusionModeDefinition.namedTypeDefinitions||e.inclusionModeDefinition.namedTypeDefinitions.size<1))throw new a("knowledge-graph:composite-layer-constructor","If an explicit inclusion definition is defined, at least one namedTypeDefinition must also be defined");e.inclusionModeDefinition?.generateAllSublayers?(i=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]):e.inclusionModeDefinition?.namedTypeDefinitions&&e.inclusionModeDefinition?.namedTypeDefinitions.size>0?e.inclusionModeDefinition?.namedTypeDefinitions.forEach(((a,r)=>{const s=this._graphTypeLookup.get(r);if(!s)return n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't in the data model and will be removed`),void e.inclusionModeDefinition?.namedTypeDefinitions.delete(r);"relationship"===s.type?t.has(r)||(t.add(r),o.push(s)):"entity"===s.type?t.has(r)||(t.add(r),i.push(s)):(n.getLogger(this).warn(`A named type, ${r}, was in the inclusion list that wasn't properly modeled and will be removed`),e.inclusionModeDefinition?.namedTypeDefinitions.delete(r))})):(i=e.knowledgeGraph.dataModel.entityTypes??[],o=e.knowledgeGraph.dataModel.relationshipTypes??[]);const r=new L({knowledgeGraph:e.knowledgeGraph,inclusionModeDefinition:e.inclusionModeDefinition});this.knowledgeGraph=e.knowledgeGraph,this.memberEntityTypes=i,this.memberRelationshipTypes=o,this.dataManager=r}load(e){const i=async()=>{const e=[],t=[];this.loadLayerAssumingLocalCache(),await N(this),this.dataManager.inclusionModeDefinition&&(this.dataManager.inclusionModeDefinition.generateAllSublayers=!1),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.forEach((e=>{e.useAllData=!1})),await this._initializeDiagram(),this.layers.forEach((i=>{t.push(i.refreshCachedQueryEngine()),e.push(new Promise((e=>{i.on("layerview-create",(()=>{e(null)}))})))})),this.tables.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t)};return this.addResolvingPromise(new Promise((a=>{W(this.url).then((async n=>{n.dataModel.entityTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)})),n.dataModel.relationshipTypes?.forEach((e=>{e.name&&this._graphTypeLookup.set(e.name,e)}));const r=this.parent?.linkChartProperties;if(r?.originIdOf("entitiesUrl")===g.LINK_CHART&&(this.membershipModified=!1,this._originalInclusionList=await t.fetchAndConvertSerializedLinkChart({entitiesUrl:this.parent.linkChartProperties.entitiesUrl,relationshipsUrl:this.parent.linkChartProperties.relationshipsUrl}),this._alignLayersDataModelAndInclusionDefinition(n.dataModel),this.initializationLinkChartConfig={layoutSettings:r?.layoutSettings??void 0,layoutMode:D(r.layoutType)}),this._initializeLayerProperties({knowledgeGraph:n,inclusionModeDefinition:this._originalInclusionList}),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.size||(this.dataManager.inclusionModeDefinition={generateAllSublayers:!1,namedTypeDefinitions:new Map},this.dataManager.knowledgeGraph.dataModel.entityTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})})),this.dataManager.knowledgeGraph.dataModel.relationshipTypes?.forEach((e=>{e.name&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.set(e.name,{useAllData:!0})}))),this.dataPreloadedInLocalCache){const e=v.getInstance();for(const[t,i]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions??[])for(const a of i.members?.values()??[]){const i=e.readFromStoreById(`${t}__${a.id}`);if(i){o(this.dataManager.sublayerCaches,t,(()=>new Map)).set(a.id,i)}}await i()}else{const t="geographic-organic-standard"===this.initializationLinkChartConfig?.layoutMode;this.addResolvingPromise(this.dataManager.refreshCacheContent(void 0,!1,t,!0).then((async()=>{s(e),await i()})))}a(null)}))}))),Promise.resolve(this)}set initializationInclusionModeDefinition(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("initializationInclusionModeDefinition",e):n.getLogger(this).error("#initializationInclusionModeDefinition","initializationInclusionModeDefinition cannot be changed after the layer is loaded.")}async addRecords(e,t){let i=[];t?.cascadeAddRelationshipEndNodes&&this.dataManager.knowledgeGraph.dataModel&&(i=await x(e,this.dataManager.knowledgeGraph));const a=e.concat(i).filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id)));a.length>0&&(this.membershipModified=!0),await this._handleNewRecords(a,t)}async removeRecords(e,{cascadeRemoveRelationships:t=!0,recalculateLayout:i=!1,overrideMembershipCheck:a=!1}={cascadeRemoveRelationships:!0,recalculateLayout:!1,overrideMembershipCheck:!1}){let n=[];for(const r of e)(a||!1===this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.useAllData&&this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.get(r.typeName)?.members?.has(r.id))&&n.push(r);if(t){const e=new Set,t=[];for(const i of n)if(this.dataManager.nodeConnectionsLookup.has(i.id))for(const t of this.dataManager.nodeConnectionsLookup.get(i.id))e.add(t);for(const i of e)if(this.dataManager.memberIdTypeLookup.has(i))for(const e of this.dataManager.memberIdTypeLookup.get(i))this.dataManager.relationshipTypeNames.has(e)&&t.push({id:i,typeName:e});n=n.concat(t)}this.dataManager.removeFromLayer(n);for(const r of n)this.sublayerIdsCache.get(r.typeName)?.delete(r.id),this.dataManager.relationshipTypeNames.has(r.typeName)?this.relationshipLinkChartDiagramLookup.delete(r.id):this.entityLinkChartDiagramLookup.delete(r.id);i&&await this._calculateLayoutWithSublayerTimeInfo(this._currentLinkChartConfig.layoutMode,{layoutSettings:this._currentLinkChartConfig.layoutSettings}),n.length>0&&(this.membershipModified=!0);const o=[];return this.layers.forEach((e=>{o.push(e.refreshCachedQueryEngine())})),await Promise.all(o),this._refreshNamedTypes(),n}async expand(e,t){let i=[];try{const a=await this.dataManager.getConnectedRecordIds(e,t?.relationshipTypeNames,t);i=a.filter((e=>!this.sublayerIdsCache.get(e.typeName)?.has(e.id))),await this._handleNewRecords(a,t),a.length>0&&(this.membershipModified=!0),s(t?.signal)}catch(a){throw l(a)&&i.length>0&&this.removeRecords(i,{overrideMembershipCheck:!0}),a}return{records:i}}loadLayerAssumingLocalCache(){const e=[...this.memberRelationshipTypes,...this.memberEntityTypes];this.originIdOf("layers")===g.DEFAULTS?this._createSublayers(e,this.layers,(e=>!!e.geometryType)):this._updateSublayers(e,this.layers),this.originIdOf("tables")===g.DEFAULTS?this._createSublayers(e,this.tables,(e=>!e.geometryType)):this._updateSublayers(e,this.tables),this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{const i=o(this.sublayerIdsCache,t,(()=>new Set));e.members?.forEach((({id:e,linkChartLocation:a})=>{if(i.add(e),a){const i="coords"in a&&"lengths"in a?a:m(a);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(e,i):this.entityLinkChartDiagramLookup.set(e,i)}}))}))}async calculateLinkChartLayout(e="radial-root-centric",t){const i=[],r=[],l=[];this.dataManager.sublayerCaches.forEach(((e,t)=>{this.dataManager.entityTypeNames.has(t)?e.forEach((e=>{i.push({typeName:t,feature:e})})):this.dataManager.relationshipTypeNames.has(t)&&e.forEach((e=>{r.push({typeName:t,feature:e})}))})),this.entityLinkChartDiagramLookup=new Map,this.relationshipLinkChartDiagramLookup=new Map;const d=new Map,c=new Map,p=new Map,u=new Map,g=new Uint8Array(i.length),y=new Float64Array(i.length),f=new Float64Array(i.length),L=new Float64Array(i.length),b=new Float64Array(i.length),N=new Uint32Array(r.length),v=new Uint32Array(r.length),D=new Float64Array(r.length),x=new Float64Array(r.length),S=[],I="organic-standard",E=new Q({xmin:-1e-7,ymin:-1e-7,xmax:1e-7,ymax:1e-7});let W,K="organic-standard",q=0,J=0;const V=_.apply;switch(K="geographic-organic-standard"===e?I:e,K){case"organic-standard":W=P.apply;break;case"organic-community":W=z.apply;break;case"hierarchical-bottom-to-top":W=G.apply;break;case"radial-root-centric":W=j.apply;break;case"tree-left-to-right":W=R.apply;break;default:W=A.apply}let X=!1;i.forEach((({typeName:i,feature:a})=>{if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e&&t?.lockedNodeLocations?.has(a.attributes[w])){"geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(i)?g[q]=F.IsGeographic:g[q]=F.None;const n=t.lockedNodeLocations.get(a.attributes[w]);y[q]=n.x,f[q]=n.y}else if("geographic-organic-standard"===e&&this.dataManager.geographicLookup.has(i)){g[q]=F.IsGeographic;let e=null;const t=a.attributes[this.dataManager.geographicLookup.get(i).name],n=this.dataManager.geographicLookup.get(i)?.geometryType;switch(n){case"esriGeometryPoint":y[q]=t?.x,f[q]=t?.y;break;case"esriGeometryPolygon":e=t?.centroid,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=F.IsMovable;break;case"esriGeometryPolyline":case"esriGeometryMultipoint":e=t?.extent?.center,null!=e?.x&&null!=e?.y?(y[q]=e.x,f[q]=e.y):g[q]=F.IsMovable;break;default:g[q]=F.IsMovable}(null==y[q]||null==f[q]||Number.isNaN(y[q])||Number.isNaN(f[q]))&&(g[q]=F.IsMovable,y[q]=0,f[q]=0)}else if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){!X&&t?.lockedNodeLocations?.has(a.attributes[w])&&(X=!0);const e=t?.timeInfoByTypeName?.get(i),n=e?.startField,o=n&&e?.startField?a.attributes[n]:null;L[q]=o?new Date(o).getTime():NaN;const r=e?.endField,s=r&&e?.endField?a.attributes[r]:null;b[q]=s?new Date(s).getTime():NaN,y[q]=0,f[q]=0,g[q]=F.IsMovable}else g[q]=F.IsMovable,y[q]=0,f[q]=0;u.set(a.attributes[w],q),S[q]={feature:a,typeName:i},q++})),X&&n.getLogger(this).warn("Locked node locations are not supported for chronological layout at this time. Requested node locations were ignored");let Y=!1;const Z=new Map;r.forEach((i=>{const a=i.feature.attributes[M],n=i.feature.attributes[k],o=u.get(a),r=u.get(n),s=t?.timeInfoByTypeName?.get(i.typeName),h=t?.timeInfoByTypeName?s?.startField:null,d=h?i.feature.attributes[h]:null,c=s?.endField,p=c?i.feature.attributes[c]:null;if(void 0!==o&&void 0!==r){let t=a+"-"+n;"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(t=t+"-"+d+"-"+p);const s=Z.get(t),h=s?.has(i.typeName);h||(N[J]=o,v[J]=r,"chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e||(D[J]=d?new Date(d).getTime():NaN,x[J]=p?new Date(p).getTime():NaN),void 0===s?Z.set(t,new Map([[i.typeName,J]])):s.set(i.typeName,J),J++),l.push(i)}else Y=!0,this.relationshipLinkChartDiagramLookup.set(a,null)})),Y&&n.getLogger(this).warn("A relationship is a member of this layer that has either origin or destination entity nodes that are not members. The diagram geometry will be set to null");const ee=this._validateLayoutSettings(e,t?.layoutSettings),te=this._convertLayoutSettingsToCalculationSettings(ee);await U();let ie=B.Error,ae=null;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){let i;({status:ie,links:ae,graphics:i}=V((()=>t?.signal?.aborted??!1),g,y,f,L,b,N.subarray(0,J),v.subarray(0,J),D.subarray(0,J),x.subarray(0,J),"chronological-multi-timeline"===e,t?.layoutSettings?.chronologicalLayoutSettings??{})),ie===B.Success&&(this.chronologicalAuxiliaryGraphics=i)}else({status:ie,links:ae}=W((()=>t?.signal?.aborted??!1),g,y,f,N.subarray(0,J),v.subarray(0,J),te.computationBudgetTime,te.idealEdgeLengthMultiplier,te.repulsionRadiusMultiplier));if(s(t?.signal),ie===B.Error)throw new a("knowledge-graph:layout-failed","Attempting to arrange the records in the specified layout failed");if(ie===B.Canceled)throw h();for(let a=0;a<S.length;a++){if(f[a]>84.9999?f[a]=84.9999:f[a]<-84.9999&&(f[a]=-84.9999),y[a]>179.9999?y[a]=179.9999:y[a]<-179.9999&&(y[a]=-179.9999),S[a].feature.attributes[C]=new $(y[a],f[a]),d.has(S[a].typeName)){const e=d.get(S[a].typeName);e?.set(S[a].feature.attributes[w],S[a].feature)}else{const e=new Map;e.set(S[a].feature.attributes[w],S[a].feature),d.set(S[a].typeName,e)}p.set(S[a].feature.attributes[w],S[a].feature);const e=m(S[a].feature.attributes[C]);this.entityLinkChartDiagramLookup.set(S[a].feature.attributes[w],S[a].feature.attributes[C]?e:null);const t=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,S[a].typeName,(()=>({useAllData:!1,members:new Map})));o(t.members,S[a].feature.attributes[w],(()=>({id:S[a].feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=S[a].feature.attributes[C],S[a].feature.attributes[C].x<E.xmin&&(E.xmin=S[a].feature.attributes[C].x),S[a].feature.attributes[C].x>E.xmax&&(E.xmax=S[a].feature.attributes[C].x),S[a].feature.attributes[C].y<E.ymin&&(E.ymin=S[a].feature.attributes[C].y),S[a].feature.attributes[C].y>E.ymax&&(E.ymax=S[a].feature.attributes[C].y)}if(this.linkChartExtent.xmin=E.xmin,this.linkChartExtent.xmax=E.xmax,this.linkChartExtent.ymin=E.ymin,this.linkChartExtent.ymax=E.ymax,!ae)throw new a("knowledge-graph:layout-failed","Attempting to retrieve link geometry from diagram engine failed");const ne=new Map,oe=new Map,re=new Map,se=new Set;for(let a=0;a<l.length;a++){const i=[],r=l[a],s=r.feature.attributes[M],h=r.feature.attributes[k];let d=s+"-"+h;if("chronological-mono-timeline"===e||"chronological-multi-timeline"===e){const e=t?.timeInfoByTypeName?.get(r.typeName),i=t?.timeInfoByTypeName?e?.startField:null,a=i?r.feature.attributes[i]:null,n=e?.endField;d+="-"+a+"-"+(n?r.feature.attributes[n]:null)}const g=Z.get(d).get(r.typeName),y=0===g?0:ae?.vertexEndIndex[g-1];if(!se.has(g)){if(se.add(g),ae.types[g]===O.Recursive){const e=[ae.vertices[2*y],ae.vertices[2*y+1]],t=[ae.vertices[2*(y+1)],ae.vertices[2*(y+1)+1]],a=[.5*(e[0]+t[0]),.5*(e[1]+t[1])],n=[a[0]-e[0],a[1]-e[1]],o=[a[0]+n[1],a[1]-n[0]],r=[a[0]-n[1],a[1]+n[0]];i.push(e),i.push(o),i.push(t),i.push(r),i.push(e)}else{if(ae.types[g]!==O.Regular){n.getLogger(this).warn("A relationship generated an unsupported link geometry type. It will not be rendered");continue}for(let e=y;e<ae.vertexEndIndex[g];e++)i.push([ae.vertices[2*e],ae.vertices[2*e+1]])}if("chronological-mono-timeline"!==e&&"chronological-multi-timeline"!==e){const e=S[u.get(s)]?.feature.attributes[C],t=S[u.get(h)]?.feature.attributes[C];i[0][0]===e.x&&i[0][1]===e.y||(i[0]=[e.x,e.y]),i[i.length-1][0]===t.x&&i[i.length-1][1]===t.y||(i[i.length-1]=[t.x,t.y])}for(let e=1;e<i.length-1;e++)i[e][1]>85.5?i[e][1]=85.5:i[e][1]<-85.5&&(i[e][1]=-85.5),i[e][0]>179.9999?i[e][0]=179.9999:i[e][0]<-179.9999&&(i[e][0]=-179.9999);ne.has(d)?ne.get(d).push(i):ne.set(d,[i])}const f=ne.get(d);oe.has(d)||(oe.set(d,new Map),re.set(d,new Map));const L=oe.get(d),b=re.get(d);L.has(r.typeName)||(L.set(r.typeName,f.shift()),b.set(r.typeName,0));const T=L.get(r.typeName);b.set(r.typeName,b.get(r.typeName)+1);const N=new H({paths:[T]});if(r.feature.attributes[C]=N,c.has(r.typeName)){const e=c.get(r.typeName);e?.set(r.feature.attributes[w],r.feature)}else{const e=new Map;e.set(r.feature.attributes[w],r.feature),c.set(r.typeName,e)}p.set(r.feature.attributes[w],r.feature);const v=m(r.feature.attributes[C]);this.relationshipLinkChartDiagramLookup.set(r.feature.attributes[w],r.feature.attributes[C]?v:null);const D=o(this.dataManager.inclusionModeDefinition.namedTypeDefinitions,r.typeName,(()=>({useAllData:!1,members:new Map})));o(D.members,r.feature.attributes[w],(()=>({id:r.feature.attributes[w],linkChartLocation:void 0}))).linkChartLocation=r.feature.attributes[C]}for(const a of l)a.feature.attributes[T]=re.get(a.feature.attributes[M]+"-"+a.feature.attributes[k])?.get(a.typeName)??null;return this._currentLinkChartConfig={layoutMode:e,layoutSettings:ee},{nodes:d,links:c,idMap:p}}async applyNewLinkChartLayout(e="radial-root-centric",t){const i=[];await this._calculateLayoutWithSublayerTimeInfo(e,t),this.layers.forEach((e=>{i.push(e.refreshCachedQueryEngine())})),this.membershipModified=!0,await Promise.all(i),this._refreshNamedTypes()}getCurrentNodeLocations(){const e=new Map;for(const[t,i]of this.dataManager.inclusionModeDefinition?.namedTypeDefinitions.entries()??[])this.dataManager.relationshipTypeNames.has(t)||i?.members?.forEach((t=>{const i=t.linkChartLocation;let a;const n=t.id;i&&(a="x"in i?{x:i.x,y:i.y}:{x:i.coords[0],y:i.coords[1]},e.set(n,new $({x:a.x,y:a.y})))}));return e}async refreshLinkChartCache(e){await this.dataManager.refreshCacheContent(e);const t=[];this.layers.forEach((e=>{t.push(e.refreshCachedQueryEngine())})),await Promise.all(t),this._refreshNamedTypes()}async connectBetweenEntities(e,t){if(!e.length)return{records:[]};let i=[];try{let a=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(a=a.concat(Array.from(t.keys())))}i=await this.dataManager.getRelationshipsBetweenNodes(e,a,t),await this._handleNewRecords(i,t),s(t)}catch(a){throw l(a)&&this.removeRecords(i),a}return{records:i}}async connectFromEntities(e,t){if(!e.length)return{records:[]};let i=[];try{let a=[];for(const e of this.dataManager.relationshipTypeNames){const t=this.sublayerIdsCache.get(e);t&&(a=a.concat(Array.from(t.keys())))}let n=[];for(const e of this.dataManager.entityTypeNames){const t=this.sublayerIdsCache.get(e);t&&(n=n.concat(Array.from(t)))}i=await this.dataManager.getRelationshipsFromNodes(e,n,a,t),await this._handleNewRecords(i,t),i.length>0&&(this.membershipModified=!0),s(t)}catch(a){throw l(a)&&this.removeRecords(i),a}return{records:i}}getCurrentLayout(){return this._currentLinkChartConfig.layoutMode}async _calculateLayoutWithSublayerTimeInfo(e="radial-root-centric",t){const i=new Map;this.layers.forEach((e=>{i.set(e.objectType.name,e.timeInfo)})),await this.calculateLinkChartLayout(e,{timeInfoByTypeName:i,...t})}async _handleNewRecords(e,t){const i=[];this.dataManager.addToLayer(e);for(const n of e)this.sublayerIdsCache.has(n.typeName)||(this.sublayerIdsCache.set(n.typeName,new Set),i.push(n.typeName)),this.sublayerIdsCache.get(n.typeName).add(n.id);for(const n of i){const e=this._graphTypeLookup.get(n);if(e){const t=this._createSublayer(e);"entity"===e.type?this.dataManager.entityTypeNames.add(n):this.dataManager.relationshipTypeNames.add(n),t.geometryType?this.layers.push(t):this.tables.push(t),this.dataManager.sublayerCaches.set(n,new Map)}}await N(this,i,t),await this.dataManager.refreshCacheContent(e.map((e=>e.id)),void 0,void 0,void 0,t);const a=Object.assign({},this._currentLinkChartConfig.layoutSettings);a.lockedNodeLocations=new Map;for(const[n,o]of this.entityLinkChartDiagramLookup.entries())o&&a.lockedNodeLocations.set(n,new $(o.coords[0],o.coords[1]));await this.applyNewLinkChartLayout(this._currentLinkChartConfig.layoutMode,{layoutSettings:a})}_createSublayers(e,t,i){e.forEach((e=>{const a=this._createSublayer(e);i(a)&&t.push(a),this._updateSublayerCaches(e)}))}_updateSublayers(e,t){t.forEach((t=>{t.parentCompositeLayer=this;const i=e.find((e=>e.type===t.graphType&&e.name===t.graphTypeName));i&&(t.objectType=i,t.read({title:i.name},{origin:"service"}),this._updateSublayerCaches(i))}))}_updateSublayerCaches(e){const t=this.dataManager.sublayerCaches;t.has(e.name)||t.set(e.name,new Map)}async _initializeDiagram(){this.initializationLinkChartConfig?this.initializationLinkChartConfig.doNotRecalculateLayout?(this.dataManager.inclusionModeDefinition?.namedTypeDefinitions?.forEach(((e,t)=>{e?.members?.forEach((e=>{const i=e.linkChartLocation;let a;const n=e.id;if(!i)return;a="x"in i?{x:i.x,y:i.y}:{x:i.coords[0],y:i.coords[1]};const o=m(a);this.dataManager.relationshipTypeNames.has(t)?this.relationshipLinkChartDiagramLookup.set(n,o):this.entityLinkChartDiagramLookup.set(n,o),this.linkChartExtent.xmin>a.x&&(this.linkChartExtent.xmin=a.x),this.linkChartExtent.xmax<a.x&&(this.linkChartExtent.xmax=a.x),this.linkChartExtent.ymin>a.y&&(this.linkChartExtent.ymin=a.y),this.linkChartExtent.ymax<a.y&&(this.linkChartExtent.ymax=a.y)}))})),this.memberRelationshipTypes.forEach((e=>{e.name&&this.dataManager.sublayerCaches.get(e.name)?.forEach((e=>{const t=this.relationshipLinkChartDiagramLookup.get(e.attributes[M]),i=this.relationshipLinkChartDiagramLookup.get(e.attributes[k]);if(t&&i){const a=m(new H({paths:[[[t.coords[0],t.coords[1]],[i.coords[0],i.coords[1]]]]}));this.relationshipLinkChartDiagramLookup.set(e.attributes[w],a)}else this.relationshipLinkChartDiagramLookup.set(e.attributes[w],null)}))}))):await this._calculateLayoutWithSublayerTimeInfo(this.initializationLinkChartConfig.layoutMode,{lockedNodeLocations:this.getCurrentNodeLocations(),...this.initializationLinkChartConfig||{}}):await this._calculateLayoutWithSublayerTimeInfo("radial-root-centric",{lockedNodeLocations:this.getCurrentNodeLocations()})}_refreshNamedTypes(){for(const e of this.layers)e.emit("refresh",{dataChanged:!0});for(const e of this.tables)e.emit("refresh",{dataChanged:!0})}_validateLayoutSettings(e,t){const i=e=>"number"==typeof e&&!isNaN(e),a=e=>i(e)&&e>=1,o=e=>i(e)&&e>=1,r=e=>Object.values(f).includes(e),s=e=>i(e)&&e>=0,l={organicLayoutSettings:{},chronologicalLayoutSettings:{}};if(!new Set(["organic-standard","organic-community","geographic-organic-standard","chronological-multi-timeline","chronological-mono-timeline"]).has(e)||!t)return l;t.organicLayoutSettings??={};const{computationBudgetTime:h,repulsionRadiusMultiplier:d,absoluteIdealEdgeLength:c,multiplicativeIdealEdgeLength:p,idealEdgeLengthType:u}=t.organicLayoutSettings;o(h)?l.organicLayoutSettings.computationBudgetTime=h:void 0!==h&&n.getLogger(this).warn("Invalid layout computationBudgetTime setting, will revert to default setting"),a(d)?l.organicLayoutSettings.repulsionRadiusMultiplier=d:void 0!==d&&n.getLogger(this).warn("Invalid layout repulsionRadiusMultiplier setting, will revert to default setting");if("geographic-organic-standard"===e&&(void 0!==c||void 0!==p||void 0!==u)&&(r(u)?l.organicLayoutSettings.idealEdgeLengthType=u:void 0!==u&&n.getLogger(this).warn('Invalid layout idealEdgeLengthType setting, will revert to "multiplier" setting'),"absolute-value"===u&&s(c)?l.organicLayoutSettings.absoluteIdealEdgeLength=c:"absolute-value"===u&&void 0!==c?n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting"):"multiplier"===u&&s(p)?l.organicLayoutSettings.multiplicativeIdealEdgeLength=p:"multiplier"===u&&void 0!==p&&n.getLogger(this).warn("Invalid layout idealEdgeLength setting, will revert to default setting")),("chronological-multi-timeline"===e||"chronological-mono-timeline"===e)&&t.chronologicalLayoutSettings){const e=t.chronologicalLayoutSettings;e.durationLineWidth&&e.durationLineWidth<0&&n.getLogger(this).warn("Invalid layout durationLineWidth setting, will revert to default setting")}return l}_convertLayoutSettingsToCalculationSettings(e){e.organicLayoutSettings??={};let t=e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE?e.organicLayoutSettings.absoluteIdealEdgeLength:e.organicLayoutSettings.multiplicativeIdealEdgeLength;return e.organicLayoutSettings.idealEdgeLengthType===f.ABSOLUTE&&(void 0===t?t=-1:t*=-1),{computationBudgetTime:e.organicLayoutSettings.computationBudgetTime??void 0,repulsionRadiusMultiplier:e.organicLayoutSettings.repulsionRadiusMultiplier&&!e.organicLayoutSettings.autoRepulsionRadius?e.organicLayoutSettings.repulsionRadiusMultiplier:void 0,idealEdgeLengthMultiplier:t}}_createSublayer(e){return new b({objectType:e,parentCompositeLayer:this,graphType:e.type})}_handleSublayersChange(e,t){t&&(t.forEach((e=>{e.parent=null})),this.removeHandles("sublayers-owner")),e&&(e.forEach((e=>{e.parent=this})),this.addHandles([e.on("after-add",(({item:e})=>{e.parent=this})),e.on("after-remove",(({item:e})=>{e.parent=null}))],"sublayers-owner"))}_alignLayersDataModelAndInclusionDefinition(e){const t=new Set((e.entityTypes??[]).map((e=>e.name)).concat((e.relationshipTypes??[]).map((e=>e.name)))),a=new Set((e.entityTypes??[]).map((e=>e.name))),o=new Set((e.relationshipTypes??[]).map((e=>e.name)));if(this.layers){for(const e of this.layers)!e.graphType&&t.has(e.graphTypeName)&&(e.graphType=a.has(e.graphTypeName)?"entity":"relationship");this.layers=this.layers.filter((e=>t.has(e.graphTypeName)&&("entity"===e.graphType?a.has(e.graphTypeName):o.has(e.graphTypeName))))}else this.layers=new i;if(this.layers&&this._originalInclusionList){const e=new Set(this._originalInclusionList.namedTypeDefinitions.keys()),t=this.tables?.map((e=>e.graphTypeName))??[],i=this.layers.map((e=>e.graphTypeName)).concat(t);for(const n of i)e.has(n)||this._originalInclusionList.namedTypeDefinitions.set(n,{useAllData:!1,members:new Map});const a=[];for(const o of this._originalInclusionList.namedTypeDefinitions.keys())i.includes(o)||(n.getLogger(this).warn(`A named type, ${o}, was in the serialized feature collection but did not have a sublayer config in the item, so will be removed`),a.push(o));for(const n of a)this._originalInclusionList.namedTypeDefinitions.delete(n)}}};e([p()],K.prototype,"dataPreloadedInLocalCache",void 0),e([p()],K.prototype,"initializationLinkChartConfig",void 0),e([p()],K.prototype,"membershipModified",void 0),e([p()],K.prototype,"dataManager",void 0),e([p()],K.prototype,"initializationInclusionModeDefinition",null),e([p()],K.prototype,"knowledgeGraph",void 0),e([p({type:i.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"layers",void 0),e([p()],K.prototype,"entityLinkChartDiagramLookup",void 0),e([p()],K.prototype,"relationshipLinkChartDiagramLookup",void 0),e([p()],K.prototype,"linkChartExtent",void 0),e([p()],K.prototype,"memberEntityTypes",void 0),e([p()],K.prototype,"memberRelationshipTypes",void 0),e([p({type:["LinkChartLayer"]})],K.prototype,"operationalLayerType",void 0),e([p()],K.prototype,"sublayerIdsCache",void 0),e([p({type:i.ofType(b),json:{write:{ignoreOrigin:!0}}})],K.prototype,"tables",void 0),e([p({json:{read:!1}})],K.prototype,"type",void 0),e([p({json:{read:!1}})],K.prototype,"chronologicalAuxiliaryGraphics",void 0),K=e([u("esri.layers.LinkChartLayer")],K);const q=K;export{q as default};
|
package/layers/MapNotesLayer.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import"../symbols.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import n from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import{projectOrLoad as u,canProjectWithoutEngine as c,isLoaded as f,load as d,project as g}from"../geometry/projection.js";import{empty as b,expand as S,equals as h,toExtent as O,negativeInfinity as w}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as j}from"../geometry/support/normalizeUtils.js";import{equals as N}from"../geometry/support/spatialReferenceUtils.js";import L from"./FeatureLayer.js";import x from"./GraphicsLayer.js";import J from"./Layer.js";import{findLastObjectIdFromFeatures as v}from"./graphics/objectIdUtils.js";import{BlendLayer as T}from"./mixins/BlendLayer.js";import{OperationalLayer as C}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import R from"./support/Field.js";import E from"../symbols/SimpleFillSymbol.js";import D from"../symbols/SimpleLineSymbol.js";import _ from"../symbols/SimpleMarkerSymbol.js";import G from"../symbols/TextSymbol.js";import P from"../geometry/SpatialReference.js";import F from"../geometry/Extent.js";function B(e){return"markup"===e.featureCollectionType||e.layers.some((e=>null!=e.layerDefinition.visibilityField||!k(e)))}function k({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find((t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type))}function z(){return new F({xmin:-180,ymin:-90,xmax:180,ymax:90})}const U=new R({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),W=new R({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let A=class extends x{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",(e=>{e.item.sourceLayer=this.layer})),this.graphics.on("after-remove",(e=>{e.item.sourceLayer=null}))}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?u(z(),e).geometry:O(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=b();return this.graphics.forEach((r=>{const o=null!=r.geometry?u(r.geometry,e).geometry:null;null!=o&&S(t,"point"===o.type?o:o.extent,t)})),h(t,w)?null:t}get sublayers(){return this.graphics}};e([s({readOnly:!0})],A.prototype,"fullExtent",null),e([s({readOnly:!0})],A.prototype,"fullBounds",null),e([s({readOnly:!0})],A.prototype,"sublayers",null),e([s()],A.prototype,"layer",void 0),e([s()],A.prototype,"layerId",void 0),e([s({readOnly:!0})],A.prototype,"visibilityMode",void 0),A=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],A);const $=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new E).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new D).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new G).toJSON()}];let q=class extends(T(I(C(M(l(J)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=P.WGS84,this.sublayers=new r($.map((e=>new A({id:e.id,layerId:e.layerId,title:e.title,layer:this})))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!B(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!B(t))return null;const i=t.layers.map((e=>{const t=new L;return t.read(e,o),t}));return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return B(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=b();if(null!=this.sublayers)this.sublayers.forEach((({fullBounds:e})=>null!=e?S(t,e,t):t),t);else if(this.featureCollectionJSON?.layers.some((e=>e.layerDefinition.extent))){this.featureCollectionJSON.layers.forEach((r=>{const o=u(r.layerDefinition.extent,e).geometry;null!=o&&S(t,o,t)}))}return h(t,w)?u(z(),e).geometry:O(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?P.fromJSON(t.layers[0].layerDefinition.spatialReference):P.WGS84}readSublayers(e,o,i){if(B(o))return null;const l=[];let a=o.layers.reduce(((e,t)=>Math.max(e,t.layerDefinition.id??-1)),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??a++,n=k(r);if(null!=n){const r=new A({id:n.id,title:e.name,layerId:i,layer:this,graphics:o.features.map((({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i})))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:n}=this;if(null==e)return;const s=e.some((e=>e.graphics.length>0));if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find((e=>o.id===e.id));this._writeMapNoteSublayer(p,t,o,l,n,y,i)}a("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?N(o.spatialReference,e)||(c(o.spatialReference,e)||f()||await d(),r.geometry=g(o,e)):e=o.spatialReference,t.push(r)}const r=await j(t.map((e=>e.geometry)));t.forEach(((e,t)=>e.geometry=r[t]))}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find((t=>t.id===e))??null}_writeMapNoteSublayer(e,t,r,o,l,a,n){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,n);this._normalizeObjectIds(s,U),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[U.toJSON(),W.toJSON()],spatialReference:a},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:a}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new n("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new n("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=a&&(s.popupInfo=a.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=v(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:P})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);const H=q;export{H as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../geometry.js";import t from"../Graphic.js";import"../symbols.js";import r from"../core/Collection.js";import o from"../core/Error.js";import{clone as i}from"../core/lang.js";import{MultiOriginJSONMixin as l}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as a}from"../core/object.js";import n from"../core/Warning.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{reader as p}from"../core/accessorSupport/decorators/reader.js";import{subclass as y}from"../core/accessorSupport/decorators/subclass.js";import{writer as m}from"../core/accessorSupport/decorators/writer.js";import{projectOrLoad as u,canProjectWithoutEngine as c,load as f,project as d,isLoaded as g}from"../geometry/projection.js";import{empty as b,expand as S,equals as h,toExtent as O,negativeInfinity as w}from"../geometry/support/aaBoundingRect.js";import{normalizeCentralMeridian as j}from"../geometry/support/normalizeUtils.js";import{equals as N}from"../geometry/support/spatialReferenceUtils.js";import L from"./FeatureLayer.js";import x from"./GraphicsLayer.js";import J from"./Layer.js";import{findLastObjectIdFromFeatures as v}from"./graphics/objectIdUtils.js";import{BlendLayer as T}from"./mixins/BlendLayer.js";import{OperationalLayer as C}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import R from"./support/Field.js";import E from"../symbols/SimpleFillSymbol.js";import D from"../symbols/SimpleLineSymbol.js";import _ from"../symbols/SimpleMarkerSymbol.js";import G from"../symbols/TextSymbol.js";import P from"../geometry/SpatialReference.js";import F from"../geometry/Extent.js";function B(e){return"markup"===e.featureCollectionType||e.layers.some((e=>null!=e.layerDefinition.visibilityField||!k(e)))}function k({layerDefinition:e,featureSet:t}){const r=e.geometryType??t.geometryType;return $.find((t=>r===t.geometryTypeJSON&&e.drawingInfo?.renderer?.symbol?.type===t.identifyingSymbol.type))}function z(){return new F({xmin:-180,ymin:-90,xmax:180,ymax:90})}const U=new R({name:"OBJECTID",alias:"OBJECTID",type:"oid",nullable:!1,editable:!1}),W=new R({name:"title",alias:"Title",type:"string",nullable:!0,editable:!0,length:255});let A=class extends x{constructor(e){super(e),this.visibilityMode="inherited"}initialize(){for(const e of this.graphics)e.sourceLayer=this.layer;this.graphics.on("after-add",(e=>{e.item.sourceLayer=this.layer})),this.graphics.on("after-remove",(e=>{e.item.sourceLayer=null}))}get fullExtent(){const e=this.layer?.spatialReference,t=this.fullBounds;return e?null==t?u(z(),e).geometry:O(t,e):null}get fullBounds(){const e=this.layer?.spatialReference;if(!e)return null;const t=b();return this.graphics.forEach((r=>{const o=null!=r.geometry?u(r.geometry,e).geometry:null;null!=o&&S(t,"point"===o.type?o:o.extent,t)})),h(t,w)?null:t}get sublayers(){return this.graphics}};e([s({readOnly:!0})],A.prototype,"fullExtent",null),e([s({readOnly:!0})],A.prototype,"fullBounds",null),e([s({readOnly:!0})],A.prototype,"sublayers",null),e([s()],A.prototype,"layer",void 0),e([s()],A.prototype,"layerId",void 0),e([s({readOnly:!0})],A.prototype,"visibilityMode",void 0),A=e([y("esri.layers.MapNotesLayer.MapNotesSublayer")],A);const $=[{geometryType:"polygon",geometryTypeJSON:"esriGeometryPolygon",id:"polygonLayer",layerId:0,title:"Polygons",identifyingSymbol:(new E).toJSON()},{geometryType:"polyline",geometryTypeJSON:"esriGeometryPolyline",id:"polylineLayer",layerId:1,title:"Polylines",identifyingSymbol:(new D).toJSON()},{geometryType:"multipoint",geometryTypeJSON:"esriGeometryMultipoint",id:"multipointLayer",layerId:2,title:"Multipoints",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"pointLayer",layerId:3,title:"Points",identifyingSymbol:(new _).toJSON()},{geometryType:"point",geometryTypeJSON:"esriGeometryPoint",id:"textLayer",layerId:4,title:"Text",identifyingSymbol:(new G).toJSON()}];let q=class extends(T(I(C(M(l(J)))))){constructor(e){super(e),this.capabilities={operations:{supportsMapNotesEditing:!0}},this.featureCollections=null,this.featureCollectionJSON=null,this.featureCollectionType="notes",this.legendEnabled=!1,this.listMode="hide-children",this.minScale=0,this.maxScale=0,this.spatialReference=P.WGS84,this.sublayers=new r($.map((e=>new A({id:e.id,layerId:e.layerId,title:e.title,layer:this})))),this.title="Map Notes",this.type="map-notes",this.visibilityMode="inherited"}readCapabilities(e,t,r){return{operations:{supportsMapNotesEditing:!B(t)&&"portal-item"!==r?.origin}}}readFeatureCollections(e,t,o){if(!B(t))return null;const i=t.layers.map((e=>{const t=new L;return t.read(e,o),t}));return new r({items:i})}readLegacyfeatureCollectionJSON(e,t){return B(t)?i(t.featureCollection):null}get fullExtent(){const e=this.spatialReference,t=b();if(null!=this.sublayers)this.sublayers.forEach((({fullBounds:e})=>null!=e?S(t,e,t):t),t);else if(this.featureCollectionJSON?.layers.some((e=>e.layerDefinition.extent))){this.featureCollectionJSON.layers.forEach((r=>{const o=u(r.layerDefinition.extent,e).geometry;null!=o&&S(t,o,t)}))}return h(t,w)?u(z(),e).geometry:O(t,e)}readMinScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.minScale)return r.layerDefinition.minScale;return 0}readMaxScale(e,t){for(const r of t.layers)if(null!=r.layerDefinition.maxScale)return r.layerDefinition.maxScale;return 0}get multipointLayer(){return this._findSublayer("multipointLayer")}get pointLayer(){return this._findSublayer("pointLayer")}get polygonLayer(){return this._findSublayer("polygonLayer")}get polylineLayer(){return this._findSublayer("polylineLayer")}readSpatialReference(e,t){return t.layers.length?P.fromJSON(t.layers[0].layerDefinition.spatialReference):P.WGS84}readSublayers(e,o,i){if(B(o))return null;const l=[];let a=o.layers.reduce(((e,t)=>Math.max(e,t.layerDefinition.id??-1)),-1)+1;for(const r of o.layers){const{layerDefinition:e,featureSet:o}=r,i=e.id??a++,n=k(r);if(null!=n){const r=new A({id:n.id,title:e.name,layerId:i,layer:this,graphics:o.features.map((({geometry:e,symbol:r,attributes:o,popupInfo:i})=>t.fromJSON({attributes:o,geometry:e,symbol:r,popupTemplate:i})))});l.push(r)}}return new r(l)}writeSublayers(e,t,r,i){const{minScale:l,maxScale:n}=this;if(null==e)return;const s=e.some((e=>e.graphics.length>0));if(!this.capabilities.operations.supportsMapNotesEditing)return void(s&&i?.messages?.push(new o("map-notes-layer:editing-not-supported","New map notes cannot be added to this layer")));const p=[];let y=this.spatialReference.toJSON();e:for(const o of e)for(const e of o.graphics)if(null!=e.geometry){y=e.geometry.spatialReference.toJSON();break e}for(const o of $){const t=e.find((e=>o.id===e.id));this._writeMapNoteSublayer(p,t,o,l,n,y,i)}a("featureCollection.layers",p,t)}get textLayer(){return this._findSublayer("textLayer")}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Feature Collection"]},e)),Promise.resolve(this)}read(e,t){"featureCollection"in e&&(e=i(e),Object.assign(e,e.featureCollection)),super.read(e,t)}async beforeSave(){if(null==this.sublayers)return;let e=null;const t=[];for(const o of this.sublayers)for(const r of o.graphics)if(null!=r.geometry){const o=r.geometry;e?N(o.spatialReference,e)||(c(o.spatialReference,e)||g()||await f(),r.geometry=d(o,e)):e=o.spatialReference,t.push(r)}const r=await j(t.map((e=>e.geometry)));t.forEach(((e,t)=>e.geometry=r[t]))}_findSublayer(e){return null==this.sublayers?null:this.sublayers?.find((t=>t.id===e))??null}_writeMapNoteSublayer(e,t,r,o,l,a,n){const s=[];if(null!=t){for(const e of t.graphics)this._writeMapNote(s,e,r.geometryType,n);this._normalizeObjectIds(s,U),e.push({layerDefinition:{name:t.title,drawingInfo:{renderer:{type:"simple",symbol:i(r.identifyingSymbol)}},id:t.layerId,geometryType:r.geometryTypeJSON,minScale:o,maxScale:l,objectIdField:"OBJECTID",fields:[U.toJSON(),W.toJSON()],spatialReference:a},featureSet:{features:s,geometryType:r.geometryTypeJSON}})}}_writeMapNote(e,t,r,o){if(null==t)return;const{geometry:i,symbol:l,popupTemplate:a}=t;if(null==i)return;if(i.type!==r)return void o?.messages?.push(new n("map-notes-layer:invalid-geometry-type",`Geometry "${i.type}" cannot be saved in "${r}" layer`,{graphic:t}));if(null==l)return void o?.messages?.push(new n("map-notes-layer:no-symbol","Skipping map notes with no symbol",{graphic:t}));const s={attributes:{...t.attributes},geometry:i.toJSON(),symbol:l.toJSON()};null!=a&&(s.popupInfo=a.toJSON()),e.push(s)}_normalizeObjectIds(e,t){const r=t.name;let o=v(r,e)+1;const i=new Set;for(const l of e){l.attributes||(l.attributes={});const{attributes:e}=l;(null==e[r]||i.has(e[r]))&&(e[r]=o++),i.add(e[r])}}};e([s({readOnly:!0})],q.prototype,"capabilities",void 0),e([p(["portal-item","web-map"],"capabilities",["layers"])],q.prototype,"readCapabilities",null),e([s({readOnly:!0})],q.prototype,"featureCollections",void 0),e([p(["web-map","portal-item"],"featureCollections",["layers"])],q.prototype,"readFeatureCollections",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{enabled:!0,target:"featureCollection"}}}}})],q.prototype,"featureCollectionJSON",void 0),e([p(["web-map","portal-item"],"featureCollectionJSON",["featureCollection"])],q.prototype,"readLegacyfeatureCollectionJSON",null),e([s({readOnly:!0,json:{read:!0,write:{enabled:!0,ignoreOrigin:!0}}})],q.prototype,"featureCollectionType",void 0),e([s({readOnly:!0})],q.prototype,"fullExtent",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{target:"featureCollection.showLegend",overridePolicy(){return{enabled:null!=this.featureCollectionJSON}}}}}}})],q.prototype,"legendEnabled",void 0),e([s({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"minScale",void 0),e([p(["web-map","portal-item"],"minScale",["layers"])],q.prototype,"readMinScale",null),e([s({type:Number,nonNullable:!0,json:{write:!1}})],q.prototype,"maxScale",void 0),e([p(["web-map","portal-item"],"maxScale",["layers"])],q.prototype,"readMaxScale",null),e([s({readOnly:!0})],q.prototype,"multipointLayer",null),e([s({value:"ArcGISFeatureLayer",type:["ArcGISFeatureLayer"]})],q.prototype,"operationalLayerType",void 0),e([s({readOnly:!0})],q.prototype,"pointLayer",null),e([s({readOnly:!0})],q.prototype,"polygonLayer",null),e([s({readOnly:!0})],q.prototype,"polylineLayer",null),e([s({type:P})],q.prototype,"spatialReference",void 0),e([p(["web-map","portal-item"],"spatialReference",["layers"])],q.prototype,"readSpatialReference",null),e([s({readOnly:!0,json:{origins:{"web-map":{write:{ignoreOrigin:!0}}}}})],q.prototype,"sublayers",void 0),e([p("web-map","sublayers",["layers"])],q.prototype,"readSublayers",null),e([m("web-map","sublayers")],q.prototype,"writeSublayers",null),e([s({readOnly:!0})],q.prototype,"textLayer",null),e([s()],q.prototype,"title",void 0),e([s({readOnly:!0,json:{read:!1}})],q.prototype,"type",void 0),q=e([y("esri.layers.MapNotesLayer")],q);const H=q;export{H as default};
|
package/layers/MediaLayer.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import o from"../core/Error.js";import t from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i}from"../core/promiseUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{OriginId as u}from"../core/accessorSupport/PropertyOrigin.js";import d from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as h}from"./mixins/ScaleRangeLayer.js";import g from"./support/ControlPointsGeoreference.js";import S from"./support/ImageElement.js";import w from"./support/LocalMediaElementSource.js";import{isWritingLayerFromItemToWebDocument as v}from"./support/mediaUtils.js";import j from"./support/VideoElement.js";import{
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Collection.js";import o from"../core/Error.js";import t from"../core/Logger.js";import{MultiOriginJSONMixin as s}from"../core/MultiOriginJSONSupport.js";import{debounce as i}from"../core/promiseUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as c}from"../core/accessorSupport/decorators/reader.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../core/accessorSupport/decorators/writer.js";import{OriginId as u}from"../core/accessorSupport/PropertyOrigin.js";import d from"./Layer.js";import{BlendLayer as m}from"./mixins/BlendLayer.js";import{OperationalLayer as f}from"./mixins/OperationalLayer.js";import{PortalLayer as y}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as h}from"./mixins/ScaleRangeLayer.js";import g from"./support/ControlPointsGeoreference.js";import S from"./support/ImageElement.js";import w from"./support/LocalMediaElementSource.js";import{isWritingLayerFromItemToWebDocument as v}from"./support/mediaUtils.js";import j from"./support/VideoElement.js";import{isMediaElement as O}from"../support/mediaLayerUtils.js";import{SaveOperationType as L}from"../webdoc/interfaces.js";let b=class extends(m(h(f(y(s(d)))))){constructor(e){super(e),this.effectiveSource=null,this.georeference=null,this.copyright=null,this.operationalLayerType="MediaLayer",this.spatialReference=null,this.type="media",this._debouncedSaveOperations=i((async(e,r,o)=>{const{save:t,saveAs:s}=await import("./save/mediaLayerUtils.js");switch(e){case L.SAVE:return t(this,r);case L.SAVE_AS:return s(this,o,r)}})),this.source=new w}load(e){return this.addResolvingPromise(this._doLoad(e)),Promise.resolve(this)}async _doLoad(e){await this.loadFromPortal({supportedTypes:["Media Layer"]},e);let t=this.source;if(!t)throw new o("media-layer:source-missing","Set 'MediaLayer.source' before loading the layer.");const s=this._getSourceOverride(t,this.georeference);s&&(this.setAtOrigin("source",s,"web-map"),this.setAtOrigin("source",s,"web-scene"),t=s);const i=O(t)?new w({elements:new r([t])}):t;this._set("effectiveSource",i),this.spatialReference&&(i.spatialReference=this.spatialReference),await i.load(e),this.spatialReference=i.spatialReference}destroy(){this.effectiveSource?.destroy(),this.effectiveSource!==this.source&&this.source?.destroy()}readGeoreference(e,r){return e&&"itemId"in r&&r.itemId?e:void 0}get fullExtent(){return this.loaded?this.effectiveSource.fullExtent:null}get source(){return this._get("source")}set source(e){"loaded"!==this.loadStatus&&"failed"!==this.loadStatus?this._set("source",e):t.getLogger(this).error("#source","source cannot be changed after the layer is loaded.")}castSource(e){return e?Array.isArray(e)?new w({elements:new r(e)}):e instanceof r?new w({elements:e}):e:null}readSource(e,r,o){if("itemId"in r&&r.itemId)return;const t=this._createSource(r);return t?.read(r,o),t}writeSource(e,r,t,s){if(e&&e instanceof w){const r=e.elements.length;if(1!==r)return void(s?.messages&&s.messages.push(new o("media-layer:unsupported-source",`local media element source can only be persisted if it contains exactly one ImageElement, but it has ${r}.`)));e=e.elements.at(0)}O(e)?e.write(r,s):s?.messages&&(e?s.messages.push(new o("media-layer:unsupported-source","only media elements of type 'ImageElement' or 'VideoElement' can be persisted")):s.messages.push(new o("media-layer:unsupported-source","the media layer is missing a source")))}async save(e){return this._debouncedSaveOperations(L.SAVE,e)}async saveAs(e,r){return this._debouncedSaveOperations(L.SAVE_AS,r,e)}_createSource(e){if("mediaType"in e)switch(e.mediaType){case"image":return new S;case"video":return new j}return null}_getSourceOverride(e,r){if(O(e)&&this.originIdOf("source")===u.PORTAL_ITEM&&r&&(this.originIdOf("georeference")===u.WEB_MAP||this.originIdOf("georeference")===u.WEB_SCENE)){const o=e.toJSON(),t=this._createSource(o);return t.read({...o},{origin:"portal-item"}),t.read({georeference:r},{origin:"web-map"}),t.read({georeference:r},{origin:"web-scene"}),t}return null}};e([a({readOnly:!0})],b.prototype,"effectiveSource",void 0),e([a({readOnly:!0,json:{read:!1,write:!1,origins:{"web-document":{read:!0}}}})],b.prototype,"georeference",void 0),e([c("web-document","georeference")],b.prototype,"readGeoreference",null),e([a({type:String})],b.prototype,"copyright",void 0),e([a({readOnly:!0})],b.prototype,"fullExtent",null),e([a({type:["MediaLayer"]})],b.prototype,"operationalLayerType",void 0),e([a({type:["show","hide"]})],b.prototype,"listMode",void 0),e([a({nonNullable:!0,json:{write:{enabled:!0,allowNull:!1,target:{url:{type:String},mediaType:{type:["image","video"]},georeference:{type:g}},overridePolicy(e,r,o){return{enabled:!0,allowNull:!1,ignoreOrigin:v(this,o?.origin)&&O(e)&&!!e.georeference&&e.originIdOf("georeference")>u.PORTAL_ITEM}}}}})],b.prototype,"source",null),e([n("source")],b.prototype,"castSource",null),e([c("source",["url"])],b.prototype,"readSource",null),e([l("source")],b.prototype,"writeSource",null),e([a()],b.prototype,"spatialReference",void 0),e([a({readOnly:!0})],b.prototype,"type",void 0),b=e([p("esri.layers.MediaLayer")],b);const E=b;export{E 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.32/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 n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as r}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 f}from"./queryUtils.js";import{makeEdgeCandidate as p,makeVertexCandidate as g}from"./SnappingCandidate.js";import{isDateField as y,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 S from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as R,calculateStringStatistics as z,calculateStatistics as b,processSummaryStatisticsResult as B,calculateUniqueValuesCount as A,createUVResult as w,calculateClassBreaks as M,resolveCBResult as N,calculateHistogram as q,getAttributeComparator as P,calculatePercentile as D,binIndex as Z,getBinParams as j}from"../../../statistics/utils.js";class G{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 n=new Map,r=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!r.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,n);i.push(t)}r.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=r.get(a);for(const t in u){const{data:s,items:a}=u[t],n=s.join(",");i&&!e.validateItems(a,i)||o.add(n)}}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=E(this.hasZ,this.hasM),{point:a,mode:n}=e,r="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(n,this.spatialReference,t),d=new O(null,0),h=new O(null,0),f={x:0,y:0,z:0};for(const y of this.items){const t=i.getGeometry(y);if(null==t)continue;const{coords:n}=t,x=t.isPoint?H:t.lengths;if(d.coords=n,h.coords=n,e.returnEdge){let e=0;for(let t=0;t<x.length;t++){const n=x[t],c=e;for(let t=0;t<n;t++,e+=s){if(!u&&t===n-1)continue;const g=d;g.coordsIndex=e;const x=h;x.coordsIndex=t===n-1?c:e+s;const I=f;if(!C(f,a,g,x))continue;const T=(a.x-I.x)/r,F=(a.y-I.y)/o,_=T*T+F*F;_<=1&&l.candidates.push(p(i.getObjectId(y),m(I),Math.sqrt(_),m(g),m(x)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<x.length;t++){const n=x[t],c=e,f=h;f.coordsIndex=c;for(let t=0;t<n;t++,e+=s){const s=d;if(s.coordsIndex=e,u&&t===n-1&&s.x===f.x&&s.y===f.y)continue;const c=(a.x-s.x)/r,h=(a.y-s.y)/o,p=c*c+h*h;p<=1&&l.candidates.push(g(i.getObjectId(y),m(s),Math.sqrt(p)))}}}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)/r,n=(a.y-e.y)/o,u=t*t+n*n;u<=1&&l.candidates.push(g(i.getObjectId(y),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,n=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:n}):({x:e,y:t})=>s({x:e,y:t})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,minValue:r,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=y(m)||x(m)||I(m),h=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,scale:l,timeZone:u},this.items),f=R({normalizationType:a,normalizationField:s,minValue:r,maxValue:o}),p={value:.5,fieldType:m?.type},g=T(m)?z({values:h,supportsNullCount:f,percentileParams:p,outStatisticTypes:c}):b({values:h,minValue:r,maxValue:o,useSampleStdDev:!a,supportsNullCount:f,percentileParams:p,outStatisticTypes:c});return B(g,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:n,timeZone:r}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:n,timeZone:r},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:n,classificationMethod:r,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:n,scale:m,timeZone:d},this.items),f=M(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:r,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return N(f,r)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:r,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:n,scale:m,timeZone:d},this.items);return q(h,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:n,classificationMethod:r,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],n=this.fieldsIndex.get(a),r=!!t[1]&&"desc"===t[1].toLowerCase(),o=P(n?.type,r);e.sort(((e,t)=>{const s=i(e,a,n),r=i(t,a,n);return o(s,r)}))}}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,objectIdField:n,spatialReference:o}=this,{outFields:l,outSR:u,quantizationParameters:m,resultRecordCount:d,resultOffset:h,returnZ:f,returnM:p}=e,g=null!=d&&t.length>(h||0)+d,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map((e=>this.fieldsIndex.get(e))));return{exceededTransferLimit:g,features:this._createFeatures(e,t),fields:y,geometryType:i,hasM:s&&p,hasZ:a&&f,objectIdFieldName:n,spatialReference:c(u||o),transform:m&&r(m)||null}}_createFeatures(e,t){const i=new u(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:n,quantizationParameters:o,returnGeometry:l,returnCentroid:c,maxAllowableOffset:h,resultOffset:f,resultRecordCount:p,returnZ:g=!1,returnM:y=!1}=e,x=a&&g,I=s&&y;let T=[],F=0;const _=[...t];if(this._sortFeatures(_,n,((e,t,s)=>i.getFieldValue(e,t,s))),this.geometryType&&(l||c)){const e=r(o)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!c)for(const s of _){const a=this.featureAdapter.getGeometry(s),n={attributes:i.getAttributes(s),geometry:m(this.geometryType,this.hasZ,this.hasM,a,h,e,x,I)};t&&a&&!n.geometry&&(n.centroid=d(this,this.featureAdapter.getCentroid(s,this),e)),T[F++]=n}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 r of _){const e=i.getAttributes(r);e&&(T[F++]={attributes:e})}const V=f||0;if(null!=p){const e=V+p;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=E(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,n=new Map,r=new Map,o=new Map,l=new u(e,this.featureAdapter,this.fieldsIndex),c=e.outStatistics,{groupByFieldsForStatistics:m,having:d,orderByFields:h,resultRecordCount:f}=e,p=m?.length,g=!!p,y=g?m[0]:null,x=g&&!this.fieldsIndex.get(y);for(const u of c??[]){const{outStatisticFieldName:e,statisticType:c}=u,h=u,f="exceedslimit"!==c?u.onStatisticField:void 0,I="percentile_disc"===c||"percentile_cont"===c,F="EnvelopeAggregate"===c||"CentroidAggregate"===c||"ConvexHullAggregate"===c,_=g&&1===p&&(f===y||x)&&"count"===c;if(g){if(!r.has(f)){const e=[];for(const i of m){const s=this._getAttributeValues(l,i,t,a);e.push(s)}r.set(f,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=r.get(f);if(!i)continue;const s=Object.keys(i);for(const n of s){const{count:s,data:r,items:u,itemPositions:c}=i[n],p=r.join(",");if(!d||l.validateItems(u,d)){const i=o.get(p)||{attributes:{}};if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(h,u);i.aggregateGeometries[t]=e}else{let n=null;if(_)n=s;else{const e=this._getAttributeValues(l,f,t,a),i=c.map((t=>e[t]));n=I&&"statisticParameters"in h?this._getPercentileValue(h,i):this._getStatisticValue(h,i,null,l.returnDistinctValues)}i.attributes[e]=n}let n=0;m.forEach(((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++n]=r[t])),o.set(p,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,f,t,a);i.attributes[e]=I&&"statisticParameters"in h?this._getPercentileValue(h,s):this._getStatisticValue(h,s,n,l.returnDistinctValues)}const V="min"!==c&&"max"!==c||!T(this.fieldsIndex.get(f))&&!this._isAnyDateField(f)?null:this.fieldsIndex.get(f)?.type;s.push({name:e,alias:e,type:V||"esriFieldTypeDouble"})}const I=g?Array.from(o.values()):[i];return this._sortFeatures(I,h,((e,t)=>e.attributes[t])),f&&(I.length=Math.min(f,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return y(t)||x(t)||I(t)||F(t)}async _getAggregateGeometry(e,t){const{convexHull:r,union:o}=await import("../../../geometry/geometryEngineJSON.js"),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:d,geometryType:h,hasZ:f,hasM:p}=this,g=t.map((e=>m(h,f,p,c.getGeometry(e)))),y=r(d,g,!0)[0],x={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=y?a(y):n(o(d,g));x.aggregateGeometries={...e,spatialReference:d},x.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=y?i(y):s(n(o(d,g)));x.aggregateGeometries={x:e[0],y:e[1],spatialReference:d},x.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(x.aggregateGeometries=y,x.outStatisticFieldName=u||"convexHull");return x}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:n}=e;let r=null;r=i?.has(a)?i.get(a):T(this.fieldsIndex.get(a))||this._isAnyDateField(a)?z({values:t,returnDistinct:s}):b({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,r);return r["var"===n?"variance":n]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:n,orderBy:r}=s,o=this.fieldsIndex.get(i);return D(t,{value:n,orderBy:r,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),n=i.map((i=>e.getFieldValue(i,t,a)));return s.set(t,n),n}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let n=0;n<a;n++){const a=t[n],r=[];for(const t of e)r.push(t[n]);const o=r.join(",");null==s[o]?s[o]={count:1,data:r,items:[a],itemPositions:[n]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(n))}return s}async _getDataValues(t,i,s=!0){const a=new u(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:r,timeZone:o}=t;return n?a.getExpressionValues(i,n,{viewingMode:"map",scale:r,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,n=t.max??0,r=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<=n){const e=Z(s,t);e>-1&&(r[e].count++,r[e].items.push(l))}}return r}async createQueryBinsResponse(e){const t=e.bin;switch(t.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(_.fromJSON(t),e);case"dateBin":return this._createDateBinsResponse(V.fromJSON(t),e);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(v.fromJSON(t),e);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(S.fromJSON(t),e)}}async _createAutoIntervalBinsResponse(e,t){const{field:i,normalizationField:s,numBins:a,normalizationType:n,normalizationTotal:r,start:o,end:l}=e,u=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},this.items),c=j(u,{field:i,normalizationField:s,normalizationType:n,normalizationTotal:r,numBins:a,minValue:f(o,!1),maxValue:f(l,!1)}),m=await this._calculateHistogramBins(u,c,this.items);return this._createFeaturesFromHistogramBins(m,t)}async _createDateBinsResponse(e,i){const{field:s,interval:a,start:n,end:r}=e,o=a.unit,l="quarters"===o?3*t.months:t[o],u=a.value*l/t.milliseconds,c=await this._getDataValues({field:e.field,timeZone:i.outTimeReference?.ianaTimeZone},this.items),m=F(this.fieldsIndex.get(s)),d=j(c,{field:s,classificationMethod:"defined-interval",definedInterval:u,minValue:f(n,m),maxValue:f(r,m)},!0),h=await this._calculateHistogramBins(c,d,this.items);return this._createFeaturesFromHistogramBins(h,i)}async _createFixedBoundariesBinsResponse(e,t){const{field:i}=e,s=await this._getDataValues({field:i,timeZone:t.outTimeReference?.ianaTimeZone},this.items),a=F(this.fieldsIndex.get(i)),n=e.boundaries.map((e=>f(e,a))).sort(((e,t)=>e-t)),r=[];for(let u=0;u<n.length-1;u++)r.push([n[u],n[u+1]]);const o={intervals:r,min:n.at(0),max:n.at(-1)},l=await this._calculateHistogramBins(s,o,this.items);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t){const{field:i,interval:s,start:a,end:n}=e,r=await this._getDataValues({field:e.field,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},this.items),o=F(this.fieldsIndex.get(i)),l=j(r,{field:i,classificationMethod:"defined-interval",definedInterval:s,minValue:f(a,o),maxValue:f(n,o)},!0),u=await this._calculateHistogramBins(r,l,this.items);return this._createFeaturesFromHistogramBins(u,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",n=i||"upperBoundary",r=[],o=[];for(const l of e){const{minValue:e,maxValue:i,items:s}=l,u={attributes:{}};u.attributes[a]=e,u.attributes[n]=i;const c=await this._createStatisticsQueryResponse(t,s,u);r.push(u),c.fields&&o.push(...c.fields)}return"desc"===t.binOrder&&r.reverse(),{fields:o,features:r}}}function C(e,t,i,s){const a=s.x-i.x,n=s.y-i.y,r=t.x-i.x,o=t.y-i.y,l=a*a+n*n;if(0===l)return!1;const u=r*a+o*n,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+n*c,!0}function E(e,t){return e?t?4:3:t?3:2}class O{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 H=[1];export{G 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 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:{...t,[u??e]:e,...d.attributes}})))):(d.stackedAttributes=h.features.map((({attributes:{EXPR_1:e,...t}})=>({...t,[u??e]:e}))),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};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as
|
|
5
|
+
import t from"../../../core/Error.js";import{JSONMap as e}from"../../../core/jsonMap.js";import{getUnitString as i}from"../../../core/unitUtils.js";import{canProjectWithoutEngine as r}from"../../../geometry/projection.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{fromJSON as a,isExtent as o,isPolygon as s,isPolyline as l}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as m}from"../../../geometry/support/normalizeUtils.js";import{equals as u,isGeographic as c,isWebMercator as p,wgs84 as f}from"../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as y,project as d}from"./projectionSupport.js";const g=new e({esriSRUnit_Meter:"meters",esriSRUnit_Kilometer:"kilometers",esriSRUnit_Foot:"feet",esriSRUnit_StatuteMile:"miles",esriSRUnit_NauticalMile:"nautical-miles",esriSRUnit_USNauticalMile:"us-nautical-miles"}),S=Object.freeze({}),R="frequency";async function w(t,e,i){const r=t.bin;return r.onField&&(r.onField=r.onField.trim()),r.onExpression?.value&&(r.onExpression.value=r.onExpression.value.trim()),r.splitBy&&(r.splitBy.value&&(r.splitBy.value=r.splitBy.value.trim()),r.splitBy.outAlias&&(r.splitBy.outAlias=r.splitBy.outAlias.trim())),r.stackBy&&(r.stackBy.value&&(r.stackBy.value=r.stackBy.value.trim()),r.stackBy.outAlias&&(r.stackBy.outAlias=r.stackBy.outAlias.trim())),"normalizationField"in r.parameters&&r.parameters.normalizationField&&(r.parameters.normalizationField=r.parameters.normalizationField.trim()),t.outStatistics?.length||(t.outStatistics=[{statisticType:"count",onStatisticField:"1",outStatisticFieldName:R}]),x(t,e,i)}async function x(t,e,i){const{outFields:r,orderByFields:n,groupByFieldsForStatistics:a,outStatistics:o}=t;if(r)for(let s=0;s<r.length;s++)r[s]=r[s].trim();if(n)for(let s=0;s<n.length;s++)n[s]=n[s].trim();if(a)for(let s=0;s<a.length;s++)a[s]=a[s].trim();if(o)for(let s=0;s<o.length;s++)o[s].onStatisticField&&(o[s].onStatisticField=o[s].onStatisticField.trim());return t.geometry&&!t.outSR&&(t.outSR=t.geometry.spatialReference),B(t,e,i)}async function B(t,e,i){if(!t)return null;let{where:r}=t;if(t.where=r=r?.trim(),(!r||/^1 *= *1$/.test(r)||e&&e===r)&&(t.where=null),!t.geometry)return t;let o=await v(t);if(t.distance=0,t.units=null,"esriSpatialRelEnvelopeIntersects"===t.spatialRel){const{spatialReference:e}=t.geometry;o=n(o),o.spatialReference=e}if(o){await y(o.spatialReference,i),o=j(o,i);const e=(await m(a(o)))[0];if(null==e)throw S;const r="quantizationParameters"in t&&t.quantizationParameters?.tolerance||"maxAllowableOffset"in t&&t.maxAllowableOffset||0,n=r&&F(o,i)?{densificationStep:8*r}:void 0,s=e.toJSON(),l=d(s,s.spatialReference,i,n);if(!l)throw S;l.spatialReference=i,t.geometry=l}return t}function F(t,e){if(!t)return!1;const i=t.spatialReference;return(o(t)||s(t)||l(t))&&!u(i,e)&&!r(i,e)}function j(t,e){const i=t.spatialReference;return F(t,e)&&o(t)?{spatialReference:i,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:t}async function v(e){const{distance:r,units:n}=e,a=e.geometry;if(null==r||"vertexAttributes"in a)return a;const o=a.spatialReference,l=n?g.fromJSON(n):i(o),m=o&&(c(o)||p(o))?a:await y(o,f).then((()=>d(a,f))),u=await import("../../../geometry/operators/json/geodesicBufferOperator.js");await u.load();const S=u.execute(m,r,{unit:l})??void 0;if(!S||!s(S)||0===S.rings.length)throw new t("unsupported-query:invalid-parameters","Invalid parameters for query by distance");return S}function h(t,e){return null==t?null:"string"==typeof t?e?new Date(`1970-01-01T${t}Z`).getTime():new Date(t).getTime():t instanceof Date?t.getTime():t}export{h as getDateInNumber,w as normalizeAttributeBinsQuery,x as normalizeQuery,B as normalizeQueryLike,S as queryEngineEmptyResult,g as unitsKebabDict};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{numericFieldTypes as t,allDateAndTimeFieldTypes as i,validateFields as s,validateWhere as r,validateHaving as n}from"./attributeSupport.js";import{checkProjectionSupport as o}from"./projectionSupport.js";import{checkSpatialQuerySupport as a}from"./spatialQuerySupport.js";import{loadArcade as l}from"../../../support/arcadeOnDemand.js";const u="unsupported-query";async function p(t,i){const s=t.bin;if(!s.onField&&!s.
|
|
5
|
+
import e from"../../../core/Error.js";import{numericFieldTypes as t,allDateAndTimeFieldTypes as i,validateFields as s,validateWhere as r,validateHaving as n}from"./attributeSupport.js";import{checkProjectionSupport as o}from"./projectionSupport.js";import{checkSpatialQuerySupport as a}from"./spatialQuerySupport.js";import{loadArcade as l}from"../../../support/arcadeOnDemand.js";const u="unsupported-query";async function p(t,i){const s=t.bin;if(!s.onField&&!s.onExpression?.value||"autoIntervalBin"===s.type&&null==s.parameters.numberOfBins||"dateBin"===s.type&&(null==s.parameters.number||null==s.parameters.unit)||"fixedBoundariesBin"===s.type&&null==s.parameters.boundaries||"fixedIntervalBin"===s.type&&null==s.parameters.interval)throw new e(u,"Unsupported query options",{query:t});return c(t,i)}async function c(t,{fieldsIndex:i,geometryType:s,spatialReference:r,availableFields:n}){if(null!=t.geometryPrecision||t.multipatchOption&&"xyFootprint"!==t.multipatchOption||t.pixelSize||t.relationParam||t.text)throw new e(u,"Unsupported query options",{query:t});return d(i,n,t),m(i,n,t),Promise.all([a(t,s,r),o(r,t.outSR)]).then((()=>t))}function d(t,i,n){const{outFields:o,orderByFields:a,returnDistinctValues:l,outStatistics:p}=n,c=p?p.map((e=>e.outStatisticFieldName&&e.outStatisticFieldName.toLowerCase())).filter(Boolean):[];if(a&&a.length>0){const e=" asc",r=" desc",o=a.map((t=>{const i=t.toLowerCase();return i.includes(e)?i.split(e)[0]:i.includes(r)?i.split(r)[0]:t})).filter((e=>!c.includes(e)));s(t,i,o,{expressionName:"orderByFields",query:n})}if(o&&o.length>0)s(t,i,o,{expressionName:"outFields",query:n,allowedFieldTypes:"all"});else if(l)throw new e(u,"outFields should be specified for returnDistinctValues",{query:n});r(t,i,n.where,n)}const f=new Set([...t,...i]);function m(t,i,r){const{outStatistics:o,groupByFieldsForStatistics:a,having:l}=r,p=a?.length,c=o?.length;if(l){if(!p||!c)throw new e(u,"outStatistics and groupByFieldsForStatistics should be specified with having",{query:r});n(t,i,l,o,r)}if(c){if(!F(o))return;const n=o.map((e=>e.onStatisticField)).filter(Boolean);s(t,i,n,{expressionName:"onStatisticFields",query:r}),p&&s(t,i,a,{expressionName:"groupByFieldsForStatistics",query:r});for(const a of o){const{onStatisticField:n,statisticType:o}=a;if(("percentile_disc"===o||"percentile_cont"===o)&&"statisticParameters"in a){const{statisticParameters:t}=a;if(!t)throw new e(u,"statisticParameters should be set for percentile type",{definition:a,query:r})}else t.get(n)&&"count"!==o&&"min"!==o&&"max"!==o&&s(t,i,[n],{expressionName:`outStatistics with '${o}' statistic type`,allowedFieldTypes:f,query:r})}}}async function y(t,i,{fieldsIndex:s,geometryType:r,spatialReference:n,availableFields:l}){if(null!=t.geometryPrecision||t.multipatchOption||t.pixelSize||t.relationParam||t.text||t.outStatistics||t.groupByFieldsForStatistics||t.having||t.orderByFields)throw new e(u,"Unsupported query options",{query:t});return d(s,l,t),Promise.all([h(s,l,i,t),a(t,r,n),o(n,t.outSR)]).then((()=>t))}async function h(t,i,r,n){let o=[];if(r.valueExpression){const{arcadeUtils:e}=await l();o=e.extractFieldNames(r.valueExpression)}if(r.field&&o.push(r.field),r.field2&&o.push(r.field2),r.field3&&o.push(r.field3),r.normalizationField&&o.push(r.normalizationField),!o.length&&!r.valueExpression)throw new e(u,"field or valueExpression is required",{params:r});s(t,i,o,{expressionName:"statistics",query:n})}function F(e){return null!=e&&e.every((e=>"exceedslimit"!==e.statisticType))}export{p as validateAttributeBinsQuery,c as validateQuery,y as validateStatisticsQuery};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{debounce as a,eachAlways as s}from"../../../core/promiseUtils.js";import{open as i}from"../../../core/workers/workers.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Loadable.js";import o from"../../../core/Logger.js";import{debounce as a,eachAlways as s}from"../../../core/promiseUtils.js";import{open as i}from"../../../core/workers/workers.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as u}from"../../../geometry/support/typeUtils.js";import{createCapabilities as c,createDrawingInfo as p}from"./support/clientSideDefaults.js";import{getCapabilities as m,getWFSLayerInfo as d,prepareWFSLayerFields as y,findFeatureType as f}from"../../ogc/wfsUtils.js";import h from"../../../rest/support/AttributeBinsFeatureSet.js";import w from"../../../rest/support/FeatureSet.js";import{utc as g}from"../../../time/timeZoneUtils.js";import S from"../../../geometry/Extent.js";let F=class extends r{constructor(){super(...arguments),this._connection=null,this._workerHandler=null,this.capabilities=c(!1,!1),this.type="wfs",this.refresh=a((async()=>{await this.load();const e={customParameters:this.layer.customParameters,maxRecordCount:this.layer.maxRecordCount,maxTotalRecordCount:this.layer.maxTotalRecordCount,maxPageCount:this.layer.maxPageCount},{extent:t}=await this._workerHandler.refresh(e);return t&&(this.sourceJSON.extent=t),{dataChanged:!0,updates:{extent:this.sourceJSON.extent}}}))}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this._startWorker({signal:t})),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null}async openPorts(){return await this.load(),this._connection.openPorts()}async queryFeatures(e,t={}){const r=await this.queryFeaturesJSON(e,t);return w.fromJSON(r)}async queryFeaturesJSON(e,t={}){return await this.load(t),this._workerHandler.queryFeatures(e?e.toJSON():void 0,t)}async queryFeatureCount(e,t={}){return await this.load(t),this._workerHandler.queryFeatureCount(e?e.toJSON():void 0,t)}async queryObjectIds(e,t={}){return await this.load(t),this._workerHandler.queryObjectIds(e?e.toJSON():void 0,t)}async queryExtent(e,t={}){await this.load(t);const r=await this._workerHandler.queryExtent(e?e.toJSON():void 0,t);return{count:r.count,extent:S.fromJSON(r.extent)}}async querySnapping(e,t={}){return await this.load(t),this._workerHandler.querySnapping(e,t)}async queryAttributeBins(e,t={}){await this.load(t);const r=await this._workerHandler.queryAttributeBins(e?.toJSON(),t);return h.fromJSON(r)}async _createLoadOptions(e){const{url:r,customParameters:o,name:a,namespaceUri:s,fields:i,geometryType:n,maxRecordCount:l,maxPageCount:c,maxTotalRecordCount:p,swapXY:h}=this.layer,w="defaults"===this.layer.originOf("spatialReference")?void 0:this.layer.spatialReference;if(!r)throw new t("wfs-layer:missing-url","WFSLayer must be created with a url");this.wfsCapabilities||(this.wfsCapabilities=await m(r,{customParameters:o,...e}));const g=["fields","geometryType","name","namespaceUri","swapXY"].some((e=>null==this.layer[e])),S=g?await d(this.wfsCapabilities,a,s,{spatialReference:w,customParameters:o,signal:e?.signal}):{...y(i??[]),geometryType:n,name:a,namespaceUri:s,spatialReference:w,swapXY:h},F=f(this.wfsCapabilities.readFeatureTypes(),S.name,S.namespaceUri),x=u.toJSON(S.geometryType),{operations:j}=this.wfsCapabilities,O=j.GetFeature.url,C=j.GetFeature.outputFormat;return{customParameters:o,featureType:F,fields:S.fields?.map((e=>e.toJSON()))??[],geometryField:S.geometryField,geometryType:x,getFeatureUrl:O,getFeatureOutputFormat:C,maxRecordCount:l,maxPageCount:c,maxTotalRecordCount:p,objectIdField:S.objectIdField,spatialReference:S.spatialReference?.toJSON(),swapXY:!!S.swapXY}}async _startWorker(e){const[t,r]=await s([this._createLoadOptions(e),i("WFSSourceWorker",{...e,strategy:has("feature-layers-workers")?"dedicated":"local",registryTarget:this})]),a=t.error||r.error||null,n=r.value||null;if(a)throw n&&n.close(),a;const l=t.value;this._connection=r.value,this._workerHandler=this._connection.createInvokeProxy();const u=await this._workerHandler.load(l,e);for(const s of u.warnings)o.getLogger(this.layer).warn("#load()",`${s.message} (title: '${this.layer.title||"no title"}', id: '${this.layer.id??"no id"}')`,{warning:s});this.sourceJSON={dateFieldsTimeReference:{timeZoneIANA:g},extent:u.extent,fields:l.fields,geometryType:l.geometryType,objectIdField:l.objectIdField,geometryField:l.geometryField,drawingInfo:p(l.geometryType),name:l.featureType.title,wfsInfo:{name:l.featureType.name,featureUrl:l.getFeatureUrl,maxFeatures:l.maxRecordCount,swapXY:l.swapXY,supportedSpatialReferences:l.featureType.supportedSpatialReferences,version:"2.0.0",wfsNamespace:l.featureType.namespaceUri}}}};e([n()],F.prototype,"capabilities",void 0),e([n({constructOnly:!0})],F.prototype,"layer",void 0),e([n()],F.prototype,"sourceJSON",void 0),e([n()],F.prototype,"type",void 0),e([n()],F.prototype,"wfsCapabilities",void 0),F=e([l("esri.layers.graphics.sources.WFSSource")],F);export{F as WFSSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import o from"../../core/Error.js";import{getImageData as r}from"../../core/imageUtils.js";import{isAbsolute as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../request.js";import o from"../../core/Error.js";import{getImageData as r}from"../../core/imageUtils.js";import{isAbsolute as i,isDataProtocol as n,isBlobProtocol as s,dataToBlob as a,join as m}from"../../core/urlUtils.js";import{generateUUID as l}from"../../core/uuid.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../../core/accessorSupport/decorators/writer.js";import d from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import{getResourceContentExtension as y}from"../../portal/support/resourceExtension.js";import{ImageElementSymbol as v}from"../../support/mediaLayerUtils.js";import{f as j,t as I,i as b,M as w}from"../../chunks/persistableUrlUtils.js";var E;let U=class extends d{constructor(t){super(t),this.animationOptions=null,this.content=null,this.image=null,this.type="image",this[E]=!0,this.image=null}load(){const t=this.image;if("string"==typeof t){const e=r(t).then((t=>{this._set("content",t)}));this.addResolvingPromise(e)}else if(t instanceof HTMLImageElement){const e=t.decode().then((()=>{this._set("content",t)}));this.addResolvingPromise(e)}else t?this._set("content",t):this.addResolvingPromise(Promise.reject(new o("image-element:invalid-image-type","Invalid image type",{image:t})));return Promise.resolve(this)}get contentWidth(){return null==this.content?0:this.content instanceof HTMLImageElement?this.content.naturalWidth:this.content.width}get contentHeight(){return null==this.content?0:this.content instanceof HTMLImageElement?this.content.naturalHeight:this.content.height}readImage(t,e,o){return j(e.url,o)}writeImage(t,e,o,r){if(null==t)return;const n=r?.portalItem,s=r?.resources;if(!n||!s)return void("string"==typeof t&&(e[o]=I(t,r)));const a=L(t)?t:null;if(a){if(null==b(a))return void(e[o]=a);const t=I(a,{...r,verifyItemRelativeUrls:r?.verifyItemRelativeUrls?{writtenUrls:r.verifyItemRelativeUrls.writtenUrls,rootPath:void 0}:void 0},w.NO);if(n&&t&&!i(t))return s.toKeep.push({resource:n.resourceFromPath(t),compress:!1}),void(e[o]=t)}e[o]="<pending>",s.pendingOperations.push(M(t).then((t=>{const r=R(t,n);e[o]=r.itemRelativeUrl,s.toAdd.push({resource:r,content:{type:"blob",blob:t},compress:!1,finish:t=>{this.image=t.url}})})))}};E=v,t([c()],U.prototype,"animationOptions",void 0),t([c({readOnly:!0})],U.prototype,"content",void 0),t([c({readOnly:!0})],U.prototype,"contentWidth",null),t([c({readOnly:!0})],U.prototype,"contentHeight",null),t([c(g)],U.prototype,"image",void 0),t([p("image",["url"])],U.prototype,"readImage",null),t([h("image")],U.prototype,"writeImage",null),t([c(f)],U.prototype,"type",void 0),U=t([u("esri.layers.support.ImageElement")],U);const H=U;function L(t){return"string"==typeof t&&!n(t)&&!s(t)}async function M(t){if("string"==typeof t){if(n(t))return a(t);return(await e(t,{responseType:"blob"})).data}return new Promise((e=>P(t).toBlob(e)))}function P(t){if(t instanceof HTMLCanvasElement)return t;const e=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height,r=document.createElement("canvas"),i=r.getContext("2d");return r.width=e,r.height=o,t instanceof HTMLImageElement?i.drawImage(t,0,0,t.width,t.height):t instanceof ImageData&&i.putImageData(t,0,0),r}function R(t,e){const o=l(),r=`${m("media",o)}.${y({type:"blob",blob:t})}`;return e.resourceFromPath(r)}export{H 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../request.js";import o from"../../core/Error.js";import{once as r}from"../../core/events.js";import s from"../../core/Logger.js";import{clamp as i}from"../../core/mathUtils.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{isAbsolute as l,makeAbsolute as a,getProxyRule as c,addProxy as d,isBlobProtocol as p,isDataProtocol as m}from"../../core/urlUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{writer as v}from"../../core/accessorSupport/decorators/writer.js";import y from"./MediaElementBase.js";import{mediaElementUrlProperty as g,mediaTypeProperty as f}from"./mediaUtils.js";import{VideoElementSymbol as j}from"../../support/mediaLayerUtils.js";import{i as w}from"../../chunks/persistableUrlUtils.js";var U;let b=class extends y{constructor(e){super(e),this.autoplay=!0,this.content=null,this.controller=null,this.type="video",this[U]=!0}load(){const e=this.video;return"string"==typeof e?this.addResolvingPromise(Promise.all([this._preProcessVideoUrl(e),import("../video/VideoController.js")]).then((async([e,{default:t}])=>{this.controller=new t,this.controller.playerUrl=e,await n((()=>this.controller?.element)),this.controller.loop=!0,this.controller.muted=!0,this.controller.playsInline=!0,this.controller.crossOrigin="anonymous",await n((()=>"can-play"===this.controller?.state)),await this.controller.play(),this.autoplay||this.controller.pause(),this._set("content",this.controller.element)}))):e instanceof HTMLVideoElement?this.addResolvingPromise(this._loadVideo(e).then((()=>{this._set("content",e)}))):this.addResolvingPromise(Promise.reject(new o("video-element:invalid-video-type","Invalid video type",{video:e}))),Promise.resolve(this)}get contentWidth(){return this.content?.videoWidth??0}get contentHeight(){return this.content?.videoHeight??0}get currentTime(){return this.controller?.currentTime}set currentTime(e){if(!this.controller)return;const t=i(e,0,this.controller.duration);this.controller?.setCurrentTime(t)}get duration(){return this.controller?.duration}set video(e){"not-loaded"===this.loadStatus?this._set("video",e):s.getLogger(this).error("#video","video cannot be changed after the element is loaded.")}writeVideo(e,t,r,s){if(!e)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source is missing")));const i=V(e)?e:null;if(!i)return void(s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source must be an absolute url")));!l(i)&&s?.blockedRelativeUrls&&s.blockedRelativeUrls.push(i);const n=a(i);!w(n)?t[r]=n:s?.messages&&s.messages.push(new o("video-element:unsupported-video","video source cannot be an item resource"))}async _preProcessVideoUrl(e){if(c(e))return d(e);try{return await t(e,{method:"head"}),e}catch{return d(e,!0)}}_loadVideo(e){return new Promise(((t,o)=>{const s=r(e,"canplay",(()=>{this.removeHandles("canplay"),this.autoplay?e.play().then(t,o):t()}));this.addHandles(s,"canplay"),"anonymous"!==e.crossOrigin&&(e.crossOrigin="anonymous",p(e.src)||(e.src=e.src))}))}};U=j,e([u()],b.prototype,"autoplay",void 0),e([u({readOnly:!0})],b.prototype,"content",void 0),e([u({readOnly:!0})],b.prototype,"contentWidth",null),e([u({readOnly:!0})],b.prototype,"contentHeight",null),e([u()],b.prototype,"controller",void 0),e([u({type:Number})],b.prototype,"currentTime",null),e([u({type:Number})],b.prototype,"duration",null),e([u(g)],b.prototype,"video",null),e([v("video")],b.prototype,"writeVideo",null),e([u(f)],b.prototype,"type",void 0),b=e([h("esri.layers.support.VideoElement")],b);const P=b;function V(e){return"string"==typeof e&&!m(e)&&!p(e)}export{P 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportedStatistics:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
|
|
5
|
+
const s={supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1,supportedStatistics:void 0,supportedNormalizationTypes:void 0},t={analytics:{supportsCacheHint:!1},attachment:{supportsContentType:!1,supportsExifInfo:!1,supportsKeywords:!1,supportsName:!1,supportsSize:!1,supportsCacheHint:!1,supportsResize:!1},data:{isVersioned:!1,isBranchVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsAsyncApplyEdits:!1,zDefault:void 0},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryBins:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},queryAttributeBins:s,query:{maxRecordCount:0,maxRecordCountFactor:0,standardMaxRecordCount:0,supportsCacheHint:!1,supportsCentroid:!1,supportsCompactGeometry:!1,supportsCurrentUser:!1,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsDisjointSpatialRelationship:!1,supportsDistance:!1,supportsDistinct:!1,supportsExtent:!1,supportsFormatPBF:!1,supportsGeometryProperties:!1,supportsHavingClause:!1,supportsHistoricMoment:!1,supportsMaxRecordCountFactor:!1,supportsOrderBy:!1,supportsPagination:!1,supportsPercentileStatistics:!1,supportsQuantization:!1,supportsQuantizationEditMode:!1,supportsQueryByAnonymous:!1,supportsQueryByOthers:!1,supportsQueryGeometry:!1,supportsResultType:!1,supportsReturnMesh:!1,supportsSqlExpression:!1,supportsStandardizedQueriesOnly:!1,supportsTopFeaturesQuery:!1,supportsTrueCurve:!1,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsStatistics:!1,tileMaxRecordCount:0}};export{t as zeroCapabilities,s as zeroQueryBins};
|