@arcgis/core 5.0.0-next.6 → 5.0.0-next.8
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/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{8f56f298e7c1a283f407.js → 0030d68d9edf42b4af57.js} +1 -1
- package/assets/esri/core/workers/chunks/01d460398f3ba6767a37.js +1 -0
- package/assets/esri/core/workers/chunks/{17d5f8dba6ebb1184506.js → 042cd64e1f4eb326c30f.js} +1 -1
- package/assets/esri/core/workers/chunks/05429f9d292a7a714309.js +316 -0
- package/assets/esri/core/workers/chunks/{66db5f77e09d25e33951.js → 063905fbf9a0c6586949.js} +1 -1
- package/assets/esri/core/workers/chunks/{9486032af3e934d85582.js → 0a5d74414dd02a2fb8e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{3815ffa13e7b439bca6e.js → 0d5212f59e9b62c16164.js} +1 -1
- package/assets/esri/core/workers/chunks/{73487b9d85e726e9c012.js → 1257c37bf04d39c27b62.js} +1 -1
- package/assets/esri/core/workers/chunks/{398f356b11fd33bd3831.js → 136a7d781dad05a7463b.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e4e7aedf4b779241a02.js → 15c7c10ff9ac63f0e792.js} +1 -1
- package/assets/esri/core/workers/chunks/17784cf16fa91504b9ea.js +1 -0
- package/assets/esri/core/workers/chunks/{a395373e3173e6458a56.js → 1ab37e13947d0e2e4181.js} +1 -1
- package/assets/esri/core/workers/chunks/{f03635ddf56e2ef90e4c.js → 1d06fcae4c2f02fb1c95.js} +1 -1
- package/assets/esri/core/workers/chunks/{020c8913d8e35d63080b.js → 1d15d1b20dc10fde6def.js} +1 -1
- package/assets/esri/core/workers/chunks/1dfca37f95f2b968aa54.js +1 -0
- package/assets/esri/core/workers/chunks/20975513be0a3a1da286.js +1 -0
- package/assets/esri/core/workers/chunks/{285762ff92d5388b6024.js → 2166238a7ad63a2d43c7.js} +1 -1
- package/assets/esri/core/workers/chunks/{620a94b54be3ed78350d.js → 22ca80f491e070b2a5e7.js} +1 -1
- package/assets/esri/core/workers/chunks/{88074189fa10c335370b.js → 24cd7b84cd0f3de4bff2.js} +1 -1
- package/assets/esri/core/workers/chunks/{9fac5a12e878cd745354.js → 28020063048e644f17a5.js} +1 -1
- package/assets/esri/core/workers/chunks/{95c594a87b732f5c4979.js → 2a8dff8521e1e6a10cf6.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e43c105f1cfc44b7bd0.js → 2fa01bd3f3608616fd7f.js} +1 -1
- package/assets/esri/core/workers/chunks/30e220f4f843681a4cdd.js +1 -0
- package/assets/esri/core/workers/chunks/{5d3661d1fe46dd29aae9.js → 311b564e44ae637c960d.js} +1 -1
- package/assets/esri/core/workers/chunks/31c7ce65e16f7858400f.js +1 -0
- package/assets/esri/core/workers/chunks/{8a314b3790313e6dc5db.js → 333b62dad3811cff0f14.js} +1 -1
- package/assets/esri/core/workers/chunks/36d067c8d03d7a894f5f.js +1 -0
- package/assets/esri/core/workers/chunks/{e31192ae920e3e19b6aa.js → 37c1f155da14de91565a.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa54b6f2aba6952af149.js → 38cc18fd93c18815ded0.js} +1 -1
- package/assets/esri/core/workers/chunks/{c55c096669677321a227.js → 38cd3648932bf2534b0f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ac26e3e77df4302f47a2.js → 3afb83f5de033dda89ec.js} +1 -1
- package/assets/esri/core/workers/chunks/{f5e47eea8720ba84665b.js → 3c07aa2015ab1dff5f7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e9311386f58f3cb95c22.js → 42a1e71d09e8583a7327.js} +1 -1
- package/assets/esri/core/workers/chunks/443dfe7029ec208f670c.js +1 -0
- package/assets/esri/core/workers/chunks/{b75930d60449eceb0f1c.js → 4baf6f6e7ddedb25f806.js} +1 -1
- package/assets/esri/core/workers/chunks/{bb5484b5eeacc9ad2ceb.js → 4d0cbf9584446f411a37.js} +1 -1
- package/assets/esri/core/workers/chunks/{17103e6542aae53c7301.js → 4e3e27673d0671fc2b58.js} +1 -1
- package/assets/esri/core/workers/chunks/{5fc7b61f467f1d60a284.js → 51ab2acac4ecc1ca9c34.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc4417d1260b717a9385.js → 52282f767bd0e99ddca0.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc06014fb484fc8c697e.js → 53654edd766d9b4ef750.js} +1 -1
- package/assets/esri/core/workers/chunks/{90f8b4bda28af43ea019.js → 538f509d7fc8337d37ac.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed8a85efbd90241512bb.js → 588533c3abe876f20f62.js} +1 -1
- package/assets/esri/core/workers/chunks/{c8733cd621105afab2ac.js → 59d3cac32ad6dad941dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{72846fb9c87c6642daf0.js → 5e2ce34def5e053913b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c056eac35d05d9524b7.js → 5f29422a051311ef9b3c.js} +1 -1
- package/assets/esri/core/workers/chunks/5f402b3c00bc4afc77b2.js +1 -0
- package/assets/esri/core/workers/chunks/{ff35a077ac6776469805.js → 61d970ed75c2c358b1e9.js} +1 -1
- package/assets/esri/core/workers/chunks/{7a6a96edc892d7060b7d.js → 629127877042ad784ad2.js} +1 -1
- package/assets/esri/core/workers/chunks/{fd2efd1d1cf9d95a87e6.js → 63a6f3e70d2b6ea57e40.js} +1 -1
- package/assets/esri/core/workers/chunks/{90b2b43b8b54c9a1ec35.js → 664ae441617afe4b17ec.js} +1 -1
- package/assets/esri/core/workers/chunks/{c4e4da69969499a89a2c.js → 695cdef5057e5461078a.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c5a7249a311070d8f43.js → 6af18d7a0d314d7c1756.js} +1 -1
- package/assets/esri/core/workers/chunks/{f35aaa04cca676c2d3f8.js → 6b59f94040c7d2f6728a.js} +1 -1
- package/assets/esri/core/workers/chunks/{811d4c46c75cf6a63e78.js → 6bb7dbc46787b8e34bd9.js} +1 -1
- package/assets/esri/core/workers/chunks/6d9f2b113d6bde936a04.js +1 -0
- package/assets/esri/core/workers/chunks/{5132ca68e8c7af111a47.js → 6e22b02a9715c10578d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{cd1930f08e1fc8b30b14.js → 6ee2f0f708494102a493.js} +1 -1
- package/assets/esri/core/workers/chunks/{f0e0a63962784acb4ba1.js → 6f0aec7428021e440ac9.js} +1 -1
- package/assets/esri/core/workers/chunks/{deb2854bb7d082a26f52.js → 7005d956c990a04ee8b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a3991ae8caa713d4ddcd.js → 731f7b552dde0fb325cd.js} +1 -1
- package/assets/esri/core/workers/chunks/{464d42bebb365287808d.js → 773f2c6c9d38db76dfed.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f3d492f1093b7832aab.js → 7803495f8862d9025bcd.js} +1 -1
- package/assets/esri/core/workers/chunks/78694ad8229347903f41.js +1 -0
- package/assets/esri/core/workers/chunks/7e4c14d4502e3f06d94b.js +1 -0
- package/assets/esri/core/workers/chunks/{7544316a75dbd981aea6.js → 86cb097deec50b0da3f3.js} +1 -1
- package/assets/esri/core/workers/chunks/8a40ed2ee4b032822c30.js +1 -0
- package/assets/esri/core/workers/chunks/{09de8be660174a229efb.js → 8cbb28476151a37ae958.js} +1 -1
- package/assets/esri/core/workers/chunks/{62a49cfd9a2508950e9f.js → 8fedfd33c37172dba6bf.js} +1 -1
- package/assets/esri/core/workers/chunks/90cbd627d4113db3b686.js +1 -0
- package/assets/esri/core/workers/chunks/91aa1157da32f650983b.js +1 -0
- package/assets/esri/core/workers/chunks/{e7638b9ab6674bc8a18f.js → 91dfd29e2dba200eab09.js} +1 -1
- package/assets/esri/core/workers/chunks/{794748fd1edc29a621cd.js → 9698f36c143953a975d4.js} +1 -1
- package/assets/esri/core/workers/chunks/98584902c9db6faa3e4d.js +1 -0
- package/assets/esri/core/workers/chunks/9e5e05d6430712b0b1bc.js +1 -0
- package/assets/esri/core/workers/chunks/{6f4bd0ee85e7e5a74340.js → a31635a6366347dcef0f.js} +1 -1
- package/assets/esri/core/workers/chunks/a6ee40dfc471d6612f3c.js +1 -0
- package/assets/esri/core/workers/chunks/{ccc0da0e01f023c8aa1f.js → a876d6159ca120c1567e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a4db5c9a90107e097df8.js → af47272aaaef0ea57e71.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1fe816b6990918c13c7.js → afc13d5b842275db7dbc.js} +1 -1
- package/assets/esri/core/workers/chunks/aff8e40a641c6822af1d.js +1 -0
- package/assets/esri/core/workers/chunks/{22d6b8102e75bdef204c.js → b0365cbc3d2a41969e3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{79968c183135281d2a6f.js → b3613a38178cad2ebc82.js} +1 -1
- package/assets/esri/core/workers/chunks/b548910e820d731ffe8a.js +1 -0
- package/assets/esri/core/workers/chunks/{5bd36dbf46c25bd961c8.js → b708792c84620b73c847.js} +1 -1
- package/assets/esri/core/workers/chunks/c29486c4eeb3e72effff.js +1 -0
- package/assets/esri/core/workers/chunks/{2b94623cabc6ae0f86ce.js → c37f7756d48ff9af2656.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c52999a6392370844a6.js → c4090a60d149a5962179.js} +1 -1
- package/assets/esri/core/workers/chunks/{73c1d43070b4fe1e5c1e.js → c8e686efe344a33a0258.js} +1 -1
- package/assets/esri/core/workers/chunks/{6bb5158de43c4b59107f.js → c9b16fd41cd59d452522.js} +1 -1
- package/assets/esri/core/workers/chunks/ce98416437cc1a89d8ea.js +1 -0
- package/assets/esri/core/workers/chunks/{279366e6b743f9680603.js → cfff044859e6e6dcc75d.js} +1 -1
- package/assets/esri/core/workers/chunks/d07f911d40bf05fc0306.js +1 -0
- package/assets/esri/core/workers/chunks/{8833c3d168951be4bf20.js → d0d79dd3e88eecf5c314.js} +1 -1
- package/assets/esri/core/workers/chunks/{76ae1702fecc7ad7017c.js → d1e97cce5047f1791e22.js} +1 -1
- package/assets/esri/core/workers/chunks/{17acde0245ecd956306c.js → d233cc33497a663450f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{36fe6b8228e622407ec2.js → d8793eead02491136841.js} +1 -1
- package/assets/esri/core/workers/chunks/{dedc4583b5f32a278124.js → d88f2fe680b8d5603ef8.js} +1 -1
- package/assets/esri/core/workers/chunks/{4d599008e1ea42321b37.js → da24ad57747714ac5eda.js} +1 -1
- package/assets/esri/core/workers/chunks/{facb3886714222772ab2.js → ddfd01bb9ba8577c3ffc.js} +1 -1
- package/assets/esri/core/workers/chunks/{50d9f69d5255af4b29bb.js → df5afa06c6deb6b40109.js} +1 -1
- package/assets/esri/core/workers/chunks/e25c4b4a03270d48f408.js +1 -0
- package/assets/esri/core/workers/chunks/e3294318daf1192b8319.js +1 -0
- package/assets/esri/core/workers/chunks/{da573ecc68e6aa8f6da9.js → e767f83f9e2de6650f80.js} +1 -1
- package/assets/esri/core/workers/chunks/e9d4cae2144974489d6e.js +1 -0
- package/assets/esri/core/workers/chunks/{91df8638b8b904e6d8c5.js → ead8d0cbcebd12dbfad7.js} +1 -1
- package/assets/esri/core/workers/chunks/{f9324e88c359c03f35aa.js → eb9c166db0db6fa60e95.js} +1 -1
- package/assets/esri/core/workers/chunks/{8ffd4710d168c2fcfd96.js → ebf23b46db56aaa88841.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc241c7735e4efba734a.js → f34e3fa0c5b28531e289.js} +1 -1
- package/assets/esri/core/workers/chunks/f64037a88ab03662dc2a.js +1 -0
- package/assets/esri/core/workers/chunks/{d97fadbc69e055d183a0.js → f77f4bd6a577b92cf66f.js} +1 -1
- package/assets/esri/core/workers/chunks/{16d66770ef841564ee3f.js → f89c90f98c85667b0ebc.js} +1 -1
- package/assets/esri/core/workers/chunks/{4c4227b0ea21a5e429ab.js → fb192de7e4fa152342bb.js} +1 -1
- package/assets/esri/core/workers/chunks/fbd8d2f61f8a15bcf3db.js +1 -0
- package/assets/esri/core/workers/chunks/{2f78861afe0e9037dd8d.js → fe49321dca22dc60d105.js} +1 -1
- package/assets/esri/core/workers/chunks/{fe77ae6cf232a7a3298e.js → fef45bc59c71f88c60b5.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/config.js +1 -1
- package/core/QueueProcessor.js +1 -1
- package/core/SetUtils.js +1 -1
- package/core/has.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/identity/Credential.js +1 -1
- package/identity/IdentityManager.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +67 -27
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/connections/GeoEventConnection.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/support/fieldConfigUtils.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +1 -1
- package/layers/support/source/DataLayerSource.js +1 -1
- package/package.json +3 -3
- package/popup/FieldInfo.js +1 -1
- package/processRequest.js +5 -0
- package/request.js +1 -1
- package/requestConfig.js +5 -0
- package/requestQueue.js +5 -0
- package/rest/query/executeForCount.js +1 -1
- package/rest/query/executeForExtent.js +1 -1
- package/rest/query/executeForIds.js +1 -1
- package/rest/query/executeQueryJSON.js +1 -1
- package/rest/query/executeQueryPBF.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/support/BaseImageMeasureResultValue.js +5 -0
- package/rest/support/ImageAreaResult.js +1 -1
- package/rest/support/ImageDistanceResult.js +1 -1
- package/rest/support/ImageHeightResult.js +1 -1
- package/rest/support/ImageMeasureResultAngleValue.js +5 -0
- package/rest/support/ImageMeasureResultAreaValue.js +5 -0
- package/rest/support/ImageMeasureResultLengthValue.js +5 -0
- package/rest/support/ImageWithType.js +5 -0
- package/rest/support/imageMeasureUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/{3d/support/ImageWithType.js → 2d/layers/features/sources/strategies/constants.js} +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/volumeMeasurementErrors.js +1 -1
- package/views/3d/glTF/DefaultLoadingContext.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SDataRequester.js +5 -0
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteractionOptions.js +1 -1
- package/views/3d/layers/support/MediaLayerInteractionReshapeOptions.js +5 -0
- package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +5 -0
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/fetchTile.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lighting/SceneLighting.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +6 -0
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +1 -1
- package/views/draw/MultipointDrawAction.js +1 -1
- package/views/draw/PointDrawAction.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/input/CursorUpdateEvents.js +5 -0
- package/views/draw/input/DrawCompleteEvent.js +5 -0
- package/views/draw/input/VertexAddEvent.js +5 -0
- package/views/draw/input/VertexRemoveEvent.js +5 -0
- package/views/draw/input/VertexUpdateEvent.js +5 -0
- package/views/interactive/editGeometry/CheckpointingEditGeometryOperations.js +5 -0
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/operations/ReplayableAppendVertex.js +5 -0
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTilesSimple.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTileNode.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicTilePyramid.js +1 -1
- package/widgets/PanoramicViewer/support/getVisibleTiles.js +5 -0
- package/widgets/Sketch/CreateToolVisibilityMap.js +5 -0
- package/widgets/Sketch/SelectionToolVisibilityMap.js +5 -0
- package/widgets/Sketch/VisibleElements.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/02e69f0c63d97661da60.js +0 -1
- package/assets/esri/core/workers/chunks/05eee334d58a0b9f6316.js +0 -1
- package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +0 -1
- package/assets/esri/core/workers/chunks/326a76a4e80269d4029d.js +0 -1
- package/assets/esri/core/workers/chunks/377a66034e7c1bad5599.js +0 -1
- package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +0 -1
- package/assets/esri/core/workers/chunks/459a67928bde4a62b6a4.js +0 -1
- package/assets/esri/core/workers/chunks/53bd8996e8812f1ad7b2.js +0 -1
- package/assets/esri/core/workers/chunks/557960763695abee4a83.js +0 -1
- package/assets/esri/core/workers/chunks/6201356f7f91e5c06425.js +0 -1
- package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +0 -1
- package/assets/esri/core/workers/chunks/7413e582bc2b16af6a0f.js +0 -1
- package/assets/esri/core/workers/chunks/7461124454bfb4fb6474.js +0 -1
- package/assets/esri/core/workers/chunks/75bf27271a31e26e1b21.js +0 -1
- package/assets/esri/core/workers/chunks/7aaaebbabee27690283c.js +0 -1
- package/assets/esri/core/workers/chunks/7c4a63aeead2505d6f02.js +0 -1
- package/assets/esri/core/workers/chunks/90250e9239c173aace88.js +0 -1
- package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +0 -1
- package/assets/esri/core/workers/chunks/99859dce1925b406ccd0.js +0 -1
- package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +0 -1
- package/assets/esri/core/workers/chunks/9e8dceef4c961f56940d.js +0 -1
- package/assets/esri/core/workers/chunks/a06bac9b8f9e18874de8.js +0 -316
- package/assets/esri/core/workers/chunks/a712cdff78fc826acd8c.js +0 -1
- package/assets/esri/core/workers/chunks/d305a21666b1ed5bf33d.js +0 -1
- package/assets/esri/core/workers/chunks/d40f57f9fc47f9a9f97c.js +0 -1
- package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +0 -1
- package/assets/esri/core/workers/chunks/f4d0ae6be1b3984228d0.js +0 -1
- package/assets/esri/core/workers/chunks/f6c8beb60f6d29945a2e.js +0 -1
- package/assets/esri/core/workers/chunks/f746e3f7ebff2bbdf333.js +0 -1
- package/views/3d/layers/i3s/I3SStreamDataController.js +0 -5
- package/views/3d/support/StreamDataLoader.js +0 -5
- package/views/3d/support/StreamDataRequester.js +0 -5
- package/views/3d/support/downloadSlots.js +0 -5
- package/views/draw/input/DrawEvents.js +0 -5
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3117],{5808:(t,e,s)=>{s.d(e,{O:()=>i});const i={geodesic:0,loxodrome:1,"great-elliptic":2,"normal-section":3,"shape-preserving":4}},6774:(t,e,s)=>{s.d(e,{O3:()=>n,Ox:()=>o,bR:()=>i});class i{constructor(t,e){this.x=t,this.y=e}static fromArray(t){return new i(t[0],t[1])}clone(){return new i(this.x,this.y)}equals(t,e){return t===this.x&&e===this.y}isEqual(t){return t.x===this.x&&t.y===this.y}setCoords(t,e){return this.x=t,this.y=e,this}normalize(){const t=this.x,e=this.y,s=Math.sqrt(t*t+e*e);return this.x/=s,this.y/=s,this}rightPerpendicular(){const t=this.x;return this.x=this.y,this.y=-t,this}leftPerpendicular(){const t=this.x;return this.x=-this.y,this.y=t,this}move(t,e){return this.x+=t,this.y+=e,this}assign(t){return this.x=t.x,this.y=t.y,this}assignAdd(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}assignSub(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}rotate(t,e){const s=this.x,i=this.y;return this.x=s*t-i*e,this.y=s*e+i*t,this}rotateReverse(t,e){const s=this.x,i=this.y;return this.x=s*t+i*e,this.y=-s*e+i*t,this}scale(t){return this.x*=t,this.y*=t,this}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}sub(t){return this.x-=t.x,this.y-=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}static distance(t,e){const s=e.x-t.x,i=e.y-t.y;return Math.sqrt(s*s+i*i)}static add(t,e){return new i(t.x+e.x,t.y+e.y)}static sub(t,e){return new i(t.x-e.x,t.y-e.y)}}class r{constructor(t,e,s){this.ratio=t,this.x=e,this.y=s}}class n{constructor(t,e,s,i=8,r=8){this._lines=[],this._starts=[],this.validateTessellation=!0,this._pixelRatio=i,this._pixelMargin=r,this._tileSize=512*i,this._dz=t,this._yPos=e,this._xPos=s}setPixelMargin(t){t!==this._pixelMargin&&(this._pixelMargin=t,this.setExtent(this._extent))}setExtent(t){this._extent=t,this._finalRatio=this._tileSize/t*(1<<this._dz);let e=this._pixelRatio*this._pixelMargin;e/=this._finalRatio;const s=t>>this._dz;e>s&&(e=s),this._margin=e,this._xmin=s*this._xPos-e,this._ymin=s*this._yPos-e,this._xmax=this._xmin+s+2*e,this._ymax=this._ymin+s+2*e}reset(t){this._type=t,this._lines=[],this._starts=[],this._line=null,this._start=0}moveTo(t,e){this._pushLine(),this._prevIsIn=this._isIn(t,e),this._moveTo(t,e,this._prevIsIn),this._prevPt=new i(t,e),this._firstPt=new i(t,e),this._dist=0}lineTo(t,e){const s=this._isIn(t,e),n=new i(t,e),o=i.distance(this._prevPt,n);let a,h,c,l,u,d,p,_;if(s)this._prevIsIn?this._lineTo(t,e,!0):(a=this._prevPt,h=n,c=this._intersect(h,a),this._start=this._dist+o*(1-this._r),this._lineTo(c.x,c.y,!0),this._lineTo(h.x,h.y,!0));else if(this._prevIsIn)h=this._prevPt,a=n,c=this._intersect(h,a),this._lineTo(c.x,c.y,!0),this._lineTo(a.x,a.y,!1);else{const t=this._prevPt,e=n;if(t.x<=this._xmin&&e.x<=this._xmin||t.x>=this._xmax&&e.x>=this._xmax||t.y<=this._ymin&&e.y<=this._ymin||t.y>=this._ymax&&e.y>=this._ymax)this._lineTo(e.x,e.y,!1);else{const s=[];if((t.x<this._xmin&&e.x>this._xmin||t.x>this._xmin&&e.x<this._xmin)&&(l=(this._xmin-t.x)/(e.x-t.x),_=t.y+l*(e.y-t.y),_<=this._ymin?d=!1:_>=this._ymax?d=!0:s.push(new r(l,this._xmin,_))),(t.x<this._xmax&&e.x>this._xmax||t.x>this._xmax&&e.x<this._xmax)&&(l=(this._xmax-t.x)/(e.x-t.x),_=t.y+l*(e.y-t.y),_<=this._ymin?d=!1:_>=this._ymax?d=!0:s.push(new r(l,this._xmax,_))),(t.y<this._ymin&&e.y>this._ymin||t.y>this._ymin&&e.y<this._ymin)&&(l=(this._ymin-t.y)/(e.y-t.y),p=t.x+l*(e.x-t.x),p<=this._xmin?u=!1:p>=this._xmax?u=!0:s.push(new r(l,p,this._ymin))),(t.y<this._ymax&&e.y>this._ymax||t.y>this._ymax&&e.y<this._ymax)&&(l=(this._ymax-t.y)/(e.y-t.y),p=t.x+l*(e.x-t.x),p<=this._xmin?u=!1:p>=this._xmax?u=!0:s.push(new r(l,p,this._ymax))),0===s.length)u?d?this._lineTo(this._xmax,this._ymax,!0):this._lineTo(this._xmax,this._ymin,!0):d?this._lineTo(this._xmin,this._ymax,!0):this._lineTo(this._xmin,this._ymin,!0);else if(s.length>1&&s[0].ratio>s[1].ratio)this._start=this._dist+o*s[1].ratio,this._lineTo(s[1].x,s[1].y,!0),this._lineTo(s[0].x,s[0].y,!0);else{this._start=this._dist+o*s[0].ratio;for(let t=0;t<s.length;t++)this._lineTo(s[t].x,s[t].y,!0)}this._lineTo(e.x,e.y,!1)}}this._dist+=o,this._prevIsIn=s,this._prevPt=n}close(){if(this._line.length>2){const t=this._firstPt,e=this._prevPt;t.x===e.x&&t.y===e.y||this.lineTo(t.x,t.y);const s=this._line;let i=s.length;for(;i>=4&&(s[0].x===s[1].x&&s[0].x===s[i-2].x||s[0].y===s[1].y&&s[0].y===s[i-2].y);)s.pop(),s[0].x=s[i-2].x,s[0].y=s[i-2].y,--i}}result(t=!0){return this._pushLine(),0===this._lines.length?null:(3===this._type&&t&&a.simplify(this._tileSize,this._margin*this._finalRatio,this._lines),this._lines)}resultWithStarts(){if(2!==this._type)throw new Error("Only valid for lines");this._pushLine();const t=this._lines,e=t.length;if(0===e)return null;const s=[];for(let i=0;i<e;i++)s.push({line:t[i],start:this._starts[i]||0});return s}_isIn(t,e){return t>=this._xmin&&t<=this._xmax&&e>=this._ymin&&e<=this._ymax}_intersect(t,e){let s,r,n;if(e.x>=this._xmin&&e.x<=this._xmax)r=e.y<=this._ymin?this._ymin:this._ymax,n=(r-t.y)/(e.y-t.y),s=t.x+n*(e.x-t.x);else if(e.y>=this._ymin&&e.y<=this._ymax)s=e.x<=this._xmin?this._xmin:this._xmax,n=(s-t.x)/(e.x-t.x),r=t.y+n*(e.y-t.y);else{r=e.y<=this._ymin?this._ymin:this._ymax,s=e.x<=this._xmin?this._xmin:this._xmax;const i=(s-t.x)/(e.x-t.x),o=(r-t.y)/(e.y-t.y);i<o?(n=i,r=t.y+i*(e.y-t.y)):(n=o,s=t.x+o*(e.x-t.x))}return this._r=n,new i(s,r)}_pushLine(){this._line&&(1===this._type?this._line.length>0&&(this._lines.push(this._line),this._starts.push(this._start)):2===this._type?this._line.length>1&&(this._lines.push(this._line),this._starts.push(this._start)):3===this._type&&this._line.length>3&&(this._lines.push(this._line),this._starts.push(this._start))),this._line=[],this._start=0}_moveTo(t,e,s){3!==this._type?s&&(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new i(t,e))):(s||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.push(new i(t,e)),this._isH=!1,this._isV=!1)}_lineTo(t,e,s){let r,n;if(3!==this._type)if(s){if(t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line.length>0&&(r=this._line[this._line.length-1],r.equals(t,e)))return;this._line.push(new i(t,e))}else this._line&&this._line.length>0&&this._pushLine();else if(s||(t<this._xmin&&(t=this._xmin),t>this._xmax&&(t=this._xmax),e<this._ymin&&(e=this._ymin),e>this._ymax&&(e=this._ymax)),t=Math.round((t-(this._xmin+this._margin))*this._finalRatio),e=Math.round((e-(this._ymin+this._margin))*this._finalRatio),this._line&&this._line.length>0){r=this._line[this._line.length-1];const s=r.x===t,o=r.y===e;if(s&&o)return;this._isH&&s||this._isV&&o?(r.x=t,r.y=e,n=this._line[this._line.length-2],n.x===t&&n.y===e?(this._line.pop(),this._line.length<=1?(this._isH=!1,this._isV=!1):(n=this._line[this._line.length-2],this._isH=n.x===t,this._isV=n.y===e)):(this._isH=n.x===t,this._isV=n.y===e)):(this._line.push(new i(t,e)),this._isH=s,this._isV=o)}else this._line.push(new i(t,e))}}class o{setExtent(t){this._ratio=4096===t?1:4096/t}get validateTessellation(){return this._ratio<1}reset(t){this._lines=[],this._line=null}moveTo(t,e){this._line&&this._lines.push(this._line),this._line=[];const s=this._ratio;this._line.push(new i(t*s,e*s))}lineTo(t,e){const s=this._ratio;this._line.push(new i(t*s,e*s))}close(){const t=this._line;t&&!t[0].isEqual(t[t.length-1])&&t.push(t[0])}result(){return this._line&&this._lines.push(this._line),0===this._lines.length?null:this._lines}}class a{static simplify(t,e,s){if(!s)return;const i=-e,r=t+e,n=-e,o=t+e,h=[],c=[],l=s.length;for(let t=0;t<l;++t){const e=s[t];if(!e||e.length<2)continue;let a,l=e[0];const u=e.length;for(let s=1;s<u;++s)a=e[s],l.x===a.x&&(l.x<=i&&(l.y>a.y?(h.push(t),h.push(s),h.push(0),h.push(-1)):(c.push(t),c.push(s),c.push(0),c.push(-1))),l.x>=r&&(l.y<a.y?(h.push(t),h.push(s),h.push(1),h.push(-1)):(c.push(t),c.push(s),c.push(1),c.push(-1)))),l.y===a.y&&(l.y<=n&&(l.x<a.x?(h.push(t),h.push(s),h.push(2),h.push(-1)):(c.push(t),c.push(s),c.push(2),c.push(-1))),l.y>=o&&(l.x>a.x?(h.push(t),h.push(s),h.push(3),h.push(-1)):(c.push(t),c.push(s),c.push(3),c.push(-1)))),l=a}if(0===h.length||0===c.length)return;a.fillParent(s,c,h),a.fillParent(s,h,c);const u=[];a.calcDeltas(u,c,h),a.calcDeltas(u,h,c),a.addDeltas(u,s)}static fillParent(t,e,s){const i=s.length,r=e.length;for(let n=0;n<r;n+=4){const r=e[n],o=e[n+1],a=e[n+2],c=t[r][o-1],l=t[r][o];let u=8092,d=-1;for(let e=0;e<i;e+=4){if(s[e+2]!==a)continue;const i=s[e],r=s[e+1],n=t[i][r-1],o=t[i][r];switch(a){case 0:case 1:if(h(c.y,n.y,o.y)&&h(l.y,n.y,o.y)){const t=Math.abs(o.y-n.y);t<u&&(u=t,d=e)}break;case 2:case 3:if(h(c.x,n.x,o.x)&&h(l.x,n.x,o.x)){const t=Math.abs(o.x-n.x);t<u&&(u=t,d=e)}}}e[n+3]=d}}static calcDeltas(t,e,s){const i=e.length;for(let r=0;r<i;r+=4){const i=[],n=a.calcDelta(r,e,s,i);t.push(e[r]),t.push(e[r+1]),t.push(e[r+2]),t.push(n)}}static calcDelta(t,e,s,i){const r=e[t+3];if(-1===r)return 0;const n=i.length;return n>1&&i[n-2]===r?0:(i.push(r),a.calcDelta(r,s,e,i)+1)}static addDeltas(t,e){const s=t.length;let i=0;for(let e=0;e<s;e+=4){const s=t[e+3];s>i&&(i=s)}for(let r=0;r<s;r+=4){const s=e[t[r]],n=t[r+1],o=i-t[r+3];switch(t[r+2]){case 0:s[n-1].x-=o,s[n].x-=o,1===n&&(s[s.length-1].x-=o),n===s.length-1&&(s[0].x-=o);break;case 1:s[n-1].x+=o,s[n].x+=o,1===n&&(s[s.length-1].x+=o),n===s.length-1&&(s[0].x+=o);break;case 2:s[n-1].y-=o,s[n].y-=o,1===n&&(s[s.length-1].y-=o),n===s.length-1&&(s[0].y-=o);break;case 3:s[n-1].y+=o,s[n].y+=o,1===n&&(s[s.length-1].y+=o),n===s.length-1&&(s[0].y+=o)}}}}const h=(t,e,s)=>t>=e&&t<=s||t>=s&&t<=e},6797:(t,e,s)=>{s.d(e,{Ui:()=>d});var i=s(69622),r=s(7762),n=s(88620);const o=new Set(["esri.Color","esri.portal.Portal","esri.symbols.support.Symbol3DAnchorPosition2D","esri.symbols.support.Symbol3DAnchorPosition3D"]);function a(t){return t instanceof i.A}function h(t){return t instanceof r.A?Object.keys(t.items):a(t)?(0,n.oY)(t).keys():t?Object.keys(t):[]}function c(t,e){return t instanceof r.A?t.items[e]:t[e]}function l(t){return t?t.declaredClass:null}function u(t,e){const s=t.diff;if(s&&"function"==typeof s)return s(t,e);const i=h(t),r=h(e);if(0===i.length&&0===r.length)return;if(!i.length||!r.length||function(t,e){return!(!Array.isArray(t)||!Array.isArray(e))&&t.length!==e.length}(t,e))return{type:"complete",oldValue:t,newValue:e};const n=r.filter(t=>!i.includes(t)),d=i.filter(t=>!r.includes(t)),p=i.filter(s=>r.includes(s)&&c(t,s)!==c(e,s)).concat(n,d).sort(),_=l(t);if(_&&o.has(_)&&p.length)return{type:"complete",oldValue:t,newValue:e};let f;const m=a(t)&&a(e);for(const i of p){const r=c(t,i),n=c(e,i);let o;if((m||"function"!=typeof r&&"function"!=typeof n)&&r!==n&&(null!=r||null!=n)){if(s&&s[i]&&"function"==typeof s[i])o=s[i]?.(r,n);else if(r instanceof Date&&n instanceof Date){if(r.getTime()===n.getTime())continue;o={type:"complete",oldValue:r,newValue:n}}else o="object"==typeof r&&"object"==typeof n&&l(r)===l(n)?u(r,n):{type:"complete",oldValue:r,newValue:n};null!=o&&(null!=f?f.diff[i]=o:f={type:"partial",diff:{[i]:o}})}}return f}function d(t,e){if("function"!=typeof t&&"function"!=typeof e&&(null!=t||null!=e))return null==t||null==e||"object"==typeof t&&"object"==typeof e&&l(t)!==l(e)?{type:"complete",oldValue:t,newValue:e}:u(t,e)}},10382:(t,e,s)=>{s.d(e,{A:()=>c});var i=s(36563),r=(s(44208),s(74887)),n=s(9775),o=s(72457),a=s(52268),h=s(61322);class c{constructor(){this._inUseClients=new Array,this._clients=new Array,this._clientPromises=new Array,this._ongoingJobsQueue=new n.A,this._ongoingLowPriorityJobsQueue=new n.A}destroy(){this.close()}get closed(){return!this._clients?.length}open(t,e){return new Promise((s,i)=>{let n=!0;const o=t=>{(0,r.Te)(e.signal),n&&(n=!1,t())};this._clients.length=t.length,this._clientPromises.length=t.length,this._inUseClients.length=t.length;for(let n=0;n<t.length;++n){const a=t[n];(0,r.$X)(a)?this._clientPromises[n]=a.then(t=>(this._clients[n]=new h.default(t,e,this._ongoingJobsQueue,this._ongoingLowPriorityJobsQueue),o(s),this._clients[n]),()=>(o(i),null)):(this._clients[n]=new h.default(a,e,this._ongoingJobsQueue,this._ongoingLowPriorityJobsQueue),this._clientPromises[n]=Promise.resolve(this._clients[n]),o(s))}})}broadcast(t,e,s){const i=new Array(this._clientPromises.length);for(let r=0;r<this._clientPromises.length;++r){const n=this._clientPromises[r];i[r]=n.then(i=>i?.invoke(t,e,s))}return i}close(){let t;for(;t=this._ongoingJobsQueue.pop();)t.resolver.reject((0,r.NK)(`Worker closing, aborting job calling '${t.methodName}'`));for(;t=this._ongoingLowPriorityJobsQueue.pop();)t.resolver.reject((0,r.NK)(`Worker closing, aborting job calling '${t.methodName}'`));for(const t of this._clientPromises)t.then(t=>t?.close());this._clients.length=0,this._clientPromises.length=0,this._inUseClients.length=0,(0,o.h)(this)}invoke(t,e,s){return this.apply(t,[e],s)}apply(t,e,s){const i=(0,r.Tw)();(1===s?.jobPriority?this._ongoingLowPriorityJobsQueue:this._ongoingJobsQueue).push({methodName:t,data:e,invokeOptions:s,resolver:i});for(let t=0;t<this._clientPromises.length;t++){const e=this._clients[t];e?e.jobAdded():this._clientPromises[t].then(t=>t?.jobAdded())}return i.promise}createInvokeProxy(t){return(0,a.L)(this,t)}on(t,e){return Promise.all(this._clientPromises).then(()=>(0,i.vE)(this._clients.map(s=>s.on(t,e))))}openPorts(){return new Promise(t=>{const e=new Array(this._clientPromises.length);let s=e.length;for(let i=0;i<this._clientPromises.length;++i)this._clientPromises[i].then(r=>{r&&(e[i]=r.openPort()),0===--s&&t(e)})})}get test(){}}},13195:(t,e,s)=>{s.d(e,{GW:()=>m,IU:()=>b,Jo:()=>o,MG:()=>n,Wh:()=>d,cP:()=>S,os:()=>l,p6:()=>f,pJ:()=>a,ru:()=>v,s3:()=>w,wV:()=>_,yM:()=>I,z0:()=>p});var i=s(95108),r=s(6774);const n=Number.POSITIVE_INFINITY,o=Math.PI,a=2*o,h=128/o,c=256/360,l=o/180,u=1/Math.LN2;function d(t,e){return(t%=e)>=0?t:t+e}function p(t){return d(t*h,256)}function _(t){return d(t*c,256)}function f(t){return Math.log(t)*u}function m(t,e,s){return t*(1-s)+e*s}const g=8,y=14,x=16;function b(t){return g+Math.max((t-y)*x,0)}function w(t,e,s){let i,r,n,o=0;for(const a of s){i=a.length;for(let s=1;s<i;++s)r=a[s-1],n=a[s],r.y>e!=n.y>e&&((n.x-r.x)*(e-r.y)-(n.y-r.y)*(t-r.x)>0?o++:o--)}return 0!==o}function v(t,e,s,r){let n,o,a,h;const c=r*r;for(const r of s){const s=r.length;if(!(s<2)){n=r[0].x,o=r[0].y;for(let l=1;l<s;++l){if(a=r[l].x,h=r[l].y,(0,i.Ng)(t,e,n,o,a,h)<c)return!0;n=a,o=h}}}return!1}function S(t,e){if(0===e||Number.isNaN(e))return t;const s=[],i=new r.bR(0,0),n=new r.bR(0,0),o=new r.bR(0,0);for(let a=0;a<t.length;a++){const h=t[a],c=[];for(let t=0;t<h.length;t++){const s=h[t-1],a=h[t],l=h[t+1];0===t?i.setCoords(0,0):i.assignSub(a,s).normalize().rightPerpendicular(),t===h.length-1?n.setCoords(0,0):n.assignSub(l,a).normalize().rightPerpendicular(),o.assignAdd(i,n).normalize();const u=o.x*n.x+o.y*n.y;0!==u&&o.scale(1/u),c.push(r.bR.add(a,o.scale(e)))}s.push(c)}return s}function I(t,e,s,i){const n=new r.bR(t[0],t[1]);if(n.scale(i),"viewport"===e){const t=-s*(Math.PI/180),e=Math.cos(t),i=Math.sin(t);n.rotate(e,i)}return n}},18047:(t,e,s)=>{s.d(e,{Up:()=>h,ZV:()=>c,yx:()=>a});var i=s(73444);const r={ar:"ar-u-nu-latn",bs:"sr-Latn-CS",nn:"no-NN"};let n=new WeakMap,o={};function a(t={}){const e={};return null!=t.digitSeparator&&(e.useGrouping=t.digitSeparator),null!=t.places&&(e.minimumFractionDigits=e.maximumFractionDigits=t.places),e}function h(t){const{minimumFractionDigits:e,maximumFractionDigits:s,useGrouping:i}=t;return{minimumFractionDigits:e,maximumFractionDigits:s,useGrouping:"auto"===i?"auto":"always"===i}}function c(t,e){return Object.is(t,-0)&&(t=0),function(t){const e=t||o;if(!n.has(e)){const s=(0,i.lR)(),o=s&&r[s]||(0,i.QC)();n.set(e,new Intl.NumberFormat(o,t))}return n.get(e)}(e).format(t)}(0,i.Ml)(()=>{n=new WeakMap,o={}}),new Map},30624:(t,e,s)=>{s.r(e),s.d(e,{createConnection:()=>S});var i=s(31635),r=s(78888),n=s(49186),o=s(53966),a=s(74887),h=s(84952),c=(s(44208),s(87811),s(64108)),l=s(16930),u=s(65864),d=s(10107),p=s(62815),_=s(65529);let f=class extends _.nJ{destroy(){this.emit("destroy")}get connectionError(){return this.errorString?new n.A("stream-connection",this.errorString):null}onFeature(t){this.emit("data-received",t)}onMessage(t){this.emit("message-received",t)}};(0,i.Cg)([(0,d.MZ)({readOnly:!0})],f.prototype,"connectionError",null),f=(0,i.Cg)([(0,c.$)("esri.layers.support.StreamConnection")],f);let m=class extends f{constructor(t){super({}),this._outstandingMessages=[],this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._config=t,this._featureZScaler=(0,p.N)(e,i,s),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),null!=this._websocket&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(null==this._websocket)return"disconnected";switch(this._websocket.readyState){case 0:case 1:return"connected";case 2:case 3:return"disconnected"}}sendMessageToSocket(t){null!=this._websocket?this._websocket.send(JSON.stringify(t)):this._outstandingMessages.push(t)}sendMessageToClient(t){this._onMessage(t)}updateCustomParameters(t){this._config.customParameters=t,null!=this._websocket&&this._websocket.close()}async _tryCreateWebSocket(t=this._config.source.path,e=1e3,s=0){try{if(this.destroyed)return;const e=(0,h.a6)(t,this._config.customParameters??{});this._websocket=await this._createWebSocket(e),this.notifyChange("connectionStatus")}catch(i){const r=e/1e3;return this._config.maxReconnectionAttempts&&s>=this._config.maxReconnectionAttempts?(o.A.getLogger(this).error(new n.A("websocket-connection","Exceeded maxReconnectionAttempts attempts. No further attempts will be made")),void this.destroy()):(o.A.getLogger(this).error(new n.A("websocket-connection",`Failed to connect. Attempting to reconnect in ${r}s`,i)),await(0,a.Pl)(e),this._tryCreateWebSocket(t,Math.min(1.5*e,1e3*this._config.maxReconnectionInterval),s+1))}}_setWebSocketJSONParseHandler(t){t.onmessage=t=>{try{const e=JSON.parse(t.data);this._onMessage(e)}catch(t){return void o.A.getLogger(this).error(new n.A("websocket-connection","Failed to parse message, invalid JSON",{error:t}))}}}_createWebSocket(t){return new Promise((e,s)=>{const i=new WebSocket(t);i.onopen=()=>{if(i.onopen=null,this.destroyed)return i.onclose=null,void i.close();i.onclose=t=>this._onClose(t),i.onerror=t=>this._onError(t),this._setWebSocketJSONParseHandler(i),e(i)},i.onclose=t=>{i.onopen=i.onclose=null,s(t)}})}async _handshake(t=1e4){const e=this._websocket;if(null==e)return;const s=(0,a.Tw)(),i=e.onmessage,{filter:r,outFields:h,spatialReference:c}=this._config;return s.timeout(t),e.onmessage=t=>{let a=null;try{a=JSON.parse(t.data)}catch(t){}a&&"object"==typeof a||(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - malformed message",t.data)),s.reject(),this.destroy()),a.spatialReference?.wkid!==c?.wkid&&(o.A.getLogger(this).error(new n.A("websocket-connection",`Protocol violation. Handshake failed - expected wkid of ${c.wkid}`,t.data)),s.reject(),this.destroy()),"json"!==a.format&&(o.A.getLogger(this).error(new n.A("websocket-connection","Protocol violation. Handshake failed - format is not set",t.data)),s.reject(),this.destroy()),r&&a.filter!==r&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set filter, but server doesn't support it")),h&&a.outFields!==h&&o.A.getLogger(this).error(new n.A("websocket-connection","Tried to set outFields, but server doesn't support it")),e.onmessage=i;for(const t of this._outstandingMessages)e.send(JSON.stringify(t));this._outstandingMessages=[],s.resolve()},e.send(JSON.stringify({filter:r,outFields:h,format:"json",spatialReference:{wkid:c.wkid}})),s.promise}_onMessage(t){if(this.onMessage(t),"type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}}_onError(t){const e="Encountered an error over WebSocket connection";this._set("errorString",e),o.A.getLogger(this).error("websocket-connection",e)}_onClose(t){this._websocket=null,this.notifyChange("connectionStatus"),1e3!==t.code&&o.A.getLogger(this).error("websocket-connection",`WebSocket closed unexpectedly with error code ${t.code}`),this.destroyed||this._open()}};(0,i.Cg)([(0,d.MZ)()],m.prototype,"connectionStatus",null),(0,i.Cg)([(0,d.MZ)()],m.prototype,"errorString",void 0),m=(0,i.Cg)([(0,c.$)("esri.layers.graphics.sources.connections.WebSocketConnection")],m);var g=s(80893),y=s(61956);const x={maxQueryDepth:5,maxRecordCountFactor:3};let b=class extends m{constructor(t){super({...x,...t}),this._buddyServicesQuery=null,this._relatedFeatures=null}async _open(){const t=await this._fetchServiceDefinition(this._config.source);t.timeInfo.trackIdField||o.A.getLogger(this).warn("GeoEvent service was configured without a TrackIdField. This may result in certain functionality being disabled. The purgeOptions.maxObservations property will have no effect.");const e=this._fetchWebSocketUrl(t.streamUrls,this._config.spatialReference);this._buddyServicesQuery||(this._buddyServicesQuery=this._queryBuddyServices()),await this._buddyServicesQuery,await this._tryCreateWebSocket(e);const{filter:s,outFields:i}=this._config;this.destroyed||this._setFilter(s,i)}_onMessage(t){if("attributes"in t){let e;try{e=this._enrich(t),null!=this._featureZScaler&&this._featureZScaler(e.geometry)}catch(t){return void o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to parse message",t))}this.onFeature(e)}else this.onMessage(t)}async _fetchServiceDefinition(t){const e={f:"json",...this._config.customParameters},s=(0,r.A)(t.path,{query:e,responseType:"json"}),i=(await s).data;return this._serviceDefinition=i,i}_fetchWebSocketUrl(t,e){const s=t[0],{urls:i,token:r}=s,n=this._inferWebSocketBaseUrl(i);return(0,h.a6)(`${n}/subscribe`,{outSR:""+e.wkid,token:r})}_inferWebSocketBaseUrl(t){if(1===t.length)return t[0];for(const e of t)if(e.includes("wss"))return e;return o.A.getLogger(this).error(new n.A("geoevent-connection","Unable to infer WebSocket url",t)),null}async _setFilter(t,e){const s=this._websocket;if(null==s||null==t&&null==e)return;const i=JSON.stringify({filter:this._serializeFilter(t,e)});let r=!1;const h=(0,a.Tw)();return s.onmessage=t=>{const e=JSON.parse(t.data);e.filter&&(e.error&&(o.A.getLogger(this).error(new n.A("geoevent-connection","Failed to set service filter",e.error)),this._set("errorString",`Could not set service filter - ${e.error}`),h.reject(e.error)),this._setWebSocketJSONParseHandler(s),r=!0,h.resolve())},s.send(i),setTimeout(()=>{r||(this.destroyed||this._websocket!==s||o.A.getLogger(this).error(new n.A("geoevent-connection","Server timed out when setting filter")),h.reject())},1e4),h.promise}_serializeFilter(t,e){const s={};if(null==t&&null==e)return s;if(t?.geometry)try{const e=(0,u.rS)(t.geometry);if("extent"!==e.type)throw new n.A("geoevent-connection",`Expected extent but found type ${e.type}`);s.geometry=JSON.stringify(e.shiftCentralMeridian())}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when setting connection geometryDefinition",t))}return t?.where&&"1 = 1"!==t.where&&"1=1"!==t.where&&(s.where=t.where),null!=e&&(s.outFields=e.join(",")),s}_enrich(t){if(!this._relatedFeatures)return t;const e=this._serviceDefinition.relatedFeatures.joinField,s=t.attributes[e],i=this._relatedFeatures.get(s);if(!i)return o.A.getLogger(this).warn("geoevent-connection","Feature join failed. Is the join field configured correctly?",t),t;const{attributes:r,geometry:a}=i;for(const e in r)t.attributes[e]=r[e];return a&&(t.geometry=a),t.geometry||t.centroid||o.A.getLogger(this).error(new n.A("geoevent-connection","Found malformed feature - no geometry found",t)),t}async _queryBuddyServices(){try{const{relatedFeatures:t,keepLatestArchive:e}=this._serviceDefinition,s=this._queryRelatedFeatures(t),i=this._queryArchive(e);await s;const r=await i;if(!r)return;for(const t of r.features)this.onFeature(this._enrich(t))}catch(t){o.A.getLogger(this).error(new n.A("geoevent-connection","Encountered an error when querying buddy services",{error:t}))}}async _queryRelatedFeatures(t){if(!t)return;const e=await this._queryBuddy(t.featuresUrl);this._addRelatedFeatures(e)}async _queryArchive(t){if(t)return this._queryBuddy(t.featuresUrl)}async _queryBuddy(t){const e=new((await Promise.all([s.e(7330),s.e(3508),s.e(6554),s.e(2869),s.e(3910),s.e(4903),s.e(1214),s.e(9953),s.e(8399),s.e(1017),s.e(957),s.e(8506),s.e(8654),s.e(812),s.e(655),s.e(2561)]).then(s.bind(s,68654))).default)({url:t}),{capabilities:i}=await e.load(),r=i.query.supportsMaxRecordCountFactor,n=i.query.supportsPagination,o=i.query.supportsCentroid,a=this._config.maxRecordCountFactor,h=e.capabilities.query.maxRecordCount,c=r?h*a:h,u=new y.A;if(u.outFields=this._config.outFields??["*"],u.where=this._config.filter?.where??"1=1",u.returnGeometry=!0,u.returnExceededLimitFeatures=!0,u.outSpatialReference=l.A.fromJSON(this._config.spatialReference),o&&(u.returnCentroid=!0),r&&(u.maxRecordCountFactor=a),n)return u.num=c,e.destroy(),this._queryPages(t,u);const d=await(0,g.eW)(t,u,this._config.sourceSpatialReference);return e.destroy(),d.data}async _queryPages(t,e,s=[],i=0){e.start=null!=e.num?i*e.num:null;const{data:r}=await(0,g.eW)(t,e,this._config.sourceSpatialReference);return r.exceededTransferLimit&&i<(this._config.maxQueryDepth??0)?(r.features.forEach(t=>s.push(t)),this._queryPages(t,e,s,i+1)):(s.forEach(t=>r.features.push(t)),r)}_addRelatedFeatures(t){const e=new Map,s=t.features,i=this._serviceDefinition.relatedFeatures.joinField;for(const t of s){const s=t.attributes[i];e.set(s,t)}this._relatedFeatures=e}};b=(0,i.Cg)([(0,c.$)("esri.layers.graphics.sources.connections.GeoEventConnection")],b);let w=class extends f{constructor(t){super({}),this.connectionStatus="connected",this.errorString=null;const{geometryType:e,spatialReference:s,sourceSpatialReference:i}=t;this._featureZScaler=(0,p.N)(e,i,s)}normalizeCtorArgs(){return{}}updateCustomParameters(t){}sendMessageToSocket(t){}sendMessageToClient(t){if("type"in t)switch(t.type){case"features":case"featureResult":for(const e of t.features)null!=this._featureZScaler&&this._featureZScaler(e.geometry),this.onFeature(e)}this.onMessage(t)}};function v(t,e){if(null==t&&null==e)return null;const s={};return null!=e&&(s.geometry=e),null!=t&&(s.where=t),s}function S(t,e,s,i,r,n,o,a,h){const c={source:t,sourceSpatialReference:e,spatialReference:s,geometryType:i,filter:v(r,n),maxReconnectionAttempts:o,maxReconnectionInterval:a,customParameters:h};return t?t.path.startsWith("wss://")||t.path.startsWith("ws://")?new m(c):new b(c):new w(c)}(0,i.Cg)([(0,d.MZ)()],w.prototype,"connectionStatus",void 0),(0,i.Cg)([(0,d.MZ)()],w.prototype,"errorString",void 0),w=(0,i.Cg)([(0,c.$)("esri.layers.support.ClientSideConnection")],w)},32730:(t,e,s)=>{s.d(e,{BI:()=>m,D3:()=>_,XJ:()=>f,lc:()=>p,mX:()=>y,rU:()=>g,tH:()=>S});var i=s(799);const r="__begin__",n="__end__",o=new RegExp(r,"ig"),a=new RegExp(n,"ig"),h=new RegExp("^"+r,"i"),c=new RegExp(n+"$","i"),l='"',u=l+" + ",d=" + "+l;function p(t){return t.replaceAll(new RegExp("\\[","g"),"{").replaceAll(new RegExp("\\]","g"),"}")}function _(t){return t.replaceAll(new RegExp("\\{","g"),"[").replaceAll(new RegExp("\\}","g"),"]")}function f(t){const e={expression:"",type:"none"};return t.labelExpressionInfo?t.labelExpressionInfo.value?(e.expression=t.labelExpressionInfo.value,e.type="conventional"):t.labelExpressionInfo.expression&&(e.expression=t.labelExpressionInfo.expression,e.type="arcade"):null!=t.labelExpression&&(e.expression=p(t.labelExpression),e.type="conventional"),e}function m(t){const e=f(t);if(!e)return null;switch(e.type){case"conventional":return y(e.expression);case"arcade":return e.expression}return null}function g(t){const e=f(t);if(!e)return null;switch(e.type){case"conventional":return function(t){const e=t?.match(x);return e?.[1].trim()||null}(e.expression);case"arcade":return S(e.expression)}return null}function y(t){let e;return t?(e=(0,i.HC)(t,t=>r+'$feature["'+t+'"]'+n),e=h.test(e)?e.replace(h,""):l+e,e=c.test(e)?e.replace(c,""):e+l,e=e.replaceAll(o,u).replaceAll(a,d)):e='""',e}const x=/^\s*\{([^}]+)\}\s*$/i,b=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*$/i,w=/^\s*(?:(?:\$feature\.(\w+))|(?:\$feature\[(["'])(.+)(\2)\]));?\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(\1|\3)(\5)\s*\));?\s*$/i,v=/^\s*(?:DomainName\(\s*\$feature\s*,\s*(["'])(.+)(\1)\s*\));?\s*$/i;function S(t){if(!t)return null;let e=b.exec(t)||w.exec(t);return e?e[1]||e[3]:(e=v.exec(t),e?e[2]:null)}},41560:(t,e,s)=>{s.d(e,{Ch:()=>o,mW:()=>n});var i=s(34727),r=s(39516);function n(t,e){return{...e,filterMode:t.mode}}function o(t,e,s){const n=function(t){if("manual"===c(t))return null;const e=[Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY];for(const{minScale:s,maxScale:i}of t.filters)e[0]=Math.max(e[0],l(s)),e[1]=Math.min(e[1],u(i));return e}(t);if(n&&((0,i.gg)(e,n[0])||(0,i.ZH)(s,n[1])))return"";const o=Array.from(a(t,e,s)),h=function(t,e,s){if(0===t.length)return!0;const r=l(t.at(0)?.minScale),n=u(t.at(-1)?.maxScale);if((0,i.ZH)(r,e)||(0,i.gg)(n,s))return!0;for(let e=0;e<t.length-1;e++){const s=t[e],r=t[e+1];if((0,i.ZH)(l(r.minScale),u(s.maxScale)))return!0}return!1}(o,e,s)?"1=1":o.map(t=>t.where||"1=1").reduce((t,e)=>(0,r.IW)(t,e),"");return h&&"1=1"!==h?h:""}function*a(t,e,s){if("manual"===c(t)){const e=t.filters.find(e=>e.id===t.activeFilterId);e&&(yield e)}else{"object"==typeof e&&(e=e.scale);for(const i of t.filters)h(i.minScale,i.maxScale,e,s)&&(yield i)}}function h(t,e,s,r){return t=l(t),s=l(s),e=u(e),!(!(0,i.Sp)(s,t)&&(r??s)>t||(0,i.Hx)(e,s)||void 0!==r&&(0,i.Sp)(r,t))}function c(t){return"mode"in t?t.mode:t.filterMode}function l(t){return t||Number.POSITIVE_INFINITY}function u(t){return t||0}},44159:(t,e,s)=>{s.d(e,{A:()=>r});var i=s(93687);class r{static{this.pool=new i.A(()=>new r(""),null,null,25,50)}static getId(t,e,s,i){return"object"==typeof t?`${t.level}/${t.row}/${t.col}/${t.world}`:`${t}/${e}/${s}/${i}`}constructor(t,e,s,i){this.set(t,e,s,i)}get key(){return this}get id(){return this.toString()}get normalizedId(){return`${this.level}/${this.row}/${this.col}`}set id(t){this.set(t)}get hash(){const t=4095&this.row,e=4095&this.col,s=63&this.level;return(3&this.world)<<30|e<<22|t<<8|s}acquire(t,e,s,i){this.set(t,e,s,i)}contains(t){const e=t.level-this.level;return e>=0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}containsChild(t){const e=t.level-this.level;return e>0&&this.row===t.row>>e&&this.col===t.col>>e&&this.world===t.world}equals(t){return this.level===t.level&&this.row===t.row&&this.col===t.col&&this.world===t.world}clone(){return new r(this)}release(){this.level=0,this.row=0,this.col=0,this.world=0}set(t,e,s,i){if(null==t)this.level=0,this.row=0,this.col=0,this.world=0;else if("object"==typeof t)this.level=t.level||0,this.row=t.row||0,this.col=t.col||0,this.world=t.world||0;else if("string"==typeof t){const[e,s,i,r]=t.split("/");this.level=parseFloat(e),this.row=parseFloat(s),this.col=parseFloat(i),this.world=parseFloat(r)}else this.level=+t,this.row=+e,this.col=+s,this.world=+i||0;return this}toString(){return`${this.level}/${this.row}/${this.col}/${this.world}`}getParentKey(){return this.level<=0?null:new r(this.level-1,this.row>>1,this.col>>1,this.world)}getNormalizedNeighbor(t,e,s){const i=this.clone();return i.col+=t,i.row+=e,s.normalizeKey(i),i}getChildKeys(){const t=this.level+1,e=this.row<<1,s=this.col<<1,i=this.world;return[new r(t,e,s,i),new r(t,e,s+1,i),new r(t,e+1,s,i),new r(t,e+1,s+1,i)]}compareRowMajor(t){return this.row<t.row?-1:this.row>t.row?1:this.col<t.col?-1:this.col>t.col?1:0}}},46140:(t,e,s)=>{s.d(e,{R:()=>r});var i=s(49186);let r=class t{constructor(t,e,s=""){this.major=t,this.minor=e,this._context=s}lessThan(t,e){return this.major<t||t===this.major&&this.minor<e}greaterEqual(t,e){return!this.lessThan(t,e)}validate(t){if(this.major!==t.major){const e=this._context&&this._context+":",s=this._context&&this._context+" ";throw new i.A(e+"unsupported-version",`Required major ${s}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:t})}}clone(){return new t(this.major,this.minor,this._context)}static parse(e,s=""){const[r,n]=e.split("."),o=/^\s*\d+\s*$/;if(!r?.match||!o.test(r))throw new i.A((s&&s+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!n?.match||!o.test(n))throw new i.A((s&&s+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),h=parseInt(n,10);return new t(a,h,s)}}},55674:(t,e,s)=>{s.d(e,{Ad:()=>p,Gj:()=>m,QY:()=>d,lL:()=>g,xR:()=>_});var i=s(66131),r=s(49186),n=(s(44208),s(44729)),o=s(15032),a=s(65864),h=s(95466),c=s(43668),l=s(98623);const u=["geometry","scale","timeProperties"];function d(t,e){if(null!=e)for(const s of u)e.hasArcadeDependency(s)&&t.add(s);return t}function p(t,e){return f.create(t,e,null,["$feature","$view"])}function _(t,e,s){return f.create(t,e,s,["$feature","$view","$config"])}class f{static async create(t,e,s,i){const{arcade:n,Dictionary:o}=await(0,c.l)();let a;try{a=n.parseScript(t)}catch(e){throw new r.A("arcade-bad-expression","Failed to parse arcade script",{script:t,error:e})}const h=n.scriptUsesGeometryEngine(a);h&&await n.enableGeometrySupport(),await n.loadDependentModules(new Set,a,null,!1,h);const l={vars:i.reduce((t,e)=>({...t,[e]:null}),{}),spatialReference:e,useAsync:!1},u=n.compileScript(a,l);let d=null;null!=s&&(d=new o(s),d.immutable=!0);const p=new o;return p.immutable=!1,p.setField("scale",0),new f(t,n,a,u,e,p,d,o)}constructor(t,e,s,i,r,n,o,a){this.script=t,this._arcade=e,this._syntaxTree=s,this._compiled=i,this._spatialReference=r,this._viewDict=n,this._configDict=o,this._dictionaryCtor=a,this._dependencies=new Map,this._featureReader=new m,this._dependencies.set("geometry",e.scriptTouchesGeometry(this._syntaxTree)),this._dependencies.set("scale",this._arcade.referencesMember(this._syntaxTree,"scale")),this._dependencies.set("timeProperties",this._arcade.scriptUsesViewProperties(this._syntaxTree,["timeProperties"]))}evaluate(t,e){const s=e.$view?.timeZone;if(e.$view){let t;if(this._viewDict.setField("scale",e.$view.scale),null!=e.$view.timeProperties){const{currentStart:r,currentEnd:n}=e.$view.timeProperties;t=new this._dictionaryCtor({currentStart:null!=r?null!=s?i.lY.epochToArcadeDate(r,s):i.lY.unknownEpochToArcadeDate(r):void 0,currentEnd:null!=n?null!=s?i.lY.epochToArcadeDate(n,s):i.lY.unknownEpochToArcadeDate(n):void 0,startIncluded:!0,endIncluded:!0})}this._viewDict.setField("timeProperties",t)}return this._compiled({vars:{$view:this._viewDict,$config:this._configDict,$feature:t},spatialReference:this._spatialReference,timeZone:s})}repurposeFeature(t,e){return this._featureReader.bind(t,e,this._spatialReference),this._featureReader}references(t){return this._dependencies.get(t)??!1}}class m{constructor(){this._boundTarget=null,this._boundSchema={fields:null,fieldsIndex:null,spatialReference:null,get geometryType(){return null},get objectIdField(){return null}},this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}bind(t,e,s){const i=e??new h.A(g(t.attributes));this._boundTarget=t,this._boundSchema.fields=i.fields,this._boundSchema.fieldsIndex=i,this._boundSchema.spatialReference=s}_getField(t){return this._boundSchema.fieldsIndex.get(t)}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(t){this._contextTimeZone=t}readArcadeFeature(){return this}hasField(t){return this._boundSchema.fieldsIndex.has(t)}geometry(){if("fromJSON"in this._boundTarget)return this._boundTarget.geometry;const t=(0,a.rS)(this._boundTarget.geometry);if(t){if(!this._boundSchema.spatialReference)throw new Error("InternalError: Expected spatial reference to be defined");t.spatialReference=this._boundSchema.spatialReference}return t}_hasGeometry(){return null!=this._boundTarget.geometry}isUnknownDateTimeField(t){return this._boundSchema.fieldsIndex.getTimeZone(t)===l.L5}field(t,e=!0){const s=this._getField(t);if(s){const e=this._boundTarget.attributes[s.name];if(null==e)return null;switch(s.type){case"date-only":case"esriFieldTypeDateOnly":return n.n.fromReader(e);case"time-only":case"esriFieldTypeTimeOnly":return o.k.fromReader(e);case"esriFieldTypeTimestampOffset":case"timestamp-offset":return i.lY.fromReaderAsTimeStampOffset(e);case"date":case"esriFieldTypeDate":return this.isUnknownDateTimeField(t)?i.lY.unknownEpochToArcadeDate(e):i.lY.epochToArcadeDate(e,this.contextTimeZone??l.qU);default:return e}}if(e)throw new Error(`Field ${t} does not exist`);return null}setField(t,e){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this._boundSchema.fieldsIndex.fields.map(t=>t.name)}isEmpty(){return this._boundSchema.fields.length<=0&&!this._hasGeometry()}castToText(t=!1){return JSON.stringify(this._boundTarget)}gdbVersion(){return null}fullSchema(){return this._boundSchema}castAsJson(t=null){return{attributes:this._boundTarget.attributes,geometry:!0===t?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(t=null,e=null){return Promise.resolve(this.castAsJson(e))}}function g(t){const e=[];for(const s in t)e.push({name:s,alias:s,type:"string"==typeof t[s]?"esriFieldTypeString":"esriFieldTypeDouble"});return e}},63907:(t,e,s)=>{s.d(e,{$0:()=>u,CQ:()=>m,Fq:()=>_,H0:()=>n,SB:()=>h,WR:()=>i,XN:()=>o,iE:()=>a,ld:()=>c,nI:()=>f,pe:()=>r,r6:()=>d,vt:()=>l,yI:()=>p});const i={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},r={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,HALF_FLOAT:5131},n={RGBA4:32854,R16F:33325,RG16F:33327,RGB32F:34837,RGBA16F:34842,R32F:33326,RG32F:33328,RGBA32F:34836,R11F_G11F_B10F:35898,RGB8:32849,RGBA8:32856,RGB5_A1:32855,R8:33321,RG8:33323,R8I:33329,R8UI:33330,R16I:33331,R16UI:33332,R32I:33333,R32UI:33334,RG8I:33335,RG8UI:33336,RG16I:33337,RG16UI:33338,RG32I:33339,RG32UI:33340,RGB16F:34843,RGB9_E5:35901,SRGB8:35905,SRGB8_ALPHA8:35907,RGB565:36194,RGBA32UI:36208,RGB32UI:36209,RGBA16UI:36214,RGB16UI:36215,RGBA8UI:36220,RGB8UI:36221,RGBA32I:36226,RGB32I:36227,RGBA16I:36232,RGB16I:36233,RGBA8I:36238,RGB8I:36239,R8_SNORM:36756,RG8_SNORM:36757,RGB8_SNORM:36758,RGBA8_SNORM:36759,RGB10_A2:32857,RGB10_A2UI:36975},o=Object.values(n),a={DEPTH24_STENCIL8:35056,DEPTH32F_STENCIL8:36013},h={DEPTH_COMPONENT16:33189,DEPTH_COMPONENT24:33190,DEPTH_COMPONENT32F:36012},c={FLOAT:r.FLOAT,UNSIGNED_BYTE:r.UNSIGNED_BYTE,UNSIGNED_INT_24_8:34042,UNSIGNED_SHORT_4_4_4_4:32819,UNSIGNED_SHORT_5_5_5_1:32820,UNSIGNED_SHORT_5_6_5:33635,BYTE:r.BYTE,UNSIGNED_SHORT:r.UNSIGNED_SHORT,SHORT:r.SHORT,UNSIGNED_INT:r.UNSIGNED_INT,INT:r.INT,HALF_FLOAT:5131,UNSIGNED_INT_2_10_10_10_REV:33640,UNSIGNED_INT_10F_11F_11F_REV:35899,UNSIGNED_INT_5_9_9_9_REV:35902,FLOAT_32_UNSIGNED_INT_24_8_REV:36269},l={Texture:0,TileTexture:1,BufferObject:2,VertexArrayObject:3,Shader:4,Program:5,FramebufferObject:6,Renderbuffer:7,TransformFeedback:8,Sync:9,UNCOUNTED:10,LinesOfCode:10,Uniform:11,COUNT:12},u=0,d=36064,p=36065,_=36066,f=33306,m={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_SRGB8_ETC2:37493,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37494,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37495,COMPRESSED_RGBA8_ETC2_EAC:37496,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37497}},67482:(t,e,s)=>{function i(t){return null!=a(t)||null!=o(t)}function r(t){return h.test(t)}function n(t){return a(t)??o(t)}function o(t){const e=new Date(t);return function(t,e){if(Number.isNaN(t.getTime()))return!1;let s=!0;if(l&&/\d+\W*$/.test(e)){const t=e.match(/[a-zA-Z]{2,}/);if(t){let e=!1,i=0;for(;!e&&i<=t.length;)e=!c.test(t[i]),i++;s=!e}}return s}(e,t)?Number.isNaN(e.getTime())?null:e.getTime()-6e4*e.getTimezoneOffset():null}function a(t){const e=h.exec(t);if(!e?.groups)return null;const s=e.groups,i=+s.year,r=+s.month-1,n=+s.day,o=+(s.hours??"0"),a=+(s.minutes??"0"),c=+(s.seconds??"0");if(o>23)return null;if(a>59)return null;if(c>59)return null;const l=s.ms??"0",u=l?+l.padEnd(3,"0").slice(0,3):0;let d;if(s.isUTC||!s.offsetSign)d=Date.UTC(i,r,n,o,a,c,u);else{const t=+s.offsetHours,e=+s.offsetMinutes;d=6e4*("+"===s.offsetSign?-1:1)*(60*t+e)+Date.UTC(i,r,n,o,a,c,u)}return Number.isNaN(d)?null:d}s.d(e,{Br:()=>r,Cq:()=>i,_U:()=>n});const h=/^(?:(?<year>-?\d{4,})-(?<month>\d{2})-(?<day>\d{2}))(?:T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<ms>\d+))?)?(?:(?<isUTC>Z)|(?:(?<offsetSign>\+|-)(?<offsetHours>\d{2}):(?<offsetMinutes>\d{2})))?$/,c=/^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i,l=!Number.isNaN(new Date("technology 10").getTime())},72457:(t,e,s)=>{s.d(e,{h:()=>n,k:()=>r});const i=new FinalizationRegistry(t=>{t.close()});function r(t,e){i.register(t,e,e)}function n(t){i.unregister(t)}},72691:(t,e,s)=>{s.d(e,{Aw:()=>o,DN:()=>i,EA:()=>n,Gm:()=>r,xq:()=>a});const i="__esri_stream_id__",r="__esri_timestamp__",n="__esri_track_part__",o="__esri_time_received__",a="__esri_track_line__"},73681:(t,e,s)=>{s.d(e,{n:()=>h});var i=s(49186),r=s(53966),n=s(46140),o=s(95466),a=s(55674);class h{static async from(t,e,s){const o=t.dictionary_version?n.R.parse(t.dictionary_version):null,l=new Set(t.itemsNames),u={};if(e)for(const t in e)u[t]=e[t];if(t.authoringInfo.configuration)for(const e of t.authoringInfo.configuration)u.hasOwnProperty(e.name)||(u[e.name]=e.value);const d=new Set(t.authoringInfo.symbol);for(const t of Object.keys(s))d.delete(t);d.size&&r.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("missing-fields: fieldMap entries for the following symbol fields are missing",{symbolFields:d});const p=await(0,a.xR)(t.expression,null,u);if(!p)throw new i.A("dictionary-renderer:expression-error","Unable to create dictionary renderer expression");const _=!o||!o.greaterEqual(4,0);_&&r.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("Dictionary script does not support native field types. Applying fallback",{version:o});const f=new c(s,_);return new h(_,l,p,f)}constructor(t,e,s,i){this._requiresFieldCoercionToString=t,this._itemNames=e,this._compiled=s,this._reader=i}get itemNames(){return this._itemNames}evaluate(t,e,s,i){try{return this._reader.bind(t,s,i),this._compiled.evaluate(this._reader,{$view:{scale:e}})}catch(t){r.A.getLogger("esri.renderers.support.DictionaryScriptEvaluator").warnOnce("arcade: dictionary script evaluation failed",{error:t})}return null}createDictionaryFieldsIndex(t){if(!this._requiresFieldCoercionToString)return new o.A(t);const e=t.map(t=>({...t,type:"esriFieldTypeString"}));return new o.A(e)}}class c extends a.Gj{constructor(t,e){super(),this._fieldMap=t,this._requiresFieldCoercionToString=e}_getField(t){const e=this._fieldMap[t]??t;return this._boundSchema.fieldsIndex.get(e)}field(t){if(!this._requiresFieldCoercionToString)return super.field(t,!1);const e=this._getField(t);return null==e||null==this._boundTarget.attributes[e.name]?"":""+this._boundTarget.attributes[e.name]}}},75321:(t,e,s)=>{s.d(e,{GA:()=>T,GL:()=>S,I:()=>A,J0:()=>k,Ki:()=>M,Px:()=>P,QE:()=>v,bV:()=>I,bW:()=>C,vJ:()=>w});var i=s(78888),r=s(49186),n=s(53966),o=s(84952),a=s(16930),h=s(21325),c=s(28735),l=s(90708),u=s(58512),d=s(85113),p=s(64714),_=s(82832),f=s(95466),m=s(98453),g=s(98623);const y=()=>n.A.getLogger("esri.layers.ogc.ogcFeatureUtils"),x="startindex",b=new Set([x,"offset"]),w="http://www.opengis.net/def/crs/",v=`${w}OGC/1.3/CRS84`;async function S(t,e,s={},n=5){const{links:a}=t,h=O(a,"items","application/geo+json")||O(a,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(null==h)throw new r.A("ogc-feature-layer:missing-items-page","Missing items url");const{apiKey:c,customParameters:l,signal:u}=s,_=(0,o.s2)(h.href,t.landingPage.url),b={limit:n,...l,token:c},w=(0,o.a6)(_,b),{data:v}=await(0,i.A)(w,{signal:u,headers:{accept:"application/geo+json"}}),S=L(w,n,v.links)??x;(0,d.sO)(v);const I=(0,d.BM)(v,{geometryType:e.geometryType}),P=e.fields||I.fields||[],M=null!=e.hasZ?e.hasZ:I.hasZ,T=I.geometryType,k=e.objectIdField||I.objectIdFieldName||"OBJECTID";let C=e.timeInfo;const A=P.find(({name:t})=>t===k);if(A)A.editable=!1,A.nullable=!1;else{if(!I.objectIdFieldType)throw new r.A("ogc-feature-layer:missing-feature-id","Collection geojson require a feature id as a unique identifier");P.unshift({name:k,alias:k,type:"number"===I.objectIdFieldType?"esriFieldTypeOID":"esriFieldTypeString",editable:!1,nullable:!1})}if(k!==I.objectIdFieldName){const t=P.find(({name:t})=>t===I.objectIdFieldName);t&&(t.type="esriFieldTypeInteger")}P===I.fields&&I.unknownFields.length>0&&y().warn({name:"ogc-feature-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:I.unknownFields}});for(const t of P){if(null==t.name&&(t.name=t.alias),null==t.alias&&(t.alias=t.name),"esriFieldTypeOID"!==t.type&&"esriFieldTypeGlobalID"!==t.type&&(t.editable=null==t.editable||!!t.editable,t.nullable=null==t.nullable||!!t.nullable),!t.name)throw new r.A("ogc-feature-layer:invalid-field-name","field name is missing",{field:t});if(!m.m.jsonValues.includes(t.type))throw new r.A("ogc-feature-layer:invalid-field-type",`invalid type for field "${t.name}"`,{field:t})}if(C){const t=new f.A(P);if(C.startTimeField){const e=t.get(C.startTimeField);e?(C.startTimeField=e.name,e.type="esriFieldTypeDate"):C.startTimeField=null}if(C.endTimeField){const e=t.get(C.endTimeField);e?(C.endTimeField=e.name,e.type="esriFieldTypeDate"):C.endTimeField=null}if(C.trackIdField){const e=t.get(C.trackIdField);e?C.trackIdField=e.name:(C.trackIdField=null,y().warn({name:"ogc-feature-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:C}}))}C.timeReference||={timeZoneIANA:g.n$},C.startTimeField||C.endTimeField||(y().warn({name:"ogc-feature-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:C}}),C=void 0)}return{drawingInfo:T?(0,p.F0)(T):null,extent:R(t),geometryType:T,fields:P,hasZ:!!M,objectIdField:k,paginationParameter:S,timeInfo:C}}async function I(t,e={}){const{links:s,url:n}=t,a=O(s,"data","application/json")||O(s,"http://www.opengis.net/def/rel/ogc/1.0/data","application/json");if(null==a)throw new r.A("ogc-feature-layer:missing-collections-page","Missing collections url");const{apiKey:h,customParameters:c,signal:l}=e,u=(0,o.s2)(a.href,n),{data:d}=await(0,i.A)(u,{signal:l,headers:{accept:"application/json"},query:{...c,token:h}});for(const e of d.collections)e.landingPage=t;return d}async function P(t,e={}){const{links:s,url:n}=t,a=O(s,"conformance","application/json")||O(s,"http://www.opengis.net/def/rel/ogc/1.0/conformance","application/json");if(null==a)throw new r.A("ogc-feature-layer:missing-conformance-page","Missing conformance url");const{apiKey:h,customParameters:c,signal:l}=e,u=(0,o.s2)(a.href,n),{data:d}=await(0,i.A)(u,{signal:l,headers:{accept:"application/json"},query:{...c,token:h}});return d}async function M(t,e={}){const{apiKey:s,customParameters:r,signal:n}=e,{data:o}=await(0,i.A)(t,{signal:n,headers:{accept:"application/json"},query:{...r,token:s}});return o.url=t,o}async function T(t,e={}){const{links:s,url:r}=t,n=O(s,"service-desc","application/vnd.oai.openapi+json;version=3.0");if(null==n)return y().warn("ogc-feature-layer:missing-openapi-page","The OGC API-Features server does not have an OpenAPI page."),null;const{apiKey:a,customParameters:h,signal:c}=e,l=(0,o.s2)(n.href,r),{data:u}=await(0,i.A)(l,{signal:c,headers:{accept:"application/vnd.oai.openapi+json;version=3.0"},query:{...h,token:a}});return u}function k(t){const e=/^http:\/\/www\.opengis.net\/def\/crs\/(?<authority>.*)\/(?<version>.*)\/(?<code>.*)$/i.exec(t),s=e?.groups;if(!s)return null;const{authority:i,code:r}=s;switch(i.toLowerCase()){case"ogc":switch(r.toLowerCase()){case"crs27":return a.A.GCS_NAD_1927.wkid;case"crs83":return 4269;case"crs84":case"crs84h":return a.A.WGS84.wkid;default:return null}case"esri":case"epsg":{const t=Number.parseInt(r,10);return Number.isNaN(t)?null:t}default:return null}}async function C(t,e,s){const i=await A(t,e,s);return(0,l.ZF)(i)}async function A(t,e,s){const{collection:{links:n,landingPage:{url:p}},layerDefinition:m,maxRecordCount:g,queryParameters:{apiKey:y,customParameters:x},spatialReference:b,supportedCrs:w}=t,v=O(n,"items","application/geo+json")||O(n,"http://www.opengis.net/def/rel/ogc/1.0/items","application/geo+json");if(null==v)throw new r.A("ogc-feature-layer:missing-items-page","Missing items url");const{geometry:S,num:I,start:P,timeExtent:M,where:T}=e;if(e.objectIds)throw new r.A("ogc-feature-layer:query-by-objectids-not-supported","Queries with object ids are not supported");const k=a.A.fromJSON(b),C=e.outSpatialReference??k,A=C.isWGS84?null:F(C,w),E=z(S,w),R=function(t){if(null==t)return null;const{start:e,end:s}=t;return`${null!=e?e.toISOString():".."}/${null!=s?s.toISOString():".."}`}(M),L=null!=($=T)&&$&&"1=1"!==$?$:null,D=I??(null==P?g:10),G=0===P?void 0:P,{fields:N,geometryType:B,hasZ:q,objectIdField:U,paginationParameter:W}=m,V=(0,o.s2)(v.href,p),{data:j}=await(0,i.A)(V,{...s,query:{...x,...E,crs:A,datetime:R,query:L,limit:D,[W]:G,token:y},headers:{accept:"application/geo+json"}}),Y=(0,d.bd)(j,{geometryType:B,hasZ:q,objectIdField:U}),H=Y.length===D&&!!O(j.links??[],"next","application/geo+json"),X=new f.A(N);var $;for(const t of Y){const e={};(0,_.MB)(X,e,t.attributes,!0);for(const t of X.fields)t.nullable&&!(t.name in e)&&(e[t.name]=null);e[U]=t.attributes[U],t.attributes=e}if(!A&&C.isWebMercator)for(const t of Y)if(null!=t.geometry&&null!=B){const e=(0,l.zv)(t.geometry,B,q,!1);e.spatialReference=a.A.WGS84,t.geometry=(0,l.Ux)((0,c.Cv)(e,C))}for(const t of Y)t.objectId=t.attributes[U];const Z=A||!A&&C.isWebMercator?C.toJSON():h.KK,Q=new u.A;return Q.exceededTransferLimit=H,Q.features=Y,Q.fields=N,Q.geometryType=B,Q.hasZ=q,Q.spatialReference=Z,Q}function F(t,e){const{isWebMercator:s,wkid:i}=t;if(!i)return null;const r=s?e[3857]??e[102100]??e[102113]??e[900913]:e[t.wkid];return r?`${w}${r}`:null}function E(t){if(null==t)return"";const{xmin:e,ymin:s,xmax:i,ymax:r}=t;return`${e},${s},${i},${r}`}function z(t,e){if(!function(t){return null!=t&&"extent"===t.type}(t))return null;const{spatialReference:s}=t;if(!s||s.isWGS84)return{bbox:E(t)};const i=F(s,e);return null!=i?{bbox:E(t),"bbox-crs":i}:s.isWebMercator?{bbox:E((0,c.Cv)(t,a.A.WGS84))}:null}function R(t){const e=t.extent?.spatial;if(!e)return null;const s=e.bbox[0],i=4===s.length,[r,n]=s,o=i?void 0:s[2];return{xmin:r,ymin:n,xmax:i?s[2]:s[3],ymax:i?s[3]:s[4],zmin:o,zmax:i?void 0:s[5],spatialReference:a.A.WGS84.toJSON()}}function O(t,e,s){return t.find(({rel:t,type:i})=>t===e&&i===s)??t.find(({rel:t,type:s})=>t===e&&!s)}function L(t,e,s){if(!s)return;const i=O(s,"next","application/geo+json"),r=(0,o.An)(i?.href)?.query;if(!r)return;const n=(0,o.An)(t).query,a=Object.keys(n??{}),h=Object.entries(r).filter(([t])=>!a.includes(t)).find(([t,s])=>b.has(t.toLowerCase())&&Number.parseInt(s,10)===e),c=h?.[0];return c}},76061:(t,e,s)=>{s.d(e,{G:()=>i,S:()=>r});class i{*[Symbol.iterator](){let t=this.next();for(;t;)yield t,t=this.next()}}class r extends i{constructor(t){super(),this.m_iGeom=-1,this.m_aGeoms=t?t.slice():[]}next(){if(this.m_iGeom<this.m_aGeoms.length-1){const t=this.m_aGeoms[++this.m_iGeom];return this.m_aGeoms[this.m_iGeom]=null,t}return null}tock(){return!1}getGeometryID(){return this.m_iGeom}getRank(){return 1}}},77085:(t,e,s)=>{s.d(e,{Hh:()=>a,fz:()=>l,g7:()=>h,s1:()=>o,zo:()=>c});var i=s(76061),r=s(83290);let n;function o(){return!!n&&(0,r.i)()}async function a(){if(!o()){const[t,e]=await Promise.all([Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(1088)]).then(s.bind(s,31088)),Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(5756)]).then(s.bind(s,15756)).then(({injectPe:t})=>t),(0,r.l)()]);n=new t.OperatorGeodeticDensifyByLength,e(r.p)}}function h(t,e,s,i){return n.execute(t,e,s,i,null)}function c(t,e,s,r){const o=n.executeMany(new i.S(t),e,s,r,null);return Array.from(o)}function l(){return n.supportsCurves()}},82832:(t,e,s)=>{s.d(e,{$1:()=>m,CR:()=>f,MB:()=>d,PC:()=>g,Yx:()=>h,bP:()=>l});var i=s(67482),r=s(21325),n=s(30524);class o{constructor(t){this.description=t,this.code=null}}class a{constructor(t){this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error=new o(t)}}function h(t){return new a(t)}class c{constructor(t){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=t}}function l(t){return new c(t)}const u=new Set;function d(t,e,s,i=!1){u.clear();for(const r in s){const o=t.get(r);if(!o)continue;const a=p(o,s[r]);if(u.add(o.name),o&&(i||o.editable)){const t=(0,n.CJ)(o,a);if(t)return h((0,n.uo)(t,o,a));e[o.name]=a}}for(const e of t.requiredFields??[])if(!u.has(e.name))return h(`missing required field "${e.name}"`);return null}function p(t,e){let s=e;return(0,n.WA)(t)&&"string"==typeof e?s=parseFloat(e):(0,n.yM)(t)&&null!=e&&"string"!=typeof e?s=String(e):(0,n.vE)(t)&&"string"==typeof e&&(s=(0,i._U)(e)),(0,n.WX)(s)}let _;function f(t,e){if(!t||!(0,r.fn)(e))return t;if("rings"in t||"paths"in t){if(null==_)throw new TypeError("geometry engine not loaded");return _.simplify(e,t)}return t}async function m(t,e){!(0,r.fn)(t)||"esriGeometryPolygon"!==e&&"esriGeometryPolyline"!==e||await async function(){return null==_&&(_=await Promise.all([s.e(3209),s.e(7559)]).then(s.bind(s,47559))),_}()}const g={supportsAutoIntervalBin:!0,supportsFixedIntervalBin:!0,supportsFixedBoundariesBin:!0,supportsDateBin:!0,supportsStackBy:!0,supportsSplitBy:!0,supportsNormalization:!0,supportedStatisticTypes:["COUNT","SUM","AVG","VAR","STDDEV","MIN","MAX","PERCENTILE_CONT","PERCENTILE_DISC","CentroidAggregate","EnvelopeAggregate","ConvexHullAggregate"],supportedNormalizationTypes:["field","log","naturalLog","percentOfTotal","squareRoot"]}},85113:(t,e,s)=>{s.d(e,{BM:()=>P,bd:()=>M,sO:()=>I,xD:()=>u});var i=s(67482),r=s(49186),n=s(21325),o=s(90708),a=s(43334),h=s(92722),c=s(30524);const l={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function u(t){return l[t]}function*d(t){switch(t.type){case"Feature":yield t;break;case"FeatureCollection":for(const e of t.features)e&&(yield e)}}function*p(t){if(t)switch(t.type){case"Point":yield t.coordinates;break;case"LineString":case"MultiPoint":yield*t.coordinates;break;case"MultiLineString":case"Polygon":for(const e of t.coordinates)yield*e;break;case"MultiPolygon":for(const e of t.coordinates)for(const t of e)yield*t}}function _(t){for(const e of t)if(e.length>2)return!0;return!1}function f(t){let e=0;for(let s=0;s<t.length;s++){const i=t[s],r=t[(s+1)%t.length];e+=i[0]*r[1]-r[0]*i[1]}return e<=0}function m(t){const e=t[0],s=t[t.length-1];e[0]===s[0]&&e[1]===s[1]&&e[2]===s[2]||t.push(e)}function g(t,e){const{coordinates:s,type:i}=t,r=e.hasZ??!1,n=!0;switch(i){case"Point":return new h.A([],[...s],r,!1);case"LineString":return(0,o.Ap)({paths:[s],hasZ:n},r,!1);case"MultiLineString":return(0,o.Ap)({paths:s,hasZ:n},r,!1);case"MultiPoint":return(0,o.PR)({points:s,hasZ:n},r,!1);case"Polygon":case"MultiPolygon":{const t=new h.A([],[],r,!1);for(const e of"Polygon"===i?[s]:s){y(t,e[0],r);for(let s=1;s<e.length;s++)x(t,e[s],r)}return t}}}function y(t,e,s){m(e),function(t){return!f(t)}(e)?w(t,e,s):b(t,e,s)}function x(t,e,s){m(e),function(t){return f(t)}(e)?w(t,e,s):b(t,e,s)}function b(t,e,s){for(const i of e)v(t,i,s);t.lengths.push(e.length)}function w(t,e,s){for(let i=e.length-1;i>=0;i--)v(t,e[i],s);t.lengths.push(e.length)}function v(t,[e,s,i],r){t.coords.push(e,s),r&&t.coords.push(i||0)}function S(t){switch(typeof t){case"string":return(0,i.Br)(t)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function I(t,e=4326){if(!t)throw new r.A("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==t.type&&"FeatureCollection"!==t.type)throw new r.A("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:t});const{crs:s}=t;if(!s)return;const i="string"==typeof s?s:"name"===s.type?s.properties.name:"EPSG"===s.type?s.properties.code:null,o=(0,n.oT)({wkid:e})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${e})$`,"i");if(!i||!o.test(i))throw new r.A("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:s})}function P(t,e={}){const s=[],i=new Set,r=new Set;let n,o=!1,a=null,h=!1,{geometryType:l=null}=e;for(const e of d(t)){const{geometry:t,properties:d,id:f}=e;if((!t||(l||(l=u(t.type)),u(t.type)===l))&&(o||(o=_(p(t))),h||(h=null!=f,h&&(n=typeof f,d&&(a=Object.keys(d).filter(t=>d[t]===f)))),d&&a&&h&&null!=f&&(a.length>1?a=a.filter(t=>d[t]===f):1===a.length&&(a=d[a[0]]===f?a:[])),d))for(const t in d){if(i.has(t))continue;const e=S(d[t]);if("unknown"===e){r.add(t);continue}r.delete(t),i.add(t);const n=(0,c.rS)(t);n&&s.push({name:n,alias:t,type:e})}}const f=(0,c.rS)(1===a?.length&&a[0]||null)??void 0;if(f)for(const t of s)if(t.name===f&&(0,c.WA)(t)){t.type="esriFieldTypeOID";break}return{fields:s,geometryType:l,hasZ:o,objectIdFieldName:f,objectIdFieldType:n,unknownFields:Array.from(r)}}function M(t,e){return Array.from(function*(t,e={}){const{geometryType:s,objectIdField:i}=e;for(const r of t){const{geometry:t,properties:n,id:o}=r;if(t&&u(t.type)!==s)continue;const h=n||{};let c;i&&(c=h[i],null==o||c||(h[i]=c=o)),yield new a.Om(t&&g(t,e),h,null,c)}}(d(t),e))}},88340:(t,e,s)=>{function i(){return new Float32Array(2)}function r(t,e){const s=new Float32Array(2);return s[0]=t,s[1]=e,s}function n(){return i()}function o(){return r(1,1)}function a(){return r(1,0)}function h(){return r(0,1)}s.d(e,{Un:()=>l,fA:()=>r,uY:()=>c,vt:()=>i});const c=n(),l=o(),u=a(),d=h();Object.freeze(Object.defineProperty({__proto__:null,ONES:l,UNIT_X:u,UNIT_Y:d,ZEROS:c,clone:function(t){const e=new Float32Array(2);return e[0]=t[0],e[1]=t[1],e},create:i,fromValues:r,ones:o,unitX:a,unitY:h,zeros:n},Symbol.toStringTag,{value:"Module"}))},89056:(t,e,s)=>{s.d(e,{b3:()=>u,jZ:()=>l});var i=s(12195),r=s(19419),n=s(6606),o=s(95108),a=s(65864),h=s(80754),c=s(21325);function l(t){return d(t,!0)}function u(t){return d(t,!1)}function d(t,e){if(null==t)return null;const s=t.spatialReference,r=(0,c.Vp)(s),o=(0,i.W)(t)?t.toJSON():t;if(!r)return o;const l=(0,c.K8)(s)?102100:4326,u=h.j7[l].maxX,d=h.j7[l].minX;if((0,a.fT)(o))return _(o,u,d);if((0,a.U9)(o))return o.points=o.points.map(t=>_(t,u,d)),o;if((0,a.ZC)(o))return p(o,r);if((0,a.Bi)(o)||(0,a.Rg)(o)){const t=(0,n.Rg)(b,o),s={xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]},i=(0,h.kd)(s.xmin,d)*(2*u),r=0===i?o:(0,h.kS)(o,i);return s.xmin+=i,s.xmax+=i,s.xmax>u?y(r,u,e):s.xmin<d?y(r,d,e):r}return o}function p(t,e){if(!e)return t;const s=function(t,e){const s=[],{ymin:i,ymax:r,xmin:n,xmax:o}=t,a=t.xmax-t.xmin,[h,c]=e.valid,{x:l,frameId:u}=f(t.xmin,e),{x:d,frameId:p}=f(t.xmax,e),_=l===d&&a>0;if(a>2*c){const t={xmin:n<o?l:d,ymin:i,xmax:c,ymax:r},e={xmin:h,ymin:i,xmax:n<o?d:l,ymax:r},a={xmin:0,ymin:i,xmax:c,ymax:r},_={xmin:h,ymin:i,xmax:0,ymax:r},f=[],g=[];m(t,a)&&f.push(u),m(t,_)&&g.push(u),m(e,a)&&f.push(p),m(e,_)&&g.push(p);for(let t=u+1;t<p;t++)f.push(t),g.push(t);s.push(new x(t,[u]),new x(e,[p]),new x(a,f),new x(_,g))}else l>d||_?s.push(new x({xmin:l,ymin:i,xmax:c,ymax:r},[u]),new x({xmin:h,ymin:i,xmax:d,ymax:r},[p])):s.push(new x({xmin:l,ymin:i,xmax:d,ymax:r},[u]));return s}(t,e).map(t=>t.extent);return s.length<2?s[0]||t:s.length>2?(t.xmin=e.valid[0],t.xmax=e.valid[1],t):{rings:s.map(t=>[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]])}}function _(t,e,s){if(Array.isArray(t)){const i=t[0];if(i>e){const s=(0,h.kd)(i,e);t[0]=i+s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t[0]=i+e*(-2*s)}}else{const i=t.x;if(i>e){const s=(0,h.kd)(i,e);t.x+=s*(-2*e)}else if(i<s){const e=(0,h.kd)(i,s);t.x+=e*(-2*s)}}return t}function f(t,e){const[s,i]=e.valid,r=2*i;let n,o=0;return t>i?(n=Math.ceil(Math.abs(t-i)/r),t-=n*r,o=n):t<s&&(n=Math.ceil(Math.abs(t-s)/r),t+=n*r,o=-n),{x:t,frameId:o}}function m(t,e){const{xmin:s,ymin:i,xmax:r,ymax:n}=e;return g(t,s,i)&&g(t,s,n)&&g(t,r,n)&&g(t,r,i)}function g(t,e,s){return e>=t.xmin&&e<=t.xmax&&s>=t.ymin&&s<=t.ymax}function y(t,e,s=!0){const i=!(0,a.Rg)(t);if(i&&(0,o.m3)(t),s)return(new w).cut(t,e);const r=i?t.rings:t.paths,n=i?4:2,h=r.length,c=-2*e;for(let t=0;t<h;t++){const e=r[t];if(e&&e.length>=n){const t=[];for(const[s,...i]of e)t.push([s+c,...i]);r.push(t)}}return i?t.rings=r:t.paths=r,t}class x{constructor(t,e){this.extent=t,this.frameIds=e}}const b=(0,r.vt)();class w{constructor(){this._linesIn=[],this._linesOut=[]}cut(t,e){let s;if(this._xCut=e,t.rings)this._closed=!0,s=t.rings,this._minPts=4;else{if(!t.paths)return null;this._closed=!1,s=t.paths,this._minPts=2}for(const t of s){if(!t||t.length<this._minPts)continue;let e=!0;for(const s of t)e?(this.moveTo(s),e=!1):this.lineTo(s);this._closed&&this.close()}this._pushLineIn(),this._pushLineOut(),s=[];for(const t of this._linesIn)t&&t.length>=this._minPts&&s.push(t);const i=-2*this._xCut;for(const t of this._linesOut)if(t&&t.length>=this._minPts){for(const e of t)e[0]+=i;s.push(t)}return this._closed?t.rings=s:t.paths=s,t}moveTo(t){this._pushLineIn(),this._pushLineOut(),this._prevSide=this._side(t[0]),this._moveTo(t[0],t[1],this._prevSide),this._prevPt=t,this._firstPt=t}lineTo(t){const e=this._side(t[0]);if(e*this._prevSide===-1){const s=this._intersect(this._prevPt,t);this._lineTo(this._xCut,s,0),this._prevSide=0,this._lineTo(t[0],t[1],e)}else this._lineTo(t[0],t[1],e);this._prevSide=e,this._prevPt=t}close(){const t=this._firstPt,e=this._prevPt;t[0]===e[0]&&t[1]===e[1]||this.lineTo(t),this._checkClosingPt(this._lineIn),this._checkClosingPt(this._lineOut)}_moveTo(t,e,s){this._closed?(this._lineIn.push([s<=0?t:this._xCut,e]),this._lineOut.push([s>=0?t:this._xCut,e])):(s<=0&&this._lineIn.push([t,e]),s>=0&&this._lineOut.push([t,e]))}_lineTo(t,e,s){this._closed?(v(this._lineIn,s<=0?t:this._xCut,e),v(this._lineOut,s>=0?t:this._xCut,e)):s<0?(0===this._prevSide&&this._pushLineOut(),this._lineIn.push([t,e])):s>0?(0===this._prevSide&&this._pushLineIn(),this._lineOut.push([t,e])):this._prevSide<0?(this._lineIn.push([t,e]),this._lineOut.push([t,e])):this._prevSide>0&&(this._lineOut.push([t,e]),this._lineIn.push([t,e]))}_checkClosingPt(t){const e=t.length;e>3&&t[0][0]===this._xCut&&t[e-2][0]===this._xCut&&t[1][0]===this._xCut&&(t[0][1]=t[e-2][1],t.pop())}_side(t){return t<this._xCut?-1:t>this._xCut?1:0}_intersect(t,e){const s=(this._xCut-t[0])/(e[0]-t[0]);return t[1]+s*(e[1]-t[1])}_pushLineIn(){this._lineIn&&this._lineIn.length>=this._minPts&&this._linesIn.push(this._lineIn),this._lineIn=[]}_pushLineOut(){this._lineOut&&this._lineOut.length>=this._minPts&&this._linesOut.push(this._lineOut),this._lineOut=[]}}function v(t,e,s){const i=t.length;i>1&&t[i-1][0]===e&&t[i-2][0]===e?t[i-1][1]=s:t.push([e,s])}},93117:(t,e,s)=>{s.r(e),s.d(e,{default:()=>vc});var i=s(49186),r=s(36563),n=s(44208),o=s(26390),a=s(74887),h=s(87811),c=s(36708),l=s(90629),u=s(8341),d=s(87045),p=s(76213);class _{constructor(t){this._client=t,this.layerView=this._client.createInvokeProxy(""),this.container=this._client.createInvokeProxy("container"),this._eventLog=this._client.createInvokeProxy("eventLog")}onEvent(t){(0,u.oV)(this._eventLog.onEvent(t))}}var f=s(97768),m=s(93637),g=s(6797),y=s(16930),x=s(21325),b=s(44159);function w(t,e){return[t,e]}function v(t,e,s){return t[0]=e,t[1]=s,t}const S=new b.A("0/0/0/0");class I{static create(t,e,s=null){const i=(0,x.Vp)(t.spatialReference),r=e.origin||w(t.origin.x,t.origin.y),n=w(t.size[0]*e.resolution,t.size[1]*e.resolution),o=w(-1/0,-1/0),a=w(1/0,1/0),h=w(1/0,1/0);null!=s&&(v(o,Math.max(0,Math.floor((s.xmin-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymax)/n[1]))),v(a,Math.max(0,Math.floor((s.xmax-r[0])/n[0])),Math.max(0,Math.floor((r[1]-s.ymin)/n[1]))),v(h,a[0]-o[0]+1,a[1]-o[1]+1));const{cols:c,rows:l}=e;let u,d,p,_;return!s&&c&&l&&(v(o,c[0],l[0]),v(a,c[1],l[1]),v(h,c[1]-c[0]+1,l[1]-l[0]+1)),t.isWrappable?(u=w(Math.ceil(Math.round((i.valid[1]-i.valid[0])/e.resolution)/t.size[0]),h[1]),d=!0,p=i.origin,_=i.valid):(u=h,d=!1),new I(e.level,e.resolution,e.scale,r,o,a,h,n,u,d,p,_)}constructor(t,e,s,i,r,n,o,a,h,c,l,u){this.level=t,this.resolution=e,this.scale=s,this.origin=i,this.first=r,this.last=n,this.size=o,this.norm=a,this.worldSize=h,this.wrap=c,this._spatialReferenceOrigin=l,this._spatialReferenceValid=u}normalizeCol(t){if(!this.wrap)return t;const e=this.worldSize[0];return t<0?e-1-Math.abs((t+1)%e):t%e}normalizeKey(t){if(!this.wrap)return;const e=this.worldSize[0],s=t.col;s<0?(t.col=s+e,t.world-=1):s>=e&&(t.col=s-e,t.world+=1)}denormalizeCol(t,e){return this.wrap?this.worldSize[0]*e+t:t}getWorldForColumn(t){return this.wrap?Math.floor(t/this.worldSize[0]):0}getFirstColumnForWorld(t){return t*this.worldSize[0]+this.first[0]}getLastColumnForWorld(t){return t*this.worldSize[0]+this.first[0]+this.size[0]-1}getColumnForX(t){return(t-this.origin[0])/this.norm[0]}getXForColumn(t){const e=this.origin[0]+t*this.norm[0],s=this._spatialReferenceOrigin,i=this._spatialReferenceValid;return this.wrap&&s&&i?e===s[0]?i[0]:this.origin[0]===s[0]&&t===this.worldSize[0]?i[1]:e:e}getRowForY(t){return(this.origin[1]-t)/this.norm[1]}getYForRow(t){return this.origin[1]-t*this.norm[1]}getTileBounds(t,e,s=!1){S.set(e);const i=s?S.col:this.denormalizeCol(S.col,S.world),r=S.row;return function(t,e,s,i,r){t[0]=e,t[1]=s,t[2]=i,t[3]=r}(t,this.getXForColumn(i),this.getYForRow(r+1),this.getXForColumn(i+1),this.getYForRow(r)),t}getTileCoords(t,e,s=!1){S.set(e);const i=s?S.col:this.denormalizeCol(S.col,S.world);return Array.isArray(t)?v(t,this.getXForColumn(i),this.getYForRow(S.row)):(t.x=this.getXForColumn(i),t.y=this.getYForRow(S.row)),t}}var P=s(93687);class M{constructor(){this.spans=[]}static{this.pool=new P.A(()=>new M)}acquire(t){this.lodInfo=t}release(){this.lodInfo=null,this.spans.length=0}*keys(){const t=this.lodInfo;for(const{row:e,colFrom:s,colTo:i}of this.spans)for(let r=s;r<=i;r++){const s=t.getWorldForColumn(r);yield new b.A(t.level,e,t.normalizeCol(r),s)}}forEach(t,e){const{spans:s,lodInfo:i}=this,{level:r}=i;if(0!==s.length)for(const{row:n,colFrom:o,colTo:a}of s)for(let s=o;s<=a;s++)t.call(e,r,n,i.normalizeCol(s),i.getWorldForColumn(s))}}class T{constructor(t,e,s){this.row=t,this.colFrom=e,this.colTo=s}}const k=new b.A("0/0/0/0");class C{static create(t,e){t[1]>e[1]&&([t,e]=[e,t]);const[s,i]=t,[r,n]=e,o=r-s,a=n-i,h=0!==a?o/a:0,c=(Math.ceil(i)-i)*h,l=(Math.floor(i)-i)*h;return new C(s,Math.floor(i),Math.ceil(n),h,o<0?c:l,o<0?l:c,o<0?r:s,o<0?s:r)}constructor(t,e,s,i,r,n,o,a){this.x=t,this.ymin=e,this.ymax=s,this.invM=i,this.leftAdjust=r,this.rightAdjust=n,this.leftBound=o,this.rightBound=a}incrRow(){this.x+=this.invM}getLeftCol(){return Math.max(this.x+this.leftAdjust,this.leftBound)}getRightCol(){return Math.min(this.x+this.rightAdjust,this.rightBound)}}const A=[[0,0],[0,0],[0,0],[0,0]];class F{constructor(t,e=null,s=t.lods[0].level,i=t.lods[t.lods.length-1].level){this.tileInfo=t,this.fullExtent=e,this.scales=[],this._infoByScale={},this._infoByLevel={};const r=t.lods.filter(t=>t.level>=s&&t.level<=i);this.minScale=r[0].scale,this.maxScale=r[r.length-1].scale;const n=this._lodInfos=r.map(s=>I.create(t,s,e));r.forEach((t,e)=>{this._infoByLevel[t.level]=n[e],this._infoByScale[t.scale]=n[e],this.scales[e]=t.scale},this),this._wrap=t.isWrappable}get spatialReference(){return this.tileInfo.spatialReference}getLODInfoAt(t){return this._infoByLevel["number"==typeof t?t:t.level]}getTileBounds(t,e,s=!1){k.set(e);const i=this._infoByLevel[k.level];return i?i.getTileBounds(t,k,s):t}getTileCoords(t,e,s=!1){k.set(e);const i=this._infoByLevel[k.level];return i?i.getTileCoords(t,k,s):t}getTileCoverage(t,e=192,s=!0,i="closest"){if(!s&&(t.scale>this.minScale||t.scale<this.maxScale))return null;const r="closest"===i?this.getClosestInfoForScale(t.scale):this.getSmallestInfoForScale(t.scale),n=M.pool.acquire(r),o=this._wrap;let a,h,c,l=1/0,u=-1/0;const d=n.spans;A[0][0]=A[0][1]=A[1][1]=A[3][0]=-e,A[1][0]=A[2][0]=t.size[0]+e,A[2][1]=A[3][1]=t.size[1]+e;for(const e of A)t.toMap(e,e),e[0]=r.getColumnForX(e[0]),e[1]=r.getRowForY(e[1]);const p=[];let _=3;for(let t=0;t<4;t++){if(A[t][1]===A[_][1]){_=t;continue}const e=C.create(A[t],A[_]);l=Math.min(e.ymin,l),u=Math.max(e.ymax,u),void 0===p[e.ymin]&&(p[e.ymin]=[]),p[e.ymin].push(e),_=t}if(null==l||null==u||u-l>100)return null;let f=[];for(a=l;a<u;){null!=p[a]&&(f=f.concat(p[a])),h=1/0,c=-1/0;for(let t=f.length-1;t>=0;t--){const e=f[t];h=Math.min(h,e.getLeftCol()),c=Math.max(c,e.getRightCol())}if(h=Math.floor(h),c=Math.floor(c),a>=r.first[1]&&a<=r.last[1])if(o)if(r.size[0]<r.worldSize[0]){const t=Math.floor(c/r.worldSize[0]);for(let e=Math.floor(h/r.worldSize[0]);e<=t;e++)d.push(new T(a,Math.max(r.getFirstColumnForWorld(e),h),Math.min(r.getLastColumnForWorld(e),c)))}else d.push(new T(a,h,c));else h>r.last[0]||c<r.first[0]||(h=Math.max(h,r.first[0]),c=Math.min(c,r.last[0]),d.push(new T(a,h,c)));a+=1;for(let t=f.length-1;t>=0;t--){const e=f[t];e.ymax>=a?e.incrRow():f.splice(t,1)}}return n}getTileParentId(t){k.set(t);const e=this._infoByLevel[k.level],s=this._lodInfos.indexOf(e)-1;return s<0?null:(this._getTileIdAtLOD(k,this._lodInfos[s],k),k.id)}getTileResolution(t){const e=this._infoByLevel["object"==typeof t?t.level:t];return e?e.resolution:-1}getTileScale(t){const e=this._infoByLevel[t.level];return e?e.scale:-1}intersects(t,e){k.set(e);const s=this._infoByLevel[k.level],i=t.lodInfo;if(i.resolution>s.resolution){this._getTileIdAtLOD(k,i,k);const e=i.denormalizeCol(k.col,k.world);for(const s of t.spans)if(s.row===k.row&&s.colFrom<=e&&s.colTo>=e)return!0}if(i.resolution<s.resolution){const[e,r,n,o]=t.spans.reduce((t,e)=>(t[0]=Math.min(t[0],e.row),t[1]=Math.max(t[1],e.row),t[2]=Math.min(t[2],e.colFrom),t[3]=Math.max(t[3],e.colTo),t),[1/0,-1/0,1/0,-1/0]),a=s.denormalizeCol(k.col,k.world),h=i.getColumnForX(s.getXForColumn(a)),c=i.getRowForY(s.getYForRow(k.row)),l=i.getColumnForX(s.getXForColumn(a+1))-1,u=i.getRowForY(s.getYForRow(k.row+1))-1;return!(h>o||l<n||c>r||u<e)}const r=i.denormalizeCol(k.col,k.world);return t.spans.some(t=>t.row===k.row&&t.colFrom<=r&&t.colTo>=r)}normalizeBounds(t,e,s){if(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],this._wrap){const e=(0,x.Vp)(this.tileInfo.spatialReference),i=-s*(e.valid[1]-e.valid[0]);t[0]+=i,t[2]+=i}return t}getSmallestInfoForScale(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t];if(t>e[0])return this._infoByScale[e[0]];for(let s=1;s<e.length-1;s++)if(t>e[s]+1e-6)return this._infoByScale[e[s-1]];return this._infoByScale[e[e.length-1]]}getClosestInfoForScale(t){const e=this.scales;return this._infoByScale[t]||(t=e.reduce((e,s)=>Math.abs(s-t)<Math.abs(e-t)?s:e,e[0])),this._infoByScale[t]}scaleToLevel(t){const e=this.scales;if(this._infoByScale[t])return this._infoByScale[t].level;for(let s=e.length-1;s>=0;s--)if(t<e[s])return s===e.length-1?this._infoByScale[e[e.length-1]].level:this._infoByScale[e[s]].level+(e[s]-t)/(e[s]-e[s+1]);return this._infoByScale[e[0]].level}scaleToZoom(t){return this.tileInfo.scaleToZoom(t)}zoomToScale(t){return this.tileInfo.zoomToScale(t)}_getTileIdAtLOD(t,e,s){const i=this._infoByLevel[s.level];return t.set(s),e.resolution<i.resolution?null:(e.resolution===i.resolution||(t.level=e.level,t.col=Math.floor(s.col*i.resolution/e.resolution+.01),t.row=Math.floor(s.row*i.resolution/e.resolution+.01)),t)}}var E=s(31635),z=s(69622),R=s(91869),O=s(3483),L=s(10107),D=s(53966),G=s(64108),N=s(37585),B=s(9775),q=s(32587),U=s(76030),W=s(44794);class V{constructor(t,e){this.item=t,this.controller=e,this.promise=null}}class j{constructor(t){this._schedule=null,this._task=null,this._deferreds=new q.A,this._controllers=new q.A,this._processingItems=new q.A,this._pausedSignal=(0,W.v)(!1),this.concurrency=1,t.concurrency&&(this.concurrency=t.concurrency),this._queue=new B.A(t.peeker),this.process=t.process;const e=t.scheduler;t.priority&&e&&(this._task=e.registerTask(t.priority,this))}destroy(){this.clear(),this._schedule=(0,f.xt)(this._schedule),this._task=(0,f.xt)(this._task)}get updating(){return!!this._task?.updating||this.readyToRun}get length(){return this._processingItems.size+this._queue.length}abort(t){const e=this._controllers.get(t);e&&e.abort()}clear(){this._queue.clear();const t=[];this._controllers.forEach(e=>t.push(e)),this._controllers.clear(),t.forEach(t=>t.abort()),this._processingItems.clear(),this._cancelNext()}forEach(t){this._deferreds.forEach((e,s)=>t(s))}get(t){const e=this._deferreds.get(t);return e?e.promise:void 0}isOngoing(t){return this._processingItems.has(t)}has(t){return this._deferreds.has(t)}pause(){this._pausedSignal.value||(this._pausedSignal.value=!0,this._cancelNext())}push(t,e){const s=this.get(t);if(s)return s;const i=new AbortController;let r=null;e&&(r=(0,a.u7)(e,()=>i.abort()));const n=()=>{o.remove(),null!=r&&r.remove(),this._removeItem(t),this._queue.remove(t),this._scheduleNext()},o=(0,a.NY)(i.signal,()=>{const e=this._processingItems.get(t);e&&e.controller.abort(),n(),h.reject((0,a.NK)())}),h=(0,a.Tw)();return this._deferreds.set(t,h),this._controllers.set(t,i),h.promise.then(n,n),this._queue.push(t),this._scheduleNext(),h.promise}last(){return this._queue.last()}lastPromise(){const t=this.last();return t?this.get(t):null}peek(){return this._queue.peek()}popLast(){const t=this._queue.popLast();return t&&(this._deferreds.get(t)?.reject((0,a.NK)()),this._removeItem(t)),t}reset(){const t=Array.from(this._processingItems.values());this._processingItems.clear();for(const e of t)this._queue.push(e.item),e.controller.abort();this._scheduleNext()}resume(){this._pausedSignal.value&&(this._pausedSignal.value=!1,this._scheduleNext())}takeAll(){const t=[];for(;this._queue.length;)t.push(this._queue.pop());return this.clear(),t}get readyToRun(){return!this._pausedSignal.value&&this._queue.length>0&&this._processingItems.size<this.concurrency}runTask(t){for(;!t.done&&this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop()),t.madeProgress()}_removeItem(t){this._deferreds.delete(t),this._controllers.delete(t),this._processingItems.delete(t)}_scheduleNext(){this._task||this._pausedSignal.value||this._schedule||(this._schedule=(0,U._)(()=>{this._schedule=null,this._next()}))}_next(){for(;this._queue.length>0&&this._processingItems.size<this.concurrency;)this._process(this._queue.pop())}_cancelNext(){this._schedule&&(this._schedule.remove(),this._schedule=null)}_processResult(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).resolve(e))}_processError(t,e){this._canProcessFulfillment(t)&&(this._scheduleNext(),this._deferreds.get(t.item).reject(e))}_canProcessFulfillment(t){return!!this._deferreds.get(t.item)&&this._processingItems.get(t.item)===t}_process(t){if(null==t)return;let e;const s=new AbortController,i=new V(t,s);this._processingItems.set(t,i);try{e=this.process(t,s.signal)}catch(t){this._processError(i,t)}(0,a.$X)(e)?(i.promise=e,e.then(t=>this._processResult(i,t),t=>this._processError(i,t))):this._processResult(i,e)}get test(){}}const Y=[0,0];let H=class extends z.A{constructor(t){super(t),this._keyToItem=new Map,this._tilesByScale=new Map,this.concurrency=6}initialize(){const{concurrency:t,process:e,scheduler:s,priority:i}=this;this._queue=new j({concurrency:t,scheduler:s,priority:i,process:(t,s)=>{const i=this._keyToItem.get(t);return e(i,{signal:s})},peeker:t=>this._peek(t)})}destroy(){this.clear(),this._queue=(0,f.pR)(this._queue)}get length(){return this._queue?this._queue.length:0}abort(t){const e="string"==typeof t?t:t.id;this._queue.abort(e)}clear(){this._queue.clear(),this._keyToItem.clear(),this._tilesByScale.clear()}has(t){return"string"==typeof t?this._keyToItem.has(t):this._keyToItem.has(t.id)}pause(){this._queue.pause()}push(t){const e=t.key.id;if(this._queue.has(e))return this._queue.get(e);const s=this._queue.push(e),i=this.tileInfoView.getTileScale(t.key),r=(0,R.tE)(this._tilesByScale,i,()=>new Set),n=()=>{r.delete(t.key),0===r.size&&this._tilesByScale.delete(i),this._keyToItem.delete(e)};return r.add(t.key),this._keyToItem.set(e,t),s.then(n,n),s}reset(){this._queue.reset()}resume(){this._queue.resume()}_peek(t){if(!this.state)return t.values().next().value;const e=new Set;for(const s of t)e.add(this._keyToItem.get(s).key);const s=this.state.scale;let i,r=Number.POSITIVE_INFINITY;for(const[t,n]of this._tilesByScale)if((0,O.bw)(n,t=>e.has(t))){const e=Math.abs(t-s);e<r&&(i=n,r=e)}return this._getClosestTileKey(i,t).id}_getClosestTileKey(t,e){const s=this.tileInfoView,i=this.state.center;let r,n=Number.POSITIVE_INFINITY;for(const o of t)if(e.has(o.id)){s.getTileCoords(Y,o);const t=(0,N.Io)(Y,i);t<n&&(n=t,r=o)}return r}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],H.prototype,"concurrency",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],H.prototype,"priority",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],H.prototype,"process",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],H.prototype,"scheduler",void 0),(0,E.Cg)([(0,L.MZ)()],H.prototype,"state",void 0),(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],H.prototype,"tileInfoView",void 0),H=(0,E.Cg)([(0,G.$)("esri.views.2d.tiling.TileQueue")],H);var X=s(19419);new b.A(0,0,0,0),new Map;class ${static{this.byteSizeHint=7*Uint32Array.BYTES_PER_ELEMENT}static{this.estimatedMemory=40}constructor(t,e,s,i,r,n,o){this.instanceId=t,this.textureKey=e,this.indexStart=s,this.indexCount=i,this.vertexStart=r,this.vertexCount=n,this.overlaps=o}updateBaseOffsets(t){this.vertexStart+=t.vertexFrom,this.indexStart+=t.indexFrom}clone(){return new $(this.instanceId,this.textureKey,this.indexStart,this.indexCount,this.vertexStart,this.vertexCount,this.overlaps)}static write(t,e,s,i,r,n,o,a){t.push(e),t.push(s),t.push(i),t.push(r),t.push(n),t.push(o),t.push(a)}serialize(t){return t.push(this.instanceId),t.push(this.textureKey),t.push(this.indexStart),t.push(this.indexCount),t.push(this.vertexStart),t.push(this.vertexCount),t.push(this.overlaps),t}static deserialize(t){const e=t.readInt32(),s=t.readInt32(),i=t.readInt32(),r=t.readInt32(),n=t.readInt32(),o=t.readInt32(),a=t.readInt32();return new $(e,s,i,r,n,o,a)}}function Z(t,e){if(null!==e){t.push(e.length);for(const s of e)s.serialize(t);return t}t.push(0)}function Q(t,e,s){const i=t.readInt32(),r=new Array(i);for(let i=0;i<r.length;i++)r[i]=e.deserialize(t,s);return r}class J{static{this.byteSizeHint=2*Uint32Array.BYTES_PER_ELEMENT+$.byteSizeHint}static estimateMemory(t){return 24+$.estimatedMemory*t}constructor(t,e){this.id=t,this.sortKey=e,this.records=[]}serialize(t){return t.push(this.id),t.writeF32(this.sortKey),Z(t,this.records),t}static deserialize(t){const e=t.readInt32(),s=t.readF32(),i=new J(e,s);return i.records=Q(t,$)??[],i}}class K{get length(){return this._pos}constructor(t,e){this._pos=0;const s=e?this._roundToNearest(e,t.BYTES_PER_ELEMENT):40;this._array=new ArrayBuffer(s),this._buffer=new t(this._array),this._ctor=t,this._i16View=new Int16Array(this._array)}_roundToNearest(t,e){const s=Math.round(t);return 1===e?s:s+(e-s%e)}_ensureSize(t){if(this._pos+t>=this._buffer.length){const e=this._roundToNearest(1.25*(this._array.byteLength+t*this._buffer.BYTES_PER_ELEMENT),this._buffer.BYTES_PER_ELEMENT),s=new ArrayBuffer(e),i=new this._ctor(s);i.set(this._buffer,0),this._array=s,this._buffer=i,this._i16View=new Int16Array(this._array)}}ensureSize(t){this._ensureSize(t)}writeF32(t){this._ensureSize(1);const e=this._pos;return new Float32Array(this._array,4*this._pos,1)[0]=t,this._pos++,e}push(t){this._ensureSize(1);const e=this._pos;return this._buffer[this._pos++]=t,e}writeFixed(t){this._buffer[this._pos++]=t}setValue(t,e){this._buffer[t]=e}i1616Add(t,e,s){this._i16View[2*t]+=e,this._i16View[2*t+1]+=s}getValue(t){return this._buffer[t]}getValueF32(t){return new Float32Array(this._array,4*t,1)[0]}incr(t){if(this._buffer.length<t)throw new Error("Increment index overflows the target buffer");this._buffer[t]++}decr(t){this._buffer[t]--}writeRegion(t){this._ensureSize(t.length);const e=this._pos;return this._buffer.set(t,this._pos),this._pos+=t.length,e}writeManyFrom(t,e,s){this._ensureSize(s-e);for(let i=e;i!==s;i++)this.writeFixed(t._buffer[i])}buffer(){const t=this._array.slice(0,4*this._pos);return this.destroy(),t}toArray(){return[...this._buffer]}seek(t){this._pos=t}destroy(){this._array=null,this._buffer=null}}class tt{constructor(t,e,s=0){const i=6*s*Uint32Array.BYTES_PER_ELEMENT,r=4*s*e.stride,n=e.stride/4,o=e.attributes.find(t=>"pos"===t.name||"position"===t.name);if(!o)throw new Error("InternalError: Unable to find position attribute");this.layout={...e,position:o},this._indices=new K(Uint32Array,i),this._vertices=new K(Uint32Array,r),this._metrics=new K(Uint32Array,0),this._metricCountOffset=this._metrics.push(0),this._strideInt=n,this._instanceId=t}serialize(t){const e=this._indices.buffer(),s=this._vertices.buffer(),i=this._metrics.length?this._metrics.buffer():null;return t.push(e,s),{instanceId:this._instanceId,layout:this.layout,indices:e,vertices:s,metrics:i}}get strideInt(){return this._strideInt}get vertexCount(){return this._vertices.length/this._strideInt}get indexCount(){return this._indices.length}get indexWriter(){return this._indices}get vertexWriter(){return this._vertices}get metricWriter(){return this._metrics}vertexEnsureSize(t){this._vertices.ensureSize(t)}indexEnsureSize(t){this._indices.ensureSize(t)}writeIndex(t){this._indices.push(t)}writeVertex(t){this._vertices.push(t)}writeVertexRegion(t){this._vertices.writeRegion(t)}writeVertexF32(t){this._vertices.writeF32(t)}writeMetric(t){this._metrics.incr(this._metricCountOffset),t.serialize(this._metrics)}}class et{constructor(t,e=0){this._id=t,this._sizeHint=e,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:0,metricBoxLenPointer:0},this._entities=new K(Uint32Array,this._sizeHint*J.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){const t=new Array,e=[],s=this._entities.buffer();for(const s of this._instanceIdToVertexData.values())e.push(s.serialize(t));return{message:{data:e,entities:s},transferList:t}}vertexStart(){return this._current.vertexStart??0}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(t){this._current.writer.vertexEnsureSize(t)}indexEnsureSize(t){this._current.writer.indexEnsureSize(t)}vertexWrite(t){this._current.writer.writeVertex(t)}vertexWriteRegion(t){this._current.writer.writeVertexRegion(t)}vertexWriteF32(t){this._current.writer.writeVertexF32(t)}recordBounds(t,e,s,i){}indexWrite(t){this._current.writer.writeIndex(t)}metricStart(t){this._current.metric=t,this._current.metric.recordStart=this.recordCount()}metricEnd(){const t=this._current.writer;this._current.metric&&(this._current.metric.recordCount=this.recordCount()-this._current.metric.recordStart),this._current.metric?.bounds.length&&this._current.metric?.recordCount?(t.writeMetric(this._current.metric),this._current.metric=null):this._current.metric=null}metricBoxWrite(t){this._current.metric.bounds.push(t)}entityStart(t,e=t){this._entityIdIndex=this._entities.push(t),this._entitySortKeyIndex=this._entities.writeF32(e),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){this._didEntityStart&&(0===this.entityRecordCount()?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1)}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(t,e,s=0){this._current.writer=this._getVertexWriter(t,e),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=t,this._current.layoutHash=e.hash,this._current.textureKey=s}recordEnd(t=0){const e=this._current.vertexStart,s=this._current.writer.vertexCount-e;if(!s)return!1;const i=this._current.indexStart,r=this._current.writer.indexCount-i;return this._recordIndexStart=i,this._recordIndexCount=r,this._recordVertexStart=e,this._recordVertexCount=s,this._entities.incr(this._entityRecordCountOffset),$.write(this._entities,this._current.instanceId,this._current.textureKey,i,r,e,s,t),!0}copyLast(t,e){const s=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),$.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,s,this._recordVertexCount,0);const i=this._current.writer.indexWriter,r=this._current.writer.vertexWriter,n=this._recordIndexStart+this._recordIndexCount,o=this._recordVertexCount;for(let t=this._recordIndexStart;t!==n;t++){const e=i.getValue(t);i.push(e+o)}const a=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,h=this._recordVertexStart*a,c=(this._recordVertexStart+this._recordVertexCount)*a;for(let t=h;t!==c;t++){const e=r.getValue(t);r.push(e)}const l=this._current.writer.layout.position,u=l.packPrecisionFactor??1,d=l.offset/Uint32Array.BYTES_PER_ELEMENT,p=t*u,_=e*u;for(let t=s*a;t<=r.length;t+=a)r.i1616Add(t+d,p,_)}copyLastFrom(t,e,s){const i=t._entities.getValue(t._entityIdIndex);if(i!==this._entities.getValue(this._entityIdIndex)){const e=t._entities.getValueF32(t._entitySortKeyIndex);this.entityStart(i,e)}this.recordStart(t._current.instanceId,t._current.writer.layout,t._current.textureKey);const r=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,n=this._current.vertexStart,o=t._current.vertexStart-n,a=this._current.writer.indexWriter,h=this._current.writer.vertexWriter,c=t._current.writer.indexWriter,l=t._current.writer.vertexWriter;for(let e=t._current.indexStart;e!==c.length;e++){const t=c.getValue(e);a.push(t-o)}for(let e=t._current.vertexStart*r;e!==l.length;e++){const t=l.getValue(e);h.push(t)}const u=this._current.writer.layout.position,d=u.packPrecisionFactor??1,p=u.offset/Uint32Array.BYTES_PER_ELEMENT,_=e*d,f=s*d;for(let t=n*r;t<=h.length;t+=r)h.i1616Add(t+p,_,f);this.recordEnd()}_getVertexWriter(t,e){const s=this._instanceIdToVertexData;return s.has(t)||s.set(t,new tt(t,e,this._sizeHint)),s.get(t)}}function st(t){switch(t){case 1:case 8:case 32:return-1;case 2:case 64:return 0;case 4:case 16:case 128:return 1}}function it(t){switch(t){case 1:case 2:case 4:return-1;case 8:case 16:return 0;case 32:case 64:case 128:return 1}}class rt{constructor(t,e,s,i,r=0){this.tileKey=t,this._bufferingEnabled=e,this._sizeHint=r,this._meshes={self:new et(this.id,this._sizeHint),neighbors:new Array},this._currentRecordOverlaps=0,this._currentEntityOverlaps=0;const n=i?1:0;this._copyBufferedDataIntoSelf=s&&this._bufferingEnabled&&t.level===n}get id(){return this.tileKey.id}vertexStart(){return this._meshes.self.vertexStart()??0}vertexCount(){return this._meshes.self.vertexCount()}indexCount(){return this._meshes.self.indexCount()}indexEnsureSize(t){this._meshes.self.indexEnsureSize(t)}entityStart(t,e=t){this._currentEntityOverlaps=0,this._meshes.self.entityStart(t,e)}entityRecordCount(){return this._meshes.self.entityRecordCount()}entityEnd(){if(this._meshes.self.entityEnd(),this._bufferingEnabled){if(this._copyBufferedDataIntoSelf)return;for(let t=0;t<8;t++){const e=1<<t;this._currentEntityOverlaps&e&&this._meshes.neighbors[t].entityEnd()}}}recordStart(t,e,s){this._currentRecordOverlaps=0,this._meshes.self.recordStart(t,e,s)}recordEnd(t=0){const e=this._meshes.self.recordEnd(this._currentRecordOverlaps);return e&&0!==this._currentRecordOverlaps?(this._copyIntoNeighbors(),this._currentEntityOverlaps|=this._currentRecordOverlaps,!0):e}recordBounds(t,e,s,i){this._bufferingEnabled&&this._addOverlap(t,e,s,i)}recordCount(){return this._meshes.self.recordCount()}metricStart(t){this._meshes.self.metricStart(t)}metricBoxWrite(t){this._meshes.self.metricBoxWrite(t)}metricEnd(){this._meshes.self.metricEnd()}vertexWrite(t){this._meshes.self.vertexWrite(t)}vertexWriteF32(t){this._meshes.self.vertexWriteF32(t)}vertexWriteRegion(t){this._meshes.self.vertexWriteRegion(t)}indexWrite(t){this._meshes.self.indexWrite(t)}serialize(t){const e={message:[],transferList:[]},s=this._meshes.self.serialize();return e.message.push({tileId:this.tileKey.id,...s.message}),e.transferList.push(...s.transferList),this._meshes.neighbors.forEach((s,i)=>{const r=s.serialize(),n=1<<i,o=st(n),a=it(n),h=new b.A(this.tileKey).getNormalizedNeighbor(o,a,t);e.message.push({tileId:h.id,...r.message}),e.transferList.push(...r.transferList)}),e}_addOverlap(t,e,s,i){const r=Math.min(p.CQ/2,s),n=Math.min(p.CQ/2,i),o=255^((t<0+r?148:t>=p.CQ-r?41:189)|(e<0+n?224:e>=p.CQ-n?7:231));this._currentRecordOverlaps|=o}_copyIntoNeighbors(){for(let t=0;t<8;t++){const e=1<<t;if(this._currentRecordOverlaps&e){if(this._copyBufferedDataIntoSelf){const t=-st(e)*p.CQ,s=-it(e)*p.CQ;if(0!==s)continue;this._meshes.self.copyLast(t,s);continue}if(!this._meshes.neighbors[t]){const s=Math.floor(this._sizeHint/16);this._meshes.neighbors[t]=new et(e,s)}const s=this._meshes.neighbors[t],i=-st(e)*p.CQ,r=-it(e)*p.CQ;s.copyLastFrom(this._meshes.self,i,r)}}}}class nt{}var ot=s(72691),at=s(73681);class ht{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(t,e){const s=new ht;return s.setDefault(await t.createMeshWriters(e.meshes)),s}size(){return 1}getDefault(){return this._defaultResult}setDefault(t){this._defaultResult=t}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(t){this._backgroundFillResult=t}hasArcadeDependency(t){return this._defaultResult?.some(e=>e.hasArcadeDependency(t))??!1}match(t,e,s){const i=this.doMatch(t,e)||this.getDefault();if(i&&i.length>0){const t=this.getBackgroundFill();if(t)return[...t,...i]}return i}getSortKey(t,e){return 0}doMatch(t,e){return null}async fetchResources(t,e){}}class ct extends ht{static async fromDictionaryRenderer(t,e){const s=await at.n.from(e.dictionaryInfo,e.userConfig,e.fieldMap);return new ct(t,s)}constructor(t,e){super(),this._context=t,this._evaluator=e,this._controlStringToPromise=new Map,this._controlStringToGroup=new Map}async fetchResources(t,e){const s=e.getCursor(),i=new Set;for(;s.next();){const t=this._evaluateControlString(s);t&&i.add(t)}const r=Array.from(i.values()).map(e=>this._ensureGroup(t,e));await Promise.all(r)}match(t,e){const s=this._evaluateControlString(t);return s?this._controlStringToGroup.get(s):null}_evaluateControlString(t){const e=t.readLegacyFeatureWorldSpace();return this._evaluator.evaluate(e,0,t.fields,null)}_ensureGroup(t,e){let s=this._controlStringToPromise.get(e);return null==s&&(s=this._fetchGroup(t,e),this._controlStringToPromise.set(e,s)),s}async _fetchGroup(t,e){const s=await t.fetchDictionaryResourceImmediate({type:"dictionary-request",controlString:e});if(!s)return;const i=await this._context.createMeshWriters(s.meshes);this._controlStringToGroup.set(e,i)}}class lt extends ht{constructor(t,e){super(),this._intervals=[],this._isMaxInclusive=e,this._field=t}static async fromIntervalSchema(t,e){const s=await t.storage.createComputedField(e),i=new lt(s,e.isMaxInclusive);await Promise.all(e.intervals.map(async e=>{const s=await t.createMeshWriters(e.meshes);i.add(e,s)}));const r=await t.createMeshWriters(e.defaultSymbol);i.setDefault(r);const n=await t.createMeshWriters(e.backgroundFill);return i.setBackgroundFill(n),i}add(t,e){this._intervals.push({interval:t,result:e}),this._intervals.sort((t,e)=>t.interval.min-e.interval.min)}size(){return super.size()+this._intervals.length}hasArcadeDependency(t){return this._field?.hasArcadeDependency(t)||this._intervals.some(e=>e.result.some(e=>e.hasArcadeDependency(t)))}doMatch(t,e){const s=this._field?.read(t,e);if(null==s||isNaN(s)||s===1/0||s===-1/0)return null;for(let t=0;t<this._intervals.length;t++){const{interval:e,result:i}=this._intervals[t],r=s>=e.min,n=this._isMaxInclusive?s<=e.max:s<e.max;if(r&&n)return i}return null}}class ut extends ht{static async fromLabelSchema(t,e){const s=e.classes.map(async e=>{const s=await t.createMeshWriters(e.meshes);return{minScale:e.minScale,maxScale:e.maxScale,meshes:s,expression:null,where:await t.storage.createWhereClause(e.where)}}),i=await Promise.all(s);return new ut(i)}constructor(t){super(),this._labels=t}match(t,e,s){if(!this._labels.length)return null;const i=this._getLabels(e.$view.scale),r=[];for(const e of i)e.where&&!e.where(t,s)||r.push(...e.meshes);return r}hasArcadeDependency(t){return this._labels.some(e=>e.meshes.some(e=>e.hasArcadeDependency(t)))}_getLabels(t){return this._labels.filter(e=>this._validForTileScale(e,t))}_validForTileScale(t,e){const s=e-e/4,i=e+e/2;return(!t.minScale||t.minScale>=s)&&(!t.maxScale||t.maxScale<=i)}}class dt extends ht{constructor(t,e){super(),this._defaultSymbolSortKey=0,this._nullResult=null,this._resultsMap=new Map,this._fields=[],this._fields=t,this._separator=e||""}static async fromMatcherSchema(t,e){const s=e.expression?[t.storage.createComputedField({expression:e.expression})]:[e.field?t.storage.createComputedField({field:e.field}):null,e.field2?t.storage.createComputedField({field:e.field2}):null,e.field3?t.storage.createComputedField({field:e.field3}):null],i=(await Promise.all(s)).filter(t=>!!t),r=new dt(i,e.fieldDelimiter),n=await t.createMeshWriters(e.defaultSymbol);r.setDefault(n);const o=await t.createMeshWriters(e.backgroundFill);return r.setBackgroundFill(o),await Promise.all(e.map.map(async(e,s)=>{const i=await t.createMeshWriters(e.symbol);"<Null>"===e.value?r.setNullResult(i):r.add(e.value,i,s+1)})),r}setNullResult(t){this._nullResult=t}getSortKey(t,e){const s=this._getValueFromFields(t,e);if(null==s||""===s||"<Null>"===s)return 0;const i=this._resultsMap.get(s.toString());return i?i.sortKey:this._defaultSymbolSortKey}add(t,e,s){this._resultsMap.set(t.toString(),{meshWriters:e,sortKey:s}),this._defaultSymbolSortKey=Math.max(this._defaultSymbolSortKey,s+1)}size(){return super.size()+this._resultsMap.size}hasArcadeDependency(t){return this._fields.some(e=>e.hasArcadeDependency(t))||[...this._resultsMap.values()].some(e=>e.meshWriters.some(e=>e.hasArcadeDependency(t)))||this._nullResult?.some(e=>e.hasArcadeDependency(t))||!1}doMatch(t,e){const s=this._getValueFromFields(t,e);if(null!==this._nullResult&&(null==s||""===s||"<Null>"===s))return this._nullResult;if(null==s)return null;const i=s.toString();return this._resultsMap.get(i)?.meshWriters}_getValueFromFields(t,e){const s=[];for(const i of this._fields){const r=i.read(t,e);null==r||""===r?s.push("<Null>"):s.push(r)}return s.join(this._separator)}}async function pt(t,e){switch(e.type){case"simple":case"heatmap":case"dot-density":case"pie-chart":return ht.from(t,e);case"interval":return lt.fromIntervalSchema(t,e);case"dictionary":return ct.fromDictionaryRenderer(t,e);case"label":return ut.fromLabelSchema(t,e);case"map":return dt.fromMatcherSchema(t,e);case"subtype":return _t.fromSubtypes(t,e);case"cluster":return ft.fromClusterSchema(t,e);case"track":return mt.fromTrackSchema(t,e);default:throw new Error("Impl")}}class _t extends ht{constructor(t,e){super(),this._subMatchers=t,this._subtypeField=e}static async fromSubtypes(t,e){const s=new Map,i=[];for(const r in e.renderers){const n=parseInt(r,10),o=pt(t,e.renderers[r]).then(t=>s.set(n,t));i.push(o)}return await Promise.all(i),new _t(s,e.subtypeField)}match(t,e,s){const i=t.readAttribute(this._subtypeField),r=this._subMatchers.get(i);return r?r.match(t,e,s):null}hasArcadeDependency(t){for(const e of this._subMatchers.values())if(e.hasArcadeDependency(t))return!0;return!1}}class ft extends ht{static async fromClusterSchema(t,e){const[s,i]=await Promise.all([pt(t,e.feature),pt(t,e.cluster)]);return new ft(s,i)}constructor(t,e){super(),this._featureMatcher=t,this._clusterMatcher=e}match(t,e,s){return 1===t.readAttribute("cluster_count")?this._featureMatcher.match(t,e,s):this._clusterMatcher.match(t,e,s)}hasArcadeDependency(t){return this._featureMatcher.hasArcadeDependency(t)||this._clusterMatcher.hasArcadeDependency(t)}}class mt extends ht{static async fromTrackSchema(t,e){const[s,i,r]=await Promise.all([pt(t,e.previousObservation),pt(t,e.latestObservation),pt(t,e.trackLine)]);return new mt(s,i,r)}constructor(t,e,s){super(),this._previousObservationMatcher=t,this._latestObservationMatcher=e,this._trackLineMatcher=s}match(t,e,s){switch(t.readAttribute(ot.EA)){case 0:return this._trackLineMatcher.match(t,e,s);case 1:return this._latestObservationMatcher.match(t,e,s);case 2:return this._previousObservationMatcher.match(t,e,s)}return null}hasArcadeDependency(t){return this._trackLineMatcher.hasArcadeDependency(t)||this._latestObservationMatcher.hasArcadeDependency(t)||this._previousObservationMatcher.hasArcadeDependency(t)}}class gt extends nt{static async create(t,e){const s=await pt(t,e.symbology),i=e.labels?await pt(t,e.labels):null;return new gt(s,i)}constructor(t,e){super(),this._symbology=t,this._labels=e}destroy(){}async enqueueMatcherRequests(t,e){await Promise.all([this._symbology.fetchResources(t,e),this._labels?.fetchResources(t,e)])}enqueueWriterRequests(t,e,s,i){const r=this._symbology.match(e,s,i);if(r){for(const i of r)i.enqueueRequest(t,e,s);if(this._labels){const r=this._labels.match(e,s,i);if(!r)return;for(const i of r)i.enqueueRequest(t,e,s)}}}write(t,e,s,i,r,n){const o=this._symbology.match(s,i,r);if(o){for(const r of o)r.write(t,e,s,i,n);if(t.entityRecordCount()>=1&&this._labels){const a=this._labels.match(s,i,r);if(!a)return;for(const r of a)r.setReferences(o),r.write(t,e,s,i,n)}}}getSortKey(t,e){return this._symbology.getSortKey(t,e)}hasArcadeDependency(t){return!(!this._symbology.hasArcadeDependency(t)&&!this._labels?.hasArcadeDependency(t))}}var yt=s(799);class xt{}class bt extends xt{constructor(t){super(),this._fetcher=t,this._controller=new AbortController,this._pendingIds=new Set,this._pendingRequests=[],this._resourceIdToResource=new Map}destroy(){this._controller.abort()}get _abortOptions(){return{signal:this._controller.signal}}enqueueRequest(t){const e=function(t){return"url"in t&&"urlHash"in t?{...t,url:""}:t}(t.resource),s=(0,yt.Wm)(JSON.stringify(e));return this._pendingIds.has(s)||(this._pendingIds.add(s),this._pendingRequests.push({...t,resourceId:s})),s}async fetchEnqueuedResources(){const t=this._pendingRequests;if(this._pendingIds.clear(),this._pendingRequests=[],0===t.length)return;const e=await this._fetcher.fetch(t,this._abortOptions);for(let s=0;s<e.length;s++){const i=t[s].resourceId;this._resourceIdToResource.set(i,e[s])}}async fetchResourceImmediate(t){const e=await this._fetcher.fetch([t]);if(1!==e.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch resources");return e[0]}async fetchDictionaryResourceImmediate(t){const e=await this._fetcher.fetchDictionary([t]);if(1!==e.length)throw new Error("FeaturePipelineResourceProxy: failed to fetch dictionary resources");return e[0]}getResource(t){return this._resourceIdToResource.get(t)}}var wt=s(36745),vt=s(28076);const St=1024;vt.D.CIMSolidStroke.capstyle,vt.D.CIMSolidStroke.joinstyle,vt.D.CIMSolidStroke.miterlimit;class It{static{this.instance=null}static local(){return null===It.instance&&(It.instance=new It),It.instance}execute(t,e){return new Pt(t,e)}}class Pt{constructor(t,e){this._inputGeometries=t,this._angleTolerance=void 0!==e.angleTolerance?e.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let t=this._inputGeometries.next();if(!t)return null;for(;t;){if("esriGeometryPolygon"===t.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===t.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==t.geometryType){t=this._inputGeometries.next();continue}if(this._maxCosAngle)return t;this._isClosed=!0}for(;t.nextPath();)this._processPath(t);return t.reset(),t}return null}_processPath(t){if(t.nextPoint()){const e=t.x,s=t.y;let i=e,r=s,n=t.pathSize,o=0,a=0,h=0,c=0,l=0,u=0;this._isClosed&&++n;for(let d=1;t.nextPoint()||d<n;++d){let p,_;this._isClosed&&d===n-1?(p=e,_=s):(p=t.x,_=t.y);const f=p-i,m=_-r,g=Math.sqrt(f*f+m*m);d>1&&g>0&&h>0&&(o*f+a*m)/g/h<=this._maxCosAngle&&t.setControlPointAt(d-1),1===d&&(c=f,l=m,u=g),g>0&&(i=p,r=_,o=f,a=m,h=g)}this._isClosed&&h>0&&u>0&&(o*c+a*l)/u/h<=this._maxCosAngle&&t.setControlPointAt(0)}}}var Mt=s(51118);class Tt{constructor(){this.setIdentity()}getAngle(){return(null==this.rz||0===this.rz&&1!==this.rzCos&&0!==this.rzSin)&&(this.rz=Math.atan2(this.rzSin,this.rzCos)),this.rz}setIdentity(){this.tx=0,this.ty=0,this.tz=0,this.s=1,this.rx=0,this.ry=0,this.rz=0,this.rzCos=1,this.rzSin=0}setTranslate(t,e){this.tx=t,this.ty=e}setTranslateZ(t){this.tz=t}setRotateCS(t,e){this.rz=void 0,this.rzCos=t,this.rzSin=e}setRotate(t){this.rz=t,this.rzCos=void 0,this.rzSin=void 0}setRotateY(t){this.ry=t}setScale(t){this.s=t}setMeasure(t){this.m=t}}function kt(t,e){t[4]=e}class Ct{constructor(t,e=!0,s=!0,i=0){this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!e&&"esriGeometryPolygon"===t.geometryType||!s&&"esriGeometryPolyline"===t.geometryType?null:t,this.geomUnitsPerPoint=i,this.iterateMultiPath=!1,this.iteratePath=!1,this.internalPlacement=new Tt}next(){if(!this.geometryCursor)return null;const t=this.processMultiPath(this.geometryCursor);return this.iterateMultiPath&&t||(this.geometryCursor=null),t}processMultiPath(t){for(;this.iteratePath||t.pathIndex<t.totalSize-1;){this.iteratePath||t.nextPath(),this.iterateMultiPath=!0;const e=this.processPath(t);if(e)return e}return this.iterateMultiPath=!1,null}}class At{constructor(t,e,s,i=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=s,this.geomUnitsPerPoint=i,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&"esriGeometryPolygon"===t.geometryType||"esriGeometryEnvelope"===t.geometryType,this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}}const Ft=.03;class Et{constructor(t=0,e=!1){}isEmpty(t){if(!t.nextPoint())return!0;let e,s,i,r;for(e=t.x,s=t.y;t.nextPoint();e=s,s=r)if(i=t.x,r=t.y,i!==e||r!==s)return t.seekPathStart(),!1;return t.seekPathStart(),!0}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);0!==e&&(t[0]/=e,t[1]/=e)}getLength(t,e,s,i){const r=s-t,n=i-e;return Math.sqrt(r*r+n*n)}getSegLength(t){const[[e,s],[i,r]]=t;return this.getLength(e,s,i,r)}getCoord2D(t,e,s,i,r){return[t+(s-t)*r,e+(i-e)*r]}getSegCoord2D(t,e){const[[s,i],[r,n]]=t;return this.getCoord2D(s,i,r,n,e)}getAngle(t,e,s,i,r){const n=s-t,o=i-e;return Math.atan2(o,n)}getAngleCS(t,e,s,i,r,n){null==t&&(t=[0,0]);const o=i-e,a=r-s,h=Math.sqrt(o*o+a*a);return 0!==h?(t[0]=o/h,t[1]=a/h,t):(t[0]=1,t[1]=0,t)}getSegAngleCS(t,e,s){const[[i,r],[n,o]]=e;return this.getAngleCS(t,i,r,n,o,s)}cut(t,e,s,i,r,n){return[r<=0?[t,e]:this.getCoord2D(t,e,s,i,r),n>=1?[s,i]:this.getCoord2D(t,e,s,i,n)]}getSubCurve(t,e,s){const i=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");return this.appendSubCurve(i,t,e,s)?i:null}appendSubCurve(t,e,s,i){t.startPath(),e.seekPathStart();let r=0,n=!0;if(!e.nextPoint())return!1;let o=e.x,a=e.y;for(;e.nextPoint();){const h=this.getLength(o,a,e.x,e.y);if(0!==h){if(n){if(r+h>s){const c=(s-r)/h;let l=1,u=!1;r+h>=i&&(l=(i-r)/h,u=!0);const d=this.cut(o,a,e.x,e.y,c,l);if(d&&t.pushPoints(d),u)break;n=!1}}else{if(r+h>i){const s=this.cut(o,a,e.x,e.y,0,(i-r)/h);s&&t.pushPoint(s[1]);break}t.pushXY(e.x,e.y)}r+=h,o=e.x,a=e.y}else o=e.x,a=e.y}return!0}getCIMPointAlong(t,e){if(!t.nextPoint())return null;let s,i,r,n,o=0;for(s=t.x,i=t.y;t.nextPoint();s=r,i=n){r=t.x,n=t.y;const a=this.getLength(s,i,r,n);if(0!==a){if(o+a>e){const t=(e-o)/a;return this.getCoord2D(s,i,r,n,t)}o+=a}}return null}offset(t,e,s,i,r){if(!t||t.length<2)return null;let n=0,o=t[n++],a=n;for(;n<t.length;){const e=t[n];e[0]===o[0]&&e[1]===o[1]||(n!==a&&(t[a]=t[n]),o=t[a++]),n++}const h=t[0][0]===t[a-1][0]&&t[0][1]===t[a-1][1];if(h&&--a,a<(h?3:2))return null;const c=[];o=h?t[a-1]:null;let l=t[0];for(let r=0;r<a;r++){const n=r===a-1?h?t[0]:null:t[r+1];if(o)if(n){const t=[n[0]-l[0],n[1]-l[1]];this.normalize(t);const r=[l[0]-o[0],l[1]-o[1]];this.normalize(r);const a=r[0]*t[1]-r[1]*t[0],h=r[0]*t[0]+r[1]*t[1];if(0===a&&1===h){l=n;continue}if(a>=0==e<=0){if(h<1){const s=[t[0]-r[0],t[1]-r[1]];this.normalize(s);const n=Math.sqrt((1+h)/2);if(n>1/i){const t=-Math.abs(e)/n;c.push([l[0]-s[0]*t,l[1]-s[1]*t])}}}else switch(s){case"Mitered":{const s=Math.sqrt((1+h)/2);if(s>0&&1/s<i){const i=[t[0]-r[0],t[1]-r[1]];this.normalize(i);const n=Math.abs(e)/s;c.push([l[0]-i[0]*n,l[1]-i[1]*n]);break}}case"Bevelled":c.push([l[0]+r[1]*e,l[1]-r[0]*e]),c.push([l[0]+t[1]*e,l[1]-t[0]*e]);break;case"Rounded":if(h<1){c.push([l[0]+r[1]*e,l[1]-r[0]*e]);const s=Math.floor(2.5*(1-h));if(s>0){const i=1/s;let n=i;for(let o=1;o<s;o++,n+=i){const s=[r[1]*(1-n)+t[1]*n,-r[0]*(1-n)-t[0]*n];this.normalize(s),c.push([l[0]+s[0]*e,l[1]+s[1]*e])}}c.push([l[0]+t[1]*e,l[1]-t[0]*e])}break;default:if(a<0)c.push([l[0]+(r[1]+r[0])*e,l[1]+(r[1]-r[0])*e]),c.push([l[0]+(t[1]-t[0])*e,l[1]-(t[0]+t[1])*e]);else{const s=Math.sqrt((1+Math.abs(h))/2),i=[t[0]-r[0],t[1]-r[1]];this.normalize(i);const n=e/s;c.push([l[0]-i[0]*n,l[1]-i[1]*n])}}}else{const t=[l[0]-o[0],l[1]-o[1]];this.normalize(t),c.push([l[0]+t[1]*e,l[1]-t[0]*e])}else{const t=[n[0]-l[0],n[1]-l[1]];this.normalize(t),c.push([l[0]+t[1]*e,l[1]-t[0]*e])}o=l,l=n}return c.length<(h?3:2)?null:(h&&c.push([c[0][0],c[0][1]]),c)}}class zt{static{this.instance=null}static local(){return null===zt.instance&&(zt.instance=new zt),zt.instance}execute(t,e,s){return new Rt(t,e,s)}}class Rt extends At{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new Et,this._width=(void 0!==e.width?e.width:5)*s,this._arrowType=void 0!==e.geometricEffectArrowType?e.geometricEffectArrowType:void 0!==e.arrowType?e.arrowType:"OpenEnded",this._offsetFlattenError=Ft*s}processPath(t){const e=wt.z.createEmptyOptimizedCIM(t.geometryType);switch(this._arrowType){case"OpenEnded":default:this._constructSimpleArrow(e,t,!0);break;case"Block":this._constructSimpleArrow(e,t,!1);break;case"Crossed":this._constructCrossedArrow(e,t)}return e}_constructSimpleArrow(t,e,s){const i=e.pathLength();let r=this._width;i<2*r&&(r=i/2);const n=this._curveHelper.getSubCurve(e,0,i-r);if(!n||!n.nextPath())return;n.seekPathStart();const o=r/2;if(this._curveHelper.isEmpty(n))return;const a=(0,Mt.A)(n),h=this._constructOffset(a,-o);if(!h)return;const c=this._constructOffset(a,o);if(!c)return;const l=this._constructArrowBasePoint(h,-o/2);if(!l)return;const u=this._constructArrowBasePoint(c,o/2);if(!u)return;e.seekInPath(e.pathSize-1);const d=[e.x,e.y];t.pushPath(c),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(u),t.nextPoint(),t.setControlPoint(),t.pushPoint(d),t.nextPoint(),t.setControlPoint(),t.pushPoint(l),t.nextPoint(),t.setControlPoint(),t.pushPoints(h.reverse()),t.setControlPoint(),s||(t.setControlPointAt(0),t.setControlPointAt(t.pathSize-1),t.pushPoint(c[0])),t.reset()}_constructCrossedArrow(t,e){const s=e.pathLength();let i=this._width;s<3.732050807568877*i&&(i=s/3.732050807568877),e.seekPathStart();const r=this._curveHelper.getSubCurve(e,0,s-2.732050807568877*i);if(!r)return;r.nextPath();const n=i/2;if(this._curveHelper.isEmpty(r))return;const o=(0,Mt.A)(r),a=this._constructOffset(o,n);if(!a)return;const h=this._constructOffset(o,-n);if(!h)return;const c=this._curveHelper.getSubCurve(e,0,s-i);if(!c)return;if(c.nextPath(),this._curveHelper.isEmpty(c))return;const l=(0,Mt.A)(c),u=this._constructOffset(l,n);if(!u)return;const d=this._constructOffset(l,-n);if(!d)return;const p=u[u.length-1],_=this._constructArrowBasePoint(u,n/2);if(!_)return;const f=d[d.length-1],m=this._constructArrowBasePoint(d,-n/2);if(!m)return;e.seekInPath(e.pathSize-1);const g=[e.x,e.y];t.pushPath(a),t.nextPath(),t.nextPoint(),t.setControlPoint(),t.pushPoint(f),t.nextPoint(),t.setControlPoint(),t.pushPoint(m),t.nextPoint(),t.setControlPoint(),t.pushPoint(g),t.nextPoint(),t.setControlPoint(),t.pushPoint(_),t.nextPoint(),t.setControlPoint(),t.pushPoint(p),t.nextPoint(),t.setControlPoint(),t.pushPoints(h.reverse()),t.nextPoint(),t.setControlPoint(),t.reset()}_constructOffset(t,e){return this._curveHelper.offset(t,e,"Rounded",4,this._offsetFlattenError)}_constructArrowBasePoint(t,e){if(!t||t.length<2)return null;const s=t[t.length-2],i=t[t.length-1],r=[i[0]-s[0],i[1]-s[1]];return this._curveHelper.normalize(r),[i[0]+r[1]*e,i[1]-r[0]*e]}}var Ot=s(6774),Lt=s(93397);const Dt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(1352),s.e(6160)]).then(s.bind(s,46160))),Gt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(3285)]).then(s.bind(s,55666))),Nt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(1190)]).then(s.bind(s,51190))),Bt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(7528)]).then(s.bind(s,97528))),qt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(1352),s.e(795)]).then(s.bind(s,50795))),Ut=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(5605)]).then(s.bind(s,15605))),Wt=(0,Lt.z9)(()=>Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(6018)]).then(s.bind(s,3637)));let Vt;function jt(t){switch(t.type){case"CIMGeometricEffectDonut":case"CIMGeometricEffectBuffer":return Dt.getImportPromise();case"CIMGeometricEffectEnclosingPolygon":return Gt.getImportPromise();case"CIMGeometricEffectOffset":return Promise.all([Ut.getImportPromise(),qt.getImportPromise()]);case"CIMGeometricEffectTaperedPolygon":return Promise.all([Wt.getImportPromise(),Nt.getImportPromise(),Bt.getImportPromise()]);default:return Promise.resolve()}}class Yt{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function Ht(t,e,s){if(!t)return null;Vt||(Vt=new Ot.O3(0,0,0,1));const i=s?-1:1,r="esriGeometryPolygon"===t.geometryType,n=r?3:2,o=r?3:2;let a,h;for(Vt.reset(n),Vt.setPixelMargin(e+1),Vt.setExtent(512);t.nextPath();)if(!(t.pathSize<o)){for(t.nextPoint(),a=t.x,h=i*t.y,Vt.moveTo(a,h);t.nextPoint();)a=t.x,h=i*t.y,Vt.lineTo(a,h);r&&Vt.close()}const c=Vt.result(!1);if(c){const e=wt.z.createEmptyOptimizedCIM(t.geometryType);for(const t of c){e.startPath();for(const s of t)e.pushXY(s.x,i*s.y)}return e.reset(),e}return null}class Xt{static{this.instance=null}static local(){return null===Xt.instance&&(Xt.instance=new Xt),Xt.instance}execute(t,e,s,i,r,n){return new $t(t,e,s,i,r,n)}}class $t{constructor(t,e,s,i,r,n){this._preventClipping=n,this._inputGeometries=t,this._tileKey=i,this._curveHelper=new Et,this._size=(void 0!==e.size?e.size:1)*s,this._maxInflateSize=r*s,this._offsetFlattenError=Ft*s}next(){let t;for(;t=this._inputGeometries.next();){if(0===this._size)return t;if("esriGeometryEnvelope"===t.geometryType)if(this._size>0){const e=wt.z.createEmptyOptimizedCIM(t.geometryType),s=(0,Mt.x)(t)[0],i=this._curveHelper.offset(s,this._size,"Rounded",4,this._offsetFlattenError);if(i)return e.pushPath(i),e}else if(this._size<0){const e=t.asJSON();if(Math.min(e.xmax-e.xmin,e.ymax-e.ymin)+2*this._size>0)return wt.z.fromJSONCIM({xmin:e.xmin-this._size,xmax:e.xmax+this._size,ymin:e.ymin-this._size,ymax:e.ymax+this._size})}const e=!this._preventClipping&&this._tileKey?Ht(t,this._maxInflateSize,!0):t;if(!e)continue;const s=Dt.module,i={...e.asJSON(),spatialReference:{wkid:y.A.WebMercator.wkid}},r=s.execute(i,this._size);return r?wt.z.fromJSONCIM(r):null}return null}}var Zt=s(95108);class Qt{static{this.instance=null}static local(){return null===Qt.instance&&(Qt.instance=new Qt),Qt.instance}execute(t,e,s){return new Jt(t,e,s)}}class Jt{constructor(t,e,s){this._defaultPointSize=20,this._inputGeometries=t,this._geomUnitsPerPoint=s,this._rule=e.rule??"FullGeometry",this._defaultSize=this._defaultPointSize*s}next(){let t;for(;t=this._inputGeometries.next();){const e=this._processGeom((0,Mt.x)(t));if(e?.length)return wt.z.fromJSONCIM({paths:e})}return null}_clone(t){return[t[0],t[1]]}_mid(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}_mix(t,e,s,i){return[t[0]*e+s[0]*i,t[1]*e+s[1]*i]}_add(t,e){return[t[0]+e[0],t[1]+e[1]]}_add2(t,e,s){return[t[0]+e,t[1]+s]}_sub(t,e){return[t[0]-e[0],t[1]-e[1]]}_dist(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}_norm(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}_normalize(t,e=1){const s=e/this._norm(t);t[0]*=s,t[1]*=s}_leftPerpendicular(t){const e=-t[1],s=t[0];t[0]=e,t[1]=s}_leftPerp(t){return[-t[1],t[0]]}_rightPerpendicular(t){const e=t[1],s=-t[0];t[0]=e,t[1]=s}_rightPerp(t){return[t[1],-t[0]]}_dotProduct(t,e){return t[0]*e[0]+t[1]*e[1]}_crossProduct(t,e){return t[0]*e[1]-t[1]*e[0]}_rotateDirect(t,e,s){const i=t[0]*e-t[1]*s,r=t[0]*s+t[1]*e;t[0]=i,t[1]=r}_makeCtrlPt(t){const e=[t[0],t[1]];return kt(e,1),e}_addAngledTicks(t,e,s,i){const r=this._sub(s,e);this._normalize(r);const n=this._crossProduct(r,this._sub(i,e));let o;o=n>0?this._rightPerp(r):this._leftPerp(r);const a=Math.abs(n)/2,h=[];h.push([e[0]+(o[0]-r[0])*a,e[1]+(o[1]-r[1])*a]),h.push(e),h.push(s),h.push([s[0]+(o[0]+r[0])*a,s[1]+(o[1]+r[1])*a]),t.push(h)}_addBezier2(t,e,s,i,r){if(0===r--)return void t.push(i);const n=this._mid(e,s),o=this._mid(s,i),a=this._mid(n,o);this._addBezier2(t,e,n,a,r),this._addBezier2(t,a,o,i,r)}_addBezier3(t,e,s,i,r,n){if(0===n--)return void t.push(r);const o=this._mid(e,s),a=this._mid(s,i),h=this._mid(i,r),c=this._mid(o,a),l=this._mid(a,h),u=this._mid(c,l);this._addBezier3(t,e,o,c,u,n),this._addBezier3(t,u,l,h,r,n)}_add90DegArc(t,e,s,i,r){const n=r??this._crossProduct(this._sub(s,e),this._sub(i,e))>0,o=this._mid(e,s),a=this._sub(o,e);n?this._leftPerpendicular(a):this._rightPerpendicular(a),o[0]+=a[0],o[1]+=a[1],this._addBezier3(t,e,this._mix(e,.33333,o,.66667),this._mix(s,.33333,o,.66667),s,4)}_addArrow(t,e,s){const i=e[0],r=e[1],n=e[e.length-1],o=this._sub(i,r),a=this._norm(o);this._normalize(o);const h=Math.abs(this._crossProduct(o,this._sub(n,r)));let c=this._dotProduct(o,this._sub(n,r));c<.05*a?c=.05*a:c>.95*a&&(c=.95*a);const l=.5*h,u=this._leftPerp(o),d=[r[0]+o[0]*c,r[1]+o[1]*c],p=e.length-1,_=[];_.push(s?[-u[0],-u[1]]:u);let f=[-o[0],-o[1]];for(let t=1;t<p-1;t++){const s=this._sub(e[t+1],e[t]);this._normalize(s);const i=this._dotProduct(s,f),r=this._crossProduct(s,f),n=Math.sqrt((1+i)/2),o=this._sub(s,f);this._normalize(o),o[0]/=n,o[1]/=n,_.push(r<0?[-o[0],-o[1]]:o),f=s}_.push(this._rightPerp(f));for(let s=_.length-1;s>0;s--)t.push([e[s][0]+_[s][0]*l,e[s][1]+_[s][1]*l]);t.push([d[0]+_[0][0]*l,d[1]+_[0][1]*l]),t.push([d[0]+_[0][0]*h,d[1]+_[0][1]*h]),t.push(i),t.push([d[0]-_[0][0]*h,d[1]-_[0][1]*h]),t.push([d[0]-_[0][0]*l,d[1]-_[0][1]*l]);for(let s=1;s<_.length;s++)t.push([e[s][0]-_[s][0]*l,e[s][1]-_[s][1]*l])}_addDash(t,e,s){const i=this._norm(s)/7;this._normalize(s);let r=[];for(let n=0;n<=7;n++)r.push([e[0]+s[0]*n*i,e[1]+s[1]*n*i]),1&n&&(t.push(r),r=[])}_cp2(t,e,s){return t.length>=2?t[1]:this._add2(t[0],e*this._defaultSize,s*this._defaultSize)}_cp3(t,e,s,i){if(t.length>=3)return t[2];const r=this._mix(t[0],1-s,e,s),n=this._sub(e,t[0]);return this._normalize(n),this._rightPerpendicular(n),[r[0]+n[0]*i*this._defaultSize,r[1]+n[1]*i*this._defaultSize]}_arrowPath(t){if(t.length>2)return t;const e=t[0],s=this._cp2(t,-4,0),i=this._sub(e,s);this._normalize(i);const r=this._rightPerp(i);return[e,s,[e[0]+(r[0]-i[0])*this._defaultSize,e[1]+(r[1]-i[1])*this._defaultSize]]}_arrowLastSeg(t){const e=t[0],s=this._cp2(t,-4,0);let i;if(t.length>=3)i=t[t.length-1];else{const t=this._sub(e,s);this._normalize(t);const r=this._rightPerp(t);i=[e[0]+(r[0]-t[0])*this._defaultSize,e[1]+(r[1]-t[1])*this._defaultSize]}return[s,i]}_processGeom(t){if(!t)return null;const e=[];for(const s of t){const t=s.length>1&&(0,Zt.Yl)(s)<this._defaultSize;if(!s||0===s.length||t)continue;const i=s.length;let r=s[0];switch(this._rule){case"PerpendicularFromFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=[];n.push(i),n.push(this._mid(r,t)),e.push(n);break}case"ReversedFirstSegment":{const t=this._cp2(s,0,-1);e.push([t,r]);break}case"PerpendicularToSecondSegment":{if(s.length<3)return[];const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=[];n.push(this._mid(t,i)),n.push(r),e.push(n);break}case"SecondSegmentWithTicks":{if(s.length<3)return[];const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);let o;o=this._crossProduct(n,this._sub(r,t))>0?this._rightPerp(n):this._leftPerp(n);const a=[];a.push([t[0]+(o[0]-n[0])/3,t[1]+(o[1]-n[1])/3]),a.push(t),a.push(i),a.push([i[0]+(o[0]+n[0])/3,i[1]+(o[1]+n[1])/3]),e.push(a);break}case"DoublePerpendicular":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push(r),h.push([i[0]+o[0]*a,i[1]+o[1]*a]),e.push(h);const c=[];c.push([i[0]-o[0]*a,i[1]-o[1]*a]),c.push(t),e.push(c);break}case"OppositeToFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push([i[0]+o[0]*a,i[1]+o[1]*a]),h.push([i[0]-o[0]*a,i[1]-o[1]*a]),e.push(h);break}case"TriplePerpendicular":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=this._mid(r,t),o=this._sub(n,i);this._normalize(o);const a=this._crossProduct(o,this._sub(r,i));this._leftPerpendicular(o);const h=[];h.push([i[0]+o[0]*a*.8,i[1]+o[1]*a*.8]),h.push([n[0]+.8*(r[0]-n[0]),n[1]+.8*(r[1]-n[1])]),e.push(h),e.push([i,n]);const c=[];c.push([i[0]-o[0]*a*.8,i[1]-o[1]*a*.8]),c.push([n[0]+.8*(t[0]-n[0]),n[1]+.8*(t[1]-n[1])]),e.push(c);break}case"HalfCircleFirstSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,4),n=this._mid(r,t);let o=this._sub(t,r);const a=Math.cos(Math.PI/18),h=Math.sin(Math.PI/18),c=Math.sqrt((1+a)/2),l=Math.sqrt((1-a)/2),u=[];let d;this._crossProduct(o,this._sub(i,r))>0?(u.push(r),o=this._sub(r,n),d=t):(u.push(t),o=this._sub(t,n),d=r),this._rotateDirect(o,c,l),o[0]/=c,o[1]/=c;for(let t=1;t<=18;t++)u.push(this._add(n,o)),this._rotateDirect(o,a,h);u.push(d),e.push(u);break}case"HalfCircleSecondSegment":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,1,-1);let n=this._sub(r,t);this._normalize(n);const o=this._crossProduct(n,this._sub(i,t))/2;this._leftPerpendicular(n);const a=[t[0]+n[0]*o,t[1]+n[1]*o];n=this._sub(t,a);const h=Math.cos(Math.PI/18);let c=Math.sin(Math.PI/18);o>0&&(c=-c);const l=[t];for(let t=1;t<=18;t++)this._rotateDirect(n,h,c),l.push(this._add(a,n));e.push(l);break}case"HalfCircleExtended":{const t=this._cp2(s,0,-2),n=this._cp3(s,t,1,-1);let o;if(i>=4)o=s[3];else{const e=this._sub(r,t);o=this._add(n,e)}const a=this._dist(t,n)/2/.75,h=this._sub(t,r);this._normalize(h,a);const c=this._sub(n,o);this._normalize(c,a);const l=[o,n];e.push(l);const u=[this._clone(n)];this._addBezier3(u,n,this._add(n,c),this._add(t,h),t,4),u.push(r),e.push(u);break}case"OpenCircle":{const t=this._cp2(s,-2,0),i=this._sub(t,r),n=Math.cos(Math.PI/18),o=-Math.sin(Math.PI/18),a=[t];for(let t=1;t<=33;t++)this._rotateDirect(i,n,o),a.push(this._add(r,i));e.push(a);break}case"CoverageEdgesWithTicks":{const t=this._cp2(s,0,-1);let n,o;if(i>=3)n=s[2];else{const e=this._sub(t,r),s=this._leftPerp(e);n=[r[0]+s[0]-.25*e[0],r[1]+s[1]-.25*e[1]]}if(i>=4)o=s[3];else{const e=this._mid(r,t),s=this._sub(r,t);this._normalize(s),this._leftPerpendicular(s);const i=this._crossProduct(s,this._sub(n,e));this._rightPerpendicular(s),o=[n[0]+s[0]*i*2,n[1]+s[1]*i*2]}const a=this._sub(t,r);let h,c;h=this._crossProduct(a,this._sub(n,r))>0?this._rightPerp(a):this._leftPerp(a),c=[],c.push(n),c.push(r),c.push([r[0]+(h[0]-a[0])/3,r[1]+(h[1]-a[1])/3]),e.push(c),h=this._crossProduct(a,this._sub(o,t))>0?this._rightPerp(a):this._leftPerp(a),c=[],c.push([t[0]+(h[0]+a[0])/3,t[1]+(h[1]+a[1])/3]),c.push(t),c.push(o),e.push(c);break}case"GapExtentWithDoubleTicks":{const t=this._cp2(s,0,2),n=this._cp3(s,t,0,1);let o;if(i>=4)o=s[3];else{const e=this._sub(t,r);o=this._add(n,e)}this._addAngledTicks(e,r,t,this._mid(n,o)),this._addAngledTicks(e,n,o,this._mid(r,t));break}case"GapExtentMidline":{const t=this._cp2(s,2,0),n=this._cp3(s,t,0,1);let o;if(i>=4)o=s[3];else{const e=this._sub(t,r);o=this._add(n,e)}const a=[];a.push(this._mid(r,n)),a.push(this._mid(t,o)),e.push(a);break}case"Chevron":{const t=this._cp2(s,-1,-1);let n;if(i>=3)n=s[2];else{const e=this._sub(t,r);this._leftPerpendicular(e),n=this._add(r,e)}e.push([t,this._makeCtrlPt(r),n]);break}case"PerpendicularWithArc":{const t=this._cp2(s,0,-2),n=this._cp3(s,t,.5,-1),o=this._sub(t,r),a=this._norm(o);o[0]/=a,o[1]/=a;const h=this._crossProduct(o,this._sub(n,r));let c=this._dotProduct(o,this._sub(n,r));c<.05*a?c=.05*a:c>.95*a&&(c=.95*a);const l=[r[0]+o[0]*c,r[1]+o[1]*c];let u=this._leftPerp(o),d=[];if(d.push([l[0]-u[0]*h,l[1]-u[1]*h]),d.push([l[0]+u[0]*h,l[1]+u[1]*h]),e.push(d),i>=4){const t=s[3];let i=this._dotProduct(o,this._sub(t,r));i<.1*a?i=.1*a:i>.9*a&&(i=.9*a);const n=[r[0]+o[0]*i,r[1]+o[1]*i],h=this._crossProduct(o,this._sub(t,r)),c=[];c.push([n[0]-u[0]*h,n[1]-u[1]*h]),c.push([n[0]+u[0]*h,n[1]+u[1]*h]),e.push(c)}const p=[t[0]+u[0]*h,t[1]+u[1]*h];u=this._sub(t,p);const _=Math.cos(Math.PI/18);let f=Math.sin(Math.PI/18);h<0&&(f=-f),d=[r,t];for(let t=1;t<=9;t++)this._rotateDirect(u,_,f),d.push(this._add(p,u));e.push(d);break}case"ClosedHalfCircle":{const t=this._cp2(s,2,0),i=this._mid(r,t),n=this._sub(t,i),o=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18),h=[r,t];for(let t=1;t<=18;t++)this._rotateDirect(n,o,a),h.push(this._add(i,n));e.push(h);break}case"TripleParallelExtended":{const t=this._cp2(s,0,-2),i=this._cp3(s,t,1,-2),n=this._mid(r,t),o=this._sub(i,t);this._normalize(o);const a=Math.abs(this._crossProduct(o,this._sub(n,t)))/2,h=this._dist(t,i),c=[t,r];c.push([r[0]+o[0]*h*.5,r[1]+o[1]*h*.5]),e.push(c);const l=[];l.push([n[0]-o[0]*a,n[1]-o[1]*a]),l.push([n[0]+o[0]*h*.375,n[1]+o[1]*h*.375]),kt(l[l.length-1],1),l.push([n[0]+o[0]*h*.75,n[1]+o[1]*h*.75]),e.push(l);const u=[t,i];e.push(u);break}case"ParallelWithTicks":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(i,t);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n),this._addAngledTicks(e,r,t,i),this._addAngledTicks(e,this._mix(r,1,n,o),this._mix(t,1,n,o),this._mid(r,t));break}case"Parallel":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._leftPerp(n),a=this._crossProduct(n,this._sub(i,r));let h=[r,t];e.push(h),h=[],h.push([r[0]+o[0]*a,r[1]+o[1]*a]),h.push([t[0]+o[0]*a,t[1]+o[1]*a]),e.push(h);break}case"PerpendicularToFirstSegment":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._mid(r,t),o=this._sub(t,r);this._normalize(o);const a=this._crossProduct(o,this._sub(i,r));this._leftPerpendicular(o);const h=[];h.push([n[0]-o[0]*a*.25,n[1]-o[1]*a*.25]),h.push([n[0]+o[0]*a*1.25,n[1]+o[1]*a*1.25]),e.push(h);break}case"ParallelOffset":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]-n[0]*o,r[1]-n[1]*o]),a.push([t[0]-n[0]*o,t[1]-n[1]*o]),e.push(a);const h=[];h.push([r[0]+n[0]*o,r[1]+n[1]*o]),h.push([t[0]+n[0]*o,t[1]+n[1]*o]),e.push(h);break}case"OffsetOpposite":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]-n[0]*o,r[1]-n[1]*o]),a.push([t[0]-n[0]*o,t[1]-n[1]*o]),e.push(a);break}case"OffsetSame":{const t=this._cp2(s,3,0),i=this._cp3(s,t,.5,-1),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n);const a=[];a.push([r[0]+n[0]*o,r[1]+n[1]*o]),a.push([t[0]+n[0]*o,t[1]+n[1]*o]),e.push(a);break}case"CircleWithArc":{let t=this._cp2(s,3,0);const n=this._cp3(s,t,.5,-1);let o,a;if(i>=4)o=s[3],a=this._crossProduct(this._sub(o,t),this._sub(n,t))>0;else{o=t,a=this._crossProduct(this._sub(o,r),this._sub(n,r))>0;const e=24*this._geomUnitsPerPoint,s=this._sub(o,r);this._normalize(s,e);const i=Math.sqrt(2)/2;this._rotateDirect(s,i,a?i:-i),t=this._add(r,s)}const h=this._sub(t,r),c=Math.cos(Math.PI/18),l=Math.sin(Math.PI/18),u=[t];for(let t=1;t<=36;t++)this._rotateDirect(h,c,l),u.push(this._add(r,h));this._add90DegArc(u,t,o,n,a),kt(u[u.length-8],1),e.push(u);break}case"DoubleJog":{let t,n=this._cp2(s,-3,1),o=this._cp3(s,n,-1,-.5);if(i>=4)t=s[3];else{const e=r;r=n,t=o;const s=this._dist(r,e),i=this._dist(t,e);let a=30*this._geomUnitsPerPoint;.5*s<a&&(a=.5*s),.5*i<a&&(a=.5*i),n=this._mix(r,a/s,e,(s-a)/s),o=this._mix(t,a/i,e,(i-a)/i)}const a=this._mid(r,n),h=this._mid(t,o),c=this._dist(r,n),l=this._dist(o,t);let u=Math.min(c,l)/8;u=Math.min(u,24*this._geomUnitsPerPoint);const d=Math.cos(Math.PI/4);let p=this._sub(r,n);this._normalize(p,u),this._crossProduct(p,this._sub(t,n))>0?this._rotateDirect(p,d,-d):this._rotateDirect(p,d,d);let _=[];_.push(n),_.push(this._add(a,p)),_.push(this._sub(a,p)),_.push(r),e.push(_),p=this._sub(t,o),this._normalize(p,u),this._crossProduct(p,this._sub(r,o))<0?this._rotateDirect(p,d,d):this._rotateDirect(p,d,-d),_=[],_.push(o),_.push(this._add(h,p)),_.push(this._sub(h,p)),_.push(t),e.push(_);break}case"PerpendicularOffset":{const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);this._crossProduct(n,this._sub(r,t))>0?this._rightPerpendicular(n):this._leftPerpendicular(n);const o=[n[0]/8,n[1]/8],a=this._sub(this._mid(t,i),o);e.push([a,r]);break}case"LineExcludingLastSegment":{const t=this._arrowPath(s),i=[];let r=t.length-2;for(;r--;)i.push(t[r]);e.push(i);break}case"MultivertexArrow":{const t=this._arrowPath(s),i=[];this._addArrow(i,t,!1),e.push(i);break}case"CrossedArrow":{const t=this._arrowPath(s),i=[];this._addArrow(i,t,!0),e.push(i);break}case"ChevronArrow":{const[t,i]=this._arrowLastSeg(s),n=10*this._geomUnitsPerPoint,o=this._sub(r,t),a=this._norm(o);this._normalize(o);const h=this._crossProduct(o,this._sub(i,t));let c=this._dotProduct(o,this._sub(i,t));c<.05*a?c=.05*a:c>.95*a-n&&(c=.95*a-n);const l=[t[0]+o[0]*c,t[1]+o[1]*c],u=this._leftPerp(o),d=[];d.push([l[0]+u[0]*h+o[0]*n,l[1]+u[1]*h+o[1]*n]),d.push(r),d.push([l[0]-u[0]*h+o[0]*n,l[1]-u[1]*h+o[1]*n]),e.push(d);break}case"ChevronArrowOffset":{const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);const a=this._crossProduct(n,this._sub(i,t));let h=this._dotProduct(n,this._sub(i,t));h<.05*o?h=.05*o:h>.95*o&&(h=.95*o);const c=[t[0]+n[0]*h,t[1]+n[1]*h];this._leftPerpendicular(n);const l=[];l.push([c[0]+n[0]*a*.5,c[1]+n[1]*a*.5]),l.push(this._mid(c,r)),l.push([c[0]-n[0]*a*.5,c[1]-n[1]*a*.5]),e.push(l);break}case"PartialFirstSegment":{const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);let a=this._dotProduct(n,this._sub(i,t));a<.05*o?a=.05*o:a>.95*o&&(a=.95*o);const h=[t[0]+n[0]*a,t[1]+n[1]*a];e.push([t,h]);break}case"Arch":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,1),n=this._sub(r,t),o=this._mix(i,1,n,.55),a=this._mix(i,1,n,-.55),h=[r];this._addBezier2(h,r,o,i,4),this._addBezier2(h,i,a,t,4),e.push(h);break}case"CurvedParallelTicks":{const t=this._cp2(s,-4,1),i=this._cp3(s,t,.882353,-1.94),n=this._sub(i,t);this._crossProduct(n,this._sub(r,t))>0?this._rightPerpendicular(n):this._leftPerpendicular(n);const o=[n[0]/8,n[1]/8],a=this._sub(this._mid(t,i),o),h=this._sub(this._mix(t,.75,i,.25),o),c=this._sub(this._mix(t,.25,i,.75),o),l=[t];this._addBezier2(l,t,h,a,3),this._addBezier2(l,a,c,i,3),e.push(l);for(let t=0;t<8;t++){const s=l[2*t+1],i=[this._clone(s)];i.push(this._add(s,[n[0]/4,n[1]/4])),e.push(i)}break}case"Arc90Degrees":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,1),n=[t];this._add90DegArc(n,t,r,i),e.push(n);break}case"TipWithPerpendicularAndTicks":{const[t,i]=this._arrowLastSeg(s),n=10*this._geomUnitsPerPoint,o=this._sub(r,t),a=this._norm(o);this._normalize(o);let h=this._crossProduct(o,this._sub(i,t)),c=this._dotProduct(o,this._sub(i,t));c<.05*a?c=.05*a:c>.95*a-n&&(c=.95*a-n);const l=this._leftPerp(o),u=[r[0]-o[0]*n,r[1]-o[1]*n],d=.5*Math.max(a-c-n,n);h=Math.abs(h);const p=[];p.push([u[0]+l[0]*(h+d)-o[0]*d,u[1]+l[1]*(h+d)-o[1]*d]),p.push([u[0]+l[0]*h,u[1]+l[1]*h]),p.push([u[0]-l[0]*h,u[1]-l[1]*h]),p.push([u[0]-l[0]*(h+d)-o[0]*d,u[1]-l[1]*(h+d)-o[1]*d]),e.push(p),e.push([u,r]);break}case"ConcentricCircles":{const t=this._cp2(s,1,0),n=this._cp3(s,t,2,0),o=Math.cos(Math.PI/18),a=Math.sin(Math.PI/18);let h=this._dist(t,r),c=[h,0],l=[];for(let t=0;t<=36;t++)l.push(this._add(r,c)),this._rotateDirect(c,o,a);if(e.push(l),i>=4){l=[];const t=s[3];h=this._dist(t,r),c=[h,0];for(let t=0;t<=36;t++)l.push(this._add(r,c)),0===t&&(l.push(this._add(r,c)),kt(l[1],1)),this._rotateDirect(c,o,a);e.push(l)}l=[],h=this._dist(n,r),c=[h,0];for(let t=0;t<=36;t++)l.push(this._add(r,c)),this._rotateDirect(c,o,a);e.push(l);break}case"DoubleJogArrow":{r=this._arrowPath(s)[0];const[t,i]=this._arrowLastSeg(s),n=this._sub(r,t),o=this._norm(n);this._normalize(n);const a=Math.abs(this._crossProduct(n,this._sub(i,r)));let h=Math.abs(this._dotProduct(n,this._sub(i,r)));h<.05*o?h=.05*o:h>.95*o&&(h=.95*o);const c=Math.max(a,h),l=this._leftPerp(n);let u=[];const d=[r[0]-n[0]*h*.5+l[0]*a*.5,r[1]-n[1]*h*.5+l[1]*a*.5];u.push([d[0],d[1]]),d[0]+=n[0]*c*.5+l[0]*c*.4,d[1]+=n[1]*c*.5+l[1]*c*.4,u.push([d[0],d[1]]),d[0]-=l[0]*c*.25,d[1]-=l[1]*c*.25,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5+l[0]*c*.4,d[1]+=n[1]*c*.5+l[1]*c*.4,u.push([d[0],d[1]]),e.push(u),u=[],d[0]=r[0]-n[0]*h*.5-l[0]*a*.5,d[1]=r[1]-n[1]*h*.5-l[1]*a*.5,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5-l[0]*c*.4,d[1]+=n[1]*c*.5-l[1]*c*.4,u.push([d[0],d[1]]),d[0]+=l[0]*c*.25,d[1]+=l[1]*c*.25,u.push([d[0],d[1]]),d[0]+=n[0]*c*.5-l[0]*c*.4,d[1]+=n[1]*c*.5-l[1]*c*.4,u.push([d[0],d[1]]),e.push(u);break}case"LinkedChevrons":{const t=this._cp2(s,-5,0),i=this._cp3(s,t,-.2,1),n=this._sub(r,t);this._normalize(n);const o=this._leftPerp(n),a=Math.abs(this._crossProduct(n,this._sub(i,t)));e.push([t,r]);const h=[];h.push([r[0]-n[0]*a+o[0]*a,r[1]-n[1]*a+o[1]*a]),h.push(r),h.push([r[0]-n[0]*a-o[0]*a,r[1]-n[1]*a-o[1]*a]),e.push(h),this._addDash(e,t,[-n[0]*a+o[0]*a,-n[1]*a+o[1]*a]),this._addDash(e,t,[-n[0]*a-o[0]*a,-n[1]*a-o[1]*a]);break}case"SegmentThenHalfCircle":{const t=this._cp2(s,2,0),n=this._cp3(s,t,1.5,0);let o;o=i>=4?s[3]:this._cp3(s,t,1.25,-.5);const a=this._sub(t,r);this._normalize(a);const h=.5*this._dist(t,n),c=this._crossProduct(a,this._sub(o,r))>0,l=Math.cos(Math.PI/18);let u=Math.sin(Math.PI/18);c&&(u=-u);const d=[r,t];a[0]*=h,a[1]*=h;const p=this._add(t,a);a[0]=-a[0],a[1]=-a[1];for(let t=1;t<=18;t++)this._rotateDirect(a,l,u),d.push(this._add(p,a));e.push(d);break}case"LineWithStraightTicks":{const t=this._cp2(s,-2,1),i=this._cp3(s,t,-1,-.5),n=this._sub(i,t);this._normalize(n);const o=this._dotProduct(n,this._sub(t,r)),a=this._dotProduct(n,this._sub(i,r));let h=[r];h.push([r[0]+n[0]*o,r[1]+n[1]*o]),h.push(t),e.push(h),h=[r],h.push([r[0]+n[0]*a,r[1]+n[1]*a]),h.push(i),e.push(h);break}case"DoubleCurve":{const t=this._cp2(s,-5,-1),i=this._cp3(s,t,2,0),n=Math.atan2(1,5),o=Math.cos(n),a=Math.sin(n),h=this._sub(t,r),c=this._dist(r,t);this._normalize(h),this._rotateDirect(h,o,-a);const l=[r];l.push([r[0]+h[0]*c*.5,r[1]+h[1]*c*.5]),kt(l[1],1),l.push([r[0]+h[0]*c*.8,r[1]+h[1]*c*.8]),this._addBezier2(l,l[2],[r[0]+h[0]*c,r[1]+h[1]*c],t,3);const u=this._sub(i,t),d=this._dist(t,i);this._normalize(u),this._rotateDirect(u,o,-a),this._addBezier2(l,t,[i[0]-u[0]*d,i[1]-u[1]*d],[i[0]-u[0]*d*.8,i[1]-u[1]*d*.8],3),l.push(i),e.push(l);break}case"ParallelWithTicksByWidth":{const t=this._cp2(s,0,-1),i=this._cp3(s,t,.5,3),n=this._sub(t,r);this._normalize(n);const o=this._crossProduct(n,this._sub(i,r));this._leftPerpendicular(n),o>0?(this._addAngledTicks(e,r,[r[0]+n[0]*o,r[1]+n[1]*o],t),this._addAngledTicks(e,t,[t[0]+n[0]*o,t[1]+n[1]*o],r)):(this._addAngledTicks(e,[r[0]+n[0]*o,r[1]+n[1]*o],r,t),this._addAngledTicks(e,[t[0]+n[0]*o,t[1]+n[1]*o],r,t));break}case"EnclosingRoundedRectangle":{const t=this._cp2(s,3,-2),e=[Math.min(r[0],t[0]),Math.max(r[1],t[1])],i=[Math.max(r[0],t[0]),Math.min(r[1],t[1])],n=i[0]-e[0],o=e[1]-i[1],a=Math.min(n,o)/10,h=[];h.push([e[0]+a+.75*(n-2*a),e[1]]),h.push([i[0]-a,e[1]]),this._add90DegArc(h,[i[0]-a,e[1]],[i[0],e[1]-a],[i[0],e[1]]),h.push([i[0],i[1]+a]),this._add90DegArc(h,[i[0],i[1]+a],[i[0]-a,i[1]],i),h.push([e[0]+a,i[1]]),this._add90DegArc(h,[e[0]+a,i[1]],[e[0],i[1]+a],[e[0],i[1]]),h.push([e[0],e[1]-a]),this._add90DegArc(h,[e[0],e[1]-a],[e[0]+a,e[1]],e),h.push([e[0]+a+.75*(n-2*a),e[1]]);break}default:e.push(s)}}return e}}class Kt{static{this.instance=null}static local(){return null===Kt.instance&&(Kt.instance=new Kt),Kt.instance}execute(t,e,s){return new te(t,e,s)}}class te extends At{constructor(t,e,s){super(t,!0,!0),this._curveHelper=new Et,this._beginCut=(void 0!==e.beginCut?e.beginCut:1)*s,this._endCut=(void 0!==e.endCut?e.endCut:1)*s,this._middleCut=(void 0!==e.middleCut?e.middleCut:0)*s,this._invert=void 0!==e.invert&&e.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:e,_endCut:s,_middleCut:i}=this,r=t.pathLength(),n=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(0!==e||0!==s||0!==i)if(e+s+i>=r)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(n,t,0,e),this._curveHelper.appendSubCurve(n,t,.5*(r-i),.5*(r+i)),this._curveHelper.appendSubCurve(n,t,r-s,s)}else if(0===e&&0===s&&0===i)for(n.startPath();t.nextPoint();)n.pushXY(t.x,t.y);else e+s+i<r&&(0===i?this._curveHelper.appendSubCurve(n,t,e,r-s):(this._curveHelper.appendSubCurve(n,t,e,.5*(r-i)),this._curveHelper.appendSubCurve(n,t,.5*(r+i),r-s)));return 0===n.totalSize?null:n}}class ee{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return 0===this._values.length}size(){return this._values.length}init(t,e,s=!0){if(this._setEmpty(),!t||0===t.length)return!1;for(let e=0;e<t.length;e++){let i=Math.abs(t[e]);s&&i<1e-7&&(i=1e-7),this._values.push(i),this._length+=i}return e&&1&t.length&&(this._length*=2),0!==this._length&&(this.ctrlPtGap=this.extPtGap=0,this._currentValue=-1,!0)}scale(t){const e=this._values?this._values.length:0;for(let s=0;s<e;++s)this._values[s]*=t;this._length*=t,this.extPtGap*=t,this.ctrlPtGap*=t}addValue(t){this._length+=t,this._values.push(t)}firstValue(){return this._values[0]}lastValue(){return this._values[this._values.length-1]}nextValue(){return this._currentValue++,this._currentValue===this._values.length&&(this._currentValue=0),this._values[this._currentValue]}reset(){this._currentValue=-1}length(){return this._length}_setEmpty(){this.extPtGap=this.ctrlPtGap=this._length=0,this._currentValue=-1,this._values.length=0}}class se{constructor(){this.pt=null,this.ca=0,this.sa=0}}class ie{constructor(){this.reset()}reset(){this.segment=null,this.segmentLength=0,this.abscissa=0,this.isPathEnd=!1,this.isPartEnd=!1}isValid(){return null!==this.segment}copyTo(t){t.segment=this.segment,t.segmentLength=this.segmentLength,t.abscissa=this.abscissa,t.isPathEnd=this.isPathEnd,t.isPartEnd=this.isPartEnd}}class re extends Et{constructor(t=0,e=!1){super(t,e),this._tempPos=new ie,this._tempPt=[0,0],this._tolerance=Ft,this._currentPosition=new ie}updateTolerance(t){this._tolerance=Ft*t}init(t,e,s=!0){return s?(this._patternLength=e.length(),this._partExtPtGap=e.extPtGap,this._partCtrlPtGap=e.ctrlPtGap):(this._patternLength=0,this._partExtPtGap=0,this._partCtrlPtGap=0),this._currentPosition.reset(),this._partSegCount=0,this._pathCursor=t,this._seg=-1,this._setPosAtNextPart()}curPositionIsValid(){return this._currentPosition.isValid()}nextPosition(t,e=0){const s=new ie;return!!this._nextPosition(t,s,null,e)&&(s.copyTo(this._currentPosition),!0)}curPointAndAngle(t){t.pt=this._getPoint(this._currentPosition);const[e,s]=this._getAngleCS(this._tempPt,this._currentPosition);t.ca=e,t.sa=s}nextPointAndAngle(t,e,s=0){const i=this._tempPos;if(!this._nextPosition(t,i,null,s))return!1;i.copyTo(this._currentPosition),e.pt=this._getPoint(i);const[r,n]=this._getAngleCS(this._tempPt,i);return e.ca=r,e.sa=n,!0}nextCurve(t){if(0===t)return null;const e=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");e.startPath(),e.nextPath();const s=new ie;return this._nextPosition(t,s,e,1)?(s.copyTo(this._currentPosition),e):null}isPathEnd(){return this._currentPosition.isPathEnd}getPathEnd(){return this._currentPosition.segment[1]}getPt(t){return this._pathCursor.seekInPath(t),[this._pathCursor.x,this._pathCursor.y]}getSeg(t){return[this.getPt(t),this.getPt(t+1)]}_nextPosition(t,e,s,i){if(this._currentPosition.isPathEnd)return!1;let r=this._currentPosition.abscissa;for(this._currentPosition.segmentLength>0&&(r/=this._currentPosition.segmentLength),this._currentPosition.copyTo(e);e.abscissa+t*this._partLengthRatio>e.segmentLength+this._tolerance;){if(s){if(0===s.pathSize)if(0===r){const t=e.segment[0];s.pushXY(t[0],t[1])}else s.pushPoint(this.getSegCoord2D(e.segment,r));const t=e.segment[1];s.pushXY(t[0],t[1])}if(r=0,t-=(e.segmentLength-e.abscissa)/this._partLengthRatio,this._partSegCount)e.segment=this._nextSegment(),e.segmentLength=this.getSegLength(e.segment),e.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return 0!==i&&(e.segmentLength=this.getSegLength(e.segment),e.isPartEnd=!0,1===i?(e.abscissa=e.segmentLength,e.isPathEnd=!0):e.abscissa=e.segmentLength+t,!0);this._currentPosition.copyTo(e)}}if(e.abscissa+=t*this._partLengthRatio,s){0===s.pathSize&&(0===r?s.pushPoint(e.segment[0]):s.pushPoint(this.getSegCoord2D(e.segment,r)));const t=e.abscissa/e.segmentLength;1===t?s.pushPoint(e.segment[1]):s.pushPoint(this.getSegCoord2D(e.segment,t))}return this._partSegCount||Math.abs(e.abscissa-e.segmentLength)<this._tolerance&&(e.isPathEnd=this._partIsLast,e.isPartEnd=!0),!0}_getPoint(t){const e=t.segmentLength<=0?0:t.abscissa/t.segmentLength;return this.getSegCoord2D(this._currentPosition.segment,e)}_getAngleCS(t,e){const s=e.segmentLength<=0?0:e.abscissa/e.segmentLength;return this.getSegAngleCS(t,this._currentPosition.segment,s)}_setPosAtNextPart(){for(;this._partSegCount;)this._hasNextSegment()&&this._nextSegment(),this._partSegCount--;if(!this._hasNextSegment())return!1;for(this._partLength=0,this._partIsLast=!0,this._partSegCount=0;this._hasNextSegment();)if(this._partLength+=this.getSegLength(this._nextSegment()),this._partSegCount++,this._pathCursor.getControlPointAt(this._getEndPointIndex())){this._partIsLast=!this._hasNextSegment();break}let t=this._partSegCount;for(;t;)this._previousSegment(),--t;this._currentPosition.segment=this._nextSegment(),this._currentPosition.segmentLength=this.getSegLength(this._currentPosition.segment),this._currentPosition.abscissa=0,this._currentPosition.isPathEnd=this._currentPosition.isPartEnd=!1,--this._partSegCount;const e=this._getStartPointIndex();this._ctrlPtBegin=this._pathCursor.getControlPointAt(e);let s=e+this._partSegCount+1;if(s>=this._pathCursor.pathSize&&(s=0),this._ctrlPtEnd=this._pathCursor.getControlPointAt(s),this._patternLength>0){const t=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,e=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let s=Math.round((this._partLength-(t+e))/this._patternLength);s<=0&&(s=t+e>0?0:1),this._partLengthRatio=this._partLength/(t+e+s*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg<this._pathCursor.pathSize-2}_previousSegment(){return this.getSeg(--this._seg)}_nextSegment(){return this.getSeg(++this._seg)}_getStartPointIndex(){return this._seg}_getEndPointIndex(){return this._seg+1}}class ne{static{this.instance=null}static local(){return null===ne.instance&&(ne.instance=new ne),ne.instance}execute(t,e,s){return new oe(t,e,s)}}class oe extends At{constructor(t,e,s){super(t,!0,!0),this._firstCurve=null,this._walker=new re,this._walker.updateTolerance(s),this._endings=e.lineDashEnding,this._customDashPos=-(e.offsetAlongLine??0)*s,this._offsetAtEnd=(e.customEndingOffset??0)*s;let i=(0,Lt.FH)(e).dashTemplate;null==i&&(i=[]),i.length%2&&(i=[...i,...i]),this._pattern=new ee,this._pattern.init(i,!0),this._pattern.scale(s)}processPath(t){if(0===this._pattern.length()){this.iteratePath=!1;const e=(0,Mt.A)(t);return wt.z.fromJSONCIM({paths:[e]})}if(!this.iteratePath){let e=!0;switch(this._endings){case"HalfPattern":case"HalfGap":default:this._pattern.extPtGap=0;break;case"FullPattern":this.isClosed||(this._pattern.extPtGap=.5*this._pattern.firstValue());break;case"FullGap":this.isClosed||(this._pattern.extPtGap=.5*this._pattern.lastValue());break;case"NoConstraint":this.isClosed||(e=!1);break;case"Custom":this.isClosed||(this._pattern.extPtGap=.5*this._offsetAtEnd)}const s=t.pathLength();if(this._pattern.isEmpty()||s<.1*this._pattern.length()){const e=(0,Mt.A)(t);return wt.z.fromJSONCIM({paths:[e]})}if(!this._walker.init(t,this._pattern,e)){const e=(0,Mt.A)(t);return wt.z.fromJSONCIM({paths:[e]})}}let e;if(this.iteratePath)e=this._pattern.nextValue();else{let t;switch(this._endings){case"HalfPattern":default:t=.5*this._pattern.firstValue();break;case"HalfGap":t=.5*-this._pattern.lastValue();break;case"FullGap":t=-this._pattern.lastValue();break;case"FullPattern":t=0;break;case"NoConstraint":case"Custom":t=-this._customDashPos}let s=t/this._pattern.length();s-=Math.floor(s),t=s*this._pattern.length(),this._pattern.reset(),e=this._pattern.nextValue();let i=!1;for(;t>=e;)t-=e,e=this._pattern.nextValue(),i=!i;e-=t,i?(this._walker.nextPosition(e),e=this._pattern.nextValue()):this.isClosed&&(this._firstCurve=this._walker.nextCurve(e),e=this._pattern.nextValue(),this._walker.nextPosition(e),e=this._pattern.nextValue())}let s=this._walker.nextCurve(e);if(s)if(this._walker.isPathEnd()){if(this.iteratePath=!1,this._firstCurve){for(this._firstCurve.nextPath();this._firstCurve.nextPoint();)s.pushXY(this._firstCurve.x,this._firstCurve.y);this._firstCurve=null}}else e=this._pattern.nextValue(),!this._walker.nextPosition(e)||this._walker.isPathEnd()?(this.iteratePath=!1,this._firstCurve&&(s.pushCursor(this._firstCurve),this._firstCurve=null)):this.iteratePath=!0;else this.iteratePath=!1,s=this._firstCurve,this._firstCurve=null;return s?.reset(),s}}class ae{static{this.instance=null}static local(){return null===ae.instance&&(ae.instance=new ae),ae.instance}execute(t,e,s,i,r,n){return new he(t,e,s,i,r,n)}}class he{constructor(t,e,s,i,r,n){this._preventClipping=n,this._inputGeometries=t,this._tileKey=i,this._maxInflateSize=r*s,this._width=(void 0!==e.width?e.width:2)*s,e.method,this._option=e.option}next(){let t;for(;t=this._inputGeometries.next();){if("esriGeometryEnvelope"===t.geometryType&&this._width>0){const e=t.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?t:wt.z.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if("esriGeometryPolygon"===t.geometryType){if(0===this._width)return t.clone();const e=Dt.module,s=!this._preventClipping&&this._tileKey?Ht(t,this._maxInflateSize,!0):t.clone();if(!s)continue;const i={...s.asJSON(),spatialReference:{wkid:y.A.WebMercator.wkid}},r=e.execute(i,-this._width);if(r)for(const t of r.rings)if(t){s.startPath();for(const e of t.reverse())s.pushXY(e[0],s.yFactor*e[1])}return s}}return null}}var ce=s(6606);class le{static{this.instance=null}static local(){return null===le.instance&&(le.instance=new le),le.instance}execute(t,e){return new ue(t,e)}}class ue{constructor(t,e){this._inputGeometries=t,this._medhod=e.method}next(){let t=this._inputGeometries.next();const e=this._medhod;for(;null!=t;){if(t.totalSize>0)switch(e){case"RectangularBox":return de(t);case"ConvexHull":return this._constructConvexHull(t);default:return pe(t)}t=this._inputGeometries.next()}return null}_constructConvexHull(t){switch(t.geometryType){case"esriGeometryPolyline":case"esriGeometryPolygon":{const e=Gt.module,s={...t.asJSON(),spatialReference:{wkid:y.A.WebMercator.wkid}},i=e.execute(s);return i?wt.z.fromJSONCIM(i):null}case"esriGeometryEnvelope":return t;default:return null}}}function de(t){const e=(0,ce.z8)(t),s={xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3]};return wt.z.fromJSONCIM(s)}function pe(t){switch(t.geometryType){case"esriGeometryPolyline":{const e=[];for(;t.nextPath();)_e(t,e);return wt.z.fromJSONCIM({rings:e})}case"esriGeometryPolygon":case"esriGeometryEnvelope":return t;default:return null}}function _e(t,e){if(t.seekPathStart(),!t.nextPoint())return;const s=t.x,i=t.y,r=[[s,i]];for(e.push(r);t.nextPoint();)r.push([t.x,t.y]);r.push([s,i])}class fe{static{this.instance=null}static local(){return null===fe.instance&&(fe.instance=new fe),fe.instance}execute(t,e,s){return new me(t,e,s)}}class me extends At{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new Et,this._length=(void 0!==e.length?e.length:20)*s,this._angle=void 0!==e.angle?e.angle:225,this._position=void 0!==e.position?e.position:50,this._length<0&&(this._length=-this._length),this._position<20&&(this._position=20),this._position>80&&(this._position=80),this._mirror=!1}processPath(t){const e=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._curveHelper.isEmpty(t))return null;t.seekInPath(0);const s=t.x,i=t.y;t.seekInPath(t.pathSize-1);const r=t.x,n=t.y,o=[r-s,n-i];this._curveHelper.normalize(o);const a=s+(r-s)*this._position/100,h=i+(n-i)*this._position/100,c=Math.cos((90-this._angle)/180*Math.PI);let l=Math.sin((90-this._angle)/180*Math.PI);this._mirror&&(l=-l),this._mirror=!this._mirror;const u=[a-this._length/2*c,h-this._length/2*l],d=[a+this._length/2*c,h+this._length/2*l];return e.pushPath([[s,i],u,d,[r,n]]),e}}class ge{static{this.instance=null}static local(){return null===ge.instance&&(ge.instance=new ge),ge.instance}execute(t,e,s){return new ye(t,e,s)}}class ye{constructor(t,e,s){this._inputGeometries=t,this._offsetX=void 0!==e.offsetX?e.offsetX*s:0,this._offsetY=void 0!==e.offsetY?e.offsetY*s:0}next(){let t=this._inputGeometries.next();for(;t;){if(t.totalSize>0)return this._move(t.clone(),this._offsetX,this._offsetY);t=this._inputGeometries.next()}return null}_move(t,e,s){for(;t.nextPath();)for(;t.nextPoint();)t.x=t.x+e,t.y=t.y+s;return t.reset(),t}}var xe=s(65864);class be{static{this.instance=null}static local(){return null===be.instance&&(be.instance=new be),be.instance}execute(t,e,s,i,r,n){return new we(t,e,s,i,r,n)}}class we{constructor(t,e,s,i,r,n){this._preventClipping=n,this._inputGeometries=t,this._tileKey=i,this._curveHelper=new Et,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(r*s),10),this._option=e.option,this._offsetFlattenError=Ft*s}next(){let t;for(;t=this._inputGeometries.next();){if(0===this._offset)return t.clone();if("esriGeometryEnvelope"===t.geometryType){if("Rounded"===this._method&&this._offset>0){const e=(0,Mt.A)(t),s=this._curveHelper.offset(e,-this._offset,this._method,4,this._offsetFlattenError);if(s){const e=wt.z.createEmptyOptimizedCIM(t.geometryType);return e.pushPath(s),e}return null}const e=t.asJSON();if((0,xe.ZC)(e)&&Math.min(e.xmax-e.xmin,e.ymax-e.ymin)+2*this._offset>0)return wt.z.fromJSONCIM({xmin:e.xmin-this._offset,xmax:e.xmax+this._offset,ymin:e.ymin-this._offset,ymax:e.ymax+this._offset})}const e=!this._preventClipping&&this._tileKey?Ht(t,this._maxInflateSize,!0):t.clone();if(!e)continue;const s=Ut.module,i=qt.module,r={...e.asJSON(),spatialReference:{wkid:y.A.WebMercator.wkid}};let n,o=ve(this._method);return"esriGeometryPolygon"===t.geometryType&&this._offset>0?("square"===o&&(o="bevel"),n=i.executeMany([r],[this._offset],o,"round")[0]):n=s.execute(r,-this._offset,{joins:o,flattenError:this._offsetFlattenError,miterLimit:4}),n?wt.z.fromJSONCIM(n):null}return null}}function ve(t){switch(t){case"Rounded":return"round";case"Bevelled":return"bevel";case"Mitered":return"miter";case"Square":return"square"}}var Se=s(12359);class Ie{static{this.instance=null}static local(){return null===Ie.instance&&(Ie.instance=new Ie),Ie.instance}execute(t,e,s){return new Pe(t,e,s)}}class Pe{constructor(t,e,s){this._inputGeometries=t,this._length=(void 0!==e.length?e.length:vt.D.CIMGeometricEffectRadial.length)*s,this._angle=void 0!==e.angle?e.angle*Math.PI/180:vt.D.CIMGeometricEffectRadial.angle,this._lx=Math.cos(this._angle)*this._length,this._ly=Math.sin(this._angle)*this._length}next(){let t=this._inputGeometries.next();for(;t;){if("esriGeometryPoint"===t.geometryType||"esriGeometryMultipoint"===t.geometryType){const e=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");return t.nextPath()&&t.nextPoint()&&e.pushPath([[t.x,t.y],[t.x+this._lx,t.y+this._ly]]),e}if("esriGeometryPolygon"===t.geometryType){const e=(0,Se.IK)(t);if(!e)return null;const s=wt.z.createEmptyOptimizedCIM("esriGeometryPolyline");return s.pushPath([[e[0],e[1]],[e[0]+this._lx,e[1]+this._ly]]),s}t=this._inputGeometries.next()}return null}}class Me{static{this.instance=null}static local(){return null===Me.instance&&(Me.instance=new Me),Me.instance}execute(t,e,s){return new Te(t,e,s)}}class Te{constructor(t,e,s){this._inputGeometries=t,this._reverse=void 0===e.reverse||e.reverse}next(){let t=this._inputGeometries.next();for(;t;){if(!this._reverse)return t;if("esriGeometryPolyline"===t.geometryType)return ke(t.clone());t=this._inputGeometries.next()}return null}}function ke(t){for(;t.nextPath();)for(let e=0;e<t.pathSize/2;e++){t.seekInPath(e);const s=t.x,i=t.y;t.seekInPath(t.pathSize-e-1);const r=t.x,n=t.y;t.x=s,t.y=i,t.seekInPath(e),t.x=r,t.y=n}return t.reset(),t}class Ce{static{this.instance=null}static local(){return null===Ce.instance&&(Ce.instance=new Ce),Ce.instance}execute(t,e,s){return new Ae(t,e,s)}}class Ae{constructor(t,e,s){this._inputGeometries=t,this._rotateAngle=void 0!==e.angle?e.angle*Math.PI/180:0}next(){let t=this._inputGeometries.next();for(;t;){if(0===this._rotateAngle||"esriGeometryPoint"===t.geometryType)return t;if(t.totalSize>0){const e=(0,ce.z8)(t),s=(e[2]+e[0])/2,i=(e[3]+e[1])/2;return t.reset(),this._rotate(t.clone(),s,i)}t=this._inputGeometries.next()}return null}_rotate(t,e,s){const i=Math.cos(this._rotateAngle),r=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const n=t.x-e,o=t.y-s;t.x=e+n*i-o*r,t.y=s+n*r+o*i}return t.reset(),t}}class Fe{static{this.instance=null}static local(){return null===Fe.instance&&(Fe.instance=new Fe),Fe.instance}execute(t,e,s){return new Ee(t,e,s)}}class Ee{constructor(t,e,s){this._inputGeometries=t,this._xFactor=void 0!==e.xScaleFactor?e.xScaleFactor:1.15,this._yFactor=void 0!==e.yScaleFactor?e.yScaleFactor:1.15}next(){const t=this._inputGeometries.next();if(t){if(1===this._xFactor&&1===this._yFactor)return t;if("esriGeometryPoint"===t.geometryType)return t;if(t.totalSize>0){const e=(0,ce.z8)(t),s=(e[2]+e[0])/2,i=(e[3]+e[1])/2;return t.reset(),this._scaleCursor(t.clone(),s,i)}}return null}_scaleCursor(t,e,s){for(;t.nextPath();)for(;t.nextPoint();)t.x=e+(t.x-e)*this._xFactor,t.y=s+(t.y-s)*this._yFactor;return t.reset(),t}}class ze{constructor(){this._polyline=[]}beginPath(t){this._polyline.push([t])}lineTo(t){if(0===this._polyline.length)throw new Error("No path started. Call beginPath first.");this._polyline[this._polyline.length-1].push(t)}getPointCount(){return this._polyline.reduce((t,e)=>t+e.length,0)}addSegment(t,e,s){s&&this.beginPath(t),this.lineTo(e)}getXY(t){let e=0;for(const s of this._polyline){if(t<e+s.length)return s[t-e];e+=s.length}return null}getGeometry(){return this._polyline}}class Re{static{this.instance=null}static local(){return null===Re.instance&&(Re.instance=new Re),Re.instance}execute(t,e,s){return new Oe(t,e,s)}}class Oe extends At{constructor(t,e,s){super(t,!1,!0),this._suppress=void 0!==e.suppress&&e.suppress,this._invert=void 0!==e.invert&&e.invert}processPath(t){if(t.totalSize<=0)return null;if(!this._suppress){const e=wt.z.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.nextPoint();)e.pushXY(t.x,t.y);return e}const e=[],s=new Array(t.pathSize);let i=0;for(t.seekPathStart();t.nextPoint();)s[i++]=t.getControlPoint(),e.push([t.x,t.y]);let r=!0,n=!0,o=!1,a=!this._invert;i=0;const h=new ze;let c=e[0];for(;i<e.length;){const t=e[i+1],l=s[i],u=s[i+1];i++,n&&(a=l||u?this._invert:!this._invert,n=!1),a?(h.addSegment(c,t,r),r=!1):o=!0,c=t,u&&(a?(a=!1,r=!0):a=!0)}const l=h.getGeometry();if(0===l.length)return null;if(!o&&e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]){const t=l[l.length-1];return t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([t[0][0],t[0][1]]),wt.z.fromJSONCIM({paths:l})}const u=l[l.length-1];return h.getPointCount()>1&&"esriGeometryPolygon"===t.geometryType&&u[0][0]===u[u.length-1][0]&&u[0][1]===u[u.length-1][1]&&l.length>1&&(l[l.length-1].push(...l[0]),l.splice(0,1)),wt.z.fromJSONCIM({paths:l})}}const Le=()=>D.A.getLogger("esri.symbols.cim.effects.EffectTaperedPolygon");class De{static{this.instance=null}static local(){return null===De.instance&&(De.instance=new De),De.instance}execute(t,e,s){return new Ge(t,e,s)}}class Ge extends At{constructor(t,e,s){super(t,!1,!0),this._slopeS=0,this._slopeC=1,this._lastTangent1=new Ot.bR(NaN,NaN),this._lastWidth=0,this._geomUnitsPerPoint=s,this._halfFromWidth=Math.abs(void 0!==e.fromWidth?e.fromWidth:0)*s*.5,this._halfToWidth=Math.abs(void 0!==e.toWidth?e.toWidth:1)*s*.5,this._originalLength=(void 0!==e.length?e.length:0)*s,this._length=0}processPath(t){if(t.totalSize<=0)return null;if(this._halfFromWidth<=0&&this._halfToWidth<=0){const e=wt.z.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.prevPoint();)e.pushXY(t.x,t.y);for(t.seekPathStart();t.nextPoint();)e.pushXY(t.x,t.y);return e}const e=t.getCurrentPath().asJSON(),s=Bt.module.execute(e,.25*this._geomUnitsPerPoint,{removeDegenerateParts:!0}),r=null==s?null:(0,xe.Bi)(s)?s.rings:(0,xe.Rg)(s)?s.paths:null;if(!r)return Le().error(new i.A("mapview-bad-resource","Unable to process geometry")),null;const n=Nt.module.execute(s);if((0===this._originalLength||this._originalLength>n)&&n>0){this._length=n;const t=(this._halfToWidth-this._halfFromWidth)/this._length;if(Math.abs(t)<1){const e=t*t;this._slopeC=Math.sqrt(1/(1+e)),this._slopeS=Math.sqrt(e/(1+e)),t<0&&(this._slopeS=-this._slopeS)}else this._slopeC=this._slopeS=.7071}else this._length=this._originalLength,this._slopeC=1,this._slopeS=0;const o=[];for(const t of r){const e=new ze,s=new ze;let i=0;this._setFromOffset(t.slice(0,2),e,s);for(let r=0,n=3;n<=t.length;++r,++n)i=this._setOffset(t.slice(r,n),i,e,s);this._setToOffset(t.slice(-2),i,e,s);const[r]=e.getGeometry(),[n]=s.getGeometry();o.push([...r,...n.reverse()])}const a={rings:o,spatialReference:{wkid:y.A.WebMercator.wkid}},h=Wt.module.execute(a);return wt.z.fromJSONCIM(h)}_setFromOffset([[t,e],[s,i]],r,n){const o=this._halfFromWidth,a=new Ot.bR(s-t,i-e).normalize().scale(o);r.beginPath([t-a.y,e+a.x]),n.beginPath([t+a.y,e-a.x])}_setToOffset([[t,e],[s,i]],r,n,o){let a;a=(r+=Math.sqrt((s-t)**2+(i-e)**2))>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*r/this._length;const h=new Ot.bR(s-t,i-e).normalize().scale(a);n.lineTo([s-h.y,i+h.x]),o.lineTo([s+h.y,i-h.x])}_setOffset([[t,e],[s,r],[n,o]],a,h,c){const l=Math.sqrt((s-t)**2+(r-e)**2);let u;u=a+l>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*(a+l)/this._length,a+=l;const d=new Ot.bR(s,r),p=new Ot.bR(s-t,r-e).normalize(),_=new Ot.bR(n-s,o-r).normalize(),f=Ot.bR.sub(_,p),m=h.getPointCount(),g=c.getPointCount();p.leftPerpendicular(),_.leftPerpendicular();const y=p.x*_.x+p.y*_.y;if(y>.99){const t=Ot.bR.add(p,_).scale(u/2),e=t.clone().rotate(this._slopeC,this._slopeS);h.lineTo([d.x+e.x,d.y+e.y]);const s=t.rotateReverse(this._slopeC,this._slopeS);c.lineTo([d.x-s.x,d.y-s.y])}else{const s=p.x*_.y-p.y*_.x;if(f.scale(1/s),s<0){f.scale(-u).rotateReverse(this._slopeC,this._slopeS);const t=c.getXY(g-1);t||Le().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const e=Ot.bR.add(d,f).sub(Ot.bR.fromArray(t));if(p.x*e.y-p.y*e.x>0){const t=p.clone().scale(-u).rotateReverse(this._slopeC,this._slopeS),e=_.clone().scale(-u).rotateReverse(this._slopeC,this._slopeS);c.lineTo([d.x+t.x,d.y+t.y]),c.lineTo([d.x,d.y]),c.lineTo([d.x+e.x,d.y+e.y])}else c.lineTo([d.x+f.x,d.y+f.y])}else{f.scale(u).rotate(this._slopeC,this._slopeS);const t=h.getXY(m-1);t||Le().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const e=Ot.bR.add(d,f).sub(Ot.bR.fromArray(t));if(p.x*e.y-p.y*e.x>0){const t=p.clone().scale(u).rotate(this._slopeC,this._slopeS),e=_.clone().scale(u).rotate(this._slopeC,this._slopeS);h.lineTo([d.x+t.x,d.y+t.y]),h.lineTo([d.x,d.y]),h.lineTo([d.x+e.x,d.y+e.y])}else h.lineTo([d.x+f.x,d.y+f.y])}const r=Math.acos(y);let n=1;if(u>.25){const t=2*Math.acos(1-.25/u);t<r&&(n=Math.round(r/t))}const o=Math.cos(r/n),a=Math.sin(r/n),l=p.clone();if(s<0){l.rotate(this._slopeC,this._slopeS);const s=h.getXY(m-1);s||Le().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const r=Ot.bR.add(d,l.clone().scale(this._lastWidth)),n=Ot.bR.sub(r,Ot.bR.fromArray(s)),o=p.x*n.y-p.y*n.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&o>0){const s=new Ot.bR(t,e),i=this._lastTangent1.clone().scale(this._lastWidth);i.rotate(this._slopeC,this._slopeS);const r=p.clone().scale(this._lastWidth);r.rotate(this._slopeC,this._slopeS),h.lineTo([s.x+i.x,s.y+i.y]),h.lineTo([s.x,s.y]),h.lineTo([s.x+r.x,s.y+r.y])}}else{l.scale(-1).rotateReverse(this._slopeC,this._slopeS);const s=c.getXY(g-1);s||Le().error(new i.A("mapview-bad-resource","Unable to process geometry, index out of scope"));const r=Ot.bR.add(d,l.clone().scale(this._lastWidth)),n=Ot.bR.sub(r,Ot.bR.fromArray(s)),o=p.x*n.y-p.y*n.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&o>0){const s=new Ot.bR(t,e),i=this._lastTangent1.clone().scale(-this._lastWidth);i.rotateReverse(this._slopeC,this._slopeS);const r=p.clone().scale(-this._lastWidth);r.rotateReverse(this._slopeC,this._slopeS),c.lineTo([s.x+i.x,s.y+i.y]),c.lineTo([s.x,s.y]),c.lineTo([s.x+r.x,s.y+r.y])}}l.scale(u);for(let t=0;t<=n;t++)s<0?(h.lineTo([d.x+l.x,d.y+l.y]),l.rotateReverse(o,a)):(c.lineTo([d.x+l.x,d.y+l.y]),l.rotate(o,a))}return this._lastTangent1.setCoords(p.x,p.y),this._lastWidth=u,a}}class Ne{static{this.instance=null}static local(){return null===Ne.instance&&(Ne.instance=new Ne),Ne.instance}execute(t,e,s){return new Be(t,e,s)}}class Be{constructor(t,e,s){this._inputGeometries=t,this._height=(void 0!==e.amplitude?e.amplitude:2)*s,this._period=(void 0!==e.period?e.period:3)*s,this._style=e.waveform,this._height<=0&&(this._height=Math.abs(this._height)),this._period<=0&&(this._period=Math.abs(this._period)),this._pattern=new ee,this._pattern.addValue(this._period),this._pattern.addValue(this._period),this._walker=new re,this._walker.updateTolerance(s)}next(){let t=this._inputGeometries.next();for(;t;){if(0===this._height||0===this._period)return t;const e=this._processGeom(t);if(e)return e;t=this._inputGeometries.next()}return null}_processGeom(t){const e=wt.z.createEmptyOptimizedCIM(t.geometryType);for(;t.nextPath();){e.startPath();const s=t.pathLength();if(this._walker.init(t,this._pattern))switch(this._style){case"Sinus":default:this._constructCurve(e,s,!1);break;case"Square":this._constructSquare(e,s);break;case"Triangle":this._constructTriangle(e,s);break;case"Random":this._constructCurve(e,s,!0)}else for(;t.nextPoint();)e.pushXY(t.x,t.y)}return e}_constructCurve(t,e,s){let i=Math.round(e/this._period);0===i&&(i=1);const r=16*i+1,n=e/i,o=this._period/16,a=1/r,h=2*Math.PI*e/n,c=2*Math.PI*Math.random(),l=2*Math.PI*Math.random(),u=2*Math.PI*Math.random(),d=.75-Math.random()/2,p=.75-Math.random()/2,_=new se;this._walker.curPointAndAngle(_),t.pushPoint(_.pt);let f=0;for(;;){if(!this._walker.nextPointAndAngle(o,_)){t.pushPoint(this._walker.getPathEnd());break}{const e=f;let i;if(f+=a,s){const t=this._height/2*(1+.3*Math.sin(d*h*e+c));i=t*Math.sin(h*e+l),i+=t*Math.sin(p*h*e+u),i/=2}else i=.5*this._height*Math.sin(.5*h*e);t.pushXY(_.pt[0]-i*_.sa,_.pt[1]+i*_.ca)}}}_constructSquare(t,e){Math.round(e/this._period);let s=!0;for(;;){let e=!1;if(this._walker.curPositionIsValid()){const i=new se;this._walker.curPointAndAngle(i);const r=new se;if(this._walker.nextPointAndAngle(this._period,r)){const n=new se;this._walker.nextPointAndAngle(this._period,n)&&(s?(t.pushPoint(i.pt),s=!1):t.pushPoint(i.pt),t.pushXY(i.pt[0]-this._height/2*i.sa,i.pt[1]+this._height/2*i.ca),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(r.pt[0]+this._height/2*r.sa,r.pt[1]-this._height/2*r.ca),t.pushXY(n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca),e=!0)}}if(!e){t.pushPoint(this._walker.getPathEnd());break}}}_constructTriangle(t,e){Math.round(e/this._period);let s=!0;for(;;){let e=!1;if(this._walker.curPositionIsValid()){const i=new se;this._walker.curPointAndAngle(i);const r=new se;if(this._walker.nextPointAndAngle(this._period/2,r)){const n=new se;this._walker.nextPointAndAngle(this._period,n)&&(this._walker.nextPosition(this._period/2)&&(s?(t.pushPoint(i.pt),s=!1):t.pushPoint(i.pt),t.pushXY(r.pt[0]-this._height/2*r.sa,r.pt[1]+this._height/2*r.ca),t.pushXY(n.pt[0]+this._height/2*n.sa,n.pt[1]-this._height/2*n.ca)),e=!0)}}if(!e){t.pushPoint(this._walker.getPathEnd());break}}}}class qe{static{this.instance=null}static local(){return null===qe.instance&&(qe.instance=new qe),qe.instance}execute(t,e,s){return new Ue(t,e,s)}}class Ue extends Ct{constructor(t,e,s){super(t),this._geometryWalker=new re,this._geometryWalker.updateTolerance(s),this._angleToLine=e.angleToLine??!0,this._offset=(e.offset?e.offset:0)*s,this._originalEndings=e.endings,this._offsetAtEnd=(e.customEndingOffset?e.customEndingOffset:0)*s,this._position=-(e.offsetAlongLine?e.offsetAlongLine:0)*s,this._pattern=new ee,this._pattern.init(e.placementTemplate,!1),this._pattern.scale(s),this._endings=this._originalEndings}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath)e=this._pattern.nextValue();else{"WithFullGap"===this._originalEndings&&this.isClosed?this._endings="WithMarkers":this._endings=this._originalEndings,this._pattern.extPtGap=0;let s,i=!0;switch(this._endings){case"NoConstraint":s=-this._position,s=this._adjustPosition(s),i=!1;break;case"WithHalfGap":default:s=-this._pattern.lastValue()/2;break;case"WithFullGap":s=-this._pattern.lastValue(),this._pattern.extPtGap=this._pattern.lastValue();break;case"WithMarkers":s=0;break;case"Custom":s=-this._position,s=this._adjustPosition(s),this._pattern.extPtGap=.5*this._offsetAtEnd}if(!this._geometryWalker.init(t,this._pattern,i))return null;this._pattern.reset();let r=0;for(;s>r;)s-=r,r=this._pattern.nextValue();r-=s,e=r,this.iteratePath=!0}const s=new se;return this._geometryWalker.nextPointAndAngle(e,s)?"WithFullGap"===this._endings&&this._geometryWalker.isPathEnd()?(this.iteratePath=!1,null):"WithMarkers"===this._endings&&this._geometryWalker.isPathEnd()&&(this.iteratePath=!1,this.isClosed)?null:(this.internalPlacement.setTranslate(s.pt[0]-this._offset*s.sa,s.pt[1]+this._offset*s.ca),this._angleToLine&&this.internalPlacement.setRotateCS(s.ca,s.sa),this.internalPlacement):(this.iteratePath=!1,null)}_adjustPosition(t){let e=t/this._pattern.length();return e-=Math.floor(e),e*this._pattern.length()}}class We{static{this.instance=null}static local(){return null===We.instance&&(We.instance=new We),We.instance}execute(t,e,s){return new Ve(t,e,s)}}class Ve extends Ct{constructor(t,e,s){super(t,!1,!0),this._curveHelper=new Et,this._placePerPart=e.placePerPart??!1,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._type=e.extremityPlacement,this._position=void 0!==e.offsetAlongLine?e.offsetAlongLine*s:0,this._beginProcessed=!1}processMultiPath(t){return this._placePerPart?super.processMultiPath(t):this.processPath(t)}processPath(t){let e;switch(this._type){case"Both":default:this._beginProcessed?(e=this._atExtremities(t,this._position,!1),this._beginProcessed=!1,this.iterateMultiPath=!1,this.iteratePath=!1):(e=this._atExtremities(t,this._position,!0),this._beginProcessed=!0,this.iterateMultiPath=!0,this.iteratePath=!0);break;case"JustBegin":e=this._atExtremities(t,this._position,!0);break;case"JustEnd":e=this._atExtremities(t,this._position,!1);case"None":}return e}_atExtremities(t,e,s){if(this._placePerPart||(s?t.seekPath(0):t.seekPath(t.totalSize-1)),s||t.seekPathEnd(),s?t.nextPoint():t.prevPoint()){let i=0,[r,n]=[0,0],[o,a]=[t.x,t.y];const h=[0,0];for(;s?t.nextPoint():t.prevPoint();){r=o,n=a,o=t.x,a=t.y;const s=this._curveHelper.getLength(r,n,o,a);if(i+s>e){const t=(e-i)/s,[c,l]=this._curveHelper.getAngleCS(h,r,n,o,a,t),u=this._curveHelper.getCoord2D(r,n,o,a,t);return this.internalPlacement.setTranslate(u[0]-this._offset*l,u[1]+this._offset*c),this._angleToLine&&this.internalPlacement.setRotateCS(-c,-l),this.internalPlacement}i+=s}}return null}}class je{static{this.instance=null}static local(){return null===je.instance&&(je.instance=new je),je.instance}execute(t,e,s){return new Ye(t,e,s)}}class Ye extends Ct{constructor(t,e,s){super(t),this._walker=new re,this._walker.updateTolerance(s),this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._beginGap=void 0!==e.beginPosition?e.beginPosition*s:0,this._endGap=void 0!==e.endPosition?e.endPosition*s:0,this._flipFirst=void 0===e.flipFirst||e.flipFirst,this._pattern=new ee,this._pattern.init(e.positionArray,!1,!1),this._subPathLen=0,this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0}processPath(t){if(this._pattern.isEmpty())return null;let e;if(this.iteratePath){const t=this._pattern.nextValue()*this._subPathLen,s=this._beginGap+t;e=s-this._prevPos,this._prevPos=s}else{if(this._posCount=this._pattern.size(),this._isFirst=!0,this._prevPos=0,this._subPathLen=t.pathLength()-this._beginGap-this._endGap,this._subPathLen<0)return this.iteratePath=!1,null;if(!this._walker.init(t,this._pattern,!1))return null;this._pattern.reset();const s=this._pattern.nextValue()*this._subPathLen,i=this._beginGap+s;e=i-this._prevPos,this._prevPos=i,this.iteratePath=!0}const s=new se;if(!this._walker.nextPointAndAngle(e,s,1))return this.iteratePath=!1,null;this.internalPlacement.setTranslate(s.pt[0]-this._offset*s.sa,s.pt[1]+this._offset*s.ca);const i=this._isFirst&&this._flipFirst;let r,n;return this._angleToLine?(r=s.ca,n=s.sa):(r=1,n=0),i&&(r=-r,n=-n),this.internalPlacement.setRotateCS(r,n),this._isFirst=!1,this._posCount--,0===this._posCount&&(this.iteratePath=!1),this.internalPlacement}}const He=512,Xe=24,$e=1e-6;class Ze{static{this.instance=null}static local(){return null===Ze.instance&&(Ze.instance=new Ze),Ze.instance}execute(t,e,s,i){return new Qe(t,e,s,i)}}class Qe{constructor(t,e,s,i){if(this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,this._currentX=0,this._currentY=0,this._accelerationMap=null,this._testInsidePolygon=!1,this._verticalSubdivision=!0,this._stepX=Math.abs(e.stepX??16)*s,this._stepY=Math.abs(e.stepY??16)*s,this._stepX=Math.round(128*this._stepX)/128,this._stepY=Math.round(128*this._stepY)/128,0!==this._stepX&&0!==this._stepY){if(this._gridType=e.gridType??"Fixed","Random"===this._gridType){const t=e.seed??13,s=1;this._randomLCG=new h.A(t*s),this._randomness=(e.randomness??100)/100,this._gridAngle=0,this._shiftOddRows=!1,this._cosAngle=1,this._sinAngle=0,this._offsetX=0,this._offsetY=0,this._buildRandomValues()}else{if(this._randomness=0,this._gridAngle=e.gridAngle??0,this._shiftOddRows=e.shiftOddRows??!1,this._offsetX=(e.offsetX??0)*s,this._offsetY=(e.offsetY??0)*s,this._cosAngle=Math.cos(this._gridAngle/180*Math.PI),this._sinAngle=-Math.sin(this._gridAngle/180*Math.PI),this._stepX)if(this._offsetX<0)for(;this._offsetX<-.5*this._stepX;)this._offsetX+=this._stepX;else for(;this._offsetX>=.5*this._stepX;)this._offsetX-=this._stepX;if(this._stepY)if(this._offsetY<0)for(;this._offsetY<-.5*this._stepY;)this._offsetY+=this._stepY;else for(;this._offsetY>=.5*this._stepY;)this._offsetY-=this._stepY}if(this._graphicOriginX=0,this._graphicOriginY=0,null!=i){const[t,e,s,r]=i.split("/"),n=parseFloat(t),o=parseFloat(e),a=parseFloat(s),h=parseFloat(r);this._graphicOriginX=-(h*2**n+a)*He,this._graphicOriginY=o*He,this._testInsidePolygon=!0}this._internalPlacement=new Tt,this._calculateMinMax(t),this._geometryCursor=t}}next(){return this._geometryCursor?this._nextInside():null}_buildRandomValues(){if(!Qe._randValues){Qe._randValues=[];for(let t=0;t<Xe;t++)for(let t=0;t<Xe;t++)Qe._randValues.push(this._randomLCG.getFloat()),Qe._randValues.push(this._randomLCG.getFloat())}}_calculateMinMax(t){let e,s,i,r,n,o,a,h,c,l,u,d,p,_;this._xMin=0,this._xMax=0,this._yMin=0,this._yMax=0,a=h=p=u=Number.MAX_VALUE,c=l=_=d=-Number.MAX_VALUE;const f=1!==this._cosAngle;for(t.reset();t.nextPath();)for(;t.nextPoint();)o=t.x,n=t.y,e=o-this._graphicOriginX-this._offsetX,s=n-this._graphicOriginY-this._offsetY,f?(i=this._cosAngle*e-this._sinAngle*s,r=this._sinAngle*e+this._cosAngle*s):(i=e,r=s),a=Math.min(a,i),c=Math.max(c,i),h=Math.min(h,r),l=Math.max(l,r),u=Math.min(u,n),d=Math.max(d,n),p=Math.min(p,o),_=Math.max(_,o);u=u!==Number.MAX_VALUE?u:-512-this._stepY,d=d!==-Number.MAX_VALUE?d:this._stepY,p=p!==Number.MAX_VALUE?p:-this._stepX,_=_!==-Number.MAX_VALUE?_:He+this._stepX;const m=d-u,g=_-p;if(this._verticalSubdivision=m>=g,this._polygonMin=this._verticalSubdivision?u:p,this._testInsidePolygon){let t=0-this._graphicOriginX-this._offsetX-this._stepX,e=He-this._graphicOriginX-this._offsetX+this._stepX,s=-512-this._graphicOriginY-this._offsetY-this._stepY,i=0-this._graphicOriginY-this._offsetY+this._stepY;if(f){const r=[[t,s],[t,i],[e,s],[e,i]];t=s=Number.MAX_VALUE,e=i=-Number.MAX_VALUE;for(const n of r){const r=this._cosAngle*n[0]-this._sinAngle*n[1],o=this._sinAngle*n[0]+this._cosAngle*n[1];t=Math.min(t,r),e=Math.max(e,r),s=Math.min(s,o),i=Math.max(i,o)}}a=a!==Number.MAX_VALUE?Math.max(a,t):t,h=h!==Number.MAX_VALUE?Math.max(h,s):s,c=c!==-Number.MAX_VALUE?Math.min(c,e):e,l=l!==-Number.MAX_VALUE?Math.min(l,i):i}this._xMin=Math.round(a/this._stepX),this._xMax=Math.round(c/this._stepX),this._yMin=Math.round(h/this._stepY),this._yMax=Math.round(l/this._stepY),this._currentX=this._xMax+1,this._currentY=this._yMin-1,this._buildAccelerationMap(t,p,_,u,d)}_buildAccelerationMap(t,e,s,i,r){t.reset();const n=new Map,o=this._verticalSubdivision,a=o?r-i:s-e;let h=Math.ceil(a/10);if(h<=1)return;const c=Math.floor(a/h);let l,u,d,p,_,f,m,g,y,x,b;for(h++,this._delta=c,o?(y=-512-2*this._stepY,x=2*this._stepY,b=i):(y=-2*this._stepX,x=He+2*this._stepX,b=e);t.nextPath();)if(!(t.pathSize<2)&&t.nextPoint())for(l=t.x,u=t.y;t.nextPoint();l=d,u=p){if(d=t.x,p=t.y,o){if(u===p||u<y&&p<y||u>x&&p>x)continue;_=Math.min(u,p),f=Math.max(u,p)}else{if(l===d||l<y&&d<y||l>x&&d>x)continue;_=Math.min(l,d),f=Math.max(l,d)}for(;_<f;)m=Math.floor((_-b)/c),Je(m,l,u,d,p,n),_+=c;g=Math.floor((f-b)/c),g>m&&Je(g,l,u,d,p,n)}this._accelerationMap=n}_nextInside(){for(;;){if(this._currentX>this._xMax){if(this._currentY++,this._currentY>this._yMax)return null;this._currentX=this._xMin,this._shiftOddRows&&this._currentY%2&&this._currentX--}let t=this._currentX*this._stepX+this._offsetX;this._shiftOddRows&&this._currentY%2&&(t+=.5*this._stepX);const e=this._currentY*this._stepY+this._offsetY;let s,i;if(this._currentX++,"Random"===this._gridType){const r=(this._currentX%Xe+Xe)%Xe,n=(this._currentY%Xe+Xe)%Xe;s=this._graphicOriginX+t+this._stepX*this._randomness*(.5-Qe._randValues[n*Xe+r])*2/3,i=this._graphicOriginY+e+this._stepY*this._randomness*(.5-Qe._randValues[n*Xe+r+1])*2/3}else s=this._graphicOriginX+this._cosAngle*t+this._sinAngle*e,i=this._graphicOriginY-this._sinAngle*t+this._cosAngle*e;if(!this._testInsidePolygon||this._isInsidePolygon(s,i,this._geometryCursor))return this._internalPlacement.setTranslate(s,i),this._internalPlacement}}_isInsidePolygon(t,e,s){if(null==this._accelerationMap)return function(t,e,s){let i,r,n,o,a=0;for(t+=$e,e+=$e,s.reset();s.nextPath();)if(s.nextPoint())for(i=s.x,r=s.y;s.nextPoint();i=n,r=o)n=s.x,o=s.y,r>e!=o>e&&((n-i)*(e-r)-(o-r)*(t-i)>0?a++:a--);return 0!==a}(t,e,s);t+=$e,e+=$e;const i=this._verticalSubdivision,r=i?e:t,n=Math.floor((r-this._polygonMin)/this._delta),o=this._accelerationMap.get(n);if(!o)return!1;let a,h,c,l=0;for(const s of o){if(a=s[0],h=s[1],i){if(a[1]>e==h[1]>e)continue;c=(h[0]-a[0])*(e-a[1])-(h[1]-a[1])*(t-a[0])}else{if(a[0]>t==h[0]>t)continue;c=(h[1]-a[1])*(t-a[0])-(h[0]-a[0])*(e-a[1])}c>0?l++:l--}return 0!==l}}function Je(t,e,s,i,r,n){let o=n.get(t);o||(o=[],n.set(t,o)),o.push([[e,s],[i,r]])}class Ke{static{this.instance=null}static local(){return null===Ke.instance&&(Ke.instance=new Ke),Ke.instance}execute(t,e,s){return new ts(t,e,s)}}class ts extends Ct{constructor(t,e,s){super(t),this._curveHelper=new Et,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._relativeTo=e.relativeTo,this._position=void 0!==e.startPointOffset?e.startPointOffset*s:0,this._epsilon=.001*s}processPath(t){const e=this._position;if("SegmentMidpoint"===this._relativeTo){if(this.iteratePath||(this.iteratePath=!0),t.nextPoint()){let[e,s]=[t.x,t.y],[i,r]=[0,0];const n=[0,0];for(;t.nextPoint();){i=t.x,r=t.y;const o=this._curveHelper.getLength(e,s,i,r);if(o<this._epsilon){e=i,s=r;continue}const a=.5+this._position/o,[h,c]=this._curveHelper.getAngleCS(n,e,s,i,r,a),l=this._curveHelper.getCoord2D(e,s,i,r,a);return this.internalPlacement.setTranslate(l[0]-this._offset*c,l[1]+this._offset*h),this._angleToLine&&this.internalPlacement.setRotateCS(h,c),this.internalPlacement}}return this.iteratePath=!1,null}const s="LineEnd"===this._relativeTo;return this.onLine(t,e,s)}onLine(t,e,s){let i,r=!1;switch(this._relativeTo){case"LineMiddle":default:t.seekPathStart(),i=t.pathLength()/2+e;break;case"LineBeginning":i=e;break;case"LineEnd":i=e,r=!0}s?t.seekPathEnd():t.seekPathStart();let n=0;if(s?t.prevPoint():t.nextPoint()){let[e,o]=[t.x,t.y],[a,h]=[0,0];const c=[0,0];for(;s?t.prevPoint():t.nextPoint();){a=t.x,h=t.y;const s=this._curveHelper.getLength(e,o,a,h);if(n+s>i){const t=(i-n)/s,[l,u]=this._curveHelper.getAngleCS(c,e,o,a,h,t),d=this._curveHelper.getCoord2D(e,o,a,h,t),p=r?-this._offset:this._offset;return this.internalPlacement.setTranslate(d[0]-p*u,d[1]+p*l),this._angleToLine&&(r?this.internalPlacement.setRotateCS(-l,-u):this.internalPlacement.setRotateCS(l,u)),this.internalPlacement}e=a,o=h,n+=s}}return null}}class es{static{this.instance=null}static local(){return null===es.instance&&(es.instance=new es),es.instance}execute(t,e,s){return new ss(t,e,s)}}class ss extends Ct{constructor(t,e,s){super(t),this._curveHelper=new Et,this._angleToLine=void 0===e.angleToLine||e.angleToLine,this._offset=void 0!==e.offset?e.offset*s:0,this._endPoints=void 0===e.placeOnEndPoints||e.placeOnEndPoints,this._controlPoints=void 0===e.placeOnControlPoints||e.placeOnControlPoints,this._regularVertices=void 0===e.placeOnRegularVertices||e.placeOnRegularVertices,this._tags=[],this._tagIterator=0}processPath(t){if(this.iteratePath||(this._preparePath(t),this.iteratePath=!0),this._tagIterator>=this._tags.length)return this._tags.length=0,this._tagIterator=0,this.iteratePath=!1,null;const e=this._tags[this._tagIterator];this._angleToLine&&this.internalPlacement.setRotate(e[2]);let s=e[0],i=e[1];if(0!==this._offset){const t=Math.cos(e[2]),r=Math.sin(e[2]);s-=this._offset*r,i+=this._offset*t}return this.internalPlacement.setTranslate(s,i),this._tagIterator++,this.internalPlacement}_preparePath(t){this._tags.length=0,this._tagIterator=0,t.seekPathStart();const e=t.isClosed();let s=0,i=!1,r=0,n=0;if(t.seekPathStart(),t.nextPoint()){let o=t.x,a=t.y,h=t.getControlPoint(),c=!0,l=t.nextPoint();for(;l;){const u=t.x,d=t.y,p=t.getControlPoint();(this._angleToLine||0!==this._offset)&&(r=this._curveHelper.getAngle(o,a,u,d,0)),c?(c=!1,e?(s=r,i=h):(this._endPoints||this._controlPoints&&h)&&this._tags.push([o,a,r])):h?this._controlPoints&&this._tags.push([o,a,is(n,r)]):this._regularVertices&&this._tags.push([o,a,is(n,r)]),(this._angleToLine||0!==this._offset)&&(n=this._curveHelper.getAngle(o,a,u,d,1)),l=t.nextPoint(),l||(e?p||i?this._controlPoints&&this._tags.push([u,d,is(n,s)]):this._regularVertices&&this._tags.push([u,d,is(n,s)]):(this._endPoints||this._controlPoints&&p)&&this._tags.push([u,d,n])),o=u,a=d,h=p}}this._tagIterator=0}}function is(t,e){const s=Math.PI;for(;Math.abs(e-t)>s+2e-15;)e-t>s?e-=2*s:e+=2*s;return(t+e)/2}var rs=s(32011);class ns{static{this.instance=null}static local(){return null===ns.instance&&(ns.instance=new ns),ns.instance}execute(t,e,s){return new os(t,e,s)}}class os{constructor(t,e,s){this._geometryCursor=t,this._offsetX=void 0!==e.offsetX?e.offsetX*s:0,this._offsetY=void 0!==e.offsetY?e.offsetY*s:0,this._method=void 0!==e.method?e.method:"OnPolygon",this._placementPerPart=void 0!==e.placePerPart&&e.placePerPart,this._internalPlacement=new Tt}next(){const t=this._geometryCursor;if(!t)return null;if(!this._placementPerPart)return this._geometryCursor=null,this._polygonCenter(t);for(;t.nextPath();)if(!(t.getCurrentRingArea()<0))return this._polygonCenter(t.getCurrentPath());return this._geometryCursor=null,null}_polygonCenter(t){let e=!1;switch(this._method){case"CenterOfMass":{const s=(0,Se.TP)(t);s&&(this._internalPlacement.setTranslate(s[0]+this._offsetX,s[1]+this._offsetY),e=!0)}break;case"BoundingBoxCenter":{const s=(0,ce.z8)(t);s&&(this._internalPlacement.setTranslate((s[2]+s[0])/2+this._offsetX,(s[3]+s[1])/2+this._offsetY),e=!0)}break;default:{const s=(0,rs.d)(t);null!==s&&(this._internalPlacement.setTranslate(s[0]+this._offsetX,s[1]+this._offsetY),e=!0)}}return e?this._internalPlacement:null}}function as(t){if(!t)return null;switch(t.type){case"CIMGeometricEffectAddControlPoints":return It.local();case"CIMGeometricEffectArrow":return zt.local();case"CIMGeometricEffectBuffer":return Xt.local();case"CIMGeometricEffectControlMeasureLine":return Qt.local();case"CIMGeometricEffectCut":return Kt.local();case"CIMGeometricEffectDashes":return ne.local();case"CIMGeometricEffectDonut":return ae.local();case"CIMGeometricEffectJog":return fe.local();case"CIMGeometricEffectMove":return ge.local();case"CIMGeometricEffectOffset":return be.local();case"CIMGeometricEffectRadial":return Ie.local();case"CIMGeometricEffectReverse":return Me.local();case"CIMGeometricEffectRotate":return Ce.local();case"CIMGeometricEffectScale":return Fe.local();case"CIMGeometricEffectSuppress":return Re.local();case"CIMGeometricEffectTaperedPolygon":return De.local();case"CIMGeometricEffectWave":return Ne.local();case"CIMGeometricEffectEnclosingPolygon":return le.local()}return null}class hs{static getPlacement(t,e,s,i,r){const n=function(t){if(!t)return null;switch(t.type){case"CIMMarkerPlacementAlongLineSameSize":return qe.local();case"CIMMarkerPlacementAtExtremities":return We.local();case"CIMMarkerPlacementAtRatioPositions":return je.local();case"CIMMarkerPlacementInsidePolygon":return Ze.local();case"CIMMarkerPlacementOnLine":return Ke.local();case"CIMMarkerPlacementOnVertices":return es.local();case"CIMMarkerPlacementPolygonCenter":return ns.local()}return null}(s);return n?(-1===e&&t.invertY(),n.execute(t,s,i,r)):null}}var cs=s(68197);function ls(t,e){return[!!t?.minScale&&e.scaleToZoom(t.minScale)||0,!!t?.maxScale&&e.scaleToZoom(t.maxScale)||100]}function us(t){return 1<<t}function ds(t){let e=0;for(const[s,i]of t)i&&(e|=1<<s);return e}function ps(t){let e;if(!t)return[0,0,0,0];if("string"==typeof t){const s=cs.A.fromString(t);if(!s)return D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.meshWriterUtils").errorOnce(new i.A("mapview:mesh-processing","Unable to parse string into color",{color:t})),[0,0,0,0];e=s.toArray()}else e=t;const[s,r,n,o]=e;return[s*(o/255),r*(o/255),n*(o/255),o]}function _s(t){switch(t){case"butt":case"Butt":return 0;case"round":case"Round":return 1;case"square":case"Square":return 2}}function fs(t){switch(t){case"bevel":case"Bevel":return 0;case"miter":case"Miter":return 2;case"round":case"Round":return 1}}function ms(t,e){return Math.round(Math.min(Math.sqrt(t*e),255))}function gs(t,e){return Math.round(t*e)/e}const ys=0,xs=1,bs=2,ws=3,vs=4,Ss=5;new(s(32488).A);var Is=s(4718);s(11831),s(92602),new Map,new Set;var Ps=s(34727);function Ms(t,e=0){let s=0;for(let i=0;i<4;i++)s+=t[e+i]*Ts[i];return s}const Ts=[1/256,1/65536,1/16777216,1/4294967296];Ms(new Uint8ClampedArray([255,255,255,255])),Ms(new Uint8ClampedArray([255,255,255,0])),s(5760);var ks=s(34304);function Cs(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function As(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1],u=s[2],d=s[3],p=s[4],_=s[5];return t[0]=i*c+n*l,t[1]=r*c+o*l,t[2]=i*u+n*d,t[3]=r*u+o*d,t[4]=i*p+n*_+a,t[5]=r*p+o*_+h,t}function Fs(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=Math.sin(s),l=Math.cos(s);return t[0]=i*l+n*c,t[1]=r*l+o*c,t[2]=i*-c+n*l,t[3]=r*-c+o*l,t[4]=a,t[5]=h,t}function Es(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1];return t[0]=i,t[1]=r,t[2]=n,t[3]=o,t[4]=i*c+n*l+a,t[5]=r*c+o*l+h,t}function zs(t,e){const s=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=s,t[2]=-s,t[3]=i,t[4]=0,t[5]=0,t}function Rs(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t[2]=e[2]-s[2],t[3]=e[3]-s[3],t[4]=e[4]-s[4],t[5]=e[5]-s[5],t}const Os=As,Ls=Rs;function Ds(){const t=new Float32Array(6);return t[0]=1,t[3]=1,t}function Gs(t,e,s,i){const r=e[i],n=e[i+1];t[i]=s[0]*r+s[2]*n+s[4],t[i+1]=s[1]*r+s[3]*n+s[5]}function Ns(t,e,s,i=0,r=0,n=2){const o=r||e.length/n;for(let r=i;r<o;r++)Gs(t,e,s,r*n)}Object.freeze(Object.defineProperty({__proto__:null,add:function(t,e,s){return t[0]=e[0]+s[0],t[1]=e[1]+s[1],t[2]=e[2]+s[2],t[3]=e[3]+s[3],t[4]=e[4]+s[4],t[5]=e[5]+s[5],t},copy:function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},determinant:function(t){return t[0]*t[3]-t[1]*t[2]},equals:function(t,e){const s=t[0],i=t[1],r=t[2],n=t[3],o=t[4],a=t[5],h=e[0],c=e[1],l=e[2],u=e[3],d=e[4],p=e[5],_=(0,ks.FD)();return Math.abs(s-h)<=_*Math.max(1,Math.abs(s),Math.abs(h))&&Math.abs(i-c)<=_*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(r-l)<=_*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-u)<=_*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(o-d)<=_*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-p)<=_*Math.max(1,Math.abs(a),Math.abs(p))},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},frob:function(t){return Math.sqrt(t[0]**2+t[1]**2+t[2]**2+t[3]**2+t[4]**2+t[5]**2+1)},fromRotation:zs,fromScaling:function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},fromTranslation:function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},identity:Cs,invert:function(t,e){const s=e[0],i=e[1],r=e[2],n=e[3],o=e[4],a=e[5];let h=s*n-i*r;return h?(h=1/h,t[0]=n*h,t[1]=-i*h,t[2]=-r*h,t[3]=s*h,t[4]=(r*a-n*o)*h,t[5]=(i*o-s*a)*h,t):null},mul:Os,multiply:As,multiplyScalar:function(t,e,s){return t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*s,t[5]=e[5]*s,t},multiplyScalarAndAdd:function(t,e,s,i){return t[0]=e[0]+s[0]*i,t[1]=e[1]+s[1]*i,t[2]=e[2]+s[2]*i,t[3]=e[3]+s[3]*i,t[4]=e[4]+s[4]*i,t[5]=e[5]+s[5]*i,t},rotate:Fs,scale:function(t,e,s){const i=e[0],r=e[1],n=e[2],o=e[3],a=e[4],h=e[5],c=s[0],l=s[1];return t[0]=i*c,t[1]=r*c,t[2]=n*l,t[3]=o*l,t[4]=a,t[5]=h,t},set:function(t,e,s,i,r,n,o){return t[0]=e,t[1]=s,t[2]=i,t[3]=r,t[4]=n,t[5]=o,t},str:function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},sub:Ls,subtract:Rs,translate:Es},Symbol.toStringTag,{value:"Module"})),Object.freeze(Object.defineProperty({__proto__:null,clone:function(t){const e=new Float32Array(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},create:Ds,fromValues:function(t,e,s,i,r,n){const o=new Float32Array(6);return o[0]=t,o[1]=e,o[2]=s,o[3]=i,o[4]=r,o[5]=n,o},transform:Gs,transformMany:Ns},Symbol.toStringTag,{value:"Module"}));var Bs=s(88340);var qs=s(18989);class Us{constructor(t,e,s,i){this.transformedX=0,this.transformedY=0,this.center=(0,Bs.fA)(t,e),this.centerT=(0,Bs.vt)(),this.halfWidth=s/2,this.halfHeight=i/2,this.width=s,this.height=i}get x(){return this.center[0]}get y(){return this.center[1]}get blX(){return this.center[0]+this.halfWidth}get blY(){return this.center[1]+this.halfHeight}get trX(){return this.center[0]-this.halfWidth}get trY(){return this.center[1]-this.halfHeight}get xmin(){return this.x-this.halfWidth}get xmax(){return this.x+this.halfWidth}get ymin(){return this.y-this.halfHeight}get ymax(){return this.y+this.halfHeight}set x(t){this.center[0]=t}set y(t){this.center[1]=t}clone(){return new Us(this.x,this.y,this.width,this.height)}serialize(t){return t.writeF32(this.center[0]),t.writeF32(this.center[1]),t.push(this.width),t.push(this.height),t}findCollisionDelta(t,e=4){const s=Math.abs(t.centerT[0]-this.centerT[0]),i=Math.abs(t.centerT[1]-this.centerT[1]),r=(t.halfWidth+this.halfWidth+e)/s,n=(t.halfHeight+this.halfHeight+e)/i,o=Math.min(r,n);return Math.log2(o)}extend(t){const e=Math.min(this.xmin,t.xmin),s=Math.min(this.ymin,t.ymin),i=Math.max(this.xmax,t.xmax)-e,r=Math.max(this.ymax,t.ymax)-s,n=e+i/2,o=s+r/2;this.width=i,this.height=r,this.halfWidth=i/2,this.halfHeight=r/2,this.x=n,this.y=o}static deserialize(t){const e=t.readF32(),s=t.readF32(),i=t.readInt32(),r=t.readInt32();return new Us(e,s,i,r)}}const Ws=Math.PI/180;class Vs{constructor(t,e,s,i){this._rotationT=Ds(),this._xBounds=0,this._yBounds=0,this.minZoom=0,this.maxZoom=255,this._bounds=null;const r=s.rect,n=new Float32Array(8);t*=i,e*=i;const o=s.code?r.width*i:s.metrics.width,a=s.code?r.height*i:s.metrics.height;this.width=o,this.height=a,n[0]=t,n[1]=e,n[2]=t+o,n[3]=e,n[4]=t,n[5]=e+a,n[6]=t+o,n[7]=e+a,this._data=n,this._setTextureCoords(r),this._scale=i,this._mosaic=s,this.x=t,this.y=e,this.maxOffset=Math.max(t+o,e+a)}get mosaic(){return this._mosaic}set angle(t){this._angle=t,zs(this._rotationT,-t),this._setOffsets()}get angle(){return this._angle}get xTopLeft(){return this._data[0]}get yTopLeft(){return this._data[1]}get xBottomRight(){return this._data[6]}get yBottomRight(){return this._data[7]}get texcoords(){return this._texcoords}get textureBinding(){return this._mosaic.textureBinding}get offsets(){return this._offsets||this._setOffsets(),this._offsets}get char(){return String.fromCharCode(this._mosaic.code)}get code(){return this._mosaic.code}get bounds(){if(!this._bounds){const{height:t,width:e}=this._mosaic.metrics,s=e*this._scale,i=Math.abs(t)*this._scale,r=new Float32Array(8);r[0]=this.x,r[1]=this.y,r[2]=this.x+s,r[3]=this.y,r[4]=this.x,r[5]=this.y+i,r[6]=this.x+s,r[7]=this.y+i,Ns(r,r,As(Ds(),this._rotationT,this._transform));let n=1/0,o=1/0,a=-1/0,h=-1/0;for(let t=0;t<4;t++){const e=r[2*t],s=r[2*t+1];n=Math.min(n,e),o=Math.min(o,s),a=Math.max(a,e),h=Math.max(h,s)}const c=a-n,l=h-o,u=n+c/2,d=o+l/2;this._bounds=new Us(u,d,c,l)}return this._bounds}setTransform(t){this._transform=t,this._offsets=null}_setOffsets(){this._offsets||(this._offsets={topLeft:[0,0],topRight:[0,0],bottomLeft:[0,0],bottomRight:[0,0]});const t=As(Ds(),this._rotationT,this._transform);this._offsets.topLeft[0]=this._data[0],this._offsets.topLeft[1]=this._data[1],this._offsets.topRight[0]=this._data[2],this._offsets.topRight[1]=this._data[3],this._offsets.bottomLeft[0]=this._data[4],this._offsets.bottomLeft[1]=this._data[5],this._offsets.bottomRight[0]=this._data[6],this._offsets.bottomRight[1]=this._data[7],(0,N.l0)(this._offsets.topLeft,this._offsets.topLeft,t),(0,N.l0)(this._offsets.topRight,this._offsets.topRight,t),(0,N.l0)(this._offsets.bottomLeft,this._offsets.bottomLeft,t),(0,N.l0)(this._offsets.bottomRight,this._offsets.bottomRight,t)}_setTextureCoords({x:t,y:e,width:s,height:i}){this._texcoords={topLeft:[t,e],topRight:[t+s,e],bottomLeft:[t,e+i],bottomRight:[t+s,e+i]}}}const js=(t,e)=>({code:0,page:0,sdf:!0,rect:new qs.A(0,0,11,8),textureBinding:e,metrics:{advance:0,height:4,width:t,left:0,top:0}});function Ys(t,e){return t.forEach(t=>(0,N.l0)(t,t,e)),{topLeft:t[0],topRight:t[1],bottomLeft:t[2],bottomRight:t[3]}}class Hs{constructor(t,e,s){this._rotation=0,this._decorate(t,e,s),this.glyphs=t,this.bounds=this._createBounds(t),this.isMultiline=e.length>1,this._hasRotation=0!==s.angle,this._transform=this._createGlyphTransform(this.bounds,s),this._borderLineSizePx=s.borderLineSizePx,(s.borderLineSizePx||s.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(const e of t)e.setTransform(this._transform)}setRotation(t){if(0===t&&0===this._rotation)return;this._rotation=t;const e=this._transform;As(e,zs(Ds(),t),e);for(const t of this.glyphs)t.setTransform(this._transform)}_decorate(t,e,s){if(!s.decoration||"none"===s.decoration||!t.length)return;const i=s.scale,r="underline"===s.decoration?26:16,n=t[0].textureBinding;for(const s of e){const e=s.startX*i,o=s.startY*i,a=(s.width+s.glyphWidthEnd)*i;t.push(new Vs(e,o+r*i,js(a,n),1))}}shapeBackground(t){const e=(1.5+(this._borderLineSizePx||0))/2,s=this._borderLineSizePx?e:0,{xmin:i,ymin:r,xmax:n,ymax:o,x:a,y:h,width:c,height:l}=this.bounds,u=[i-8,r-8],d=[n+8,r-8],p=[i-8,o+8],_=[n+8,o+8],f=Ys([[u[0]-e,u[1]-e],[d[0]+e,d[1]-e],[u[0]+s,u[1]+s],[d[0]-s,d[1]+s]],t),m=Ys([[p[0]+s,p[1]-s],[_[0]-s,_[1]-s],[p[0]-e,p[1]+e],[_[0]+e,_[1]+e]],t),g=Ys([[u[0]-e,u[1]-e],[u[0]+s,u[1]+s],[p[0]-e,p[1]+e],[p[0]+s,p[1]-s]],t),y=Ys([[d[0]-s,d[1]+s],[d[0]+e,d[1]-e],[_[0]-s,_[1]-s],[_[0]+e,_[1]+e]],t),x={main:Ys([u,d,p,_],t),top:f,bot:m,left:g,right:y};return[new Us(a,h,c+2*e,l+2*e),x]}get boundsT(){const t=this.bounds,e=(0,N.hZ)((0,Bs.vt)(),t.x,t.y);if((0,N.l0)(e,e,this._transform),this._hasRotation){const s=Math.max(t.width,t.height);return new Us(e[0],e[1],s,s)}return new Us(e[0],e[1],t.width,t.height)}_createBounds(t){let e=1/0,s=1/0,i=0,r=0;for(const n of t)e=Math.min(e,n.xTopLeft),s=Math.min(s,n.yTopLeft),i=Math.max(i,n.xBottomRight),r=Math.max(r,n.yBottomRight);const n=i-e,o=r-s;return new Us(e+n/2,s+o/2,n,o)}_createGlyphTransform(t,e){const s=Ws*e.angle,i=Ds(),r=(0,Bs.vt)();return Es(i,i,(0,N.hZ)(r,e.xOffset,-e.yOffset)),e.useCIMAngleBehavior?Fs(i,i,s):(Es(i,i,(0,N.hZ)(r,t.x,t.y)),Fs(i,i,s),Es(i,i,(0,N.hZ)(r,-t.x,-t.y))),i}}class Xs{constructor(t,e,s,i,r,n){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(e,s)),this.end=Math.max(0,Math.max(e,s)),this.end<t.length&&(this.glyphWidthEnd=t[this.end].metrics.width),this.width=i,this.yMin=r,this.yMax=n}}const $s=t=>10===t,Zs=t=>32===t;function Qs(t,e){const s=e.scale,i=new Array,{glyphs:r,isRightToLeft:n}=t,o=function(t,e,s){const i=new Array,r=1/s.scale,n=s.maxLineWidth*r,o=e?t.length-1:0,a=e?-1:t.length,h=e?-1:1;let c=o,l=0,u=0,d=c,p=d,_=0,f=1/0,m=0;for(;c!==a;){const{code:e,metrics:s}=t[c],r=Math.abs(s.top);if($s(e)||Zs(e)||(f=Math.min(f,r),m=Math.max(m,r+s.height)),$s(e))c!==o&&(i.push(new Xs(t,d,c-h,l,f===1/0?0:f,m)),f=1/0,m=0),l=0,d=c+h,p=c+h,u=0;else if(Zs(e))p=c+h,u=0,_=s.advance,l+=s.advance;else if(l>n){if(p!==d){const e=p-2*h;l-=_,i.push(new Xs(t,d,e,l-u,f,m)),f=1/0,m=0,d=p,l=u}else i.push(new Xs(t,d,c-h,l,f,m)),f=1/0,m=0,d=c,p=c,l=0;l+=s.advance,u+=s.advance}else l+=s.advance,u+=s.advance;c+=h}const g=new Xs(t,d,c-h,l,f,m);return g.start>=0&&g.end<t.length&&i.push(g),i}(r,n,e),a=o.length?function(t,e){let s=0;for(let e=0;e<t.length;e++){const{width:i}=t[e];s=Math.max(i,s)}const i="underline"===e.decoration?4:0,r=t[0].yMin;return{x:0,y:r,height:t[t.length-1].yMax+e.lineHeight*(t.length-1)+i-r,width:s}}(o,e):{y:0,height:0},h=function(t){if(!t)return 0;switch(t){case"Left":case"left":return-1;case"Right":case"right":return 1;case"Justify":return D.A.getLogger("esri.views.2d.engine.webgl.alignmentUtils").warnOnce("Horizontal alignment 'justify' is not implemented. Falling back to 'center'."),0;case"Center":case"center":return 0}}(e.horizontalAlignment),c=function(t){if(!t)return 0;switch(t){case"Top":case"top":return 1;case"Center":case"middle":return 0;case"Baseline":case"baseline":return 2;case"Bottom":case"bottom":return-1}}(e.verticalAlignment),l=2===c?1:0,u=l?0:c-1,d=(1-l)*-a.y+u*(a.height/2)+-22*(l?1:0);for(let n=0;n<o.length;n++){const{start:a,end:c,width:l}=o[n];let u=-1*(h+1)*(l/2)-3;const p=(t.isRightToLeft?o.length-1-n:n)*e.lineHeight+d-3;o[n].startX=u,o[n].startY=p;for(let t=a;t<=c;t++){const e=r[t];if($s(e.code))continue;const n=new Vs(u+e.metrics.left,p-e.metrics.top,e,s);u+=e.metrics.advance,i.push(n)}}return new Hs(i,o,e)}var Js=s(39829);Math.PI,s(59868);var Ks=s(13195);function ti(t){if(!t)return 0;switch(t.type){case"CIMGeometricEffectArrow":return Math.abs(.5*t.width);case"CIMGeometricEffectBuffer":return Math.abs(t.size);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(t.length);case"CIMGeometricEffectJog":return Math.abs(.5*t.length);case"CIMGeometricEffectMove":return Math.max(Math.abs((0,Lt.$w)(t.offsetX)),Math.abs((0,Lt.$w)(t.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(t.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(t.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(t.fromWidth),Math.abs(t.toWidth));case"CIMGeometricEffectWave":return Math.abs(t.amplitude);case"CIMGeometricEffectDonut":return Math.abs(t.width)}}function ei(t){if(!t)return 0;let e=0;for(const s of t)e+=ti(s);return e}Math.PI,Math.PI;const si=96/72;class ii{static executeEffects(t,e,s,i){const r=si,n=ei(t);let o=new Yt(e);for(const e of t){const t=as(e);t&&(o=t.execute(o,e,r,s,n,i))}return o}static applyEffects(t,e){if(!t)return e;const s=ei(t);let i,r=new Yt(wt.z.fromJSONCIM(e));for(const e of t){const t=as(e);t&&(r=t.execute(r,e,1,null,s,!1))}const n=[];let o=null;for(;i=r.next();)n.push(...(0,Mt.x)(i)),o=i.geometryType;return 0===n.length||null===o?null:"esriGeometryPolygon"===o?{rings:n}:{paths:n}}}const ri=new Float32Array(1),ni=new Uint32Array(ri.buffer);function oi(t){const e=function(t){return ri[0]=t,ni[0]}(t),s=e>>>31;let i=e>>>23&255,r=8388607&e;return i-=127,i>15?s<<15|31744:i<-25?0:(i<-14&&(r+=8388608,r/=2**(-14-i),i=-15),i+=15,r/=8192,r=function(t){const e=Math.floor(t),s=t-e;return e<1023&&(s>.5||.5===s&&e%2==1)?e+1:e}(r),s<<15|i<<10|r)}function ai(t,e,s,i,r,n,o){if(t.primitiveName===e){let e=i?.readWithDefault(r,n,t[s]&&o);return"text"===t.type&&(e=e.toString()),void(t[s]=e)}if("type"in t&&null!=t.type){if(t.effects)for(const a of t.effects)ai(a,e,s,i,r,n,o);switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(t.symbolLayers)for(const a of t.symbolLayers)ai(a,e,s,i,r,n,o);break;case"CIMTextSymbol":t.symbol&&ai(t.symbol,e,s,i,r,n,o);break;case"CIMHatchFill":t.lineSymbol&&ai(t.lineSymbol,e,s,i,r,n,o);break;case"CIMPictureMarker":case"CIMCharacterMarker":case"CIMVectorMarker":if(t.markerPlacement&&ai(t.markerPlacement,e,s,i,r,n,o),"CIMVectorMarker"===t.type&&t.markerGraphics)for(const a of t.markerGraphics)ai(a,e,s,i,r,n,o),ai(a.symbol,e,s,i,r,n,o)}}}function hi(t){const e=Math.max(1.25*t.width,20);return null!=t.effects&&t.effects.length>0?400:e}var ci=s(63907);function li(t){switch(t){case ci.pe.BYTE:case ci.pe.UNSIGNED_BYTE:return 1;case ci.pe.SHORT:case ci.pe.UNSIGNED_SHORT:case ci.pe.HALF_FLOAT:return 2;case ci.pe.FLOAT:case ci.pe.INT:case ci.pe.UNSIGNED_INT:return 4}}class ui{static fromVertexSpec(t,e){const{attributes:s,optionalAttributes:i}=t;let r,n,o;const a=[];for(const t in s){if(s[t].otherSource)continue;const e=s[t];"position"===e.pack?r={...e,name:t,offset:0}:"id"===e.pack?n={...e,name:t,offset:4}:"bitset"===t?o={...e,name:t,offset:7}:a.push({...e,name:t})}for(const t in i)if(!0===e[t]){const e=i[t];a.push({...e,name:t})}const h=function(t){const e=[],s=[],i=[];for(const r of t){const t=li(r.type)*r.count;switch(t%2||t%4||4){case 4:e.push(r);continue;case 2:s.push(r);continue;case 1:i.push(r);continue;default:throw new Error("Found unexpected dataType byte count")}}return e.push(...s),e.push(...i),e}(a),c=[];let l=8,u=1;for(const t of h)c.push({...t,offset:l}),l+=li(t.type)*t.count,t.packAlternating&&(u=Math.max(t.packAlternating.count,u));const d=Uint32Array.BYTES_PER_ELEMENT,p=l%d;return new ui(r,n,o,c,l+(p?d-p:0),u)}constructor(t,e,s,i,r,n){this.position=t,this.id=e,this.bitset=s,this.standardAttributes=i,this.stride=r,this.packVertexCount=n,i.push(s),this._attributes=[t,e,s,...i]}get attributeLayout(){if(!this._attributeLayout){const t=function(t){const e=t.map(({name:t,count:e,type:s})=>`${t}.${e}.${s}`).join(",");return(0,yt.Wm)(e)}(this._attributes),e=this._attributes.map(t=>({name:t.name,count:t.count,offset:t.offset,type:t.type,packPrecisionFactor:t.packPrecisionFactor,normalized:t.normalized??!1}));this._attributeLayout={attributes:e,hash:t,stride:this.stride}}return this._attributeLayout}}class di{static fromVertexSpec(t,e){const s=ui.fromVertexSpec(t,e);return new di(s)}constructor(t){this._spec=t,this._packed=new Uint8Array(this._spec.stride*this._spec.packVertexCount),this._packedU32View=new Uint32Array(this._packed.buffer),this._dataView=new DataView(this._packed.buffer)}get attributeLayout(){return this._spec.attributeLayout}get stride(){return this._spec.stride}writeVertex(t,e,s,i,r,n){for(let t=0;t<this._spec.packVertexCount;t++){const o=t*this._spec.stride;this._packPosition(s,i,o),this._packId(e,o);const a=this._spec.bitset;if(n){if(a.packTessellation){const t=a.packTessellation(n,r,s,i);this._pack(t,a,o)}for(const t of this._spec.standardAttributes)if(null!=t.packTessellation){const e=t.packTessellation(n,r,s,i);this._pack(e,t,o)}else if(t.packAlternating?.packTessellation){const e=t.packAlternating.packTessellation(n,r,s,i);for(let s=0;s<this._spec.packVertexCount;s++){const i=e[s];this._pack(i,t,s*this._spec.stride)}}}}t.vertexWriteRegion(this._packedU32View)}pack(t,e){for(const s of this._spec.standardAttributes)if(s.pack&&"string"!=typeof s.pack){const i=s.pack(t,e);for(let t=0;t<this._spec.packVertexCount;t++)this._pack(i,s,t*this._spec.stride)}else if(s.packAlternating?.pack){const i=s.packAlternating.pack(t,e);for(let t=0;t<this._spec.packVertexCount;t++){const e=i[t];this._pack(e,s,t*this._spec.stride)}}}_packPosition(t,e,s){const{offset:i}=this._spec.position,r=this._spec.position.packPrecisionFactor??1,n=65535&t*r|e*r<<16;this._dataView.setUint32(s+i,n,!0)}_packId(t,e){const s=t*(this._spec.id.packPrecisionFactor??1),i=4278190080&this._dataView.getUint32(e+this._spec.id.offset,!0);this._dataView.setUint32(e+this._spec.id.offset,s|i,!0)}_pack(t,e,s){!function(t,e,s,i){const r=s.packPrecisionFactor??1;switch(s.type){case ci.pe.BYTE:if(1===s.count)t.setInt8(i+s.offset,e*r);else for(let n=0;n<s.count;n++){const o=n*Int8Array.BYTES_PER_ELEMENT;t.setInt8(i+s.offset+o,e[n]*r)}break;case ci.pe.UNSIGNED_BYTE:if(1===s.count)t.setUint8(i+s.offset,e*r);else for(let n=0;n<s.count;n++){const o=n*Uint8Array.BYTES_PER_ELEMENT;t.setUint8(i+s.offset+o,e[n]*r)}break;case ci.pe.SHORT:if(1===s.count)t.setInt16(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Int16Array.BYTES_PER_ELEMENT;t.setInt16(i+s.offset+o,e[n]*r,!0)}break;case ci.pe.UNSIGNED_SHORT:if(1===s.count)t.setUint16(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;t.setUint16(i+s.offset+o,e[n]*r,!0)}break;case ci.pe.INT:if(1===s.count)t.setInt32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Int32Array.BYTES_PER_ELEMENT;t.setInt32(i+s.offset+o,e[n]*r,!0)}break;case ci.pe.UNSIGNED_INT:if(1===s.count)t.setUint32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Uint32Array.BYTES_PER_ELEMENT;t.setUint32(i+s.offset+o,e[n]*r,!0)}break;case ci.pe.FLOAT:if(1===s.count)t.setFloat32(i+s.offset,e*r,!0);else for(let n=0;n<s.count;n++){const o=n*Float32Array.BYTES_PER_ELEMENT;t.setFloat32(i+s.offset+o,e[n]*r,!0)}break;case ci.pe.HALF_FLOAT:if(1===s.count)t.setUint16(i+s.offset,oi(e*r),!0);else for(let n=0;n<s.count;n++){const o=n*Uint16Array.BYTES_PER_ELEMENT;t.setUint16(i+s.offset+o,oi(e[n]*r),!0)}}}(this._dataView,t,e,s)}}class pi{constructor(t,e,s,i){this._instanceId=t,this._evaluator=e,this._enabledOptionalAttributes=s,this._viewParams=i,this._evaluator.evaluator=t=>this.vertexSpec.createComputedParams(t)}get _vertexPack(){if(!this._cachedVertexPack){const t=di.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||t.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=t}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(t){this._references=t}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:t}of this.effectInfos||[])await jt(t)}enqueueRequest(t,e,s){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(t,e,s)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.effects;if(!n||0===n.length)return void this._write(t,s,void 0,r);const o=this.getEffectCursor(t,s,n);if(!o)return;let a;for(;a=o.next();)a.invertY(),this._write(t,s,a,r)}ensurePacked(t,e,s){if(!this._evaluator.hasDynamicProperties)return;const i=this._evaluator.evaluateMeshParams(t,e,s);this._vertexPack.pack(i,this._viewParams)}hasArcadeDependency(t){return this._evaluator.hasArcadeDependency(t)}_writeVertex(t,e,s,i,r){const n=this.evaluatedMeshParams;this._vertexPack.writeVertex(t,e,s,i,n,r)}getEffectCursor(t,e,s){const i=e.readGeometryForDisplay()?.clone();if(!i)return;const r=wt.z.fromOptimizedCIM(i,e.geometryType);r.invertY();const n=t.id||"";return ii.executeEffects(s,r,n,this._preventEffectClipping)}}class _i extends pi{}function fi(t,e){let s;if("string"==typeof t)s=(0,yt.Wm)(t+`-seed(${e})`);else{let i=12;s=t^e;do{s=107*(s>>8^s)+i|0}while(0!==--i)}return(1+s/(1<<31))/2}function mi(t){return Math.floor(fi(t,gi)*yi)}const gi=53290320,yi=10;class xi{generateSource(t){const e=[];for(let s=1;s<this.length;s++)e.push(`vec4 atom${s} = texture(${t.animationTexture}, (pointer + 0.5) / size);`),e.push("pointer.x += 1.0;");for(let t=0;t<this.ins;t++)e.push("top--;"),e.push(`vec4 in${this.ins-t-1} = stack[top];`);for(let t=0;t<this.outs;t++)e.push(`vec4 out${t};`);const{microcode:s}=this;for(const t of s)e.push(t);for(let t=0;t<this.outs;t++)e.push(`stack[top] = out${t};`),e.push("top++;"),e.push(`if (top >= ${Ti}) { top = ${Ti-1}; }`);return e}}let bi=128;function wi(t){return[`float duration = clamp(${t.duration}, 0.05, 3600.0);`,`float startTimeOffset = ${t.startTimeOffset};`,`float repeatDelay = ${t.repeatDelay};`,`float timeOriginSelector = ${t.timeOriginSelector};`,`float repeatType = ${t.repeatType};`,`float easing = ${t.easing};`,`float playAnimation = ${t.playAnimation} * (1.0 - step(0.0, -${t.duration}));`,`float reverseAnimation = ${t.reverseAnimation};`,"float time = globalTime - (timeOriginSelector == 1.0 ? localTimeOrigin : 0.0);","time *= playAnimation;","time *= 1.0 - reverseAnimation * 2.0;","float period = duration + repeatDelay;","time += reverseAnimation == 1.0 ? (period - startTimeOffset - 0.001) : startTimeOffset + 0.001;","float omega = time / period;","float oi = floor(omega);","omega = repeatType == 1.0 || repeatType == 3.0 ? omega - oi : omega;","float of = omega * period;","of = (clamp(of, reverseAnimation * repeatDelay, period - (1.0 - reverseAnimation) * repeatDelay) - reverseAnimation * repeatDelay) / duration;","of = easing == 2.0 ? pow(of, 3.0) : of;","of = easing == 3.0 ? 1.0 - pow(1.0 - of, 3.0) : of;","of = easing == 4.0 ? of < 0.5 ? 4.0 * pow(of, 3.0) : 1.0 - pow(-2.0 * of + 2.0, 3.0) / 2.0 : of;","bool oscillate = repeatType == 3.0 && mod(oi, 2.0) == 1.0;",`${t.out} = oscillate ? 1.0 - of : of;`]}const vi={Linear:1,EaseIn:2,EaseOut:3,EaseInOut:4},Si={Loop:1,None:2,Oscillate:3},Ii={Local:1,Global:2};function Pi(t){const e=vi[t.easing],s=Si[t.repeatType],i=Ii[t.timeOriginSelector];return[[t.duration,t.startTimeOffset,t.repeatDelay,i],[s,e,t.playAnimation,t.reverseAnimation]]}const Mi={scalar:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.y, atom0.y, atom0.y, atom0.y);"]}encode(t){return[[this.opcode,t,0,0]]}},vector3:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=1,this.ins=0,this.outs=1,this.microcode=["out0 = vec4(atom0.yzw, 0.0);"]}encode(t){return[[this.opcode,t[0]||0,t[1]||0,t[2]||0]]}},vector4:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=2,this.ins=0,this.outs=1,this.microcode=["out0 = atom1;"]}encode(t){return[[this.opcode,0,0,0],t]}},animatedTransform:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=10,this.ins=1,this.outs=1,this.microcode=["vec2 fromTranslation = atom1.xy;","vec2 toTranslation = atom1.zw;","float fromRotation = atom2.x;","float toRotation = atom2.y;","float fromScale = atom2.z;","float toScale = atom2.w;","bool relativeTranslation = atom9.x == 1.0;","bool absoluteScale = atom9.y == 1.0;","vec2 translationMultiplier = relativeTranslation ? pixelDimensions : vec2(1.0, 1.0);","float scaleDivisor = absoluteScale ? pixelDimensions.y : 1.0;","float fTranslation;","{",...wi({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fTranslation"}),"}","float fRotation;","{",...wi({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fRotation"}),"}","float fScale;","{",...wi({duration:"atom7.x",startTimeOffset:"atom7.y",repeatDelay:"atom7.z",timeOriginSelector:"atom7.w",repeatType:"atom8.x",easing:"atom8.y",playAnimation:"atom8.z",reverseAnimation:"atom8.w",out:"fScale"}),"}","vec2 aTranslation = mix(fromTranslation, toTranslation, fTranslation);","float aRotation = mix(fromRotation, toRotation, fRotation);","float aScale = mix(fromScale, toScale, fScale);","vec2 pTranslation = in0.xy;","float pRotation = in0.z;","float pScale = in0.w;","aTranslation *= translationMultiplier;","aScale /= scaleDivisor;","float rotation = pRotation + aRotation;","float scale = pScale * aScale;","float sin1 = sin(pRotation);","float cos1 = cos(pRotation);","float s1 = pScale;","float x1 = pTranslation.x;","float y1 = pTranslation.y;","float x2 = aTranslation.x;","float y2 = aTranslation.y;","\n vec2 translation = vec2(\n cos1 * s1 * x2 - sin1 * s1 * y2 + x1,\n sin1 * s1 * x2 + cos1 * s1 * y2 + y1\n );\n ","out0 = vec4(translation, rotation, scale);"]}encode(t){return[[this.opcode,0,0,0],[t.translation.from[0],t.translation.from[1],t.translation.to[0],t.translation.to[1]],[t.rotation.from,t.rotation.to,t.scale.from,t.scale.to],...Pi(t.translation.timing),...Pi(t.rotation.timing),...Pi(t.scale.timing),[t.relativeTranslation?1:0,t.absoluteScale?1:0,0,0]]}},animatedColor:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=7,this.ins=1,this.outs=1,this.microcode=["float fromOpacity = atom0.y;","float toOpacity = atom0.z;","vec4 fromColor = atom1;","vec4 toColor = atom2;","float fColor;","{",...wi({duration:"atom3.x",startTimeOffset:"atom3.y",repeatDelay:"atom3.z",timeOriginSelector:"atom3.w",repeatType:"atom4.x",easing:"atom4.y",playAnimation:"atom4.z",reverseAnimation:"atom4.w",out:"fColor"}),"}","float fOpacity;","{",...wi({duration:"atom5.x",startTimeOffset:"atom5.y",repeatDelay:"atom5.z",timeOriginSelector:"atom5.w",repeatType:"atom6.x",easing:"atom6.y",playAnimation:"atom6.z",reverseAnimation:"atom6.w",out:"fOpacity"}),"}","vec4 aColor = mix(fromColor, toColor, fColor);","aColor.a *= mix(fromOpacity, toOpacity, fOpacity);","vec4 pColor = in0;","out0 = aColor * pColor;"]}encode(t){return[[this.opcode,t.opacity.from,t.opacity.to,0],[t.color.from[0],t.color.from[1],t.color.from[2],t.color.from[3]],[t.color.to[0],t.color.to[1],t.color.to[2],t.color.to[3]],...Pi(t.color.timing),...Pi(t.opacity.timing)]}},animatedShift:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=4,this.ins=1,this.outs=1,this.microcode=["float fromShift = atom0.y;","float toShift = atom0.z;","float duration = atom1.x;","bool multiplyByLineLength = atom3.x == 1.0;","float fShift;","{",...wi({duration:"duration",startTimeOffset:"atom1.y",repeatDelay:"atom1.z",timeOriginSelector:"atom1.w",repeatType:"atom2.x",easing:"atom2.y",playAnimation:"atom2.z",reverseAnimation:"atom2.w",out:"fShift"}),"}","toShift *= multiplyByLineLength ? lineLength : 1.0;","float aShift = mix(fromShift, toShift, fShift);","vec4 pShift = in0;","out0 = mod(aShift + pShift, lineLength);"]}encode(t){return[[this.opcode,t.shift.from,t.shift.to,0],...Pi(t.shift.timing),[t.multiplyByLineLength?1:0,0,0,0]]}},ret:new class extends xi{constructor(){super(...arguments),this.opcode=++bi,this.length=1,this.ins=0,this.outs=0,this.microcode=["break;"]}encode(){return[[this.opcode,0,0,0]]}}},Ti=4;function ki(t){return t instanceof Ci?t:"object"==typeof t&&"type"in t?Ri[t.type].hydrate(t):new Ai(t)}class Ci{constructor(t){this.inputs=t}encode(){const t=[];for(const e of this.inputs)t.push(...e.encode());return t.push(...this.instructions),t}}class Ai extends Ci{constructor(t){super([]),this.value=t}simplify(){return this}get instructions(){if(Array.isArray(this.value)){const[t,e,s,i]=this.value;return null!=i?Mi.vector4.encode([t,e||0,s||0,i]):Mi.vector3.encode([t,e||0,s||0])}return Mi.scalar.encode(this.value)}}class Fi extends Ci{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new Fi(t,ki(t.parent))}simplify(){if(this._config.relativeTranslation||this._config.absoluteScale)return this;const t=this._parent.simplify();if(!(t instanceof Ai))return this;const[e,s,i,r]=t.value,n=this._config.translation.from[0],o=this._config.translation.from[1],a=this._config.rotation.from,h=this._config.scale.from;if(n===this._config.translation.to[0]&&o===this._config.translation.to[1]&&a===this._config.rotation.to&&h===this._config.scale.to){const t=i+a,c=r*h,l=Math.sin(i),u=Math.cos(i);return new Ai([u*r*n-l*r*o+e,l*r*n+u*r*o+s,t,c])}return new Fi(this._config,t)}get instructions(){return Mi.animatedTransform.encode(this._config)}}class Ei extends Ci{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new Ei(t,ki(t.parent))}simplify(){const t=this._parent.simplify();if(!(t instanceof Ai))return this;const[e,s,i,r]=t.value,n=this._config.color.from[0],o=this._config.color.from[1],a=this._config.color.from[2];let h=this._config.color.from[3];const c=this._config.opacity.from;return n===this._config.color.to[0]&&o===this._config.color.to[1]&&a===this._config.color.to[2]&&h===this._config.color.to[3]&&c===this._config.opacity.to?(h*=c,new Ai([e*n,s*o,i*a,r*h])):new Ei(this._config,t)}get instructions(){return Mi.animatedColor.encode(this._config)}}class zi extends Ci{constructor(t,e){super([e]),this._config=t,this._parent=e}static hydrate(t){return new zi(t,ki(t.parent))}simplify(){const t=this._parent.simplify();return t instanceof Ai?new zi(this._config,t):this}get instructions(){return Mi.animatedShift.encode(this._config)}}const Ri={AnimatedTransform:Fi,AnimatedColor:Ei,AnimatedShift:zi};function Oi(t){return Di(t.map(t=>Ni(t)).map(t=>ki(t).simplify()))}function Li(t){const e=[];return e.push(t.transform),e.push(t.fromColor),e.push(t.toColor),e.push(t.colorMix),e.push(t.toOpacity),e.push(t.opacityMix),t?.shift?e.push(t?.shift):e.push([1,1,1,1]),e}function Di(t){const e=[],s=[];let i=0;for(const r of t){const n=[...r.encode(),...Mi.ret.encode()];e.push([i+t.length,0,0,0]),s.push(...n),i+=n.length}return[...e,...s]}async function Gi(t,e){const s=t;let i;if("number"==typeof s||"string"==typeof s||"boolean"==typeof s)i=s;else if(Array.isArray(s))i=await Promise.all(s.map(t=>Gi(t,e)));else if("object"==typeof s)if("valueExpressionInfo"in s){const{valueExpressionInfo:t}=s,{expression:r}=t;i={...s,computed:await e.createComputedField({expression:r})}}else{i={};for(const t in s)i[t]=await Gi(s[t],e)}return i}function Ni(t,e,s){const i=t;let r;if("number"==typeof i||"string"==typeof i||"boolean"==typeof i)r=i;else if(Array.isArray(i))r=i.map(t=>Ni(t,e,s));else if("object"==typeof i)if("type"in i&&null!=i.type&&"Process"===i.type)switch(i.op){case"ArcadeColor":{const t=Ni(i.value,e,s);qi(Array.isArray(t)&&4===t.length),r=[t[0]/255,t[1]/255,t[2]/255,t[3]]}break;case"Transparency":{const t=Ni(i.value,e,s);qi("number"==typeof t),r=1-t/100}break;case"Divide":case"Multiply":case"Add":{const t=Ni(i.left,e,s);qi("number"==typeof t);const n=Ni(i.right,e,s);switch(qi("number"==typeof n),i.op){case"Divide":r=t/n;break;case"Multiply":r=t*n;break;case"Add":r=t+n}}break;case"Random":{const t=Ni(i.seed,e,s),n=Ni(i.min,e,s),o=Ni(i.max,e,s);r=n+fi(mi(e.getObjectId()||0),t)*(o-n)}break;case"Cond":{const t=Ni(i.condition,e,s),n=Ni(i.ifTrue,e,s),o=Ni(i.ifFalse,e,s);r=t?n:o}break;case"MatchWinding":{const t=Ni(i.sign,e,s);let n=Ni(i.angle,e,s);if(t>0)for(;n<0;)n+=2*Math.PI;else for(;n>0;)n-=2*Math.PI;r=n}}else if("computed"in i)r=function(t){if(!("computed"in t))return t;let i=t.computed.readWithDefault(e,s,[255*t.defaultValue[0],255*t.defaultValue[1],255*t.defaultValue[2],t.defaultValue[3]]);if("string"==typeof i){const t=cs.A.fromString(i);t&&(i=[t.r,t.g,t.b,t.a])}return i}(i);else{r={};for(const t in i)r[t]=Ni(i[t],e,s)}return r}function*Bi(t){const e=t;if(Array.isArray(e))for(const t of e)yield*Bi(t);else if("object"==typeof e)if("type"in e&&null!=e.type&&"Process"===e.type)switch(e.op){case"ArcadeColor":case"Transparency":yield*Bi(e.value);break;case"Divide":case"Multiply":case"Add":yield*Bi(e.left),yield*Bi(e.right);break;case"Random":yield*Bi(e.seed),yield*Bi(e.min),yield*Bi(e.max);break;case"Cond":yield*Bi(e.condition),yield*Bi(e.ifTrue),yield*Bi(e.ifFalse);break;case"MatchWinding":yield*Bi(e.sign),yield*Bi(e.angle)}else if("computed"in e)yield e.computed;else for(const t in e)yield*Bi(e[t])}function qi(t){if(!t)throw new Error("Assertion failed.")}const Ui={type:ci.pe.SHORT,count:2,packPrecisionFactor:p.fq,pack:({scaleInfo:t},{tileInfo:e})=>ls(t,e)},Wi={type:ci.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:({value1Position2Value2:t})=>(qi(t),t)},Vi={type:ci.pe.FLOAT,count:4,packPrecisionFactor:1,packTessellation:()=>[0,0,0,1]},ji={type:ci.pe.FLOAT,count:1,packPrecisionFactor:1,pack:()=>0},Yi={type:ci.pe.FLOAT,count:1,packPrecisionFactor:1,packTessellation:({lineLength:t})=>t},Hi={type:ci.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},Xi={type:ci.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},$i={type:ci.pe.FLOAT,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[t,e]},Zi={type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},Qi={type:ci.pe.UNSIGNED_BYTE,count:1,pack:function(t){const{sprite:e,isMapAligned:s,colorLocked:i,scaleSymbolsProportionally:r,isStroke:n}=t;let o=0;return s&&(o|=us(xs)),i&&(o|=us(vs)),e.sdf&&(o|=us(ys)),r&&(o|=us(bs)),n&&(o|=us(Ss)),o}},Ji={type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:1},Ki={marker:{type:ci.pe.FLOAT,count:2,packAlternating:{count:4,pack:({texelDimensions:t})=>[[-.5*t[0],-.5*t[1]],[.5*t[0],-.5*t[1]],[-.5*t[0],.5*t[1]],[.5*t[0],.5*t[1]]]}},line:{type:ci.pe.FLOAT,count:2,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e},{baseSize:s})=>[t*s/2,e*s/2]},fill:{type:ci.pe.FLOAT,count:2,packTessellation:()=>[0,0]}},tr={marker:{type:ci.pe.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:t,texXmin:e,texYmax:s,texYmin:i})=>[[e,i],[t,i],[e,s],[t,s]]}}},er={type:ci.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+p.hM,n=e.y+p.hM;return[r+1,n+1,r+s-1,n+i-1]}},sr={type:ci.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,pack:({animations:t,baseSize:e,referenceSize:s})=>[t.dataColumn,t.dataRow,e,s]},ir={type:ci.pe.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:t,pixelDimensions:e,baseSize:s,sprite:i,sizeRatio:r})=>{const n=Math.max(s*i.width/i.height,s),o=i.sdfDecodeCoeff*n*r;return[e[0],e[1],t,o]}},rr={type:ci.pe.BYTE,count:1,packTessellation:({angle:t})=>t};function nr(t){let{pixelDimensions:e,texelDimensions:s,baseSize:i,referenceSize:r,strokeWidth:n,sizeRatio:o}=t;if(e||(e=t.sprite.sdf?[0,0]:[t.sprite.width,t.sprite.height]),s||(s=t.sprite.sdf?[0,0]:e),null!=t.patternHeight){const s=t.patternHeight/e[1];e[1]*=s,e[0]*=s}-1===i&&(i=e[1]),i=(0,l.Lz)(i),r=(0,l.Lz)(r),n=(0,l.Lz)(n);const a=(t.sprite.sdfDecodeCoeff??1)*o;return{...t,pixelDimensions:e,texelDimensions:s,baseSize:i,referenceSize:r,strokeWidth:n,sdfDecodeCoeff:a}}class or extends _i{get vertexSpec(){return{createComputedParams:nr,optionalAttributes:{zoomRange:Ui,value1Position2Value2:Wi,lineLength:Yi},attributes:{id:Zi,bitset:Qi,pos:Ji,offset:Ki.marker,uv:tr.marker,animationPointerAndBaseSizeAndReferenceSize:sr,sizing:ir,angle:rr}}}_write(t,e,s){const i=this.evaluatedMeshParams.sprite,{textureBinding:r}=i;t.recordStart(this.instanceId,this.attributeLayout,r);const n=e.getDisplayId();if(this.shift&&"esriGeometryPolyline"===e.geometryType){if(!s){const s=wt.z.fromFeatureSetReaderCIM(e);s&&this._writeParticles(t,e,s)}}else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(t,e);else if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[i,r]=s.coords;this._writeQuad(t,n,i,r)}else if("esriGeometryPoint"===e.geometryType){const s=e.readXForDisplay(),i=e.readYForDisplay();this._writeQuad(t,n,s,i)}else{const s=e.readGeometryForDisplay();s&&s.forEachVertex((e,s)=>{this._writeQuad(t,n,e,s)})}t.recordEnd()}_writePlacedMarkers(t,e){const s=wt.z.fromFeatureSetReaderCIM(e)?.clone();if(!s)return;const i=hs.getPlacement(s,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id);if(!i)return;const r=e.getDisplayId();let n=i.next(),o=null;for(;null!=n;){const e=n.tx,s=-n.ty;if(Math.abs(e)>St||Math.abs(s)>St){n=i.next();continue}const a=-n.getAngle();t.recordBounds(e,s,64,64),this.shift?o&&this._writeQuad(t,r,o[0],o[1],void 0,a):this._writeQuad(t,r,e,s,void 0,a),o=[e,s],n=i.next()}}_writeParticles(t,e,s){const i=e.getDisplayId();for(;s.nextPath();){const e=[];for(;s.nextPoint();)e.push([s.x,s.y]);const r=ar(e);let n=0;for(let t=1;t<e.length;t++){const s=e[t][0]-e[t-1][0],i=e[t][1]-e[t-1][1],r=Math.sqrt(s*s+i*i);n+=r}const o=e=>{for(const s of r){const{a:r,b:o}=s;this._writeQuad(t,i,r.position[0],r.position[1],[r.distance-e,o.position[0],o.position[1],o.distance-e],this.evaluatedMeshParams.angleToLine?Math.atan2(r.direction[1],r.direction[0]):0,n,!0)}},{placement:a}=this.evaluatedMeshParams;if(!a||"placementTemplate"in a||"CIMMarkerPlacementOnVertices"===a.type){let t;if(a&&"CIMMarkerPlacementOnVertices"!==a.type)t=a.placementTemplate;else{t=[0];for(const e of r){const{a:s,b:i}=e,r=s.position[0]-i.position[0],n=s.position[1]-i.position[1],o=Math.sqrt(r*r+n*n);t.push(o)}}let e=-1*n;for(;e<2*n;)for(const s of t)e+=s,o(e)}else"CIMMarkerPlacementAtExtremities"===a.type?"JustBegin"===a.extremityPlacement?o(1):"JustEnd"===a.extremityPlacement?(o(n-1),o(-1)):"Both"===a.extremityPlacement&&(o(1),o(n-1)):"CIMMarkerPlacementOnLine"===a.type&&("LineBeginning"===a.relativeTo?o(1):"LineEnd"===a.relativeTo?(o(n-1),o(-1)):"LineMiddle"===a.relativeTo&&o(n/2))}}_writeQuad(t,e,s,i,r,n=0,o=0,a=!1){const h=this.evaluatedMeshParams.sprite,{rect:c}=h,l=c.x+p.hM,u=c.y+p.hM,d=c.x+c.width-p.hM,_=c.y+c.height-p.hM,f=t.vertexCount();a||t.recordBounds(s,i,64,64);const m={texXmin:l,texYmin:u,texXmax:d,texYmax:_,value1Position2Value2:r,angle:n/.024543692606171875,lineLength:o};for(let r=0;r<4;r++)this._writeVertex(t,e,s,i,m);t.indexEnsureSize(6),t.indexWrite(f),t.indexWrite(f+1),t.indexWrite(f+2),t.indexWrite(f+1),t.indexWrite(f+3),t.indexWrite(f+2)}}function ar(t){const e=[];let s=0;for(let i=1;i<t.length;i++){const r=t[i-1],n=t[i],o=n[0]-r[0],a=n[1]-r[1],h=Math.sqrt(o*o+a*a),c=o/h,l=a/h;e.push({a:{position:r,distance:s,direction:[c,l]},b:{position:n,distance:s+h,direction:[c,l]}}),s+=h}return e}class hr extends or{constructor(){super(...arguments),this.shift=!1}}class cr extends or{constructor(){super(...arguments),this.shift=!0}}var lr=s(83773),ur=s(15585),dr=s(92722);function pr(t,e,s,i,r,n,o){Dr=0;const a=(i-s)*n,h=r&&r.length,c=h?(r[0]-s)*n:a;let l,u,d,p,_,f=_r(e,s,0,0,c,n,!0);if(f&&f.next!==f.prev){if(h&&(f=function(t,e,s,i,r,n){const o=new Array;for(let r=0,a=i.length;r<a;r++){const h=_r(t,e,0,i[r]*n,r<a-1?i[r+1]*n:s*n,n,!1);h===h.next&&(h.steiner=!0),o.push(wr(h))}o.sort(Ar);for(const t of o)r=vr(t,r);return r}(e,s,i,r,f,n)),a>80*n){l=d=e[0+s*n],u=p=e[1+s*n];for(let t=n;t<c;t+=n){const i=e[t+s*n],r=e[t+1+s*n];l=Math.min(l,i),u=Math.min(u,r),d=Math.max(d,i),p=Math.max(p,r)}_=Math.max(d-l,p-u),_=0!==_?1/_:0}mr(f,t,n,l,u,_,o,0)}}function _r(t,e,s,i,r,n,o){let a;if(o===function(t,e,s,i,r,n){let o=0;for(let s=i,a=r-n;s<r;s+=n)o+=(t[a+e*n]-t[s+e*n])*(t[s+1+e*n]+t[a+1+e*n]),a=s;return o}(t,e,0,i,r,n)>0)for(let s=i;s<r;s+=n)a=xr(s+e*n,t[s+e*n],t[s+1+e*n],a);else for(let s=r-n;s>=i;s-=n)a=xr(s+e*n,t[s+e*n],t[s+1+e*n],a);return a&&Cr(a,a.next)&&(br(a),a=a.next),a}function fr(t,e=t){if(!t)return t;let s,i=t;do{if(s=!1,i.steiner||!Cr(i,i.next)&&0!==Ir(i.prev,i,i.next))i=i.next;else{if(br(i),i=e=i.prev,i===i.next)break;s=!0}}while(s||i!==e);return e}function mr(t,e,s,i,r,n,o,a){if(!t)return;!a&&n&&(t=Sr(t,i,r,n));let h=t;for(;t.prev!==t.next;){const c=t.prev,l=t.next;if(n?yr(t,i,r,n):gr(t))e.push(c.index/s+o),e.push(t.index/s+o),e.push(l.index/s+o),br(t),t=l.next,h=l.next;else if((t=l)===h){a?1===a?mr(t=Fr(t,e,s,o),e,s,i,r,n,o,2):2===a&&Er(t,e,s,i,r,n,o):mr(fr(t),e,s,i,r,n,o,1);break}}}function gr(t){const e=t.prev,s=t,i=t.next;if(Ir(e,s,i)>=0)return!1;let r=t.next.next;const n=r;let o=0;for(;r!==t.prev&&(0===o||r!==n);){if(o++,Mr(e.x,e.y,s.x,s.y,i.x,i.y,r.x,r.y)&&Ir(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function yr(t,e,s,i){const r=t.prev,n=t,o=t.next;if(Ir(r,n,o)>=0)return!1;const a=r.x<n.x?r.x<o.x?r.x:o.x:n.x<o.x?n.x:o.x,h=r.y<n.y?r.y<o.y?r.y:o.y:n.y<o.y?n.y:o.y,c=r.x>n.x?r.x>o.x?r.x:o.x:n.x>o.x?n.x:o.x,l=r.y>n.y?r.y>o.y?r.y:o.y:n.y>o.y?n.y:o.y,u=kr(a,h,e,s,i),d=kr(c,l,e,s,i);let p=t.prevZ,_=t.nextZ;for(;p&&p.z>=u&&_&&_.z<=d;){if(p!==t.prev&&p!==t.next&&Mr(r.x,r.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Ir(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,_!==t.prev&&_!==t.next&&Mr(r.x,r.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Ir(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Mr(r.x,r.y,n.x,n.y,o.x,o.y,p.x,p.y)&&Ir(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;_&&_.z<=d;){if(_!==t.prev&&_!==t.next&&Mr(r.x,r.y,n.x,n.y,o.x,o.y,_.x,_.y)&&Ir(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function xr(t,e,s,i){const r=Or.create(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function br(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wr(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function vr(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,o=-1/0;do{if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>o){if(o=t,t===i){if(r===s.y)return s;if(r===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==e);if(!n)return null;if(i===o)return n.prev;const a=n,h=n.x,c=n.y;let l,u=1/0;for(s=n.next;s!==a;)i>=s.x&&s.x>=h&&i!==s.x&&Mr(r<c?i:o,r,h,c,r<c?o:i,r,s.x,s.y)&&(l=Math.abs(r-s.y)/(i-s.x),(l<u||l===u&&s.x>n.x)&&Tr(s,t)&&(n=s,u=l)),s=s.next;return n}(t,e);if(!s)return e;const i=Rr(s,t);return fr(i,i.next),fr(s,s.next)}function Sr(t,e,s,i){let r;for(;r!==t;r=r.next){if(r=r||t,null===r.z&&(r.z=kr(r.x,r.y,e,s,i)),r.prev.next!==r||r.next.prev!==r)return r.prev.next=r,r.next.prev=r,Sr(t,e,s,i);r.prevZ=r.prev,r.nextZ=r.next}return t.prevZ.nextZ=null,t.prevZ=null,function(t){let e,s=1;for(;;){let i,r=t;t=null,e=null;let n=0;for(;r;){n++,i=r;let o=0;for(;o<s&&i;o++)i=i.nextZ;let a=s;for(;o>0||a>0&&i;){let s;0===o?(s=i,i=i.nextZ,a--):0!==a&&i?r.z<=i.z?(s=r,r=r.nextZ,o--):(s=i,i=i.nextZ,a--):(s=r,r=r.nextZ,o--),e?e.nextZ=s:t=s,s.prevZ=e,e=s}r=i}if(e.nextZ=null,s*=2,n<2)return t}}(t)}function Ir(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function Pr(t,e,s,i){return!!(Cr(t,e)&&Cr(s,i)||Cr(t,i)&&Cr(s,e))||Ir(t,e,s)>0!=Ir(t,e,i)>0&&Ir(s,i,t)>0!=Ir(s,i,e)>0}function Mr(t,e,s,i,r,n,o,a){return(r-o)*(e-a)-(t-o)*(n-a)>=0&&(t-o)*(i-a)-(s-o)*(e-a)>=0&&(s-o)*(n-a)-(r-o)*(i-a)>=0}function Tr(t,e){return Ir(t.prev,t,t.next)<0?Ir(t,e,t.next)>=0&&Ir(t,t.prev,e)>=0:Ir(t,e,t.prev)<0||Ir(t,t.next,e)<0}function kr(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-s)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Cr(t,e){return t.x===e.x&&t.y===e.y}function Ar(t,e){return t.x-e.x}function Fr(t,e,s,i){let r=t;do{const n=r.prev,o=r.next.next;!Cr(n,o)&&Pr(n,r,r.next,o)&&Tr(n,o)&&Tr(o,n)&&(e.push(n.index/s+i),e.push(r.index/s+i),e.push(o.index/s+i),br(r),br(r.next),r=t=o),r=r.next}while(r!==t);return r}function Er(t,e,s,i,r,n,o){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.index!==t.index&&zr(a,t)){let h=Rr(a,t);return a=fr(a,a.next),h=fr(h,h.next),mr(a,e,s,i,r,n,o,0),void mr(h,e,s,i,r,n,o,0)}t=t.next}a=a.next}while(a!==t)}function zr(t,e){return t.next.index!==e.index&&t.prev.index!==e.index&&!function(t,e){let s=t;do{if(s.index!==t.index&&s.next.index!==t.index&&s.index!==e.index&&s.next.index!==e.index&&Pr(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&Tr(t,e)&&Tr(e,t)&&function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)}function Rr(t,e){const s=Or.create(t.index,t.x,t.y),i=Or.create(e.index,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}class Or{constructor(){this.index=0,this.x=0,this.y=0,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}static create(t,e,s){const i=Dr<Lr.length?Lr[Dr++]:new Or;return i.index=t,i.x=e,i.y=s,i.prev=null,i.next=null,i.z=null,i.prevZ=null,i.nextZ=null,i.steiner=!1,i}}const Lr=[];let Dr=0;for(let t=0;t<8096;t++)Lr.push(new Or);const Gr=new Ot.O3(0,0,0,1,0),Nr=new Ot.O3(0,0,0,1,0);function Br(t,e,s){let i=0;for(let r=1;r<s;r++){const s=t[2*(e+r-1)],n=t[2*(e+r-1)+1];i+=(t[2*(e+r)]-s)*(t[2*(e+r)+1]+n)}return i}function qr(t,e,s,i,r){let n=0;for(let o=s;o<i;o+=3){const s=2*(t[o]-r),i=2*(t[o+1]-r),a=2*(t[o+2]-r);n+=Math.abs((e[s]-e[a])*(e[i+1]-e[s+1])-(e[s]-e[i])*(e[a+1]-e[s+1]))}return n}function Ur(t,e){const{coords:s,lengths:i}=e,r=t;let n=0;for(let t=0;t<i.length;){let e=t,o=i[t],a=Br(s,n,o);const h=[];for(;++e<i.length;){const t=i[e],r=Br(s,n+o,t);if(!(r>0))break;a+=r,h.push(n+o),o+=t}const c=r.length;pr(r,s,n,n+o,h,2,0);const l=qr(r,s,c,r.length,0),u=Math.abs(a);if(Math.abs((l-u)/Math.max(1e-7,u))>1e-5)return r.length=0,!1;t=e,n+=o}return!0}function Wr(t,e){if(null==t)return null;if(!function(t,e,s){let i=0;for(let e=0;e<t.lengths.length;e++){const r=t.lengths[e];for(let e=0;e<r;e++){const r=t.coords[2*(e+i)],n=t.coords[2*(e+i)+1];if(r<-128||r>s||n<-128||n>s)return!0}i+=r}return!1}(t,0,p.CQ+128))return t;Gr.setPixelMargin(e),Gr.reset(3);let s=0;for(let e=0;e<t.lengths.length;e++){const i=t.lengths[e];let r=t.coords[2*(0+s)],n=t.coords[2*(0+s)+1];Gr.moveTo(r,n);for(let e=1;e<i;e++)r=t.coords[2*(e+s)],n=t.coords[2*(e+s)+1],Gr.lineTo(r,n);Gr.close(),s+=i}const i=Gr.result(!1);if(!i)return null;const r=[],n=[];for(const t of i){for(const{x:e,y:s}of t)n.push(e,s);r.push(t.length)}return new dr.A(r,n)}function Vr(t,e){Nr.setPixelMargin(e);const s=Nr,i=-e,r=p.CQ+e;let n=[],o=!1;if(!t.nextPath())return null;let a=t.pathLength(),h=!0;for(;h;){t.seekPathStart();const e=[];if(!t.pathSize)return null;s.reset(2),t.nextPoint();let c=t.x,l=t.y;if(o)s.moveTo(c,l);else{if(c<i||c>r||l<i||l>r){o=!0;continue}e.push({x:c,y:l})}let u=!1;for(;t.nextPoint();)if(c=t.x,l=t.y,o)s.lineTo(c,l);else{if(c<i||c>r||l<i||l>r){u=!0;break}e.push({x:c,y:l})}if(u)o=!0;else{if(o){const t=s.resultWithStarts();if(t)for(const e of t)n.push({...e,pathLength:a})}else n.push({line:e,start:0,pathLength:a});h=t.nextPath(),a=h?t.pathLength():0,o=!1}}return n=n.filter(t=>t.line.length>1),0===n.length?null:n}Gr.setExtent(p.CQ),Nr.setExtent(p.CQ);class jr{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const Yr={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:ci.pe.SHORT,count:2,packPrecisionFactor:p.fq,pack:({scaleInfo:t},{tileInfo:e})=>ls(t,e)}},attributes:{id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>ps(t)},offset:{type:ci.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[gs(t,16),gs(e,16)]},normal:{type:ci.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[gs(t,16),gs(e,16)]},halfWidth:{type:ci.pe.HALF_FLOAT,count:1,pack:({width:t})=>(0,l.Lz)(.5*t)},referenceHalfWidth:{type:ci.pe.HALF_FLOAT,count:1,pack:({referenceWidth:t})=>(0,l.Lz)(.5*t)}}};class Hr{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const Xr=65535;class $r extends pi{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=Yr,this._currentWrite=new Hr,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:Xr,textured:!1},this._tessParams=new jr,this._initializeTessellator()}writeLineVertices(t,e,s){const i=this._getLines(e);null!=i&&this._writeVertices(t,s,i)}_initializeTessellator(){this._lineTessellator=new lr.i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,e,s){const i=s??wt.z.fromFeatureSetReaderCIM(e);i&&this._writeGeometry(t,e,i)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t){return Vr(t,hi(this.evaluatedMeshParams))}_writeVertices(t,e,s){const{_currentWrite:i,_tessellationOptions:r,evaluatedMeshParams:n}=this,{width:o,capType:a,joinType:h,miterLimit:c,hasSizeVV:u}=n,d=(0,l.Lz)(.5*o);r.halfWidth=d,r.capType=_s(a),r.joinType=fs(h),r.miterLimit=c;const _=!u;i.out=t,i.id=e.getDisplayId(),i.vertexCount=0,i.indexCount=0,i.vertexFrom=t.vertexCount(),i.vertexBounds=_&&d<p.Gh?0:1;for(const{line:t,start:e,pathLength:n}of s)r.initialDistance=e%Xr,i.pathLength=n,i.distanceOffset=Math.floor(e/Xr)*Xr,this._lineTessellator.tessellate(t,r,_)}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l){const{out:u,id:d,vertexBounds:p,pathLength:_,distanceOffset:f}=this._currentWrite;return this.hasEffects&&u.recordBounds(t,e,p,p),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=_,this._tessParams.distanceOffset=f,this._writeVertex(u,d,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}class Zr extends _i{_write(t,e,s){const i=s??wt.z.fromFeatureSetReaderCIM(e);if(!i)return;const r=this.evaluatedMeshParams.sprite,{textureBinding:n}=r;t.recordStart(this.instanceId,this.attributeLayout,n);const o=e.getDisplayId();this._writePoly(t,o,i.asOptimized()),t.recordEnd()}}class Qr extends Zr{constructor(){super(...arguments),this.vertexSpec={createComputedParams:nr,attributes:{id:Zi,bitset:Qi,pos:Ji,offset:Ki.fill,tlbr:er,animationPointerAndBaseSizeAndReferenceSize:sr,sizing:ir},optionalAttributes:{zoomRange:Ui,value1Position2Value2:Vi,lineLength:ji}}}_writePoly(t,e,s){const i=[];if(!Ur(i,s))return;const r=t.vertexCount();s.forEachVertex((s,i)=>{this._writeVertex(t,e,s,i)}),t.indexEnsureSize(i.length);for(const e of i)t.indexWrite(r+e)}}class Jr{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}class Kr extends Zr{constructor(){super(...arguments),this.vertexSpec={createComputedParams:nr,attributes:{id:Zi,bitset:Qi,pos:Ji,offset:Ki.line,tlbr:er,animationPointerAndBaseSizeAndReferenceSize:sr,sizing:ir,accumulatedDistance:Hi,normal:$i,segmentDirection:Xi},optionalAttributes:{zoomRange:Ui,value1Position2Value2:Vi,lineLength:Yi}},this._tessParams=new jr,this._currentWrite=new Jr,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:65535,textured:!1},this._lineLength=0,this._lineTessellator=new lr.i((t,e,s,i,r,n,o,a,h,c,l)=>this._writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(t,e,s){const i=Vr(wt.z.fromOptimized(s,"esriGeometryPolyline"),64);if(null==i)return;const{_currentWrite:r,_tessellationOptions:n}=this,{baseSize:o,capType:a,joinType:h,miterLimit:c}=this.evaluatedMeshParams,u=(0,l.Lz)(.5*o);n.halfWidth=u,n.capType=_s(a||"Round"),n.joinType=fs(h||"Round"),n.miterLimit=c||2,r.out=t,r.id=e,r.vertexCount=0,r.indexCount=0,r.vertexFrom=t.vertexCount(),r.vertexBounds=1;for(const{line:t,start:e,pathLength:s}of i){n.initialDistance=e%65535,r.pathLength=s,this._lineLength=0;for(let e=1;e<t.length;e++){const s=t[e].x-t[e-1].x,i=t[e].y-t[e-1].y;this._lineLength+=Math.sqrt(s*s+i*i)}this._lineTessellator.tessellate(t,n,!1)}}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l,u){const{out:d,id:p,vertexBounds:_,pathLength:f}=this._currentWrite;return this.hasEffects&&d.recordBounds(t,e,_,_),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=f,this._tessParams.lineLength=u,this._writeVertex(d,p,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}const tn=(0,n.A)("featurelayer-fast-triangulation-enabled");class en extends pi{async loadDependencies(){await Promise.all([super.loadDependencies(),(0,ur.F)()])}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&(t.recordStart(this.instanceId,this.attributeLayout),this._writeGeometry(t,e,r.justXY()),t.recordEnd())}_clip(t){return t?Wr(t,this.hasEffects?256:8):null}_writeGeometry(t,e,s){const i=(s=s.justXY()).maxLength>100,r=[],n=this.createTesselationParams(e);if(!i&&tn&&Ur(r,s))return void(r.length&&this._writeVertices(t,e,s.coords,n,r));const o=function(t){const{coords:e,lengths:s}=t,{buffer:i}=(0,ur.l)(e,s);return i}(s);this._writeVertices(t,e,o,n)}_writeVertices(t,e,s,i,r){const n=e.getDisplayId(),o=t.vertexCount(),a=this.hasEffects;let h=0;if(r)for(const e of r){const r=s[2*e],o=s[2*e+1];a&&t.recordBounds(r,o,0,0),this._writeVertex(t,n,r,o,i),h++}else for(let e=0;e<s.length;e+=2){const r=Math.round(s[e]),o=Math.round(s[e+1]);a&&t.recordBounds(r,o,0,0),this._writeVertex(t,n,r,o,i),h++}t.indexEnsureSize(h);for(let e=0;e<h;e++)t.indexWrite(e+o)}}const sn={createComputedParams:t=>t,optionalAttributes:{},attributes:{id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1},pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},inverseArea:{type:ci.pe.FLOAT,count:1,packTessellation:({inverseArea:t})=>t}}};class rn extends en{constructor(){super(...arguments),this.vertexSpec=sn}createTesselationParams(t){return{inverseArea:1/t.readGeometryArea()}}}const nn={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:ci.pe.SHORT,count:2,packPrecisionFactor:p.fq,pack:({scaleInfo:t},{tileInfo:e})=>ls(t,e)}},attributes:{id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1},pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>ps(t)}}};class on extends en{constructor(){super(...arguments),this.vertexSpec=nn}createTesselationParams(t){return null}}const an={createComputedParams:t=>t,optionalAttributes:nn.optionalAttributes,attributes:{...nn.attributes,tlbr:{count:4,type:ci.pe.UNSIGNED_SHORT,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+p.hM,n=e.y+p.hM;return[r,n,r+s,n+i]}},inverseRasterizationScale:{count:1,type:ci.pe.BYTE,packPrecisionFactor:16,pack:({sprite:t})=>1/t.rasterizationScale}}};class hn extends on{constructor(){super(...arguments),this.vertexSpec=an}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);if(!r)return;const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(t,e,r),t.recordEnd()}}function cn(t){const{sprite:e,aspectRatio:s,scaleProportionally:i}=t,r=(0,l.Lz)(t.height),n=r>0?r:e.height;let o=r*s;return o<=0?o=e.width:i&&(o*=e.width/e.height),{width:o,height:n}}function ln(t){const{applyRandomOffset:e,sampleAlphaOnly:s}=t;return ds([[2,e],[4,s]])}const un={createComputedParams:t=>t,optionalAttributes:an.optionalAttributes,attributes:{...an.attributes,bitset:{count:1,type:ci.pe.UNSIGNED_BYTE,pack:ln},width:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>cn(t).width},height:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>cn(t).height},offset:{count:2,type:ci.pe.HALF_FLOAT,pack:({offsetX:t,offsetY:e})=>[(0,l.Lz)(t),-(0,l.Lz)(e)]},scale:{count:2,type:ci.pe.UNSIGNED_BYTE,packPrecisionFactor:16,pack:({scaleX:t,scaleY:e})=>[t,e]},angle:{count:1,type:ci.pe.UNSIGNED_BYTE,pack:({angle:t})=>(0,Ks.wV)(t)}}};class dn extends hn{constructor(){super(...arguments),this.vertexSpec=un}}const pn={createComputedParams:t=>t,optionalAttributes:Yr.optionalAttributes,attributes:{...Yr.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:t=>0},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>ps(t)}}},_n={createComputedParams:t=>t,optionalAttributes:Yr.optionalAttributes,attributes:{...Yr.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:t=>ds([[0,!0],[1,t.outlineUsesColorVV]])},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>ps(t)}}};class fn extends $r{constructor(){super(...arguments),this.vertexSpec=_n}}class mn extends on{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=pn,this._lineMeshWriter=this._createOutlineWriter(t,e,s,i)}_createOutlineWriter(t,e,s,i){return new fn(t,e,s,i)}_write(t,e){const s=this.evaluatedMeshParams.effects,i=this.evaluatedMeshParams.outlineEffects;if(s?.length||i?.length){if(s?.length){const i=this.getEffectCursor(t,e,s);if(i){let s;for(;s=i?.next();)s.invertY(),this._writeFill(t,e,s)}}else this._writeFill(t,e);if(i?.length){const s=this.getEffectCursor(t,e,i);if(s){let i;for(;i=s?.next();)i.invertY(),this._writeOutline(t,e,i)}}else this._writeOutline(t,e)}else this._writeSimpleOutlineFill(t,e)}_writeSimpleOutlineFill(t,e){const s=e.readGeometryForDisplay(),i=this._clip(s);i&&(this._writeGeometry(t,e,i),this._lineMeshWriter.writeLineVertices(t,wt.z.fromOptimizedCIM(i,"esriGeometryPolyline"),e))}_writeFill(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&this._writeGeometry(t,e,r)}_writeOutline(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay(),r=this._clip(i);r&&this._lineMeshWriter.writeLineVertices(t,wt.z.fromOptimizedCIM(r,"esriGeometryPolyline"),e)}_clip(t){return t?Wr(t,hi(this.evaluatedMeshParams)):null}get effectInfos(){return[...this._evaluator.inputMeshParams.effects?.effectInfos??[],...this._evaluator.inputMeshParams.outlineEffects?.effectInfos??[]]}write(t,e,s,i,r){this.ensurePacked(e,s,i),t.recordStart(this.instanceId,this.attributeLayout),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}get hasEffects(){return!!this.evaluatedMeshParams.outlineEffects}}const gn=un,yn=_n,xn={createComputedParams:t=>t,optionalAttributes:gn.optionalAttributes,attributes:{...gn.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:t=>ln(t)},aux1:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>cn(t).width},aux2:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>cn(t).height},aux3:{count:2,type:ci.pe.HALF_FLOAT,pack:({offsetX:t,offsetY:e})=>[(0,l.Lz)(t),(0,l.Lz)(e)]},aux4:{count:2,type:ci.pe.UNSIGNED_BYTE,pack:({scaleX:t,scaleY:e})=>[16*t,16*e]}}},bn={createComputedParams:t=>t,optionalAttributes:gn.optionalAttributes,attributes:{...gn.attributes,color:yn.attributes.color,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:t=>ds([[0,!0]])},aux1:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>(0,l.Lz)(.5*t.width)},aux2:{count:1,type:ci.pe.HALF_FLOAT,pack:t=>(0,l.Lz)(.5*t.referenceWidth)},aux3:{count:2,type:ci.pe.HALF_FLOAT,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[t,e]},aux4:{count:2,type:ci.pe.UNSIGNED_BYTE,packTessellation:({normalX:t,normalY:e})=>[16*t+128,16*e+128]}}};class wn extends fn{constructor(){super(...arguments),this.vertexSpec=bn}}class vn extends mn{constructor(){super(...arguments),this.vertexSpec=xn}_createOutlineWriter(t,e,s,i){return new wn(t,e,s,i)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}var Sn=s(15294);class In{constructor(t,e){this._size=t,this._sizeUnits=e,this._relativeSize=null}get relativeSize(){return this._relativeSize??=this.calculateRelativeSize(),this._relativeSize}calculateRelativeSize(){if(this._sizeUnits===Sn.O.Relative){const t=Math.min(this._size/100,1);return[t,t]}return this.calculateRelativeSizeFromAbsolute()}}class Pn extends In{constructor(t,e,s,i){super(e,s),this.rotationMatrix00=1,this.rotationMatrix01=0,this.rotationMatrix10=0,this.rotationMatrix11=1,this.bounds={xmin:1/0,ymin:1/0,xmax:-1/0,ymax:-1/0},this.rotationMatrix00=Math.cos(i),this.rotationMatrix01=-Math.sin(i),this.rotationMatrix10=-this.rotationMatrix01,this.rotationMatrix11=this.rotationMatrix00;const{bounds:r,rotationMatrix00:n,rotationMatrix01:o,rotationMatrix10:a,rotationMatrix11:h}=this;t.forEachVertex((t,e)=>{const s=t*n+e*o,i=t*a+e*h;r.xmin=Math.min(r.xmin,s),r.ymin=Math.min(r.ymin,i),r.xmax=Math.max(r.xmax,s),r.ymax=Math.max(r.ymax,i)}),this.center=[(r.xmin+r.xmax)/2,(r.ymin+r.ymax)/2]}}class Mn extends Pn{constructor(t,e,s,i){super(t,e,s,i),this.method="linear"}getRelativePosition(t,e){const{rotationMatrix00:s,rotationMatrix01:i,bounds:r}=this,{xmin:n,xmax:o}=r;return[(t*s+e*i-n)/(o-n),0]}calculateRelativeSizeFromAbsolute(){const{_size:t,bounds:e}=this,{xmin:s,xmax:i}=e;return[(0,l.Lz)(t)/(i-s),0]}}class Tn extends Pn{constructor(t,e,s,i){super(t,e,s,i),this.method="rectangular"}getRelativePosition(t,e){const{bounds:s,center:i,rotationMatrix00:r,rotationMatrix01:n,rotationMatrix10:o,rotationMatrix11:a}=this,h=t*o+e*a,c=t*r+e*n-i[0],l=h-i[1];return[c*(2/(s.xmax-s.xmin)),-l*(2/(s.ymax-s.ymin))]}calculateRelativeSizeFromAbsolute(){const{_size:t,bounds:e}=this,{xmin:s,ymin:i,xmax:r,ymax:n}=e;return[(0,l.Lz)(2*t)/(r-s),(0,l.Lz)(2*t)/(n-i)]}}class kn extends Pn{constructor(t,e,s){super(t,e,s,0),this.method="circular";const{xmin:i,xmax:r,ymin:n,ymax:o}=this.bounds,a=r-i,h=o-n;this.radius=Math.sqrt(a*a+h*h)/2}getRelativePosition(t,e){const{center:s,radius:i}=this;return[(t-s[0])/i,-(e-s[1])/i]}calculateRelativeSizeFromAbsolute(){const{_size:t}=this;return[(0,l.Lz)(t)/this.radius,0]}}function Cn(t,e){if(null==t)return null;const s=(0,Ps.kU)(e.angle),i=e.gradientSize,r=e.gradientSizeUnits;switch(e.gradientMethod.toLowerCase()){case"linear":return new Mn(t,i,r,s);case"rectangular":return new Tn(t,i,r,s);case"circular":return new kn(t,i,r);default:return D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.fill.GradientSizeHelper").errorOnce(`Gradient fill method "${e.gradientMethod}" currently unsupported.`),null}}const An={createComputedParams:t=>t,optionalAttributes:nn.optionalAttributes,attributes:{...nn.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({gradientSizeUnits:t,gradientType:e})=>{let s=0;return t===Sn.O.Absolute&&(s|=us(0)),"discrete"===e.toLowerCase()&&(s|=us(1)),s}},tlbr:{count:4,type:ci.pe.UNSIGNED_SHORT,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+p.hM+p.MZ,n=e.y+p.hM;return[r,n,r+s-2*p.MZ,n+i]}},relativePosition:{count:2,type:ci.pe.HALF_FLOAT,packTessellation:({gradientStats:t},e,s,i)=>t?.getRelativePosition(s,i)??[0,0]},relativeGradientSize:{count:2,type:ci.pe.HALF_FLOAT,packTessellation:({gradientStats:t})=>t?.relativeSize??[1,1]},gradientMethod:{count:1,type:ci.pe.UNSIGNED_BYTE,pack:({gradientMethod:t})=>{switch(t.toLowerCase()){case"rectangular":return 1;case"circular":return 2;default:return 0}}}}};class Fn extends en{constructor(){super(...arguments),this.vertexSpec=An}get _preventEffectClipping(){return!0}createTesselationParams(t){return{gradientStats:Cn(this._unclippedGeometry,this.evaluatedMeshParams)}}_write(t,e,s){const i=s?.asOptimized()??e.readGeometryForDisplay();this._unclippedGeometry=i;const r=this._clip(i);if(!r)return void(this._unclippedGeometry=null);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._writeGeometry(t,e,r),this._unclippedGeometry=null,t.recordEnd()}}const En={optionalAttributes:an.optionalAttributes,createComputedParams:t=>t,attributes:{...an.attributes,...pn.attributes}},zn={optionalAttributes:an.optionalAttributes,createComputedParams:t=>t,attributes:{...an.attributes,..._n.attributes}};class Rn extends fn{constructor(){super(...arguments),this.vertexSpec=zn}}class On extends mn{constructor(){super(...arguments),this.vertexSpec=En}_createOutlineWriter(t,e,s,i){return new Rn(t,e,s,i)}write(t,e,s,i,r){this.ensurePacked(e,s,i);const n=this.evaluatedMeshParams.sprite?.textureBinding;t.recordStart(this.instanceId,this.attributeLayout,n),this._write(t,s),t.recordEnd()}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._lineMeshWriter.ensurePacked(t,e,s)}enqueueRequest(t,e,s){super.enqueueRequest(t,e,s),this._lineMeshWriter.enqueueRequest(t,e,s)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}const Ln={createComputedParams:t=>t,optionalAttributes:{},attributes:{pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1},offset:{type:ci.pe.BYTE,count:2,packAlternating:{count:4,pack:()=>[[-1,-1],[1,-1],[-1,1],[1,1]]}}}};class Dn extends pi{constructor(){super(...arguments),this.vertexSpec=Ln}_write(t,e){t.recordStart(this.instanceId,this.attributeLayout);const s=e.getDisplayId();if("esriGeometryPoint"===e.geometryType){const i=e.readXForDisplay(),r=e.readYForDisplay();this._writeQuad(t,s,i,r)}else if("esriGeometryMultipoint"===e.geometryType){const i=e.readGeometryForDisplay();i?.forEachVertex((e,i)=>{e>=0&&e<=512&&i>=0&&i<=512&&this._writeQuad(t,s,e,i)})}t.recordEnd()}_writeQuad(t,e,s,i){const r=t.vertexCount();this._writeVertex(t,e,s,i),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}var Gn=s(48163),Nn=s(90708);class Bn{constructor(t,e,s,i,r,n,o,a,h,c,l,u=[],d=0,p=0){this.displayId=t,this.labelClassId=e,this.labelIdHash=s,this.hash=i,this.anchorX=r,this.anchorY=n,this.directionX=o,this.directionY=a,this.maxScale=h,this.minScale=c,this.referenceBounds=l,this.bounds=u,this.recordStart=d,this.recordCount=p,this.priority=0,this._colliders=null,this.uniqueSymbol=null,this.selectedForRendering=!1}get xTile(){return this.anchorX}get yTile(){return this.anchorY}colliders(t){if(!this._colliders){const e=t.attributeView,s=p.C2;let i=this.referenceBounds?.size??0;const r=t.layerView.labelingCollisionInfos[0].vvEvaluators[0];if(null!=r){const t=r(e.getVisualVariableData(this.displayId,0));i=isNaN(t)||null==t||t===1/0?i:t}const n=this.minScale?t.layerView.view.featuresTilingScheme.scaleToZoom(this.minScale):0,o=this.maxScale?t.layerView.view.featuresTilingScheme.scaleToZoom(this.maxScale):25,a=this.directionX*(s+i/2),h=this.directionY*(s+i/2);this._colliders=this.bounds.map(t=>({labelId:this.labelIdHash,xTile:this.anchorX,yTile:this.anchorY,dxPixels:t.x-t.halfWidth+a,dyPixels:t.y-t.halfHeight+h,hard:!0,partIndex:1,width:t.width+2,height:t.height+2,angle:0,xScreen:0,yScreen:0,dxScreen:0,dyScreen:0,enabled:!0,minLod:n,maxLod:o}))}return this._colliders}get id(){return this.displayId}serialize(t){t.push(this.displayId),t.push(this.labelClassId),t.push(this.labelIdHash),t.push(this.hash),t.push(this.recordStart),t.push(this.recordCount),t.writeF32(this.anchorX),t.writeF32(this.anchorY),t.writeF32(this.directionX),t.writeF32(this.directionY),t.writeF32(this.maxScale),t.writeF32(this.minScale),this.referenceBounds?(t.writeF32(this.referenceBounds.size),t.writeF32(this.referenceBounds.offsetX),t.writeF32(this.referenceBounds.offsetY)):(t.writeF32(0),t.writeF32(0),t.writeF32(0)),Z(t,this.bounds)}static deserialize(t){const e=t.readInt32(),s=t.readInt32(),i=t.readInt32(),r=t.readInt32(),n=t.readInt32(),o=t.readInt32(),a=t.readF32(),h=t.readF32(),c=t.readF32(),l=t.readF32(),u=t.readF32(),d=t.readF32(),p=t.readF32(),_=t.readF32(),f=t.readF32(),m=Q(t,Us)??[];return new Bn(e,s,i,r,a,h,c,l,u,d,{size:p,offsetX:_,offsetY:f},m,n,o)}}function qn(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function Un(t,e){return Math.sqrt(t*t+e*e)}function Wn(t){const e=Un(t[0],t[1]);t[0]/=e,t[1]/=e}function Vn(t,e){return Un(t[0]-e[0],t[1]-e[1])}function jn(t){return t.length-1}function Yn(t,e,s=1){let[i,r]=function(t,e){return t[e+1]}(t,e);return[i,r]=[Math.round(i),Math.round(r)],Math.sqrt(i*i+r*r)*s}class Hn{constructor(t,e,s,i,r){this._segments=t,this._index=e,this._distance=s,this._xStart=i,this._yStart=r,this._done=!1}static create(t){return new Hn(t,0,0,t[0][0],t[0][1])}clone(){return new Hn(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let s=Math.acos(e);return t>0&&(s=2*Math.PI-s),s}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<jn(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const s=this.backwardLength;if(t<=s)return this._distance=(s-t)/this.length,this;let i=this.backwardLength;for(;this.prev();){if(i+this.length>t)return this._seekBackwards(t-i);i+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let s=this.remainingLength;for(;this.next();){if(s+this.length>t)return this.seek(t-s,e);s+=this.length}return this._distance=1,e?this:null}}function Xn(t,e,s,i=!0){const r=function(t){let e=0;for(let s=0;s<jn(t);s++)e+=Yn(t,s);return e}(t),n=Hn.create(t),o=r/2;if(!i)return n.seek(o),void(n.x<p.CQ&&n.y<p.CQ&&n.x>=0&&n.y>=0&&s(n.clone(),0,o+0*e,r));const a=Math.max((r-e)/2,0),h=Math.floor(a/e),c=o-h*e;n.seek(c);for(let t=-h;t<=h;t++)n.x<p.CQ&&n.y<p.CQ&&n.x>=0&&n.y>=0&&s(n.clone(),t,o+t*e,r),n.seek(e)}function $n(t,e){const s=e;for(let e=0;e<t.length;e++){let i=t[e];Zn(i,s);const r=[];r.push(i[0]);for(let t=1;t<i.length;t++){const[e,s]=i[t-1],[n,o]=i[t],a=n-e,h=o-s;r.push([a,h])}t[e]=r,i=r}return t}function Zn(t,e){const s=1e-6;if(e<=0)return;const i=t.length;if(i<3)return;const r=[];let n=0;r.push(0);for(let e=1;e<i;e++)n+=Vn(t[e],t[e-1]),r.push(n);e=Math.min(e,.2*n);const o=[];o.push(t[0][0]),o.push(t[0][1]);const a=t[i-1][0],h=t[i-1][1],c=qn([0,0],t[0],t[1]);Wn(c),t[0][0]+=e*c[0],t[0][1]+=e*c[1],qn(c,t[i-1],t[i-2]),Wn(c),t[i-1][0]+=e*c[0],t[i-1][1]+=e*c[1];for(let t=1;t<i;t++)r[t]+=e;r[i-1]+=e;const l=.5*e;for(let n=1;n<i-1;n++){let a=0,h=0,c=0;for(let i=n-1;i>=0&&!(r[i+1]<r[n]-l);i--){const o=l+r[i+1]-r[n],u=r[i+1]-r[i],d=r[n]-r[i]<l?1:o/u;if(Math.abs(d)<s)break;const p=d*d,_=d*o-.5*p*u,f=d*u/e,m=t[i+1],g=t[i][0]-m[0],y=t[i][1]-m[1];a+=f/_*(m[0]*d*o+.5*p*(o*g-u*m[0])-p*d*u*g/3),h+=f/_*(m[1]*d*o+.5*p*(o*y-u*m[1])-p*d*u*y/3),c+=f}for(let o=n+1;o<i&&!(r[o-1]>r[n]+l);o++){const i=l-r[o-1]+r[n],u=r[o]-r[o-1],d=r[o]-r[n]<l?1:i/u;if(Math.abs(d)<s)break;const p=d*d,_=d*i-.5*p*u,f=d*u/e,m=t[o-1],g=t[o][0]-m[0],y=t[o][1]-m[1];a+=f/_*(m[0]*d*i+.5*p*(i*g-u*m[0])-p*d*u*g/3),h+=f/_*(m[1]*d*i+.5*p*(i*y-u*m[1])-p*d*u*y/3),c+=f}o.push(a/c),o.push(h/c)}o.push(a),o.push(h);for(let e=0,s=0;e<i;e++)t[e][0]=o[s++],t[e][1]=o[s++]}class Qn{constructor(t){const{offsetX:e,offsetY:s,postAngle:i,fontSize:r,haloSize:n,outlineSize:o,scaleFactor:a,transforms:h}=t;if(this.offsetX=e,this.offsetY=s,this.postAngle=i,this.fontSize=Math.min(r,96),this.haloSize=n??0,this.outlineSize=o??0,this.transforms=h,h&&h.infos.length>1){const t=(0,Lt.zb)(r,i,!1,e,s,h,!1);this.fontSize=Math.min(t.size,96);const n=t.size/r;this.haloSize*=n,this.outlineSize*=n,this.postAngle=t.rotation,this.offsetX=t.offsetX,this.offsetY=t.offsetY}a&&(this.fontSize*=a,this.offsetX*=a,this.offsetY*=a)}}const Jn=28,Kn=[4,4],to=[16,4],eo={topLeft:to,topRight:to,bottomLeft:to,bottomRight:to},so=[4,2],io=[4,6],ro={topLeft:so,topRight:so,bottomLeft:io,bottomRight:io},no={topLeft:so,topRight:io,bottomLeft:so,bottomRight:io},oo={topLeft:io,topRight:io,bottomLeft:Kn,bottomRight:Kn},ao={topLeft:Kn,topRight:Kn,bottomLeft:io,bottomRight:io},ho={topLeft:io,topRight:Kn,bottomLeft:io,bottomRight:Kn},co={topLeft:Kn,topRight:io,bottomLeft:Kn,bottomRight:io},lo={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:ci.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:p.fq,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||Jn]},clipAngle:{type:ci.pe.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>po(t||0)},referenceSymbol:{type:ci.pe.BYTE,count:4,packPrecisionFactor:1,packTessellation:(t,e)=>{const s=t.isLineLabel||!t.referenceBounds,i=function(t){switch(t){case 1:case"right":return-1;case 0:case"center":return 0;case-1:case"left":return 1;default:return console.debug(`Found invalid horizontal alignment ${t}`),0}}(s?"center":e.horizontalAlignment),r=function(t){switch(t){case 1:case"top":return 1;case 0:case"middle":return 0;case-1:case 2:case"baseline":case"bottom":return-1;default:return console.debug(`Found invalid vertical alignment ${t}`),0}}(s?"middle":e.verticalAlignment),{offsetX:n,offsetY:o,size:a}=s?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[(0,l.Lz)(n),-(0,l.Lz)(o),Math.round((0,l.Lz)(a)),i+1<<2|r+1]}},visibility:{type:ci.pe.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>ds([[0,t],[3,!!e]])},offset:{type:ci.pe.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:s,topLeft:i,topRight:r}=t;return[i,r,e,s]}}},textureUV:{type:ci.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:s,topLeft:i,topRight:r}=t;return[i,r,e,s]}}},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:ci.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({fontSize:t},{referenceSize:e})=>[Math.round((0,l.Lz)(t)),Math.round((0,l.Lz)(e??t))]},outlineColor:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>ps(t)},haloColor:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>ps(t)},outlineAndHaloSize:{type:ci.pe.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:e})=>[Math.round((0,l.Lz)(t)),Math.round((0,l.Lz)(e))]}}};class uo extends pi{constructor(){super(...arguments),this.vertexSpec=lo,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,s){super.ensurePacked(t,e,s),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new Qn(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,s){const i=this._getShaping();if(!i)return;const r=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,i,s);if(s?.nextPath())return s.nextPoint(),this._writeGlyphs(t,r,s.x,s.y,i,0);if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[n,o]=s.coords;return this._writeGlyphs(t,r,n,o,i,0)}if("esriGeometryMultipoint"===e.geometryType){const s=e.readGeometryForDisplay();return void s?.forEachVertex((e,s)=>this._writeGlyphs(t,r,e,s,i,0))}const n=e.readXForDisplay(),o=e.readYForDisplay();return this._writeGlyphs(t,r,n,o,i,0)}_writePlacedTextMarkers(t,e,s,i){const r=i??wt.z.fromFeatureSetReaderCIM(e);if(!r)return;const n=hs.getPlacement(r,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id);if(!n)return;const o=e.getDisplayId();let a=n.next();for(;null!=a;){const e=a.tx,i=-a.ty,r=-a.getAngle();this._writeGlyphs(t,o,e,i,s,r),a=n.next()}}_getShaping(t){const e=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!s.glyphs?.glyphs.length)return null;const i=(0,l.Lz)(e.fontSize),r=(0,l.Lz)(e.offsetX),n=(0,l.Lz)(e.offsetY),o=(0,Ps.qE)((0,l.Lz)(s.lineWidth),p.GR,p.cp),a=p.DY*(0,Ps.qE)(s.lineHeightRatio,.25,4);return Qs(s.glyphs,{scale:i/p.eG,angle:e.postAngle,xOffset:r,yOffset:n,horizontalAlignment:s.horizontalAlignment,verticalAlignment:t||s.verticalAlignment,maxLineWidth:o,lineHeight:a,decoration:s.decoration,borderLineSizePx:(0,l.Lz)(s.boxBorderLineSize),hasBackground:!!s.boxBackgroundColor,useCIMAngleBehavior:s.useCIMAngleBehavior})}_writeGlyphs(t,e,s,i,r,n,o,a,h=!0){const c=this.evaluatedMeshParams,u=this._textMeshTransformProps,d=(0,l.Lz)(u.fontSize),p=u.haloSize,_=u.outlineSize,f=(0,l.Lz)(u.offsetX),m=(0,l.Lz)(u.offsetY),[g,y]=ls(c.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const x=r.bounds,b=s+x.x+f,w=i+x.y-m,v=2*(c.minPixelBuffer?c.minPixelBuffer/d:1),S=Math.max(x.width,x.height)*v;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),h&&t.recordBounds(b,w,S,S),this._writeTextBox(t,e,s,i,r.textBox,o,a),t.recordEnd());for(const n of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),h&&t.recordBounds(b,w,S,S);const{texcoords:r,offsets:l}=n;this._writeQuad(t,e,s,i,{texcoords:r,offsets:l,fontSize:d,haloSize:p,outlineSize:_,color:ps(c.color),isBackground:!1,referenceBounds:o,minZoom:g,maxZoom:y,...a}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeTextBox(t,e,s,i,r,n,o){const a=this.evaluatedMeshParams,{fontSize:h,haloSize:c,outlineSize:l}=this._textMeshTransformProps,{boxBackgroundColor:u,boxBorderLineColor:d}=a,p={isBackground:!0,fontSize:h,haloSize:c,outlineSize:l,referenceBounds:n,...o};u&&(this._writeQuad(t,e,s,i,{texcoords:eo,offsets:r.main,color:ps(u),...p}),d||(this._writeQuad(t,e,s,i,{texcoords:oo,offsets:r.top,color:ps(u),...p}),this._writeQuad(t,e,s,i,{texcoords:ao,offsets:r.bot,color:ps(u),...p}),this._writeQuad(t,e,s,i,{texcoords:ho,offsets:r.left,color:ps(u),...p}),this._writeQuad(t,e,s,i,{texcoords:co,offsets:r.right,color:ps(u),...p}))),d&&(this._writeQuad(t,e,s,i,{texcoords:ro,offsets:r.top,color:ps(d),...p}),this._writeQuad(t,e,s,i,{texcoords:ro,offsets:r.bot,color:ps(d),...p}),this._writeQuad(t,e,s,i,{texcoords:no,offsets:r.left,color:ps(d),...p}),this._writeQuad(t,e,s,i,{texcoords:no,offsets:r.right,color:ps(d),...p}))}_writeQuad(t,e,s,i,r){const n=t.vertexCount();this._writeVertex(t,e,s,i,r),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}}const po=t=>Math.round(t*(254/360)),_o=(0,R.Bj)(t=>{let e=0;if(0===t)return 1/0;for(;!(t%2);)e++,t/=2;return e});class fo extends uo{constructor(){super(...arguments),this._zoomLevel=0}_write(t,e,s,i){if(this._zoomLevel=i||0,null!=s)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(e.geometryType){case"esriGeometryPoint":{const s=e.readXForDisplay(),i=e.readYForDisplay();this._writePoint(t,s,i,0,e);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":{const s=e.readCentroidForDisplay();if(!s)return;const[i,r]=s.coords;this._writePoint(t,i,r,0,e);break}case"esriGeometryMultipoint":{let s=0;const i=wt.z.fromFeatureSetReader(e);if(i?.nextPath())for(;i.nextPoint();)this._writePoint(t,i.x,i.y,s++,e);break}case"esriGeometryPolyline":this._writeLines(t,e)}}_getMetricDir(){const{horizontalAlignment:t,verticalAlignment:e}=this.evaluatedMeshParams;return["center"===t?0:"right"===t?-1:1,"middle"===e?0:"bottom"===e?-1:1]}_createLineLabelMetric(t,e,s,i,r,n){const[o,a]=this._getMetricDir(),h=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,l=this.evaluatedMeshParams.labelClassId;return new Bn(t,l,e,s,i,r,o,a,h,c,n)}_writePoint(t,e,s,i,r){if(e<0||e>p.CQ||s<0||s>p.CQ)return;const n=this._getShaping();if(!n)return;const o=r.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,h=function(t,e,s){return(0,yt.Wm)(`${t}${e}${s}`)}(this.evaluatedMeshParams.layerId,r.getObjectId(),i),c=function(t,e,s){return(0,yt.Wm)(`${t}${e}${s}`)}(r.getObjectId(),a,i),[l,u]=this._getMetricDir(),d=this.evaluatedMeshParams.scaleInfo?.maxScale??0,_=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};t.metricStart(new Bn(o,a,h,c,e,s,l,u,d,_,f)),this._writeGlyphs(t,o,e,s,n,0,f,void 0,!1),t.metricBoxWrite(n.boundsT),t.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const t of this._references){const e=t.getBoundsInfo();if(e)return e}return null}_writeLines(t,e){const{scaleInfo:s,verticalAlignment:i}=this.evaluatedMeshParams,r=this.evaluatedMeshParams.repeatLabelDistance||128,n=this._getShaping("middle");if(!n)return;const o=(t,e,s,i)=>this._placeSubdivGlyphs(t,e,s,i),a=(n.bounds.width+r)/2;this._current={out:t,id:e.getDisplayId(),objId:e.getObjectId(),shaping:n,zoomRange:ls(s,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===i?"above":"top"===i?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(e,o,a):this._writeCenterAlong(e,o,a)}_writeAboveAndBelowAlong(t,e,s){const{repeatLabel:i}=this.evaluatedMeshParams,{shaping:r}=this._current,n=r.bounds.halfHeight,o=t.readGeometryForDisplay();if(!o)return;const a=(0,Nn.kz)(o,"esriGeometryPolyline",1)??new dr.A,h=mo(a,n),c=mo(a,-n),l=(0,Nn.zv)(c,"esriGeometryPolyline",!1,!1),u=$n((0,Nn.zv)(h,"esriGeometryPolyline",!1,!1).paths,r.bounds.width),d=$n(l.paths,r.bounds.width);this._current.offsetDirection="above";for(let t=0;t<u.length;t++)this._current.pathIndex=t,Xn(u[t],s,e,!!i);this._current.offsetDirection="below";for(let t=0;t<d.length;t++)this._current.pathIndex=t,Xn(d[t],s,e,!!i)}_writeCenterAlong(t,e,s){const{repeatLabel:i}=this.evaluatedMeshParams,{shaping:r}=this._current,n=$n(t.readLegacyGeometryForDisplay().paths,r.bounds.width);for(let t=0;t<n.length;t++)this._current.pathIndex=t,Xn(n[t],s,e,!!i)}_placeSubdivGlyphs(t,e,s,i){const{allowOverrun:r,labelPosition:n,repeatLabelDistance:o,layerId:a,labelClassId:h}=this.evaluatedMeshParams,{objId:c,shaping:l,pathIndex:u}=this._current,d=this._current.zoomRange[0],p=_o(e),_=this._current.shaping.bounds.width/2,f=Math.sqrt(o||128)/2,m=Math.min(s,i-s),g=l.isMultiline?Jn:Math.log2(m/(f+_/2)),y=0===e?g:Math.min(p,g),x=Math.max(d,this._zoomLevel+1-y),b=this._zoomLevel-x,w=l.bounds.width/2*2**b,v=function(t,e,s,i,r){return(0,yt.Wm)(`${t}${e}${s}${i*2**(Jn-r)}`)}(a,c,u,e,this._zoomLevel),S=function(t,e,s,i,r){return(0,yt.Wm)(`${t}${r}${e}${s*2**(Jn-i)}`)}(c,u,e,this._zoomLevel,h);this._current.shaping.isMultiline?0===e&&this._placeStraight(t,x,v,S):r&&b<0?this._placeStraightAlong(t,d,v,S):"parallel"===n?this._placeStraightAlong(t,x,v,S):"curved"===n&&this._placeCurved(t,x,w,v,S)}_placeStraight(t,e,s,i){const{out:r,id:n,shaping:o,referenceBounds:a}=this._current,{x:h,y:c}=t;r.metricStart(this._createLineLabelMetric(n,s,i,h,c)),r.metricBoxWrite(o.boundsT);const l=t.angle*(180/Math.PI)%360,u=(t.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t={clipAngle:l,mapAligned:!0,isLineLabel:!0,minZoom:e};this._writeGlyphs(r,n,h,c,o,0,a,t,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t={clipAngle:u,mapAligned:!0,isLineLabel:!0,minZoom:e};this._writeGlyphs(r,n,h,c,o,0,a,t,!1)}r.metricEnd()}_placeCurved(t,e,s,i,r){const{out:n,id:o}=this._current;n.metricStart(this._createLineLabelMetric(o,i,r,t.x,t.y));const a=t.clone(),h=t.angle*(180/Math.PI)%360,c=(t.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,e,1,h),this._placeBack(t,a,e,s,1,h),this._placeForward(t,a,e,s,1,h)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,e,0,c),this._placeBack(t,a,e,s,0,c),this._placeForward(t,a,e,s,0,c)),n.metricEnd()}_placeStraightAlong(t,e,s,i){const{out:r,id:n,shaping:o,zoomRange:a,referenceBounds:h}=this._current,{boxBorderLineColor:c,boxBackgroundColor:u}=this.evaluatedMeshParams,d=t.clone(),p=t.angle*(180/Math.PI)%360,_=(t.angle*(180/Math.PI)+180)%360,f=o.glyphs.length>0&&!(!c&&!u);if(r.metricStart(this._createLineLabelMetric(n,s,i,t.x,t.y)),f){const s=Math.max(e,a[0],0),i=Math.min(Jn,a[1]),c=zs(Ds(),-t.angle),u={minZoom:s,maxZoom:i,clipAngle:p,mapAligned:!0,isLineLabel:!0},d=(0,l.Lz)(this.evaluatedMeshParams.offsetX),f=(0,l.Lz)(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e=(0,Bs.fA)(d,-1*f),[s,i]=o.shapeBackground(Es(Ds(),c,e));r.recordStart(this.instanceId,this.attributeLayout,o.glyphs[0].textureBinding),this._writeTextBox(r,n,t.x,t.y,i,h,u),r.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e=(0,Bs.fA)(d,f),[s,i]=o.shapeBackground(Es(Ds(),c,e));u.clipAngle=_,r.recordStart(this.instanceId,this.attributeLayout,o.glyphs[0].textureBinding),this._writeTextBox(r,n,t.x,t.y,i,h,u),r.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(d,e,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(d,e,0,_,!0),r.metricEnd()}_placeBack(t,e,s,i,r,n){const o=t.clone();let a=t.backwardLength+0;for(;o.prev()&&!(a>=i);)this._placeOnSegment(o,e,a,s,-1,r,n),a+=o.length+0}_placeForward(t,e,s,i,r,n){const o=t.clone();let a=t.remainingLength+0;for(;o.next()&&!(a>=i);)this._placeOnSegment(o,e,a,s,1,r,n),a+=o.length+0}_placeFirst(t,e,s,i,r=!1){const{out:n,id:o,shaping:a,zoomRange:h,referenceBounds:c}=this._current,u=a.glyphs,d=(0,l.Lz)(this.evaluatedMeshParams.offsetX),p=(0,l.Lz)(this.evaluatedMeshParams.offsetY),_=(0,Bs.fA)(d,p),f=zs(Ds(),-t.angle);(0,N.l0)(_,_,f);for(const l of u){const u=l.x>a.bounds.x?s:1-s,d=u*t.remainingLength+(1-u)*t.backwardLength,p=Math.abs(l.x+l.width/2-a.bounds.x),f=Math.max(0,this._zoomLevel+Math.log2(p/(d+0))),m=Math.max(e,r?0:f);if(l.maxZoom=Math.min(h[1],Jn),l.angle=t.angle+(1-s)*Math.PI,l.minZoom=Math.max(h[0],m),this._writeLineGlyph(n,o,t.x,t.y,l,i,c,!0),(s||this._current.offsetDirection)&&this._isVisible(l.minZoom,l.maxZoom)){const t=new Us(l.bounds.x+_[0],l.bounds.y+_[1],l.bounds.width,l.bounds.height);n.metricBoxWrite(t)}}}_placeOnSegment(t,e,s,i,r,n,o){const{out:a,id:h,shaping:c,referenceBounds:u}=this._current,d=c.glyphs,p=t.dx/t.length,_=t.dy/t.length,f={x:t.x+s*-r*p,y:t.y+s*-r*_},m=(0,l.Lz)(this.evaluatedMeshParams.offsetX),g=(0,l.Lz)(this.evaluatedMeshParams.offsetY),y=(0,Bs.fA)(m,g),x=zs(Ds(),-t.angle);(0,N.l0)(y,y,x);for(const e of d){const l=e.x>c.bounds.x?n:1-n;if(!(l&&1===r||!l&&-1===r))continue;const d=Math.abs(e.x+e.width/2-c.bounds.x),p=Math.max(0,this._zoomLevel+Math.log2(d/s)-.1),_=Math.max(i,this._zoomLevel+Math.log2(d/(s+t.length+0)));if(0!==p&&(e.angle=t.angle+(1-n)*Math.PI,e.minZoom=_,e.maxZoom=p,this._writeLineGlyph(a,h,f.x,f.y,e,o,u,!0),(n||this._current.offsetDirection)&&this._isVisible(e.minZoom,e.maxZoom))){const t=new Us(e.bounds.x+y[0],e.bounds.y+y[1],e.bounds.width,e.bounds.height);a.metricBoxWrite(t)}}}_writeLineGlyph(t,e,s,i,r,n,o,a){if(s<0||s>p.CQ||i<0||i>p.CQ)return;t.recordStart(this.instanceId,this.attributeLayout,r.textureBinding);const{texcoords:h,offsets:c}=r,{fontSize:l,haloSize:u,outlineSize:d}=this._textMeshTransformProps;this._writeQuad(t,e,s,i,{texcoords:h,offsets:c,fontSize:l,haloSize:u,outlineSize:d,color:ps(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:o,minZoom:Math.max(this._current.zoomRange[0],r.minZoom),maxZoom:Math.min(this._current.zoomRange[1],r.maxZoom),clipAngle:n,mapAligned:a,isLineLabel:!0}),t.recordEnd()}_packedZoom(t){return Math.floor(t*p.fq)/p.fq}_isVisible(t,e){let s=Math.max(this._current.zoomRange[0],t),i=Math.min(this._current.zoomRange[1],e);s=this._packedZoom(s),i=this._packedZoom(i);const r=this._packedZoom(this._zoomLevel);return s<=r&&r<=i}}function mo(t,e){const s=new dr.A,{coords:i,lengths:r}=t,n=(0,Gn.vt)(),o=(0,Gn.vt)(),a=(0,Gn.vt)(),h=(0,Gn.vt)(),c=(0,Gn.vt)(),l=(0,Gn.vt)();let u=0;for(let t=0;t<r.length;t++){const d=r[t];for(let t=0;t<d;t++){const r=2*(t+u-1),p=2*(t+u),_=2*(t+u+1);t>0?(0,N.hZ)(n,i[r],i[r+1]):(0,N.hZ)(n,0,0),(0,N.hZ)(o,i[p],i[p+1]),t<d-1?(0,N.hZ)(a,i[_],i[_+1]):(0,N.hZ)(a,0,0),0===t?(0,N.hZ)(h,0,0):((0,N.jb)(h,o,n),(0,N.S8)(h,h),(0,N.hZ)(h,h[1],-h[0])),t===d-1?(0,N.hZ)(c,0,0):((0,N.jb)(c,a,o),(0,N.S8)(c,c),(0,N.hZ)(c,c[1],-c[0])),(0,N.WQ)(l,h,c),(0,N.S8)(l,l);const f=l[0]*c[0]+l[1]*c[1];0!==f&&(0,N.hs)(l,l,f),(0,N.hs)(l,l,e),s.coords.push(o[0]+l[0],o[1]+l[1])}s.lengths.push(d),u+=d}return s}const go={createComputedParams:t=>t,optionalAttributes:Yr.optionalAttributes,attributes:{...Yr.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({gradientMethod:t,gradientSizeUnits:e,gradientType:s})=>ds([[0,"alongline"===t.toLowerCase()],[1,e===Sn.O.Absolute],[2,"discrete"===s.toLowerCase()]])},tlbr:{type:ci.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+p.hM+p.MZ,n=e.y+p.hM;return[r,n,r+s-2*p.MZ,n+i]}},accumulatedDistance:{type:ci.pe.HALF_FLOAT,count:1,packTessellation:({distance:t,pathLength:e,distanceOffset:s})=>(s+t)/e},gradientSize:{type:ci.pe.HALF_FLOAT,count:1,pack:({gradientSize:t,gradientSizeUnits:e})=>e===Sn.O.Relative?t/100:(0,l.Lz)(t)},totalLength:{type:ci.pe.HALF_FLOAT,count:1,packTessellation:({pathLength:t})=>t},segmentDirection:{type:ci.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]}}};class yo extends $r{get _preventEffectClipping(){return!0}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=go,this._tessellationOptions.textured=!0}_write(t,e,s){const i=s??wt.z.fromFeatureSetReaderCIM(e);if(!i)return;const{sprite:r}=this.evaluatedMeshParams;this._writeGeometry(t,e,i,r?.textureBinding)}}const xo={createComputedParams:t=>t,optionalAttributes:Yr.optionalAttributes,attributes:{...Yr.attributes,bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:s})=>ds([[4,t],[2,e],[3,s]])},tlbr:{type:ci.pe.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:i}=t,r=e.x+p.hM,n=e.y+p.hM;return[r,n,r+s,n+i]}},accumulatedDistance:{type:ci.pe.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:ci.pe.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:ci.pe.HALF_FLOAT,count:1,pack:({offsetAlongLine:t})=>(0,l.Lz)(t)},capType:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class bo extends $r{constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=xo,this._tessellationOptions.textured=!0}_write(t,e,s){const i=s??wt.z.fromFeatureSetReaderCIM(e);if(!i)return;const{sprite:r}=this.evaluatedMeshParams;this._writeGeometry(t,e,i,r?.textureBinding)}}class wo{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(t){const e=new wo(t.sprite,t.color,t.outlineColor,t.minPixelBuffer,t.placement,t.scaleInfo,t.effects),{type:s,width:i,height:r,angle:n,alignment:o,outlineSize:a,referenceSize:h,sprite:c,overrideOutlineColor:u}=t;return e.rawWidth=(0,l.Lz)(i),e.rawHeight=(0,l.Lz)(r),e.angle=n,e.alignment=o,e.outlineSize=(0,l.Lz)(a),e.referenceSize=(0,l.Lz)(h),e.overrideOutlineColor=u,e.offsetX=(0,l.Lz)(t.offsetX),e.offsetY=(0,l.Lz)(t.offsetY),"simple"!==s||c.sdf||(e.rawWidth=c.width,e.rawHeight=c.height),e._computeSize(t,!1),e}static fromComplexMeshParams(t){const e=new wo(t.sprite,t.color,t.outlineColor,t.minPixelBuffer,t.placement,t.scaleInfo,t.effects);let{alignment:s,transforms:i,size:r,scaleX:n,anchorX:o,anchorY:a,angle:h,colorLocked:c,frameHeight:u,widthRatio:d,offsetX:p,offsetY:_,outlineSize:f,referenceSize:m,scaleFactor:g,sizeRatio:y,isAbsoluteAnchorPoint:x,rotateClockwise:b,scaleSymbolsProportionally:w,sprite:v}=t;if(i&&i.infos.length>0){const t=(0,Lt.zb)(r,h,b,p,_,i);r=t.size,h=t.rotation,p=t.offsetX,_=t.offsetY,b=!1}g&&(r*=g,p*=g,_*=g);const S=n*(v.width/v.height);e.alignment=s,e.rawHeight=(0,l.Lz)(r),e.rawWidth=e.rawHeight*S,e.referenceSize=(0,l.Lz)(m),e.sizeRatio=y,e.sdfDecodeCoeff=(v.sdfDecodeCoeff??1)*y,e.angle=h,e.rotateClockwise=b,e.anchorX=o,e.anchorY=a,e.offsetX=(0,l.Lz)(p),e.offsetY=(0,l.Lz)(_),x&&r&&(v.sdf?e.anchorX=o/(r*d):e.anchorX=o/(r*S),e.anchorY=a/r);const I=w&&u?r/u:1;return e.outlineSize=0===f||isNaN(f)?0:(0,l.Lz)(f)*I,e.scaleSymbolsProportionally=w,e.colorLocked=c,e._computeSize(t,!0),e}constructor(t,e,s,i,r,n,o){this.sprite=t,this.color=e,this.outlineColor=s,this.minPixelBuffer=i,this.placement=r,this.scaleInfo=n,this.effects=o,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.sdfDecodeCoeff=1,this.alignment=0,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_computeSize(t,e){const{sprite:s,hasSizeVV:i}=t,r=!!s.sdf,n=s.sdfPaddingRatio??.5,{rawWidth:o,rawHeight:a,sizeRatio:h,outlineSize:c}=this,l=s.rect;let u=o*h,d=a*h,_=0,f=0;if(r){const t=1/(1-n);if(u*=t,d*=t,i)this.computedWidth=u,this.computedHeight=d;else{const t=e&&o>a?u:o,i=a,r=c+2;this.computedWidth=Math.min(t+r,u),this.computedHeight=Math.min(i+r,d);const n=Math.max(s.width,s.height)/Math.max(u,d);_=(this.computedWidth-u)*n,f=(this.computedHeight-d)*n}}else this.computedWidth=u*(l.width/s.width),this.computedHeight=d*(l.height/s.height),_=2*p.hM,f=2*p.hM;const m=l.x+p.hM-_/2,g=l.y+p.hM-f/2,y=m+s.width+_,x=g+s.height+f;this.texXmin=vo(m),this.texYmin=vo(g),this.texXmax=So(y),this.texYmax=So(x),this.computedWidth*=(this.texXmax-this.texXmin)/(y-m),this.computedHeight*=(this.texYmax-this.texYmin)/(x-g),this.anchorX*=u/this.computedWidth,this.anchorY*=d/this.computedHeight}}function vo(t,e=1e-7){const s=Math.ceil(t);return s-t<e?s:Math.floor(t)}function So(t,e=1e-7){const s=Math.floor(t);return t-s<e?s:Math.ceil(t)}const Io=128/Math.PI;const Po={createComputedParams:t=>wo.from(t),optionalAttributes:{zoomRange:{type:ci.pe.SHORT,count:2,packPrecisionFactor:p.fq,pack:({scaleInfo:t},{tileInfo:e})=>ls(t,e)}},attributes:{pos:{type:ci.pe.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({sprite:t,alignment:e,scaleSymbolsProportionally:s,overrideOutlineColor:i,colorLocked:r})=>{let n=0;return t.sdf&&(n|=us(ys)),1===e&&(n|=us(xs)),s&&(n|=us(bs)),i&&(n|=us(ws)),r&&(n|=us(vs)),n}},offset:{type:ci.pe.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:t,computedWidth:e,computedHeight:s,anchorX:i,anchorY:r,offsetX:n,offsetY:o,rotateClockwise:a})=>{const h=function(t,e,s,i,r=!1){const n=Ds(),o=r?1:-1;return Cs(n),(e||s)&&Es(n,n,[e,-s]),i&&Fs(n,n,.017453292519944444*o*-i),n}(0,n,o,-t,a),c=-(.5+i)*e,l=-(.5-r)*s,u=[c,l],d=[c+e,l],p=[c,l+s],_=[c+e,l+s];return(0,N.l0)(u,u,h),(0,N.l0)(d,d,h),(0,N.l0)(p,p,h),(0,N.l0)(_,_,h),[u,d,p,_]}}},textureUV:{type:ci.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:t,texXmin:e,texYmax:s,texYmin:i})=>[[e,i],[t,i],[e,s],[t,s]]}},color:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>ps(t)},outlineColor:{type:ci.pe.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>ps(t)},sizing:{type:ci.pe.UNSIGNED_BYTE,count:4,pack:({rawWidth:t,rawHeight:e,outlineSize:s,referenceSize:i})=>[ms(Math.max(t,e),128),ms(s,128),ms(i,128),0]},placementAngle:{type:ci.pe.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:t})=>function(t){return function(t){return t%=256,Math.abs(t>=0?t:t+256)}(t*Io)}(t)},sdfDecodeCoeff:{type:ci.pe.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:t})=>t}}};class Mo extends pi{constructor(){super(...arguments),this.vertexSpec=Po}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(t,e,s){const i=this.evaluatedMeshParams.sprite?.textureBinding,r=e.getDisplayId();t.recordStart(this.instanceId,this.attributeLayout,i);const n=this.evaluatedMeshParams.minPixelBuffer,o=Math.max(this.evaluatedMeshParams.computedWidth,n),a=Math.max(this.evaluatedMeshParams.computedHeight,n),h=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,c=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,l=this.evaluatedMeshParams.offsetX+h,u=-this.evaluatedMeshParams.offsetY+c;if(null!=this.evaluatedMeshParams.placement){let i=null;if(null!=s&&(i=Ht(s,2*Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight),!1),null===i))return;this._writePlacedMarkers(t,e,i,o,a)}else if(s?.nextPath()){s.nextPoint();const e=s.x,i=s.y;t.recordBounds(e+l,i+u,o,a),this._writeQuad(t,r,e,i)}else if("esriGeometryPolygon"===e.geometryType){const s=e.readCentroidForDisplay();if(!s)return;const[i,n]=s.coords;t.recordBounds(i+l,n+u,o,a),this._writeQuad(t,r,i,n)}else if("esriGeometryPoint"===e.geometryType){const s=e.readXForDisplay(),i=e.readYForDisplay();t.recordBounds(s+l,i+u,o,a),this._writeQuad(t,r,s,i)}else{const s=e.readGeometryForDisplay();s?.forEachVertex((e,s)=>{t.recordBounds(e+l,s+u,o,a),Math.abs(e)>St||Math.abs(s)>St||this._writeQuad(t,r,e,s)})}t.recordEnd()}_writePlacedMarkers(t,e,s,i,r){const n=s??wt.z.fromFeatureSetReaderCIM(e);if(!n)return;const o=hs.getPlacement(n,-1,this.evaluatedMeshParams.placement,(0,l.Lz)(1),t.id);if(!o)return;const a=e.getDisplayId();let h=o.next();const c=this.evaluatedMeshParams.offsetX,u=-this.evaluatedMeshParams.offsetY;for(;null!=h;){const e=h.tx,s=-h.ty;if(Math.abs(e)>St||Math.abs(s)>St){h=o.next();continue}const n=-h.getAngle();t.recordBounds(e+c,s+u,i,r),this._writeQuad(t,a,e,s,n),h=o.next()}}_writeQuad(t,e,s,i,r){const n=t.vertexCount(),o=null==r?null:{placementAngle:r};this._writeVertex(t,e,s,i,o),t.indexWrite(n+0),t.indexWrite(n+1),t.indexWrite(n+2),t.indexWrite(n+1),t.indexWrite(n+3),t.indexWrite(n+2)}}var To=s(4576),ko=s(55674);class Co{destroy(){}}class Ao extends Co{constructor(t){super(),this._value=t}resize(t){}read(t,e){return this._value}readWithDefault(t,e,s){return this._value}hasArcadeDependency(t){return!1}}const Fo=()=>D.A.getLogger("esri.views.2d.engine.webgl.shaderGraph.techniques.mesh.MeshWriterInputEvaluator");async function Eo(t,e,s,i){const{defaultValue:r,valueExpressionInfo:n,value:o}=e;if(n){if("dictionary-template"===n.type)return{...e,computed:t.createDictionaryTemplateField(n,s),defaultValue:r};const{expression:o}=n,a=await t.createComputedField({expression:o},i);return a?{...e,computed:a,defaultValue:r}:null}return{...e,computed:new Ao(o),defaultValue:r}}async function zo(t,e,s){const{valueExpressionInfo:i}=e,r="dictionary-template"===i.type?t.createDictionaryTemplateField(i,s):await t.createComputedField({expression:i.expression});return r?{...e,computed:r}:null}function Ro(t){return"object"==typeof t&&null!=t&&(!(!("valueExpressionInfo"in t)||!t.valueExpressionInfo)||"type"in t&&"Process"===t.type&&"op"in t&&"Random"===t.op)}function Oo(t){if(Array.isArray(t))for(const e of t)if(Oo(e))return!0;if("object"==typeof t){if(Ro(t))return!0;for(const e in t)if(Oo(t[e]))return!0}return!1}class Lo{static async create(t,e,s,i){const r={},n=new Map,o=new Map,a=new Map,h=new Map,c=new Map,l=new Map;for(const u in s){const d=s[u];if(null!=d&&"object"==typeof d)if(Array.isArray(d)){if("object"==typeof d[0])throw new Error(`InternalError: Cannot handle ${u}. Nested array params are not supported`);r[u]=d}else{if("valueExpressionInfo"in d){if(d.value){r[u]=d.value;continue}const e=await zo(t,d,i);if(!e){r[u]=d.defaultValue;continue}n.set(u,e),r[u]=null;continue}switch(d.type){case"cim-effect-infos":if(d.effectInfos.some(t=>t.overrides.length)){o.set(u,{effects:await Promise.all(d.effectInfos.map(async e=>{const s=e.overrides.map(e=>Eo(t,e,i,!1));return{effect:e.effect,compiledOverrides:(await Promise.all(s)).filter(To.Ru)}}))});break}r[u]=d.effectInfos.map(t=>t.effect);break;case"cim-marker-placement-param":d.overrides.length&&a.set(u,{placementInfo:d,compiledOverrides:(await Promise.all(d.overrides.map(e=>Eo(t,e,i,!1)))).filter(To.Ru)}),r[u]=d.placement;break;case"text-rasterization-param":{if(d.overrides.length){const e=d.overrides.map(e=>Eo(t,e,i,d.useLegacyLabelEvaluationRules??!1));h.set(u,{compiledOverrides:(await Promise.all(e)).filter(To.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};r[u]=await e.fetchResourceImmediate(s)??null;break}case"sprite-rasterization-param":{if(d.overrides.length){const e=d.overrides.map(e=>Eo(t,e,i,!1));h.set(u,{compiledOverrides:(await Promise.all(e)).filter(To.Ru),rasterizationParam:d,objectIdToResourceId:new Map});continue}if("animated"===d.resource.type){h.set(u,{compiledOverrides:[],rasterizationParam:d,objectIdToResourceId:new Map});continue}const s={type:"cim-rasterization-info",resource:d.resource};r[u]=await e.fetchResourceImmediate(s)??null;break}case"cim-marker-transform-param":{const{params:e}=d;if(Oo(e)){const s={compiledMarkerInfos:[]};await Promise.all(e.map(async e=>{const r={props:{}};for(const s in e)if(Ro(e[s])){const n=await zo(t,e[s],i);r.compiledExpressionMap||(r.compiledExpressionMap=new Map);const o=r.compiledExpressionMap;n&&o.set(s,n)}else r.props[s]=e[s];s.compiledMarkerInfos.push(r)})),c.set(u,s)}else r[u]={type:"cim-marker-transform-info",infos:e};break}case"animation-params":{const{params:s}=d,i=Li(s);if(Oo(i)){const e=await Promise.all(i.map(e=>Gi(e,t)));l.set(u,{params:e,propertyIdToResourceId:new Map,key:u})}else{const t=Oi(i),s=await e.fetchResourceImmediate({type:"animation-info",resource:t});null!=s&&"sprite"===s.type&&(r[u]={dataRow:s.rect.y,dataColumn:s.rect.x})}break}default:r[u]=d}}else r[u]=d}return new Lo(s,r,n,o,a,h,c,l)}constructor(t,e,s,i,r,n,o,a){this.inputMeshParams=t,this._resolvedMeshParams=e,this._dynamicProperties=s,this._dynamicEffectProperties=i,this._dynamicPlacementProperties=r,this._dynamicAsyncProperties=n,this._dynamicTransformProperties=o,this._dynamicAsyncAnimations=a,this.evaluator=t=>t,this._arcadeDependencies=new Set;for(const t of this._expressions())(0,ko.QY)(this._arcadeDependencies,t)}get hasDynamicProperties(){return!!(this._dynamicProperties.size||this._dynamicAsyncProperties.size||this._dynamicEffectProperties.size||this._dynamicTransformProperties.size||this._dynamicPlacementProperties.size||this._dynamicAsyncAnimations.size)}get evaluatedMeshParams(){return this._evaluatedMeshParams||(this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams)),this._evaluatedMeshParams}enqueueRequest(t,e,s){for(const r of this._dynamicAsyncProperties.values()){const n=(0,Is.o8)(r.rasterizationParam.resource);"animated"===r.rasterizationParam.resource.type&&r.rasterizationParam.resource.randomizeStartTime&&(n.primitiveName="__RESERVED__PRIMITIVE__NAME__",n.startGroup=mi(e.getObjectId()||0));for(const{primitiveName:t,propertyName:o,computed:a,defaultValue:h,valueExpressionInfo:c}of r.compiledOverrides)try{ai(n,"animated"===r.rasterizationParam.resource.type?n.primitiveName:t,o,a,e,s,h)}catch(t){Fo().errorOnce(new i.A("invalid-arcade-expression","Encountered an error when evaluating the arcade expression",{error:t,valueExpressionInfo:c}))}const o=t.enqueueRequest({type:"cim-rasterization-info",resource:n});r.objectIdToResourceId.set(e.getObjectId(),o)}for(const i of this._dynamicAsyncAnimations.values()){const r=i.params.map(t=>Ni(t,e,s)).map(ki).map(t=>t.simplify()),n=Di(r),o=t.enqueueRequest({type:"animation-info",resource:n});i.propertyIdToResourceId.set(e.getObjectId()+"."+i.key,o)}}evaluateMeshParams(t,e,s){for(const[t,i]of this._dynamicProperties.entries())this._resolvedMeshParams[t]=i.computed.readWithDefault(e,s,i.defaultValue);for(const[t,i]of this._dynamicPlacementProperties.entries())for(const{computed:r,defaultValue:n,propertyName:o}of i.compiledOverrides){const a=r.readWithDefault(e,s,n);i.placementInfo.placement[o]=a,this._resolvedMeshParams[t]=i.placementInfo.placement}for(const[t,i]of this._dynamicEffectProperties.entries())for(const r of i.effects){for(const{computed:t,defaultValue:i,propertyName:n}of r.compiledOverrides){const o=t.readWithDefault(e,s,i);r.effect[n]=o}this._resolvedMeshParams[t]=i.effects.map(t=>t.effect)}for(const[t,i]of this._dynamicTransformProperties.entries()){const r={type:"cim-marker-transform-info",infos:[]};for(const t of i.compiledMarkerInfos){const i={...t.props};if(t.compiledExpressionMap)for(const[r,n]of t.compiledExpressionMap){const t=n.computed.readWithDefault(e,s,n.defaultValue);i[r]="number"==typeof t||"boolean"==typeof t?t:n.defaultValue}r.infos.push(i)}this._resolvedMeshParams[t]=r}for(const[s,i]of this._dynamicAsyncProperties.entries()){const r=i.objectIdToResourceId.get(e.getObjectId());if(null==r)continue;const n=t.getResource(r);this._resolvedMeshParams[s]=n}for(const[s,i]of this._dynamicAsyncAnimations.entries()){const r=i.propertyIdToResourceId.get(e.getObjectId()+"."+s);if(null==r)continue;const n=t.getResource(r);this._resolvedMeshParams[s]={dataRow:n.rect.y,dataColumn:n.rect.x}}return this._evaluatedMeshParams=this.evaluator(this._resolvedMeshParams),this.evaluatedMeshParams}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}*_expressions(){for(const t of this._dynamicProperties.values())yield t.computed;for(const t of this._dynamicEffectProperties.values())for(const e of t.effects)for(const t of e.compiledOverrides)yield t.computed;for(const t of this._dynamicPlacementProperties.values())for(const e of t.compiledOverrides)yield e.computed;for(const t of this._dynamicAsyncProperties.values())for(const e of t.compiledOverrides)yield e.computed;for(const t of this._dynamicTransformProperties.values())for(const e of t.compiledMarkerInfos)if(null!=e.compiledExpressionMap)for(const t of e.compiledExpressionMap.values())yield t.computed;for(const t of this._dynamicAsyncAnimations.values())for(const e of t.params)yield*Bi(e)}}const Do={createComputedParams:t=>t,optionalAttributes:{},attributes:{pos:{type:ci.pe.SHORT,count:2,packPrecisionFactor:10,pack:"position"},id:{type:ci.pe.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:t=>0},offset:{type:ci.pe.SHORT,count:2,packPrecisionFactor:16,packAlternating:{count:4,pack:({size:t})=>{const e=(0,l.Lz)(t),s=-e/2,i=-e/2;return[[s,i],[s+e,i],[s,i+e],[s+e,i+e]]}}},texCoords:{type:ci.pe.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:()=>[[0,1],[1,1],[0,0],[1,0]]}},size:{type:ci.pe.UNSIGNED_BYTE,count:2,pack:({size:t})=>[t,t]},referenceSize:{type:ci.pe.UNSIGNED_BYTE,count:1,pack:({size:t})=>(0,l.Lz)(t)},zoomRange:{type:ci.pe.UNSIGNED_BYTE,count:2,pack:({scaleInfo:t},{tileInfo:e})=>ls(t,e)}}};class Go extends pi{constructor(){super(...arguments),this.vertexSpec=Do}_write(t,e){const s=e.getDisplayId(),i=this.evaluatedMeshParams.minPixelBuffer,r=Math.max((0,l.Lz)(this.evaluatedMeshParams.size),i);let n,o;if("esriGeometryPoint"===e.geometryType)n=e.readXForDisplay(),o=e.readYForDisplay();else{const t=e.readCentroidForDisplay();if(!t)return;n=t?.coords[0],o=t?.coords[1]}t.recordStart(this.instanceId,this.attributeLayout),t.recordBounds(n,o,r,r);const a=t.vertexCount();this._writeVertex(t,s,n,o),t.indexWrite(a+0),t.indexWrite(a+1),t.indexWrite(a+2),t.indexWrite(a+1),t.indexWrite(a+3),t.indexWrite(a+2),t.recordEnd()}}class No{async createMeshWriter(t,e,s,i,r){const n=this._getMeshWriter(i.techniqueType),o=await Lo.create(t,e,i.inputParams,r),a=new n(i.id,o,i.optionalAttributes,s);return await a.loadDependencies(),a}_getMeshWriter(t){switch(t){case 13:return on;case 11:return rn;case 9:return dn;case 26:return hn;case 14:return Fn;case 24:return mn;case 27:return On;case 10:return vn;case 21:return Mo;case 28:return Go;case 30:return uo;case 19:return $r;case 31:return bo;case 15:return yo;case 17:return Dn;case 18:return fo;case 2:return hr;case 3:return cr;case 0:return Qr;case 1:return Kr;default:throw new Error("Internal Error: Mesh writer not in the registry")}}}class Bo{constructor(t,e,s,i,r){this.storage=t,this.proxy=e,this.viewParams=s,this.registry=i,this.fieldsMap=r}async createMeshWriters(t){const e=t.map(t=>this.registry.createMeshWriter(this.storage,this.proxy,this.viewParams,t,this.fieldsMap));return Promise.all(e)}}var qo=s(563);class Uo{constructor(t){this._outstandingMessages=[],this._queue=new qo.QueueProcessor({concurrency:t.concurrency,process:e=>t.process(e)})}async push(t){if(t.end)return await Promise.all(this._outstandingMessages),await this._queue.push(t),void(this._outstandingMessages=[]);const e=this._queue.push(t);return this._outstandingMessages.push(e),e}}var Wo=s(43334),Vo=s(31464),jo=s(95466);class Yo{static async create(t,e){if("count"===e.statisticType){const t=new Ao(1);return new Yo(e.name,e.alias,e.type,e.statisticType,t)}const s=await t.createComputedField({expression:e.onStatisticExpression?.expression,field:e.onStatisticField});return new Yo(e.name,e.alias,e.type,e.statisticType,s)}constructor(t,e,s,i,r){this.name=t,this.alias=e,this.type=s,this.statisticType=i,this.computed=r}}var Ho=s(65529),Xo=s(70328),$o=s(37730),Zo=s(56390);class Qo{constructor(t){this.subscription=t,this.handledChunks=new Set}destroy(){}}class Jo{constructor(t,e,s){this._source=t,this._attributeStore=e,this._sqlOptions=s,this._sendStates=new Map}destroy(){}get enablePixelBuffering(){return!0}get isAggregate(){return!1}get usedMemory(){return 0}onSubscribe(t){const e=this.createState(t);this._sendStates.set(t.key.id,e),this.updateChunks()}onUnsubscribe(t){this._sendStates.get(t.key.id)?.destroy(),this._sendStates.delete(t.key.id)}get hasSubscribers(){return this._sendStates.size>0}requiresInvalidation(){return!1}invalidate(){const t=Array.from(this._sendStates.values());this._sendStates.clear();for(const e of t)e.destroy(),this.onSubscribe(e.subscription)}invalidateAttributeData(t){}hasArcadeDependency(t){return!1}getFeatureObjectIdsForAggregate(t){throw new Error("InternalError: AggregateId lookup not supported")}getDisplayIds(t){return this.displayMap(t,t=>t,t=>t)}getDisplayAndObjectIds(t){return this.displayMap(t,t=>t,(t,e,s)=>[t,s])}afterUpdateChunks(){}}class Ko extends Jo{constructor(t,e,s,i,r){super(t,e,r),this.spatialReference=s,this.aggregateFields=i,this._arcadeDependencies=new Set,this.events=new Ho.bk,this.featureAdapter=$o.T;for(const t of i)(0,ko.QY)(this._arcadeDependencies,t.computed)}get aggregateQueryEngine(){return this._aggregateQueryEngine||(this._aggregateQueryEngine=new Zo.do({featureStore:this,fieldsIndex:this._metadata.fieldsIndex,geometryType:this._metadata.geometryType,featureIdInfo:this._metadata.featureIdInfo,spatialReference:this.spatialReference})),this._aggregateQueryEngine}get isAggregate(){return!0}removeChunks(t){}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}forEach(t){return this.forEachAggregateWorldSpace(t)}forEachInBounds(t,e){}forEachBounds(t,e){const s=(0,Xo.vt)();for(const i of t){const t=(0,Nn.jQ)(s,i.geometry);t&&e(t)}}}class ta{constructor(t,e,s,i,r){this.subscription=t,this.reader=e,this.clear=s,this.end=i,this.debugInfo=r,this.type="append"}get id(){return this.subscription.tile.id}createMessage(t,e,s){return{type:"append",clear:this.clear,id:this.id,append:t,end:this.end,debugInfo:this.debugInfo,subscriptionVesrion:this.subscription.version,version:e,attributeEpoch:s}}}class ea{constructor(t,e,s,i,r){this.subscription=t,this.reader=e,this.remove=s,this.end=i,this.debugInfo=r,this.type="update"}get id(){return this.subscription.tile.id}createMessage(t,e,s){return{type:"update",id:this.id,modify:t,debugInfo:this.debugInfo,remove:this.remove,version:e,subscriptionVesrion:this.subscription.version,end:this.end,attributeEpoch:s}}}const sa=8388607,ia=t=>t&sa;class ra extends Co{constructor(t){super(),this._field=t}resize(t){throw new Error("Method not implemented.")}read(t,e){return t.readAttribute(this._field)}readWithDefault(t,e){return t.readAttribute(this._field)}hasArcadeDependency(t){return!1}}var na=s(50115);class oa extends Co{static async create(t,e){const s=await(0,ko.Ad)(t,e.spatialReference),i=(0,yt.Wm)(t);return new oa(s,i)}constructor(t,e){super(),this._compiled=t,this._cacheKey=e}resize(t){}read(t,e){return this.hasArcadeDependency("scale")||"system"!==e.$view.timeZone?(0,na.V4)(this._compiled,t,e):this._readCached(t,e)}readWithDefault(t,e,s){return this.hasArcadeDependency("scale")||"system"!==e.$view.timeZone?(0,na.OP)(this._compiled,t,e,s):this._readWithDefaultCached(t,e,s)}hasArcadeDependency(t){return this._compiled?.references(t)??!1}_getCacheKey(t){if(!this._compiled?.references("timeProperties"))return this._cacheKey;const{currentStart:e,currentEnd:s}=t.$view.timeProperties;return this._cacheKey+function(t,e){const s=43758.5453*Math.sin(12.9898*t+78.233*e);return s-Math.floor(s)}(e??1,s??1)}_readCached(t,e){if(t.setCache(this._getCacheKey(e)),t.hasCachedValue())return t.getCachedValue();const s=(0,na.V4)(this._compiled,t,e);return t.setCachedValue(s),s}_readWithDefaultCached(t,e,s){if(t.setCache(this._getCacheKey(e)),t.hasCachedValue())return t.getCachedValue();const i=(0,na.OP)(this._compiled,t,e,s);return t.setCachedValue(i),i}}var aa=s(97770),ha=s(18047),ca=s(68463),la=s(30524),ua=s(32730);class da extends Co{static async create(t,e){const s=(0,ua.lc)(t);return new da(t=>s.replaceAll(/{[^}]*}/g,e=>{const s=e.slice(1,-1),i=t.metadata.fieldsIndex.get(s);if(null==i)return e;const r=t.readAttribute(s);return null==r?"":function(t,e){if(null==t)return"";const s=e.domain;if(s)if("codedValue"===s.type||"coded-value"===s.type){const e=t;for(const t of s.codedValues)if(t.code===e)return t.name}else if("range"===s.type){const{max:i,min:r}=(0,ca.A5)(e),n=+t;if(null!=r&&null!=i&&r<=n&&n<=i)return s.name}let i=t;return(0,la.vE)(e)?i=(0,aa.Yq)(i,(0,aa.J2)("short-date")):(0,la.WA)(e)&&(i=(0,ha.ZV)(+i)),i||""}(r,i)}))}constructor(t){super(),this._evaluator=t}resize(t){}read(t,e){return this._evaluator(t)}readWithDefault(t,e,s){const i=this._evaluator(t);return(0,na.rZ)(i)?s:i}hasArcadeDependency(t){return!1}}class pa extends Co{constructor(t,e){super(),this._template=t,this._parts=(0,Lt.gQ)(t.template,e)}resize(t){}read(t,e){return(0,Lt._h)(t,this._parts,this._template.textCase)}readWithDefault(t,e,s){return(0,Lt._h)(t,this._parts,this._template.textCase)}hasArcadeDependency(t){return!1}}class _a extends Co{constructor(t,e){super(),this._field=t,this._normalizationInfo=e}resize(t){throw new Error("Method not implemented.")}read(t,e){return this._readNormalized(t)}readWithDefault(t,e){return this._readNormalized(t)}hasArcadeDependency(t){return!1}_readNormalized(t){const e=t.readAttribute(this._field);if(null==e)return null;const{normalizationField:s,normalizationTotal:i,normalizationType:r}=this._normalizationInfo,n=t.readAttribute(s);switch(r??"esriNormalizeByField"){case"esriNormalizeByField":return n?n?e/n:void 0:null;case"esriNormalizeByLog":return Math.log(e)*Math.LOG10E;case"esriNormalizeByPercentOfTotal":return i?e/i*100:null}}}var fa=s(73250),ma=s(39516);const ga=()=>D.A.getLogger("esri.views.2d.layers.FeatureLayerView2D"),ya={getAttribute:(t,e)=>t.readAttribute(e)};async function xa(t,e){try{const s=await(0,ma.GP)(t,e);return s.isStandardized||ga().error(new i.A("sql-parse-error","expression is not standardized",{where:t})),(e,r)=>{const n=e.readArcadeFeature();try{return s.testFeatureCompiled(n,ya,r.currentUser)}catch(e){return ga().warn(new i.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:t,error:e})),!0}}}catch(e){return ga().warn(new i.A("sql-runtime-error","Encountered an error when evaluating where clause",{where:t,error:e})),t=>!0}}const ba=()=>D.A.getLogger("esri.views.2d.layers.features.support.ComputedAttributeStorage"),wa=4294967295;function va(t,e,s){if(!(t.length>e))for(;t.length<=e;)t.push(s)}class Sa{constructor(t){this._numerics=[],this._strings=[],this._allocatedSize=256,this._bitsets=[],this._instanceIds=[],this._bounds=[],this._dirtyBitset=this.getBitset(this.createBitset()),this.compilationOptions=t}createBitset(){const t=this._bitsets.length;return this._bitsets.push(fa.y.create(this._allocatedSize,sa)),t+1}createDictionaryTemplateField(t,e){return new pa(t,e)}async createComputedField(t,e=!1){if(t.expression)try{if(!this.compilationOptions)throw new Error("InternalError: Compilation options not defined");return e?await da.create(t.expression,this.compilationOptions):await oa.create(t.expression,this.compilationOptions)}catch(e){const s=new i.A("featurelayer","Failed to compile arcade expression",{error:e,expression:t.expression});return ba().error(s),null}if(t.normalizationType||t.normalizationField)return new _a(t.field,t);if(t.field)return new ra(t.field);const s=new i.A("featurelayer","Unable to create computed field. No expression or field found",{info:t});return ba().error(s),null}async createWhereClause(t){return t?xa(t,this.compilationOptions.fields):null}getBitset(t){return this._bitsets[t-1]}getComputedNumeric(t,e){return this.getComputedNumericAtIndex(t&sa,0)}setComputedNumeric(t,e,s){return this.setComputedNumericAtIndex(t&sa,s,0)}getComputedString(t,e){return this.getComputedStringAtIndex(t&sa,0)}setComputedString(t,e,s){return this.setComputedStringAtIndex(t&sa,0,s)}getComputedNumericAtIndex(t,e){const s=t&sa;return this._ensureNumeric(e,s),this._numerics[e][s]}setComputedNumericAtIndex(t,e,s){const i=t&sa;this._ensureNumeric(e,i),this._numerics[e][i]=s}getPackedChunkId(t){const e=t&sa;return this._ensureInstanceId(e),this._instanceIds[e]}setPackedChunkId(t,e){const s=t&sa;this._ensureInstanceId(s),this._instanceIds[s]=e}getComputedStringAtIndex(t,e){const s=t&sa;return this._ensureString(e,s),this._strings[e][s]}setComputedStringAtIndex(t,e,s){const i=t&sa;this._ensureString(e,i),this._strings[e][i]=s}getXMin(t){return this._bounds[4*(t&sa)]}getYMin(t){return this._bounds[4*(t&sa)+1]}getXMax(t){return this._bounds[4*(t&sa)+2]}getYMax(t){return this._bounds[4*(t&sa)+3]}setBounds(t,e,s=!1){const i=t&sa;if(!s&&!this._dirtyBitset.has(t))return this._bounds[4*i]!==wa;this._dirtyBitset.unset(t);const r=e.readGeometryWorldSpace();if(va(this._bounds,4*i+4,0),!r||!r.coords.length)return this._bounds[4*i]=wa,this._bounds[4*i+1]=wa,this._bounds[4*i+2]=wa,this._bounds[4*i+3]=wa,!1;let n=1/0,o=1/0,a=-1/0,h=-1/0;return r.forEachVertex((t,e)=>{n=Math.min(n,t),o=Math.min(o,e),a=Math.max(a,t),h=Math.max(h,e)}),this._bounds[4*i]=n,this._bounds[4*i+1]=o,this._bounds[4*i+2]=a,this._bounds[4*i+3]=h,!0}getBounds(t,e){const s=this.getXMin(e),i=this.getYMin(e),r=this.getXMax(e),n=this.getYMax(e);return(0,Xo.BI)(t,s,i,r,n),s!==wa}_ensureNumeric(t,e){this._numerics[t]||(this._numerics[t]=[]),va(this._numerics[t],e,0)}_ensureInstanceId(t){va(this._instanceIds,t,0)}_ensureString(t,e){this._strings[t]||(this._strings[t]=[]),va(this._strings[t],e,null)}}var Ia=s(58727),Pa=s(62660),Ma=s(86420),Ta=s(61956),ka=s(30661);class Ca{constructor(t){this._geometryBounds=(0,X.vt)(),this._idToVisibility=new Map,this._serviceInfo=t}static async create(t){const e=new Ca(t);return await e.update(t.filterJSON,t.spatialReference),e}get hash(){return this._hash}check(t,e){return this._applyFilter(t,e)}invalidate(){this._idToVisibility.forEach((t,e)=>{this._idToVisibility.set(e,0)})}setKnownIds(t){for(const e of t)this._idToVisibility.set(e,1)}setTrue(t){const e=[],s=[],i=new Set(t);return this._idToVisibility.forEach((t,r)=>{const n=!!(1&this._idToVisibility.get(r)),o=i.has(r);!n&&o?e.push(r):n&&!o&&s.push(r),this._idToVisibility.set(r,o?3:0)}),{show:e,hide:s}}createQuery(){const{geometry:t,spatialRel:e,where:s,timeExtent:i,objectIds:r}=this;return Ta.A.fromJSON({geometry:t,spatialRel:e,where:s,timeExtent:i,objectIds:r})}async update(t,e){this._hash=JSON.stringify(t);const s=await(0,Ia.T2)(t,null,e);await Promise.all([this._setGeometryFilter(s),this._setIdFilter(s),this._setAttributeFilter(s),this._setTimeFilter(s)])}async _setAttributeFilter(t){if(!t?.where)return this._clause=null,void(this.where=null);this._clause=await xa(t.where,this._serviceInfo.fieldsIndex),this.where=t.where}_setIdFilter(t){this._idsToShow=t?.objectIds&&new Set(t.objectIds),this._idsToHide=t?.hiddenIds&&new Set(t.hiddenIds),this.objectIds=t?.objectIds}async _setGeometryFilter(t){if(!t?.geometry)return this._spatialQueryOperator=null,this.geometry=null,void(this.spatialRel=null);const e=t.geometry,s=t.spatialRel??"esriSpatialRelIntersects",i=await(0,Pa.xt)(s,e,this._serviceInfo.geometryType);(0,ce.Rg)(this._geometryBounds,e),this._spatialQueryOperator=i,this.geometry=e,this.spatialRel=s}_setTimeFilter(t){if(this.timeExtent=this._timeOperator=null,t?.timeExtent){if(!this._serviceInfo.timeInfo){const e=new i.A("feature-layer-view:time-filter-not-available","Unable to apply time filter, as layer doesn't have time metadata.",t.timeExtent);return void D.A.getLogger("esri.views.2d.layers.features.controllers.FeatureFilter").error(e)}this.timeExtent=t.timeExtent,this._timeOperator=(0,Ma.I)(this._serviceInfo.timeInfo,t.timeExtent,ka.Z.Shared)}}_applyFilter(t,e){return this._filterByGeometry(t)&&this._filterById(t)&&this._filterByTime(t)&&this._filterByExpression(t,e)}_filterByExpression(t,e){return!this.where||this._clause(t,e)}_filterById(t){return(!this._idsToHide?.size||!this._idsToHide.has(t.getObjectId()))&&(!this._idsToShow?.size||this._idsToShow.has(t.getObjectId()))}_filterByGeometry(t){if(!this.geometry)return!0;const e=t.readGeometryWorldSpace();return!!e&&this._spatialQueryOperator(e)}_filterByTime(t){return null==this._timeOperator||this._timeOperator(t)}}var Aa=s(35258),Fa=s(8446);class Ea extends Qo{constructor(t,e){super(t),this.bins=new Map,this.featureCache=new Map,this.done=!1,this._store=e}reset(){this.destroy(),this.done=!1}destroy(){const t=this.subscription.tile.key.level;for(const e of this.featureCache.keys())this._store.releaseDisplayIdForObjectId(`${e}.${t}`);this.bins.clear(),this.featureCache.clear(),this.handledChunks.clear()}get tile(){return this.subscription.tile}*featuresWorldSpace(){for(const t of this.featureCache.values()){const e=t.clone();e.geometry&&(0,Nn.aQ)(e.geometry,this.subscription.tile.transform),yield e}}}class za extends Ko{static async create(t,e,s,i,r,n){const o=new Sa({spatialReference:e}),a=await Promise.all(t.fields.map(async t=>Yo.create(o,t))),h=t.featureFilter?await Ca.create({geometryType:s.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:s.metadata.timeInfo,fieldsIndex:s.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return"geohash"===t.index.type&&await(0,Vo.Nk)(e,y.A.WGS84),new za(t,h,r,a,e,s,i,n)}constructor(t,e,s,i,r,n,o,a){super(n,o,r,i,a),this._schema=t,this._featureFilter=e,this._arcadeContextInfo=s,this._metadata=Aa.i.createFeature({geometryType:"esriGeometryPolygon",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new jo.A(t.fields).toJSON(),globalIdField:null,spatialReference:n.metadata.spatialReference,outSpatialReference:n.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}createState(t){return new Ea(t,this._attributeStore)}async*applyOverrideUpdate(t){for(const t of this._sendStates.values()){t.reset();const e=new ta(t.subscription,Fa.K.empty(this._source.metadata),!0,!1,{});yield e}}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._sendStates.values())for(const e of t.featuresWorldSpace()){const{objectId:t,displayId:n}=e,o=i.get(t);if(null!=o){const e=s(n,o,t);r.push(e),i.delete(t)}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[];for(const t of this._sendStates.values())for(const r of t.featuresWorldSpace())e.has(r.displayId)&&!s.has(r.objectId)&&(r.geometry&&i.push({...(0,Nn.oN)(r,this._metadata.geometryType,!1,!1),displayId:r.displayId}),s.add(r.objectId));return{features:[],aggregates:i,tracks:[]}}getFeatureObjectIdsForAggregate(t){for(const e of this._sendStates.values())for(const s of e.bins.values())if(s.id===t)return Array.from(s.containedObjectIds);return[]}async*updateChunks(){for(const t of this._sendStates.values())yield*this._update(t,this._source)}forEachAggregateWorldSpace(t){const e=new Set;for(const s of this._sendStates.values())for(const i of s.featuresWorldSpace())e.has(i.objectId)||(t(i),e.add(i.objectId))}_createIndexOptions(t){switch(this._schema.index.type){case"geohash":return{type:"geohash",fields:this.aggregateFields,featureFilter:this._featureFilter,geohashLevel:this._schema.index.fixBinLevel,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:t.scale,sqlOptions:this._sqlOptions};case"grid":{const e=this._schema.index.fixedBinLevel,s=null!=e?t.tileInfoView.getLODInfoAt(e).scale:t.scale;return{type:"grid",fields:this.aggregateFields,cellSize:this._schema.index.size,featureFilter:this._featureFilter,spatialReference:this.spatialReference,arcadeContextInfo:this._arcadeContextInfo,scale:s,sqlOptions:this._sqlOptions}}}}async*_update(t,e){const{handledChunks:s,subscription:i,bins:r,featureCache:n}=t,o=i.tile;if(t.done)return;for(const i of e.chunks()){if(s.has(i.chunkId))continue;s.add(i.chunkId);const e=i.queryInfo;if("tileId"in e){const t=new b.A(e.tileId);if(t.level!==o.level||t.world!==o.key.world)continue}i.getAggregateIndex(this._createIndexOptions(t.tile)).putBounded(r,t.tile.extent,t.tile.resolution)}const a=[],h=i.tile.transform,c=i.tile.key.level;for(const t of r.values()){let e=n.get(t.id);if(e)e.attributes=t.getAttributes();else{const s=t.getGeometry(this.spatialReference,h);e=new Wo.Om(s,t.getAttributes(),null,t.id),s||(e.centroid=t.getGeometricCentroid(this.spatialReference,h)),e.displayId=this._attributeStore.createDisplayIdForObjectId(`${e.objectId}.${c}`),n.set(t.id,e)}a.push(e)}this.events.emit("changed"),t.done=!e.updateTracking.updating;const l=Fa.K.fromOptimizedFeatures(a,this._metadata,h),u=l.getCursor(),d=t.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo);for(;u.next();)this._attributeStore.setAttributeData(u.getDisplayId(),u,d,this._sqlOptions);const p=new ea(t.subscription,l,[],t.done,{});yield p}}var Ra=s(75538),Oa=s(68974);class La{constructor(t,e){this.inner=t,this.displayId=e}}class Da extends Qo{constructor(t){super(t),this.didSend=!1,this.done=!1}}class Ga{constructor(t,e,s,i,r){this._level=t,this._scale=e,this._indexOptions=s,this._clusterRadius=i,this._store=r,this._cells=new Map,this._handledChunks=new Set,this._statistics=new Map,this._clusters=new Map}destroy(){this._clearClusters()}_clearClusters(){for(const t of this._clusters.values())this._store.releaseDisplayIdForObjectId(t.inner.id);this._clusters.clear()}*aggregatesWorldSpace(){for(const t of this._clusters.values()){const e=t.inner.getCentroid(null),s=new Wo.Om(e,t.inner.getAttributes(),null,t.inner.id,t.displayId);yield s}}clusters(){return this._clusters.values()}updateChunks(t,e){let s=!1;for(const e of t){const t=e.queryInfo;"tileId"in t&&new b.A(t.tileId).level!==this._level||this._handledChunks.has(e.normalizedChunkId)||(this._handledChunks.add(e.normalizedChunkId),s=!0,e.getAggregateIndex({...this._indexOptions,scale:this._scale}).put(this._cells))}const i={xMin:1/0,yMin:1/0,xMax:-1/0,yMax:-1/0},r=(0,Oa.p)(this._indexOptions.spatialReference,this._scale),n=this._indexOptions.cellSize;for(const{subscription:t}of e){const e=t.tile.bounds,s=Math.floor(e[0]*r/n),o=Math.floor(e[1]*r/n),a=Math.ceil(e[2]*r/n),h=Math.ceil(e[3]*r/n);i.xMin=Math.min(i.xMin,s),i.yMin=Math.min(i.yMin,o),i.xMax=Math.max(i.xMax,a),i.yMax=Math.max(i.yMax,h)}return null!=this._lastCellBounds&&i.xMin===this._lastCellBounds.xMin&&i.yMin===this._lastCellBounds.yMin&&i.yMin===this._lastCellBounds.yMin&&i.yMax===this._lastCellBounds.yMax||(s=!0,this._lastCellBounds=i),s&&this._clusterCells(i),s}async updateStatistics(t){let e=!1;for(const t of this._clusters.values())t.inner.count>1&&(e=this._updateAggregateStatistics(this._statistics,t.inner)||e);if(e){const e=Array.from(this._statistics.entries()).map(([t,e])=>({fieldName:t,minValue:e.minValue,maxValue:e.maxValue}));await t.container.updateStatistics(this._level,e)}}createAggregateFeatures(t,e){const s=t.subscription,i=[],r=s.tile.transform;for(const t of this._clusters.values()){let e=t.inner.getCentroidX(r);const n=t.inner.getCentroidY(r),o=s.tile.lod,a=o.wrap?o.worldSize[0]:null,h=1===t.inner.count?t.inner.firstObjectId:t.inner.id,c=t.displayId;if(null!=a)if(1===a){const s=new dr.A([],[e,n]),r=new Wo.Om(s,t.inner.getAttributes(),null,h,c);r.geometry.coords[0]-=p.CQ,i.push(r);const o=new dr.A([],[e,n]),a=new Wo.Om(o,t.inner.getAttributes(),null,h,c);a.geometry.coords[0]+=p.CQ,i.push(a)}else e>p.CQ+p.CQ/2?e-=a*p.CQ:e<-256&&(e+=a*p.CQ);if(e<p.CQ+128&&e>=-128&&n<p.CQ+128&&n>=-128){const s=new dr.A([],[e,n]),r=new Wo.Om(s,t.inner.getAttributes(),null,h,c);i.push(r)}}return Fa.K.fromOptimizedFeatures(i,e,s.tile.transform)}_clusterCells(t){let e=Array.from(this._cells.values());e=e.sort((t,e)=>e.count-t.count);const s=[];for(const t of this._clusters.values())s.push(t.inner.id);this._clusters.clear();const i=this._clusterRadius*(1/(0,Oa.p)(this._indexOptions.spatialReference,this._scale)),r=1+this._clusterRadius/this._indexOptions.cellSize,n=new Set;for(const s of e){if(n.has(s.id))continue;if(s.gridX<t.xMin||s.gridX>t.xMax||s.gridY<t.yMin||s.gridY>t.yMax)continue;const e=this._store.createDisplayIdForObjectId(s.id),o=new La(s.clone(),e);n.add(s.id),this._clusters.set(s.id,o);const a=s.centroidXWorld,h=s.centroidYWorld;for(let t=s.gridY-r;t<=s.gridY+r;t++)for(let e=s.gridX-r;e<=s.gridX+r;e++){if(t===s.gridY&&e===s.gridX)continue;const r=this._cells.get(Ra.L.createId(e,t));if(!r||n.has(r.id))continue;const c=Math.abs(r.centroidXWorld-a),l=Math.abs(r.centroidYWorld-h);c<i&&l<i&&(o.inner.merge(r),n.add(r.id))}}for(const t of s)this._store.releaseDisplayIdForObjectId(t)}_updateAggregateStatistics(t,e){let s=!1;for(const i of e.statistics.values()){if("esriFieldTypeString"===i.field.type)continue;const e=i.value,r=i.field,n=t.get(r.name);if(n){const{minValue:t,maxValue:i}=n,r=Math.min(n.minValue,e),o=Math.max(n.maxValue,e);t===r&&i===o||(n.minValue=r,n.maxValue=o,s=!0);continue}t.set(r.name,{minValue:e,maxValue:e}),s=!0}return s}}class Na extends Ko{static async create(t,e,s,i,r,n,o){const a=new Sa({spatialReference:s}),h={type:"grid",fields:await Promise.all(e.fields.map(async t=>Yo.create(a,t))),spatialReference:s,featureFilter:e.featureFilter?await Ca.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:s,filterJSON:e.featureFilter}):null,cellSize:e.clusterRadius/4,arcadeContextInfo:n,sqlOptions:o};return new Na(t,e.clusterRadius,h,e.fields,i,r,o)}constructor(t,e,s,i,r,n,o){super(r,n,s.spatialReference,s.fields,o),this._connection=t,this._clusterRadius=e,this._indexOptions=s,this._cellsPerScale=new Map,this._metadata=Aa.i.createFeature({geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:new jo.A([...i,...this._source.metadata.fieldsIndex.fields,{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}]).toJSON(),globalIdField:null,spatialReference:r.metadata.spatialReference,outSpatialReference:r.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}get enablePixelBuffering(){return!1}invalidate(){super.invalidate();for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear()}onSubscribe(t){super.onSubscribe(t),this._requiredLevel=t.tile.level,this._requiredScale=t.tile.scale}createState(t){return new Da(t)}async*applyOverrideUpdate(t){for(const t of this._cellsPerScale.values())t.destroy();this._cellsPerScale.clear();for(const t of this._sendStates.values())t.done=!1}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const t of n.clusters()){const e=i.get(t.inner.id);if(null!=e){const n=s(t.displayId,e,t.inner.id);r.push(n),i.delete(t.inner.id);continue}if(1===t.inner.count){const{firstObjectId:e}=t.inner,n=e?i.get(e):null;if(null!=n){const o=s(t.displayId,n,e);r.push(o),i.delete(e)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[],r=[],n=this._getClusterState(this._requiredLevel,this._requiredScale);for(const t of n.aggregatesWorldSpace())if(e.has(t.displayId)&&!s.has(t.displayId)){const e=(0,Nn.oN)(t,this._metadata.geometryType,!1,!1);if(s.add(t.displayId),1===e.attributes.cluster_count){i.push({...e,displayId:t.displayId});continue}r.push({...e,displayId:t.displayId})}return{features:i,aggregates:r,tracks:[]}}getFeatureObjectIdsForAggregate(t){const e=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of e.clusters())if(s.inner.id===t)return Array.from(s.inner.containedObjectIds);return[]}async*updateChunks(){const t=this._source.chunks();if(!t.length)return;const e=this._getClusterState(this._requiredLevel,this._requiredScale),s=Array.from(this._sendStates.values()).filter(t=>t.subscription.tile.level===this._requiredLevel);if(e.updateChunks(t,s)||!this._source.updateTracking.updating)for(const t of s)t.subscription.tile.level===this._requiredLevel&&(t.didSend=!1,t.done=!1);const i=Array.from(this._sendStates.values()).filter(t=>t.done).map(t=>t.subscription.tile.key),r=new Set(i);for(const t of this._sendStates.values()){if(this._source.updateTracking.updating){if(i.some(e=>e.containsChild(t.subscription.tile.key)))continue;if(t.subscription.tile.key.getChildKeys().every(t=>r.has(t)))continue}t.didSend||t.subscription.tile.level!==this._requiredLevel||(t.didSend=!0,yield*this._update(t,e,this._source))}await e.updateStatistics(this._connection)}forEachAggregateWorldSpace(t){if(null==this._requiredLevel||null==this._requiredScale)return;const e=this._getClusterState(this._requiredLevel,this._requiredScale);for(const s of e.aggregatesWorldSpace())t(s)}_getClusterState(t,e){if(null==t||null==e)throw new Error("InternalError: Level and scale must be defined");let s=this._cellsPerScale.get(e);return s||(s=new Ga(t,e,this._indexOptions,this._clusterRadius,this._attributeStore),this._cellsPerScale.set(e,s)),s}async*_update(t,e,s){if(t.done)return;const i=e.createAggregateFeatures(t,this._metadata);this.events.emit("changed"),t.done=!s.updateTracking.updating;const r=i.getCursor(),n=t.subscription.tile.createArcadeEvaluationOptions(this._indexOptions.arcadeContextInfo);for(;r.next();)this._attributeStore.setAttributeData(r.getDisplayId(),r,n,this._sqlOptions);const o=new ta(t.subscription,i,!0,t.done,{});yield o}}var Ba=s(5162),qa=s(9012);class Ua extends Qo{}class Wa extends Jo{constructor(t,e,s,i){super(t,e,i),this._arcadeContextInfo=s,this.handledChunks=new Set,this.handledChunksForIdCreation=new Set,this.handledChunksForAttributeData=new Set,this._streamLayerDeferredObjectIdsToRemove=[]}destroy(){super.destroy();for(const t of this._source.chunks())this._cleanupChunkIds(t)}invalidateAttributeData(t){this.handledChunksForAttributeData.clear(),this._arcadeContextInfo=t,null!=this._evalOptions&&(this._evalOptions=(0,qa.N)(this._evalOptions.$view.scale,t))}onSubscribe(t){super.onSubscribe(t),this._evalOptions=t.tile.createArcadeEvaluationOptions(this._arcadeContextInfo)}createState(t){return new Ua(t)}get aggregateQueryEngine(){return null}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._source.chunks()){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId(),n=e.getDisplayId(),o=i.get(t);if(null!=o){const e=s(n,o,t);r.push(e),i.delete(t)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=new Set,i=[];for(const t of this._source.chunks()){const r=t.reader.getCursor();for(;r.next();){const t=r.getObjectId(),n=r.getDisplayId();e.has(n)&&!s.has(t)&&(i.push({...r.readLegacyFeatureWorldSpace(),displayId:n}),s.add(t))}}return{features:i,aggregates:[],tracks:[]}}async*applyOverrideUpdate(t){const e=[];for(const s of t.modified){const t=this._attributeStore.createDisplayIdForObjectId(s.objectId);s.displayId=t,e.push(t)}const s=Fa.K.fromOptimizedFeatures(t.modified,this._source.metadata).getCursor();for(;s.next();)this._attributeStore.setAttributeData(s.getDisplayId(),s,this._evalOptions,this._sqlOptions);const i=[];for(const e of t.removed){const t=this._attributeStore.getDisplayIdForObjectId(e);null!=t&&i.push(t)}(0,n.A)("esri-2d-update-debug")&&console.debug("FeatureUpdateStrategy.applyLocalEdit",{message:t,modifiedDisplayIds:e,removedDisplayIds:i});const r=Ba.KN.fromFeatures(t.modified,this._source.metadata);this.handledChunks.add(r.chunkId),this.handledChunksForAttributeData.add(r.chunkId),this.handledChunksForIdCreation.add(r.chunkId);for(const t of this._sendStates.values())t.handledChunks.add(r.chunkId),yield new ea(t.subscription,null,e,!1,r.queryInfo);for(const t of this._sendStates.values()){const e=r.getTileReader(t.subscription.tile);yield new ea(t.subscription,e,i,!1,r.queryInfo)}for(const e of t.removed)this._attributeStore.releaseDisplayIdForObjectId(e)}async*updateChunks(){if(this._source.chunks().length){this._updateAttributeData();for(const t of this._sendStates.values())yield*this._update(t)}}removeChunks(t){for(const e of t)this.handledChunks.delete(e.chunkId),this.handledChunksForAttributeData.delete(e.chunkId),this._cleanupChunkIds(e)}afterUpdateChunks(){for(const t of this._streamLayerDeferredObjectIdsToRemove)this._attributeStore.releaseDisplayIdForObjectId(t);this._streamLayerDeferredObjectIdsToRemove=[]}_cleanupChunkIds(t){if(this.handledChunksForIdCreation.has(t.chunkId)){const e=t.reader.getCursor();for(;e.next();){const t=e.getObjectId();this._source.isStream?this._streamLayerDeferredObjectIdsToRemove.push(t):this._attributeStore.releaseDisplayIdForObjectId(t)}this.handledChunksForIdCreation.delete(t.chunkId)}}_updateAttributeData(){for(const t of this._source.chunks()){const{chunkId:e,reader:s}=t;if(!this.handledChunksForIdCreation.has(e)){this.handledChunksForIdCreation.add(e);const t=s.getCursor();for(;t.next();){const e=this._attributeStore.createDisplayIdForObjectId(t.getObjectId());t.setDisplayId(e)}}}for(const t of this._source.chunks())if(this._attributeStore.referencesScale()||!this.handledChunksForAttributeData.has(t.chunkId)){this.handledChunksForAttributeData.add(t.chunkId);const e=t.reader.getCursor();for(;e.next();){const t=e.getDisplayId();this._attributeStore.setAttributeData(t,e,this._evalOptions,this._sqlOptions)}}}*_update(t){const{subscription:e,handledChunks:s}=t;for(const i of this._source.chunks()){const{chunkId:r}=i;if(s.has(r)||!this.handledChunksForIdCreation.has(r)||!this.handledChunksForAttributeData.has(r))continue;s.add(r);const n=i.getTileReader(e.tile);n&&(yield new ta(t.subscription,n,!1,i.end,i.queryInfo))}}}var Va=s(77085),ja=s(5808),Ya=s(17136),Ha=s(89056),Xa=s(92029),$a=s(52350);let Za;class Qa{constructor(t,e,s,i,r){this.chunkIndex=t,this.featureIndex=e,this.objectId=s,this.displayId=i,this.time=r}}class Ja{static getOid(t){return ot.xq+t}constructor(t,e,s,i,r,n,o,a){this._schema=t,this.trackId=e,this.objectId=s,this.displayId=i,this._fields=r,this._spatialReference=n,this._metadata=o,this._isStream=a,this._maxDisplayDuration=this._schema.maxDisplayDuration>0?this._schema.maxDisplayDuration:1/0,this._maxDisplayObservationsPerTrack=this._schema.maxDisplayObservationsPerTrack>=1?this._schema.maxDisplayObservationsPerTrack:1/0,this._observationRecords=[],this._nextObservationRecords=[],this._trackLinePath=[],this._bounds=[],this._trackLineGeometry=new dr.A}get _trackLineAttributes(){const t={...this._latestObservationFeature?.attributes,aggregateId:this.objectId,[ot.EA]:0};if(null!=this._statistics)for(const e of this._statistics.values())t[e.field.name]=e.value;return t}get _startTimeField(){return this._metadata.timeInfo?.startTimeField}get length(){return this._observationRecords.length}*observations(){yield*this._observationRecords}*previousObservations(){for(let t=0;t<this._observationRecords.length-1;t++)yield this._observationRecords[t]}get latestObservationFeature(){return this._latestObservationFeature}get latestObservationRecord(){return this._latestObservationRecord}stageObservation(t,e){this._nextObservationRecords.push(new Qa(t,e.getIndex(),e.getObjectId(),e.getDisplayId(),null!=this._startTimeField?e.readAttributeAsTimestamp(this._startTimeField):null))}commitObservations(t,e,s){const i=new Set(this._nextObservationRecords.map(t=>t.objectId)),r=this._observationRecords.filter(t=>!i.has(t.objectId)).map(t=>t.objectId);let n,o;switch(this._observationRecords=[],this._trackLinePath=[],this._isStream||null==this._startTimeField||this._nextObservationRecords.sort((t,e)=>{const s=t.time,i=e.time;return null!=s&&null!=i?s-i:0}),this._schema.timeField){case"startTimeField":n=this._metadata.timeInfo?.startTimeField;break;case"endTimeField":n=this._metadata.timeInfo?.endTimeField;break;case"timeReceived":n=this._isStream?ot.Aw:null}o=this._isStream?s?.end??Date.now():s?.end??-1/0;const a=e.map(t=>t.reader.getCursor());let h;for(let t=this._nextObservationRecords.length-1;t>=0&&!(this._observationRecords.length>=this._maxDisplayObservationsPerTrack);t--){const e=this._nextObservationRecords[t],s=a[e.chunkIndex];(0,f.Lw)(s),s.setIndex(e.featureIndex);const i=null!=n?s.readAttributeAsTimestamp(n):null;(null!=i?o-i:0)>=this._maxDisplayDuration||(this._commitObservation(e,s),h??=e)}if(null!=h){const{chunkIndex:e,featureIndex:s}=h,i=`${h.objectId}.latest`,n=t.createDisplayIdForObjectId(i),o=a[e];(0,f.Lw)(o),o.setIndex(s);const c=new Wo.Om(o.readGeometryWorldSpace(),{...o.readAttributes(),[ot.EA]:1},null,i,n);this._latestObservationFeature&&r.push(this._latestObservationFeature.objectId),this._latestObservationFeature=c,this._latestObservationRecord=h}else this._latestObservationFeature=null;return this._trackLineGeometry=function(t,e){if(t.length<2)return(0,Nn.Ap)({paths:[t]},!1,!1);if(e.isWrappable){let s=!1;for(let i=1;i<t.length;i++){const r=t[i][0],n=(0,Ya.O7)(r,t[i-1][0],e);r!==n&&(t[i][0]=n,s=!0)}if(s){const s=(0,Ha.b3)({paths:[t],spatialReference:e});if(null!=s)return(0,Nn.Ap)({paths:s.paths},!1,!1)}return(0,Nn.Ap)({paths:[t]},!1,!1)}const s=Za.fromGeometryToGXGeometry({hasM:!1,hasZ:!1,paths:[t]}),i=Za.fromSpatialReference(e);if(null!=i){const t=(0,Va.g7)(s,1e6,i,ja.O.geodesic);if(null!=t){const e=Za.toGeometry(t,i);if(null!=e&&"paths"in e)return(0,Nn.Ap)({paths:e.paths},!1,!1)}}return(0,Nn.Ap)({paths:[t]},!1,!1)}(this._trackLinePath,this._spatialReference),this._bounds=function(t){const{lengths:e,coords:s}=t;if(!e.length)return[(0,X.Ie)()];const i=[];let r=0;for(let t=0;t<e.length;t++){const n=e[t],o=(0,X.Ie)();i.push(o);for(let t=0;t<n;t++){const e=s[2*(t+r)],i=s[2*(t+r)+1];(0,X.tK)(o,[e,i])}r+=n}return i}(this._trackLineGeometry),this._nextObservationRecords=[],r}updateStatistics(t,e){this._statistics=Xa.o.create(this._fields);const s=t.map(t=>t.reader.getCursor());for(const{chunkIndex:t,featureIndex:i}of this._observationRecords){const r=s[t];(0,f.Lw)(r),r.setIndex(i),this._statistics.insert(r,e)}}overlapsTile(t){for(const e of this._bounds)if((0,X.$9)(e,t.bounds,32))return!0;return!1}getLatestObservationFeatureForTile(t){if(null==this._latestObservationFeature)return null;const{objectId:e,displayId:s,geometry:i,attributes:r}=this._latestObservationFeature,n=(0,Nn.Nl)(i,this._metadata.geometryType,t.subscription.tile.transform)??new dr.A,o=(0,X.fA)(1/0,1/0,-1/0,-1/0);return function(t,e){const{coords:s,lengths:i}=t;if(!i.length)return void e(s[0],s[1]);let r=0;for(let t=0;t<i.length;t++){const n=i[t];let o=0,a=0;for(let t=0;t<n;t++)o+=s[2*(t+r)],a+=s[2*(t+r)+1],e(o,a);r+=n}}(n,(t,e)=>(0,X.tK)(o,[t,e])),(0,X.HY)(o,(0,X.fA)(0,0,p.CQ,p.CQ))?new Wo.Om(n,r,null,e,s):null}getTrackLineFeatureForTile(t){const e=(0,Nn.Nl)(this._trackLineGeometry,"esriGeometryPolyline",t.subscription.tile.transform)??new dr.A;return new Wo.Om(e,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineOptimizedFeature(){return new Wo.Om(this._trackLineGeometry,this._trackLineAttributes,null,this.objectId,this.displayId)}getTrackLineDisplayFeature(){const{_trackLineGeometry:t,_trackLineAttributes:e,displayId:s}=this;return{geometry:(0,Nn.zv)(t,"esriGeometryPolyline",!1,!1),attributes:e,displayId:s}}_commitObservation(t,e){const s=e.readCentroidWorldSpace();let i=s?.coords[0],r=s?.coords[1];null==s&&(i=e.readXWorldSpace(),r=e.readYWorldSpace()),null!=i&&null!=r&&(this._observationRecords.unshift(t),this._trackLinePath.unshift([i,r]))}}class Ka extends Qo{constructor(t){super(t),this.done=!1}}class th extends Ko{static async create(t,e,i,r,n,o){const a=new Sa({spatialReference:e}),h=await Promise.all(t.fields.map(async t=>Yo.create(a,t))),c=t.featureFilter?await Ca.create({geometryType:i.metadata.geometryType,hasM:!1,hasZ:!1,timeInfo:i.metadata.timeInfo,fieldsIndex:i.metadata.fieldsIndex,spatialReference:e,filterJSON:t.featureFilter}):null;return e.isWrappable||(0,Va.s1)()||await Promise.all([Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299),s.e(8125)]).then(s.bind(s,78125)),Promise.all([s.e(3661),s.e(1878),s.e(9117),s.e(3299)]).then(s.bind(s,83299)),(0,Va.Hh)()]).then(([t,e,s])=>{Za={fromGeometryToGXGeometry:e.fromGeometryToGXGeometry,toGeometry:e.toGeometry,fromSpatialReference:t.fromSpatialReference}}),new th(t,i,r,e,h,c,n,o)}constructor(t,e,s,i,r,n,o,a){super(e,s,i,r,a),this._schema=t,this._featureFilter=n,this._arcadeContextInfo=o,this._tracks=new Map,this._handledChunks=new Set,this._metadata=e.metadata.weakCloneWithAdditionalFields([{name:ot.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"}]),this._trackLineMetadata=Aa.i.createFeature({geometryType:"esriGeometryPolyline",featureIdInfo:{type:"object-id",fieldName:"aggregateId"},fieldsIndex:{fields:[...this._source.metadata.fieldsIndex.fields,...this.aggregateFields,{name:ot.EA,alias:"trackPart",type:"esriFieldTypeSmallInteger"},{name:"aggregateId",alias:"aggregateId",type:"esriFieldTypeOID"}],timeZoneByFieldName:null},globalIdField:null,spatialReference:e.metadata.spatialReference,outSpatialReference:e.metadata.outSpatialReference,subtypeField:null,subtypes:null,timeInfo:e.metadata.timeInfo,timeReferenceUnknownClient:null,dateFieldsTimeZone:null,typeIdField:null,types:null})}destroy(){super.destroy();for(const t of this._tracks.values())this._removeTrack(t);this._tracks.clear()}get _isStream(){return this._source.isStream}get enablePixelBuffering(){return!0}get isAggregate(){return!1}requiresInvalidation(){const t=new Set(this._source.chunks().map(t=>t.chunkId));for(const e of t)if(!this._handledChunks.has(e))return!0;for(const e of this._handledChunks)if(!t.has(e))return!0;return!1}invalidate(){this._handledChunks.clear(),super.invalidate()}createState(t){return new Ka(t)}async*applyOverrideUpdate(t){D.A.getLogger("esri.views.2d.layers.features.processor.TrackStrategy").error("Applying override to tracks is not supported")}displayMap(t,e,s){const i=new Map(t.map(t=>[e(t),t])),r=[];for(const t of this._tracks.values()){const e=i.get(t.objectId);if(null!=e){const n=s(t.displayId,e,t.objectId);r.push(n),i.delete(t.objectId);continue}const n=t.latestObservationFeature;if(n?.objectId){const t=i.get(n.objectId);if(null!=t){const e=s(n.displayId,t,n.objectId);r.push(e),i.delete(n.objectId);continue}}for(const e of t.observations()){const t=i.get(e.objectId);if(null!=t){const n=s(e.displayId,t,e.objectId);r.push(n),i.delete(e.objectId)}}}return r}getDisplayFeatures(t){const e=new Set(t),s=[],i=[],r=this._source.chunks().map(t=>t.reader.getCursor());for(const t of this._tracks.values()){if(e.has(t.displayId)&&i.push(t.getTrackLineDisplayFeature()),null!=t.latestObservationFeature&&e.has(t.latestObservationFeature.displayId)){const{displayId:e,chunkIndex:i,featureIndex:n}=t.latestObservationRecord,o=r[i];o.setIndex(n),s.push({displayId:e,...o.readLegacyFeatureWorldSpace()})}for(const{displayId:i,chunkIndex:n,featureIndex:o}of t.observations())if(e.has(i)){const t=r[n];t.setIndex(o),s.push({displayId:i,...t.readLegacyFeatureWorldSpace()})}}return{features:s,aggregates:[],tracks:i}}getFeatureObjectIdsForAggregate(t){for(const e of this._tracks.values())if(e.objectId===t)return Array.from(e.observations(),t=>t.objectId);return[]}async*updateChunks(){0===this._handledChunks.size&&this._rebuildTracks();for(const t of this._sendStates.values())yield*this._update(t)}forEachAggregateWorldSpace(t){for(const e of this._tracks.values())t(e.getTrackLineOptimizedFeature())}_rebuildTracks(){const t=this._source.chunks();if(!t.length)return;const e=this._metadata.timeInfo?.trackIdField;if(null==e)return;const s=new Set;for(let i=0;i<t.length;i++){const r=t[i];this._handledChunks.add(r.chunkId);const n=r.reader.getCursor();for(;n.next();){const t=n.readAttribute(e),r=n.getObjectId();if(null!=t&&null!=r&&(null===this._featureFilter||this._featureFilter.check(n,this._sqlOptions))){if(n.getDisplayId()||n.setDisplayId(this._attributeStore.createDisplayIdForObjectId(r)),!this._tracks.has(t)){const e=Ja.getOid(t),s=this._attributeStore.createDisplayIdForObjectId(e),i=new Ja(this._schema,t,e,s,this.aggregateFields,this.spatialReference,this._source.metadata,this._isStream);this._tracks.set(t,i)}this._tracks.get(t).stageObservation(i,n),s.add(t)}}}for(const e of this._tracks.values())if(s.has(e.trackId)){const s=e.commitObservations(this._attributeStore,t,this._featureFilter?.timeExtent);for(const t of s)this._attributeStore.releaseDisplayIdForObjectId(t);e.updateStatistics(t,(0,qa.N)(1,this._arcadeContextInfo))}else this._removeTrack(e)}_removeTrack(t){this._tracks.delete(t.trackId),this._attributeStore.releaseDisplayIdForObjectId(t.objectId);for(const{objectId:e}of t.observations())this._attributeStore.releaseDisplayIdForObjectId(e);null!=t.latestObservationFeature&&this._attributeStore.releaseDisplayIdForObjectId(t.latestObservationFeature.objectId)}*_update(t){if(t.done)return;t.done=!this._source.updateTracking.updating;const e=[],s=[];for(const i of this._tracks.values())if(i.length>0){if(this._schema.showLatestObservation){const s=i.getLatestObservationFeatureForTile(t);null!=s&&e.push(s)}this._schema.showTrackLine&&i.overlapsTile(t.subscription.tile)&&s.push(i.getTrackLineFeatureForTile(t))}const i=Fa.K.fromOptimizedFeatures(e,this._metadata,t.subscription.tile.transform),r=Fa.K.fromOptimizedFeatures(s,this._trackLineMetadata,t.subscription.tile.transform);let n=[];if(this._schema.showPreviousObservations){const e=this._source.chunks().map(()=>[]);for(const t of this._tracks.values())for(const{chunkIndex:s,featureIndex:i}of t.previousObservations())e[s].push(i);n=this._source.chunks().map((s,i)=>{const r=s.getTileReader(t.subscription.tile);if(null==r)return null;const n=$a.e.from(r,e[i]);return n.setProcessorAttributes({[ot.EA]:2}),"esriGeometryPoint"!==n.geometryType&&null!=n.getInTransform()||n.setTransformForDisplay(t.subscription.tile.transform),n}).filter(To.Ru)}this.events.emit("changed");const o=t.subscription.tile.createArcadeEvaluationOptions(this._arcadeContextInfo),a=r.getCursor();for(;a.next();)this._attributeStore.setAttributeData(a.getDisplayId(),a,o,this._sqlOptions);for(const t of n){const e=t.getCursor();for(;e.next();)this._attributeStore.setAttributeData(e.getDisplayId(),e,o,this._sqlOptions)}const h=i.getCursor();for(;h.next();)this._attributeStore.setAttributeData(h.getDisplayId(),h,o,this._sqlOptions);yield new ta(t.subscription,r,!1,!1,{});for(const e of n)yield new ta(t.subscription,e,!1,!1,{});yield new ta(t.subscription,i,!1,t.done,{})}}new Map;var eh=s(69397);class sh{constructor(t){this.data=t,this._referenceCount=0}static{this.estimatedMemory=20}increment(){this._referenceCount+=1}decrement(){this._referenceCount-=1}empty(){return 0===this._referenceCount}}class ih{constructor(){this._freeIdsGenerationA=[],this._freeIdsGenerationB=[],this._idCounter=1,this._freeIds=this._freeIdsGenerationA,this._objectIdToDisplayId=new Map}get usedMemory(){let t=0;return t+=(0,eh.Qf)(this._freeIdsGenerationA),t+=(0,eh.Qf)(this._freeIdsGenerationB),t+=this._objectIdToDisplayId.size*(sh.estimatedMemory+8),t}createIdForObjectId(t){let e=this._objectIdToDisplayId.get(t);return e?e.increment():(e=new sh((0|this._getFreeId())>>>0),e.increment(),this._objectIdToDisplayId.set(t,e)),e.data}releaseIdForObjectId(t){const e=this._objectIdToDisplayId.get(t);e&&(e.decrement(),e.empty()&&(this._objectIdToDisplayId.delete(t),this._freeIds.push(e.data)))}getDisplayIdForObjectId(t){const e=this._objectIdToDisplayId.get(t);return null!=e?e.data:null}releaseAll(){for(const t of this._objectIdToDisplayId.values())this._freeIds.push(t.data);this._objectIdToDisplayId.clear()}incrementGeneration(){this._freeIds=this._freeIds===this._freeIdsGenerationA?this._freeIdsGenerationB:this._freeIdsGenerationA}_getFreeId(){return this._freeIds.length?this._freeIds.pop():this._idCounter++}}const rh=()=>D.A.getLogger("esri.views.layers.2d.features.support.AttributeStore"),nh=(rh(),()=>null),oh=(0,n.A)("esri-shared-array-buffer");(0,n.A)("esri-atomics");class ah{constructor(t,e,s){this.size=0,this.texelSize=4,this.dirtyStart=0,this.dirtyEnd=0;const{pixelType:i,layout:r,textureOnly:n}=e;this.textureOnly=n||!1,this.pixelType=i,this.layout=r,this._resetRange(),this.size=t,this.isLocal=s,n||(this.data=this._initData(i,t))}get usedMemory(){return this.data?.byteLength??0}get buffer(){return this.data?.buffer}unsetComponentAllTexels(t,e){const s=this.data;for(let i=0;i<this.size*this.size;i++)s[i*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const s=this.data;for(let i=0;i<this.size*this.size;i++)s[i*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,s){const i=this.data;for(const r of s)i[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,s){this.data[s*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}unsetComponentTexel(t,e,s){this.data[s*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)}getData(t,e){const s=ia(t);return this.data[s*this.texelSize+e]}setData(t,e,s){const i=ia(t),r=1<<e;0!==(this.layout&r)?null!=this.data&&(this.data[i*this.texelSize+e]=s,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)):rh().error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t),s=this.data;e.set(s),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,s=this.texelSize;if(t>e)return null;this._resetRange();const i=!this.isLocal,r=this.pixelType,n=this.layout,o=this.data;return{start:t,end:e,data:i&&o.slice(t*s,(e+1)*s)||null,pixelType:r,layout:n}}_initData(t,e){const s=ArrayBuffer,r=function(t){switch(t){case ci.ld.UNSIGNED_BYTE:return Uint8Array;case ci.ld.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case ci.ld.FLOAT:return Float32Array;default:return void D.A.getLogger("esri.views.2d.engine.webgl.Utils").error(new i.A("webgl-utils",`Unable to handle type ${t}`))}}(t),n=new r(new s(e*e*4*r.BYTES_PER_ELEMENT));for(let t=0;t<n.length;t+=4)n[t+1]=255;return n}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class hh{constructor(t){this._client=t,this._filters=[],this._blocks=new Array,this._attributeComputeInfo=null,this._abortController=new AbortController,this._size=p.TB,this._idsToHighlight=new Map,this._arcadeDependencies=new Set,this._initialized=!1,this.version=0,this._idGenerator=new ih,this._epoch=1}destroy(){this._abortController.abort()}_initialize(){if(null!=this._blockDescriptors)return;const t=ci.ld.FLOAT;nh(`Creating AttributeStore ${oh?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:ci.ld.UNSIGNED_BYTE,layout:1},{pixelType:ci.ld.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:ci.ld.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:t,layout:15},{pixelType:ci.ld.FLOAT,layout:15}],this._blocks=this._blockDescriptors.map(()=>null)}get usedMemory(){let t=0;for(const e of this._blocks)e&&(t+=e.usedMemory);return t+=this._idGenerator.usedMemory,t}get hasHighlight(){return this._idsToHighlight.size>0}createDisplayIdForObjectId(t){return this._idGenerator.createIdForObjectId(t)}releaseDisplayIdForObjectId(t){return this._idGenerator.releaseIdForObjectId(t)}getDisplayIdForObjectId(t){return this._idGenerator.getDisplayIdForObjectId(t)}incrementDisplayIdGeneration(){this._idGenerator.incrementGeneration()}hasArcadeDependency(t){return this._arcadeDependencies.has(t)}releaseAllIds(){this._idGenerator.releaseAll()}async update(t,e,s,i=0){const r=(0,g.Ui)(this._schema,t);if(this.version=i,r&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${i}] AttributeStore.update`,{changed:r}),this._schema=t,this._attributeComputeInfo=null,this._initialize(),null!=t))if(s&&(this._filters=await Promise.all(t.filters.map(t=>t?Ca.create({geometryType:s.geometryType,hasM:!1,hasZ:!1,timeInfo:s.timeInfo,fieldsIndex:s.fieldsIndex,spatialReference:s.outSpatialReference,filterJSON:t}):null))),"multi"!==t.type)this._attributeComputeInfo={type:"feature",map:new Map},await Promise.all(t.bindings.map(async t=>{const s=await this._bind(e,t);this._updateReferences(s)}));else{this._attributeComputeInfo={type:"multi",keyField:t.keyField,map:new Map};for(const s in t.bindings){const i=t.bindings[s];await Promise.all(i.map(async t=>{const i=await this._bind(e,t,parseInt(s,10));this._updateReferences(i)}))}}}setHighlight(t,e){let s=null;0===t.length&&0===e.length&&(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<p.U5)-1));for(const{displayId:e,highlightFlags:i}of t){if(null==e||-1===e)continue;s||(s=this._getBlock(0),s.unsetComponentAllTexels(0,(1<<p.U5)-1));const t=ia(e);s.setComponent(0,i,[t])}this._idsToHighlight.clear();for(const{objectId:e,highlightFlags:s}of t)this._idsToHighlight.set(e,s);for(const{objectId:t,highlightFlags:s}of e)this._idsToHighlight.set(t,s)}setData(t,e,s,i){const r=ia(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,s,i)}getData(t,e,s){return this._getBlock(e).getData(t,s)}getHighlightFlags(t){return this._idsToHighlight.get(t)||0}unsetAttributeData(t){const e=ia(t);this._getBlock(0).setData(e,0,0)}referencesScale(){const t=this._attributeComputeInfo;if(!t)return!1;if("multi"===t.type){for(const e of t.map.values())for(const{field:t}of e.values())if(t?.hasArcadeDependency("scale"))return!0}else for(const{field:e}of t.map.values())if(e?.hasArcadeDependency("scale"))return!0;return!1}setAttributeData(t,e,s,i){const r=ia(t);this._ensureSizeForTexel(r),this._getBlock(0).setData(r,0,this.getFilterFlags(e,i));const n=this._attributeComputeInfo;let o=null;n&&(o="multi"===n.type?n.map.get(e.readAttribute(n.keyField)):n.map,o?.size&&o.forEach((t,i)=>{const n=1*i%4,o=Math.floor(1*i/4),a=this._getBlock(o+3);let h=t.field?.read(e,s);t.valueRepresentation&&(h=function(t,e){if(!t||!e)return t;switch(e){case"radius":case"distance":return 2*t;case"diameter":case"width":return t;case"area":return Math.sqrt(t)}return t}(h,t.valueRepresentation)),(null===h||isNaN(h)||h===1/0||h===-1/0)&&(h=1e-30),a.setData(r,n,h)}))}get epoch(){return this._epoch}sendUpdates(){const t=this._blocks.map(t=>null!=t?t.toMessage():null),e=this._getInitArgs();(0,n.A)("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.start"),this._client.update({initArgs:e,blockData:t,version:this.version,sendUpdateEpoch:this._epoch}),this._epoch+=1,(0,n.A)("esri-2d-log-updating")&&console.log("AttributeStore: _doSendUpdate.end")}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}async _bind(t,e,s){const i=await t.createComputedField(e),{valueRepresentation:r}=e,n=this._attributeComputeInfo;if("multi"===n.type){const t=n.map.get(s)??new Map;t.set(e.binding,{field:i,valueRepresentation:r}),n.map.set(s,t)}else n.map.set(e.binding,{field:i,valueRepresentation:r});return i}_getInitArgs(){return this._initialized?null:(this._initialized=!0,this._getBlock(1),this._getBlock(2),this._getBlock(7),{blockSize:this._size,blockDescriptors:this._blocks.map(t=>null!=t?{textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType}:null)})}_getBlock(t){const e=this._blocks[t];if(null!=e)return e;nh(`Initializing AttributeBlock at index ${t}`);const s=new ah(this._size,this._blockDescriptors[t],this._client.isLocal);return this._blocks[t]=s,this._initialized=!1,s}_expand(){if(this._size<this._schema.capabilities.maxTextureSize){const t=this._size<<=1;nh("Expanding block size to",t,this._blocks);for(const e of this._blocks)e?.expand(t);return this._initialized=!1,this._size=t,0}return rh().error(new i.A("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}_updateReferences(t){(0,ko.QY)(this._arcadeDependencies,t)}isVisible(t){return!!(this._getBlock(0).getData(t,0)&1<<p.U5)}getFilterFlags(t,e){let s=0;for(let i=0;i<this._filters.length;i++){const r=!!(1<<i),n=this._filters[i];s|=(!r||null==n||n.check(t,e)?1:0)<<i}let i=0;if(this._idsToHighlight.size){const e=t.getObjectId();i=this.getHighlightFlags(e)}return s<<p.U5|i}}class ch{constructor(t,e){this._connection=t,this._source=e,this._version=1,this._registry=new No,this._proxy=new bt({fetch:(t,e)=>this._connection.layerView.fetch(t,e),fetchDictionary:(t,e)=>this._connection.layerView.fetchDictionary(t,e)}),this._attributeStore=new hh({isLocal:!1,update:t=>(0,u.oV)(this._connection.container.updateAttributeView(t))})}destroy(){this._proxy.destroy(),this._strategy?.destroy(),this._attributeStore.destroy()}get aggregateQueryEngine(){return this._strategy?.aggregateQueryEngine}get usedMemory(){let t=0;return t+=this._attributeStore.usedMemory,this._strategy&&(t+=this._strategy.usedMemory),t}get version(){return this._version}getDisplayFeatures(t){return this._strategy?this._strategy.getDisplayFeatures(t):{features:[],aggregates:[],tracks:[]}}getDisplayIds(t){const e={};return this._strategy?(this._strategy.displayMap(t,t=>t,(t,s,i)=>{e[i]=t}),e):e}getFeatureObjectIdsForAggregate(t){return this._strategy?this._strategy.getFeatureObjectIdsForAggregate(t):[]}onSubscribe(t){this._strategy?.onSubscribe(t)}onUnsubscribe(t){this._strategy?.onUnsubscribe(t)}requiresInvalidation(){return this._strategy?.requiresInvalidation()??!1}async update(t,e,s,i,r){const o=t.processor,a=(0,m.i8)(this._schema?.storage,o.storage),h=(0,m.i8)(this._schema?.mesh.properties,o.mesh.properties),c=(0,m.i8)(this._schema?.mesh.factory,o.mesh.factory),l=(0,m.i8)(this._schema?.mesh.strategy,o.mesh.strategy),u=function(t,e){const s=[];return t?.timeExtent?.start===e.timeExtent?.start&&t?.timeExtent?.end===e.timeExtent?.end||s.push("timeProperties"),s}(this._schema?.expressionProperties,o.expressionProperties),d=u.some(t=>this._attributeStore.hasArcadeDependency(t)),p=u.some(t=>this._factory?.hasArcadeDependency(t)??!1),_=u.some(t=>this._strategy?.hasArcadeDependency(t))||this._strategy?.isAggregate&&d,f=p||_,x=h||c||l;if(!(a||x||p||d||_||i))return!1;(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${this._version}] SymbolProcessor.update`,{changes:(0,g.Ui)(this._schema,o),schema:o}),this._schema=o;const b=y.A.fromJSON(this._source.metadata.outSpatialReference),w=new Sa({fields:this._source.metadata.fieldsIndex,spatialReference:b}),v={currentUser:o.mesh.properties.currentUser};if((a||x||d)&&(await this._attributeStore.update(o.storage,w,this._source.metadata,e),this._strategy?.invalidateAttributeData(lh(o))),!i&&!x&&!f)return!1;(l||h||f)&&await this._updateStrategy(o.mesh.strategy,b,r,lh(o),v),this._updateSortKey(w,"sortKey"in o.mesh.properties?o.mesh.properties.sortKey:null);const S="dictionary"===o.mesh.factory.symbology.type?o.mesh.factory.symbology.fieldMap:null,I=new Bo(w,this._proxy,s,this._registry,S);return(c||"dictionary"===o.mesh.factory.symbology.type)&&(this._factory=await gt.create(I,o.mesh.factory)),this._version=e,!0}async applyOverrideUpdate(t){if(!this._strategy)return;const e=this._strategy.applyOverrideUpdate(t);for await(const t of e)try{await this._process(t)}catch(t){}}async updateChunks(){await this._doUpdateChunks(),this._strategy?.afterUpdateChunks()}async removeChunks(t){this._strategy?.removeChunks(t),this._attributeStore.incrementDisplayIdGeneration()}updateHighlight({highlights:t}){if(!this._strategy||!this._strategy.hasSubscribers)return void this._attributeStore.setHighlight(t.map(({objectId:t,highlightFlags:e})=>({objectId:t,highlightFlags:e,displayId:-1})),t);const e=this._strategy.displayMap(t,({objectId:t})=>t,(t,{highlightFlags:e},s)=>({objectId:s,displayId:t,highlightFlags:e}));this._attributeStore.setHighlight(e,t)}invalidate(){this._strategy&&this._strategy.invalidate()}async _doUpdateChunks(){if(!this._strategy)return;const t=this._strategy.updateChunks(),e=[],s=new Map;for await(const i of t){let t=s.get(i.id);null==t&&(t=new Uo({concurrency:16,process:t=>this._process(t)}),s.set(i.id,t));const r=t.push(i).catch(t=>(0,a.jH)(t));e.push(r)}try{await Promise.all(e)}catch(t){}(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates"),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")&&console.log("SendUpdates.await")}async _updateStrategy(t,e,s,i,r){switch(this._strategy?.destroy(),t.type){case"feature":this._strategy=new Wa(this._source,this._attributeStore,i,r);break;case"binning":this._strategy=await za.create(t,e,this._source,this._attributeStore,i,r);break;case"cluster":this._strategy=await Na.create(this._connection,t,e,this._source,this._attributeStore,i,r);break;case"track":this._strategy=await th.create(t,e,this._source,this._attributeStore,i,r)}for(const t of s)this._strategy.onSubscribe(t)}async _updateSortKey(t,e){if(this._sortInfo=(0,f.pR)(this._sortInfo?.computed),null!=e){const s=e.byRenderer?null:await t.createComputedField(e);this._sortInfo={...e,computed:s}}}async _process(t){const e=t.subscription;if((0,n.A)("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process`)}const s={currentUser:this._schema?.mesh.properties.currentUser};await this._fetchResources(t,s),(0,a.Te)(e.signal);const i=await this._write(t,e.tile.createArcadeEvaluationOptions(lh(this._schema)),s),r=e.tile.tileInfoView.getLODInfoAt(e.tile.key);(0,a.Te)(e.signal);const{message:o,transferList:h}=i.serialize(r),c={objectIdMap:null,inner:t.createMessage(o,this._version,this._attributeStore.epoch)};if(this._schema?.mesh.properties.returnMeshObjectId){c.objectIdMap={};const e=t.reader?.getCursor();if(e)for(;e.next();)c.objectIdMap[e.getDisplayId()]=e.getObjectId()}if((0,a.Te)(e.signal),await this._connection.container.onMessage(c,{signal:e.signal,transferList:h}),this._attributeStore.sendUpdates(),(0,n.A)("esri-2d-update-debug")){const s=e.tile;console.debug(`Version[${this._version}] Tile[${s.key.id}, end=${t.end}] Processor._process.await`)}}async _fetchResources(t,e){await this._fetchMatcherResources(t),await this._fetchWriterResources(t,e)}async _fetchMatcherResources(t){if(t.reader)return this._factory.enqueueMatcherRequests(this._proxy,t.reader)}async _fetchWriterResources(t,e){if(!t.reader)return;const s=t.reader.getCursor(),i=t.subscription.tile.createArcadeEvaluationOptions(lh(this._schema));for(;s.next();)this._factory.enqueueWriterRequests(this._proxy,s,i,e);await this._proxy.fetchEnqueuedResources()}async _write(t,e,s){const i=t.subscription.tile,r=t.reader?.getCursor(),n=r?.getSize()??0,o=i.tileInfoView.tileInfo.isWrappable,h=i.tileInfoView.tileInfo.spatialReference.isWGS84,c=new rt(i.key,this._strategy.enablePixelBuffering,o,h,n);if(!r)return c;const l=i.createArcadeEvaluationOptions(lh(this._schema));let u=0;for(;r.next();){++u%1e3||(await(0,a.Pl)(0),(0,a.Te)(t.subscription));const n=this._getSortKeyValue(r,e);c.entityStart(r.getDisplayId(),n),this._factory.write(c,this._proxy,r,l,s,i.level),c.entityEnd()}return c}_getSortKeyValue(t,e){if(!this._sortInfo)return 0;const{computed:s,order:i,byRenderer:r}=this._sortInfo,n=r?this._factory.getSortKey(t,e):s?.read(t,e);return null==n||isNaN(n)?0:n*("asc"===i?-1:1)}}function lh(t){const{timeZone:e}=t?.mesh.properties??{},{timeExtent:s}=t?.expressionProperties??{};return{timeZone:e,timeExtent:s}}class uh{static from(t){let e=0,s=0,i=0;return t.forEach(t=>{const r=t._readGeometry();r&&(s+=r.isPoint?1:r.lengths.reduce((t,e)=>t+e,0),i+=r.isPoint?1:r.lengths.length,e+=1)}),new uh(e,s,i)}constructor(t,e,s){this.featureCount=t,this.vertexCount=e,this.ringCount=s}toJSON(){return{featureCount:this.featureCount,ringCount:this.featureCount,vertexCount:this.featureCount}}}let dh=class extends z.A{constructor(t){super(),this._connection=t,this._enabledEventTypes=new Set,this._updateInfo={websocket:0,client:0},this._lastTime=performance.now(),this._queuedCommands=[],this.addHandles([(0,c.wB)(()=>this._strategy?.connectionStatus??"disconnected",t=>{this._layerView.setProperty({propertyName:"pipelineConnectionStatus",value:t})},{initial:!0}),(0,c.wB)(()=>this._strategy?.errorString||null,t=>this._layerView.setProperty({propertyName:"pipelineErrorString",value:t}),{initial:!0})])}destroy(){this._strategy=null,this.removeAllHandles()}get _layerView(){return this._connection.layerView}set strategy(t){null==this._strategy&&this._resetUpdateInfo(performance.now());const e="event-handles";this.removeHandles(e),null!=t&&(this.addHandles([t.events.on("data-received",t=>this._onFeature(t)),t.events.on("message-received",t=>this._onWebSocketMessage(t)),t.events.on("features-updated",t=>this._onUpdate(t)),t.events.on("tick",()=>this._onTick())],e),this._queuedCommands.forEach(e=>e(t)),this._queuedCommands=[]),this._strategy=t}updateCustomParameters(t){null!=t&&this._callOrEnqueue(e=>e.updateCustomParameters(t))}sendMessageToSocket(t){this._callOrEnqueue(e=>e.sendMessageToSocket(t))}sendMessageToClient(t){this._callOrEnqueue(e=>e.sendMessageToClient(t))}enableEvent(t,e){e?this._enabledEventTypes.add(t):this._enabledEventTypes.delete(t)}disconnect(){this._strategy?.disconnect()}connect(){this._strategy?.connect()}clear(){this._strategy?.clear()}_onWebSocketMessage(t){this._enabledEventTypes.has("message-received")&&this._layerView.emitEvent({name:"message-received",event:t})}_onFeature(t){this._updateInfo.websocket++,this._enabledEventTypes.has("data-received")&&this._layerView.emitEvent({name:"data-received",event:{attributes:t.attributes,centroid:t.centroid,geometry:t.geometry}})}_onUpdate(t){this._updateInfo.client+=t}_onTick(){const t=performance.now(),e=t-this._lastTime;if(e>2500){const s=Math.round(this._updateInfo.client/(e/1e3)),i=Math.round(this._updateInfo.websocket/(e/1e3));this._resetUpdateInfo(t),this._layerView.emitEvent({name:"update-rate",event:{client:s,websocket:i}})}}_resetUpdateInfo(t){this._lastTime=t,this._updateInfo.client=0,this._updateInfo.websocket=0}_callOrEnqueue(t){null!=this._strategy?t(this._strategy):this._queuedCommands.push(t)}};(0,E.Cg)([(0,L.MZ)()],dh.prototype,"_strategy",void 0),dh=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.features.sources.StreamMessenger")],dh);class ph{constructor(){this._requiresInvalidation=!1}get requiresInvalidation(){return this._requiresInvalidation}requireInvalidation(){this._requiresInvalidation=!0}}class _h{constructor(t,e,s){this._context=s,this._controller=new AbortController,this.metadata=Aa.i.createFeature(t),this._schema=e}destroy(){this._controller.abort(),this.store.destroy()}get store(){return this._context.store}get _connection(){return this._context.connection}get _options(){return{signal:this._controller.signal}}get _signal(){return this._controller.signal}applyOverride(t){this._onOverride(),this.store.applyOverride(t)}takeOverrideUpdate(){return this.store.takeOverrideUpdate()}unsafeSetQueryHistoricMoment(t){throw new Error("InternalError: LoadStrategy does not support query info")}async queryByObjectId(t){throw new Error("InternalError: LoadStrategy does not support fetching")}prepareCacheUpdate(t,e){}applyCacheUpdate(){return null}}var fh=s(13069),mh=s(28923);class gh{constructor(t,e,s,r){this.store=t,this.queryInfo=e,this._options=s,this._fetch=r,this._nextBatch=new Set,this._fetchFeatures=(0,a.sg)(async()=>{if(0===this._nextBatch.size||this._options.signal?.aborted)return;const t=Array.from(this._nextBatch);this._nextBatch.clear(),t.length>8e3&&D.A.getLogger("esri.views.2d.layers.FeatureLayerView2D").warn(new i.A("highlight-too-many-features","highlight is limited to 8000 features on large layers configured with a display filter to avoid performance issues"));const e=this.queryInfo.objectIdsQueryPageSize,s=Math.ceil(8e3/e),r=Math.min(s,Math.ceil(t.length/e)),n=Array.from({length:r},(s,i)=>{const r=i*e,n=Math.min(r+e,t.length);return{num:i,query:this.queryInfo.createObjectIdsQuery(t.slice(r,n))}});try{await async function(t,e,s,r={}){const n=(await Promise.allSettled(s.map(s=>async function(t,e,s,i={}){const r=`${t.chunkPrefix??""}${s.num}`,n=await t.fetch(s.query,i,{chunkId:r}),o=new mh.j(n,s.query.inner.toJSON(),s.num,!1);o.chunkId=o.normalizedChunkId=r,(0,a.Te)(i),e.insert(o)}(t,e,s,r)))).filter(t=>"rejected"===t.status).map(t=>t.reason);if(n.length)throw new i.A("featurelayer-query","Encountered errors when downloading data",{errors:n})}({chunkPrefix:"cache."+(0,fh.lk)(),fetch:this._fetch},this.store,n,this._options)}catch(t){}})}prepareCacheUpdate(t,e){if(e)for(const t of e)this._nextBatch.delete(t);for(const e of t)this._nextBatch.add(e)}applyCacheUpdate(){return 0===this._nextBatch.size||this._options.signal?.aborted?null:this._fetchFeatures().catch(()=>{})}}var yh=s(78888),xh=s(41560),bh=s(79677);class wh{static create(t,e,s){const i=e.queryScaleRanges,r=e.displayFilterInfo;return new wh(function(t,e,s){const i=function(t){switch(t.type){case"object-id":case"unique-id-simple":return`${t.fieldName} ASC`;case"unique-id-composite":return`${t.fieldNames.join(",")} ASC`}}(s.featureIdInfo);return{returnCentroid:"esriGeometryPolygon"===s.serviceGeometryType&&!t.queryMetadata.supportsCentroidOnDegeneratedQuantizedGeometry&&!t.queryMetadata.supportsDegeneratedQuantizedGeometry,returnGeometry:!0,timeReferenceUnknownClient:s.timeReferenceUnknownClient??void 0,outSpatialReference:y.A.fromJSON(t.outSpatialReference),orderByFields:"memory"===t.type?[]:[i],where:e.definitionExpression??"1=1",outFields:e.availableFields,multipatchOption:"esriGeometryMultiPatch"===s.serviceGeometryType?"xyFootprint":null,gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?new Date(e.historicMoment):null,timeExtent:e.timeExtent?bh.A.fromJSON(e.timeExtent):null}}(t,e,s),r,i,s.subtypeField,e.customParameters,s.geometryType,t.queryMetadata)}constructor(t,e,s,i,r,n,o){this._queryParams=t,this._displayFilter=e,this._queryScaleRanges=s,this._subtypeField=i,this._customParameters=r,this._geometryType=n,this._queryMetadata=o}get pageSize(){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support paged queries");const t=this._queryMetadata.supportsMaxRecordCountFactor?4:null,e=(this._queryMetadata.maxRecordCount??8e3)*(t??1);return Math.min(8e3,e)}get objectIdsQueryPageSize(){return this._queryMetadata?.maxRecordCount??2e3}updateHistoricMoment(t){this._queryParams.historicMoment=t}updateFields(t){this._queryParams.outFields=t}createPatchFieldsQuery(t,e,s){if(!e.getSize())return null;const i=t.clone();if("*"===this._queryParams.outFields[0]){if("*"===(i.outFields??[])[0])return null;i.outFields=this._queryParams.outFields}else{const t=new Set(this._queryParams.outFields),s=[];for(const i of t)e.hasField(i)||s.push(i);if(0===s.length)return null;i.outFields=s}i.returnGeometry=!1,i.returnCentroid=!1,i.quantizationParameters=null,i.cacheHint=!0;const r={inner:i,customParameters:this._customParameters};if((0,n.A)("esri-tiles-debug")&&null!=s){const t=s.chunkId.toString().replaceAll("/",".");r.customParameters=r.customParameters?{...r.customParameters,chunkId:t}:{chunkId:t}}return r}createQuery(t={}){if(!this._queryParams)throw new Error("InternalError: queryInfo should be defined");return{inner:new Ta.A({...this._queryParams,...t}),customParameters:this._customParameters}}createTileQuery(t,e){if(null==this._queryMetadata)throw new Error("InternalError: Service does not support tile queries");const s=this.createQuery(e),i=s.inner;if(this._queryScaleRanges?.length){const e=this._queryScaleRanges.filter(e=>(!e.minScale||e.minScale>=t.maxScale)&&(!e.maxScale||e.maxScale<=t.minScale)).map(t=>t.subtypeCode);if(e.length){const t=`${this._subtypeField} IN (${e})`;i.where=(0,ma.mA)(i.where,t)}}if(this._displayFilter&&(i.where=(0,ma.mA)(i.where,(0,xh.Ch)(this._displayFilter,t.minScale,t.maxScale))),i.quantizationParameters=e.quantizationParameters??t.getQuantizationParameters(),i.resultType="tile",i.geometry=t.extent,this._queryMetadata.supportsQuantization?"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset=t.resolution*(0,n.A)("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==this._geometryType&&"esriGeometryPolygon"!==this._geometryType||(i.maxAllowableOffset=t.resolution,"esriGeometryPolyline"===this._geometryType&&(i.maxAllowableOffset*=(0,n.A)("feature-polyline-generalization-factor"))),i.defaultSpatialReferenceEnabled=this._queryMetadata.supportsDefaultSpatialReference,i.compactGeometryEnabled=this._queryMetadata.supportsCompactGeometry,this._queryMetadata.supportsMaxRecordCountFactor&&(i.maxRecordCountFactor=4),(0,n.A)("esri-tiles-debug")){const e=t.id.replaceAll("/",".");s.customParameters=s.customParameters?{...s.customParameters,tileId:e}:{tileId:e}}return s}createPagedTileQuery(t,e){const s=this.pageSize;return this.createTileQuery(t,{start:s*e,num:s,returnExceededLimitFeatures:!0})}createPagedQuery(t,e){const s=this.pageSize;return this.createQuery({start:s*t,num:s,returnExceededLimitFeatures:!0,maxRecordCountFactor:4,quantizationParameters:e,cacheHint:!0})}createObjectIdsQuery(t){return this.createQuery({objectIds:t,outFields:["*"]})}}var vh=s(10382),Sh=s(62577),Ih=s(75321),Ph=s(80893),Mh=s(51624),Th=s(97633),kh=s(99996),Ch=s(53655);const Ah=268435455;class Fh{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.idFieldIndices=[],this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}get usedMemory(){let t=0;return t+=(0,eh.Qf)(this.idFieldIndices),t+=(0,eh.Qf)(this.offsets.attributes),t+=(0,eh.Qf)(this.offsets.geometry),t+=(0,eh.Qf)(this.centroid),this.displayIds&&(t+=(0,eh.Qf)(this.displayIds)),this.groupIds&&(t+=(0,eh.Qf)(this.groupIds)),t}}const Eh=268435455,zh=128e3,Rh={small:{delta:new Int32Array(128),decoded:new Int32Array(128)},small64:{delta:new Float64Array(0),decoded:new Float64Array(0)},large:{delta:new Int32Array(zh),decoded:new Int32Array(zh)},large64:{delta:new Float64Array(0),decoded:new Float64Array(0)}};function Oh(t,e){return e?t<=Rh.small64.delta.length?Rh.small64:(t<=Rh.large64.delta.length||(Rh.large64.delta=new Float64Array(Math.round(1.25*t)),Rh.large64.decoded=new Float64Array(Math.round(1.25*t))),Rh.large64):t<=Rh.small.delta.length?Rh.small:(t<=Rh.large.delta.length||(Rh.large.delta=new Int32Array(Math.round(1.25*t)),Rh.large.decoded=new Int32Array(Math.round(1.25*t))),Rh.large)}function Lh(t){for(;t.next();){if(1===t.tag())return t.getMessage();t.skip()}return null}function Dh(t,e,s,i,r){return!!t&&0===e*r-i*s&&e*i+s*r>0}class Gh extends kh.Y{static fromBuffer(t,e,s=!1){const r=e.geometryType,n=function(t){try{const e=2,s=new Mh.A(new Uint8Array(t),new DataView(t));for(;s.next();){if(s.tag()===e)return Lh(s.getMessage());s.skip()}}catch(t){const e=new i.A("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:t});D.A.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(e)}return null}(t),o=function(t,e,s,i=!1){const r=t.asUnsafe(),n=r.pos(),o=new Fh;let a=0,h=0,c=null,l=!1;const u=[];for(;r.next();)switch(r.tag()){case 12:c=r.processMessage(Ch.ae);break;case 9:if(o.exceededTransferLimit=r.getBool(),o.exceededTransferLimit){o.offsets.geometry=i?new Float64Array(8e3):new Int32Array(8e3),o.centroid=i?new Float64Array(16e3):new Int32Array(16e3);for(let t=0;t<o.centroid.length;t++)o.centroid[t]=Ah}break;case 13:{const t=r.processMessage(Ch.cn);t.index=a++,u.push(t);break}case 15:{const t=r.getLength(),s=r.pos()+t;if(!o.exceededTransferLimit){const t=o.offsets.geometry,e=o.centroid;t.push(0),e.push(Ah),e.push(Ah)}!l&&o.exceededTransferLimit&&(l=!0,o.offsets.attributes=i?new Float64Array(8e3*a):new Uint32Array(8e3*a));let n=h*a;for(;r.pos()<s&&r.next();)switch(r.tag()){case 1:{l?o.offsets.attributes[n++]=r.pos():o.offsets.attributes.push(r.pos());const t=r.getLength();r.skipLen(t);break}case 2:if(e){const t=r.getLength(),e=r.pos()+t;for(;r.pos()<e&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const t=r.getSInt64(),e=r.getSInt64();o.centroid[2*h]=t,o.centroid[2*h+1]=e;break}default:r.skip()}}else{o.offsets.geometry[h]=r.pos();const t=r.getLength();o.vertexCount+=t,r.skipLen(t)}break;case 4:{const t=r.getLength(),e=r.pos()+t;for(;r.pos()<e&&r.next();)switch(r.tag()){case 3:{r.getUInt32();const t=r.getSInt64(),e=r.getSInt64();o.centroid[2*h]=t,o.centroid[2*h+1]=e;break}default:r.skip()}break}default:r.skip()}h++,o.hasFeatures=!0;break}default:r.skip()}o.fields=new jo.A(u),o.featureCount=h,o.fieldCount=a;const d=function*(t){switch(t.type){case"object-id":case"unique-id-simple":return void(yield t.fieldName);case"unique-id-composite":return void(yield*t.fieldNames)}}(s);return o.idFieldIndices=Array.from(d,t=>o.fields.get(t)?.index),o.transform=c,o.displayIds=new Uint32Array(o.featureCount),o.groupIds=new Uint16Array(o.featureCount),r.move(n),o}(n,"esriGeometryPoint"===r,e.featureIdInfo,s);return new Gh(n,o,e,s)}constructor(t,e,s,i){super(s),this._use64Bit=i,this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0},this._parseCaches=new Array,this._geometryType=s.geometryType,this._reader=t,this._header=e,this._hasNext=e.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}get _size(){return this._header.featureCount}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get hasZ(){return!1}get hasM(){return!1}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getInTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(t){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._featureIndex=t}getAttributeHash(){let t="";for(const e of this._header.fields.fields)t+=this._readAttributeAtIndex(e.index)+".";return t}getObjectId(){if(1===this._header.idFieldIndices.length)return this._readAttributeAtIndex(this._header.idFieldIndices[0]);const t=this._header.idFieldIndices.map(t=>this._readAttributeAtIndex(t));return JSON.stringify(t)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(t){this._header.displayIds[this._featureIndex]=t}readGeometryArea(){return this._cache.area||this._readGeometry(!0),this._cache.area}copy(){const t=this._reader.clone(),e=new Gh(t,this._header,this.metadata,this._use64Bit);return this.copyInto(e),e}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}get usedMemory(){return eh.qK+(this._cache.geometry?.usedMemory??0)}get underlyingMemory(){return super.underlyingMemory+this._reader.usedMemory+this._header.usedMemory}_readX(){return this._header.centroid[2*this._featureIndex]}_readY(){return this._header.centroid[2*this._featureIndex+1]}_readServerCentroid(){const t=this._header.centroid[2*this._featureIndex],e=this._header.centroid[2*this._featureIndex+1];return t===Eh?null:new dr.A([],[t,e])}_readGeometry(t=!1){if(void 0===this._cache.geometry){let e=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===Eh)return null;const t=this._header.centroid[2*this._featureIndex],s=this._header.centroid[2*this._featureIndex+1];e=new dr.A([],[t,s])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s)return null;i.move(s);try{e=t?this._parseGeometryForDisplay(i):this._parseGeometry(i)}catch(t){return null}}return 0===e?.coords.length&&(e=null),this._cache.geometry=e,e}return this._cache.geometry}_readAttribute(t,e){const s=this._header.fields.get(t);if(null==s)return;const i=this._readAttributeAtIndex(s.index),r=this._header.fields.isDateField(s.name);return e?null==i?i:r?new Date(i):i:i}_readAttributes(){const t={};for(const e of this._header.fields.fields)t[e.name]=this._readAttributeAtIndex(e.index);return t}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._featureOffset=this._featureOffset,t._hasNext=this._hasNext,t._parseCaches=this._parseCaches}_readAttributeAtIndex(t){let e=this._parseCaches[t];if(e||(e=new Th.P(this.getSize()),this._parseCaches[t]=e),e.has(this._featureIndex))return e.get(this._featureIndex);const s=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+t],i=this._reader;i.move(s);const r=function(t){const e=t.getLength(),s=t.pos()+e;for(;t.pos()<s&&t.next();)switch(t.tag()){case 1:return t.getString();case 2:return t.getFloat();case 3:return t.getDouble();case 4:return t.getSInt32();case 5:return t.getUInt32();case 6:return t.getInt64();case 7:return t.getUInt64();case 8:return t.getSInt64();case 9:return t.getBool();default:return t.skip(),null}return null}(i);return e.set(this._featureIndex,r),r}_readGeometryDeltaDecoded(t=!1){if(void 0===this._cache.unquantGeometry){const e=this._readGeometry(t);if(!e)return this._cache.unquantGeometry=void 0,null;if(!this.getInTransform())return this._cache.unquantGeometry=e,e;const s=Oh(e.coords.length,this._use64Bit).decoded,i=e.clone(s),r=i.coords;let n=0;for(const t of i.lengths){for(let e=1;e<t;e++){const t=2*(n+e),s=2*(n+e-1);r[t]+=r[s],r[t+1]+=r[s+1]}n+=t}return this._cache.unquantGeometry=i,i}return this._cache.unquantGeometry}_parseGeometry(t){const e=t.asUnsafe(),s=e.getLength(),i=e.pos()+s,r=[],n=[];for(;e.pos()<i&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;)n.push(e.getUInt32());break}case 3:{const t=e.getUInt32(),s=e.pos()+t;for(r.push(e.getSInt64()),r.push(e.getSInt64()),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();e.pos()<s;)r.push(e.getSInt64()),r.push(e.getSInt64()),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();break}default:e.skip()}return new dr.A(n,r,this.hasZ,this.hasM)}_parseGeometryForDisplay(t){const e=t.asUnsafe(),s=e.getLength(),i=e.pos()+s,r=[],n=[];let o=0,a=0,h=null,c=0;const l="esriGeometryPolygon"===this.geometryType,u="esriGeometryPolyline"===this.geometryType,d=l?3:u?2:1,p=l||u;for(;e.pos()<i&&e.next();)switch(e.tag()){case 2:{const t=e.getUInt32(),s=e.pos()+t;for(;e.pos()<s;){const t=e.getUInt32();r.push(t),o+=t}h=Oh(2*o,this._use64Bit).delta;break}case 3:{e.getUInt32();const t=2+(this.hasZ?1:0)+(this.hasM?1:0);(0,f.Lw)(h);for(const s of r){if(a+t*s>h.length){for(let t=0;t<s;t++)e.getSInt64(),e.getSInt64(),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64();continue}let i=0,r=e.getSInt64(),o=e.getSInt64();this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64(),h[a++]=r,h[a++]=o,i+=1;for(let t=1;t<s;t++){const t=e.getSInt64(),s=e.getSInt64(),n=r+t,l=o+s;c+=-.5*(n-r)*(l+o),this.hasZ&&e.getSInt64(),this.hasM&&e.getSInt64(),0===t&&0===s||Dh(p,h[a-2],h[a-1],t,s)?(h[a-2]+=t,h[a-1]+=s):(h[a++]=t,h[a++]=s,i+=1),r=n,o=l}i>=d?n.push(i):a-=i*t}break}default:e.skip()}return this._cache.area=c,n.length?new dr.A(n,h,this.hasZ,this.hasM):null!=h?this._createDeltaQuantizedExtrudedGeometry(h[0],h[1]):null}}class Nh{constructor(t,e){this.service=t,this._metadata=e}destroy(){}}class Bh extends Nh{constructor(t,e,s){super(t,e),this._ports=[],this._loaded=this._load(s)}destroy(){this._loaded.finally(()=>{this._client.close(),this._client=null;for(const t of this._ports)t.close()}).catch(()=>{})}async _load(t){this._ports=await t.layerView.openMemoryPorts(),this._client=await async function(t){const e=new vh.A;return await e.open(t,{}),e}(this._ports)}async executeQuery(t,e){await this._loaded;const s=await this._client.invoke("queryFeatures",t.toJSON(),e);return Fa.K.fromFeatureSet(s,this._metadata)}}class qh extends Nh{async executeQuery(t,e){const{data:s}=await(0,Ph.kS)(this.service.source,t,e),i=!t.quantizationParameters;return Gh.fromBuffer(s,this._metadata,i)}}class Uh extends Nh{async executeQuery(t,e){const{source:s,queryMetadata:i}=this.service;if(null!=t.quantizationParameters&&!i.supportsQuantization){const i=t.clone(),r=(0,Sh.VV)(i.quantizationParameters);i.quantizationParameters=null;const{data:n}=await(0,Ph.eW)(s,i,this._metadata.spatialReference,e),o=(0,Nn.q3)(n,this._metadata.featureIdInfo);return(0,Nn.jH)(r,o),Fa.K.fromOptimizedFeatureSet(o,this._metadata)}const{data:r}=await(0,Ph.eW)(s,t,this._metadata.spatialReference,e);return"esriGeometryPoint"===this._metadata.geometryType&&(r.features=r.features?.filter(t=>{if(null!=t.geometry){const e=t.geometry;return Number.isFinite(e.x)&&Number.isFinite(e.y)}return!0})),Fa.K.fromFeatureSet(r,this._metadata)}}class Wh extends Nh{async executeQuery(t,e){if(t.quantizationParameters&&!this.service.queryMetadata.supportsQuantization){const s=t.clone(),i=(0,Sh.VV)(s.quantizationParameters);s.quantizationParameters=null;const r=await(0,Ih.I)(this.service.source,t,e);return(0,Nn.jH)(i,r),Fa.K.fromOptimizedFeatureSet(r,this._metadata)}const s=await(0,Ih.I)(this.service.source,t,e);return Fa.K.fromOptimizedFeatureSet(s,this._metadata)}}class Vh extends _h{constructor(t,e,s){super(t.metadata,e,s),this._service=t,this._didApplyOverride=!1,this._queue=new qo.QueueProcessor({concurrency:32,process:async t=>{const e={signal:t.options?.signal,query:t.query.customParameters,useRequestQueue:!0};return this._adapter.executeQuery(t.query.inner,e)}}),this._queryInfo=wh.create(t,{...e.full,...e.partial},this.metadata),this._adapter=function(t,e,s){switch(t.type){case"memory":return new Bh(t,e,s);case"ogc":return new Wh(t,e);case"feature-service":return t.queryMetadata.supportsFormatPBF&&(0,n.A)("featurelayer-pbf")?new qh(t,e):new Uh(t,e)}}(t,this.metadata,s.connection),this._lastEditDate=t.queryMetadata.lastEditDate}destroy(){super.destroy(),this._adapter.destroy()}unsafeSetQueryHistoricMoment(t){this._queryInfo.updateHistoricMoment(t)}async tryUpdate(t,e){if((0,m.i8)(this.availableFields,e.availableFields)){if(this._didApplyOverride||await this._queryLastEditDateChanged())return!1;await this._updateFields(e.availableFields)}return this._schema.partial=e,!0}async queryByObjectId(t){if(0===t.length)return Fa.K.empty(this.metadata);const e=this._queryInfo.createQuery({objectIds:t});return this._fetch(e,null,null)}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}_onOverride(){this._didApplyOverride=!0}async _updateFields(t){this._queryInfo.updateFields(t);const e=Array.from(this.store.chunks()).map(async t=>{const e=Ta.A.fromJSON(t.queryInfo.queryJSON);if(e)try{return await this._tryUpdateFields(t.reader,e,{chunkId:t.chunkId}),null}catch(t){return t}}),s=(await Promise.all(e)).filter(t=>t);if(s.length)throw new i.A("featurelayer-query","Encountered errors when downloading fields",{errors:s})}async _fetch(t,e,s){const i=await this._enqueue(t,e);return await this._tryUpdateFields(i,t.inner,s),i}async _queryLastEditDateChanged(){if(null==this._lastEditDate)return!1;if(!("source"in this._service))return!1;const t=this._service.source,e={...t.query,f:"json"},s=(await(0,yh.A)(t.path,{query:e,responseType:"json"})).data.editingInfo.lastEditDate;return s!==this._lastEditDate&&(this._lastEditDate=s,!0)}async _tryUpdateFields(t,e,s){const r=this._queryInfo.createPatchFieldsQuery(e,t,s);if(!r)return;const n=await this._enqueue(r,this._options);n.getSize()===t.getSize()?t.joinAttributes(n):D.A.getLogger("esri.views.2d.layers.features.sources.strategies.AFetchLoadStrategy").error(new i.A("featurelayer-query",`Failed to join features. Expected a count of ${t.getSize()} features, but got ${n.getSize()}`,{query:r.inner.toJSON(),debugInfo:s}))}async _enqueue(t,e){return this._connection.onEvent({type:"fetchStart"}),this._queue.push({query:t,options:e}).finally(()=>{this._connection.onEvent({type:"fetchEnd",done:0===this._queue.length})})}}class jh extends Vh{constructor(t,e,s){super(t,e,s),this._chunksById=new Map,this._featureCache=new gh(this.store,this._queryInfo,this._options,this._fetch.bind(this))}prepareCacheUpdate(t,e){return this._featureCache.prepareCacheUpdate(t,e)}applyCacheUpdate(){return this._featureCache.applyCacheUpdate()}unload(t){this._removeChunks(t.tile)}_addChunk(t){const e=t.tile.id;this._chunksById.has(e)||this._chunksById.set(e,[]);const s=t.size();(s||t.first||t.end)&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Chunk[${t.chunkId}] ATileLoadStrategy.addChunk [count=${s}]`),this._chunksById.get(e).push(t),this.store.insert(t))}_removeChunks(t){const e=this._chunksById.get(t.key.id)??[];for(const s of e)(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${t.key.id}] Chunk[${s.chunkId}] ATileLoadStrategy.removeChunk`),this.store.remove(s);this._chunksById.delete(t.key.id)}}var Yh=s(70300);class Hh extends Yh.K{constructor(t,e,s,i,r,n){super(),this._reader=t,this._queryJSON=e,this._tile=s,this._sourceTile=i,this._sourceTileDepth=r,this._end=n,this.chunkId=`${this._tile.key.id}.${this._sourceTile?.key.id}${this._end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._sourceTile?.key.normalizedId}${this._end?"e":""}`}get queryInfo(){return{type:"drill-down-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,sourceTileDepth:this._sourceTileDepth,sourceTileId:this._sourceTile?.key.id,size:this.size(),end:this.end}}get first(){return 0===this._sourceTileDepth}get reader(){return this._reader}get end(){return this._end}get tile(){return this._tile}get isTiled(){return!0}getTileReader(t){return this._tile.key.id===t.key.id?this.reader:null}}class Xh{constructor(t,e){this.subscription=t,this._tileIdToResult=new Map,this._controller=new AbortController,this._handles=(0,r.vE)([(0,a.u7)(t.signal,()=>this._controller.abort()),(0,a.u7)(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get(t){return this._tileIdToResult.get(t)}set(t,e){this._tileIdToResult.set(t,e)}get options(){return{signal:this._controller.signal}}}class $h extends jh{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){this._loadStates.has(t.key.id)||this._loadStates.set(t.key.id,new Xh(t,this._options));const e=this._loadStates.get(t.key.id);let s;try{for await(const s of this._fetchChunkInfos(e,t.tile,0)){const{queryJSON:t,reader:i,sourceTile:r,sourceTileDepth:n,tile:o}=s,h=new Hh(i,t,o,r,n,!1);(0,a.Te)(e.options),this._addChunk(h)}}catch(t){s=t}const i=new Hh(Fa.K.empty(this.metadata),null,t.tile,null,-1,!0);if(this._addChunk(i),s)throw s}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchChunkInfos(t,e,s){let i=t.get(e.id);const r=!!i;if(i||(i=await this._fetchChunkInfo(t,e,s),t.set(e.id,i)),i.reader.exceededTransferLimit&&s<(0,n.A)("featurelayer-query-max-depth"))for(const i of e.createChildTiles())yield*this._fetchChunkInfos(t,i,s+1);else r||(yield i)}async _fetchChunkInfo(t,e,s){const i=t.subscription.tile.getQuantizationParameters(),r=this._queryInfo.createTileQuery(e,{returnExceededLimitFeatures:!1,quantizationParameters:i});return{reader:await this._fetch(r,t.options,{chunkId:e.id}),queryJSON:r.inner.toJSON(),tile:t.subscription.tile,sourceTile:e,sourceTileDepth:s}}}class Zh extends Yh.K{constructor(t,e,s,i,r){super(),this._reader=t,this._queryJSON=e,this._tile=s,this._page=i,this._end=r,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get queryInfo(){return{type:"paged-tile",chunkId:this.chunkId,tileId:this._tile.key.id,queryJSON:this._queryJSON,page:this._page,size:this.size(),end:this.end}}get reader(){return this._reader}get first(){return 0===this._page}get end(){return this._end}get page(){return this._page}get tile(){return this._tile}get isTiled(){return!0}getTileReader(t){return this._tile.key.id===t.key.id?this.reader:null}}class Qh{constructor(t,e){this.subscription=t,this._pages=new Set,this._controller=new AbortController,this._done=!1,this._handles=(0,r.vE)([(0,a.u7)(t.signal,()=>this._controller.abort()),(0,a.u7)(e,()=>this._controller.abort())])}destroy(){this._controller.abort(),this._handles.remove()}get pageStart(){let t=-1;for(const e of this._pages.values())t=Math.max(t,e);return t+1}get done(){return this._done}get options(){return{signal:this._controller.signal}}add(t,e){this._pages.add(t),this._done=this._done||e}}class Jh extends jh{constructor(){super(...arguments),this._loadStates=new Map}destroy(){super.destroy();for(const t of this._loadStates.values())t.destroy();this._loadStates.clear()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}async load(t){const e=(0,R.tE)(this._loadStates,t.key.id,()=>new Qh(t,this._options));for await(const t of this._fetchPages(e))this._addChunk(t)}unload(t){super.unload(t),this._loadStates.get(t.key.id)?.destroy(),this._loadStates.delete(t.key.id)}async*_fetchPages(t){let e;try{for await(const e of this._concurrentPageStream(t))(0,a.Te)(t.options),0!==e.size()&&(yield e)}catch(t){e=t}if(e&&(0,a.zf)(e)||(yield new Zh(Fa.K.empty(this.metadata),null,t.subscription.tile,-1,!0)),e)throw e}async*_concurrentPageStream(t){const e=(0,n.A)("featurelayer-query-tile-concurrency"),s=this._pageStreamAll(t),i=[];let r=!1,o=1;for(;!r;){const t=[];for(;!r&&i.length<o;){const e=s.next();if(!e.value){r=!0;break}const n=e.value;n.then(t=>{t.reader.exceededTransferLimit||(r=!0)}).catch(t=>{r=!0}).finally(()=>{i.splice(i.indexOf(n),1)}),i.push(n),t.push(n)}for(const e of t)yield e;i.length&&await Promise.race(i),o<e&&(o+=1)}}*_pageStreamAll(t){const e=Math.ceil((0,n.A)("featurelayer-query-tile-max-features")/this._queryInfo.pageSize);for(let s=0;s<e;s++)yield this._downloadPage(s,t)}async _downloadPage(t,e){(0,a.Te)(e.options);const s=e.subscription.tile,i=this._queryInfo.createPagedTileQuery(s,t),r=await this._fetch(i,e.options,{chunkId:`${s.id}-${t}`});return(0,a.Te)(e.options),new Zh(r,i.inner.toJSON(),s,t,!1)}}var Kh=s(27348);class tc extends Vh{constructor(t,e,s){super(t,e,s)}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}load(t){return null==this._promise&&(this._promise=this._download()),this._promise}unload(t){}async _download(){const t=this._schema.snapshotInfo.initialTolerance,e=t?new Kh.A({mode:"view",originPosition:"upper-left",tolerance:t}):null;await this._downloadStreaming(e),null!=e&&await this._downloadRefresh()}async _downloadStreaming(t){try{for await(const e of this._fetchPages(t))this.store.insert(e)}catch(t){throw new i.A("featurelayer-query","Encountered error when downloading data",{error:t})}}async _downloadRefresh(){try{const t=[];for await(const e of this._fetchPages(null))t.push(e);this.store.clear();for(const e of t)this.store.insert(e);this.store.refresh()}catch(t){throw new i.A("featurelayer-query","Encountered error when downloading data",{error:t})}}async*_fetchPages(t){let e;try{for await(const e of this._concurrentPageStream(t))0!==e.size()&&(yield e)}catch(t){e=t}if(e&&(0,a.zf)(e)||(yield new mh.j(Fa.K.empty(this.metadata),null,-1,!0)),e)throw e}async*_concurrentPageStream(t){const e=(0,n.A)("featurelayer-snapshot-concurrency"),s=this._pageStreamAll(t),i=[];let r=!1,o=1;for(;!r;){const t=[];for(;!r&&i.length<o;){const e=s.next();if(!e.value){r=!0;break}const n=e.value;n.then(t=>{t.reader.exceededTransferLimit||(r=!0)}).catch(t=>{r=!0}).finally(()=>{i.splice(i.indexOf(n),1)}),i.push(n),t.push(n)}for(const e of t)yield e;i.length&&await Promise.race(i),o<e&&(o+=1)}}*_pageStreamAll(t){const e=Math.ceil(this._schema.snapshotInfo.maxFeatureCount/this._queryInfo.pageSize);for(let s=0;s<e;s++)yield this._downloadPage(s,t)}async _downloadPage(t,e){(0,a.Te)(this._options);const s=this._queryInfo.createPagedQuery(t,e),i=await this._fetch(s,this._options,{chunkId:t.toString()}),r=new mh.j(i,s.inner.toJSON(),t,!1);return(0,a.Te)(this._options),r}}var ec=s(70581),sc=s(16630);class ic extends _h{constructor(t,e,s){super(t.metadata,e,s),this._service=t,this._chunkId=0,this._files=new Map}destroy(){super.destroy();for(const t of this._files.values())t.free();this._files.clear()}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){if((0,m.i8)(this.availableFields,e.availableFields)&&await this._updateFields(e.availableFields),(0,m.i8)(this._schema.partial.urls,e.urls)){for(const t of e.urls)this._files.has(t)||await this._insert(t);for(const t of this._files.keys())if(!e.urls.includes(t))throw new i.A("unsupported","Removing parquet files is not supported",{previous:this._schema.partial.urls,next:e.urls})}return this._schema.partial=e,!1}async load(t){return null==this._promise&&(this._promise=this._download()),this._promise}unload(t){}_onOverride(){}async _updateFields(t){await this._promise;const e=new Set(t),s=(0,O.iv)(e,new Set(this.availableFields)),i=this._fieldsIndex;if(null==i)return;const r=Array.from(s).map(t=>i.get(t)?.column);if(s.size)for(const t of this._files.values())await t.ensureFields(new Uint32Array(r))}async _insert(t){const e=await(0,ec.DV)(t,{geometryInfo:this._service.geometryInfo,outSpatialReference:this._service.outSpatialReference,getCustomParameters:()=>this._schema.full.customParameters}),s=this._files.size;this._files.set(t,e),(0,a.Te)(this._options);const i=e.fields().map(t=>({name:t.name,alias:t.name,type:t.type,column:e.columnForFieldName(t.name)})),{timeZoneByFieldName:r}=this._service.metadata.fieldsIndex,n=jo.A.fromJSON({fields:i,timeZoneByFieldName:r});this._fieldsIndex=n;const o=new Uint32Array(Array.from(this.availableFields.values()).map(t=>n.get(t)?.column).filter(t=>null!=t));await e.readAllChunks(o,this._signal,t=>{if(this._signal.aborted)return;const e=this._chunkId++,i=new sc.s(this.metadata,n,t,e,s),r=new mh.j(i,null,e,!1);this.store.insert(r)})}async _download(){try{await Promise.all(this._schema.partial.urls.map(t=>this._insert(t)));const t=new mh.j(Fa.K.empty(this.metadata),null,-1,!0);this.store.insert(t)}catch(t){throw console.error(t),t}}}class rc extends Yh.K{constructor(t,e,s,i,r){super(),this._metadata=t,this._reader=e,this._tile=s,this._page=i,this._end=r,this.chunkId=`${this._tile.key.id}.${this._page}${this.end?"e":""}`,this.normalizedChunkId=`${this._tile.key.normalizedId}.${this._page}${this.end?"e":""}`}get reader(){return this._reader??Fa.K.empty(this._metadata)}get first(){return 0===this._page}get end(){return this._end}get tile(){return this._tile}get queryInfo(){return{type:"parquet",chunkId:this.chunkId,queryJSON:null,page:this._page,size:this.size(),tileId:this._tile.id,end:this.end}}get isTiled(){return!0}getTileReader(t){if(this._tile.key.id===t.key.id){const e=[];for(let t=0;t<this.reader.getSize();t++)e.push(t);const s=$a.e.from(this.reader,e);return s.setTransformForDisplay(t.transform),s}return null}}class nc extends _h{constructor(t,e,s){if(super(t.metadata,e,s),this._files=[],!t.geometryInfo.displayOptimization)throw new Error("InternalError: ParquetTileLoadStrategy only supports XZ-enabled parquet files");this._index=oc.create(e.partial.urls,this.metadata,t,new Set(e.partial.availableFields),this.store,()=>e.full.customParameters)}destroy(){super.destroy();for(const t of this._files)t.free()}get about(){return{willQueryAllFeatures:!0,willQueryFullResolutionGeometry:!0}}get availableFields(){return this._schema.partial.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){return(0,m.i8)(this.availableFields,e.availableFields)&&await this._updateFields(e.availableFields),this._schema.partial=e,!1}async load(t){const e=await this._index;await e.ensureLoaded(t)}unload(t){this._index.then(e=>e.unload(t.tile))}_onOverride(){}async _updateFields(t){return(await this._index).updateFields(t)}}class oc{static async create(t,e,s,i,r,n){const o=await Promise.all(t.map(t=>(0,ec.DV)(t,{geometryInfo:s.geometryInfo,outSpatialReference:s.outSpatialReference,getCustomParameters:n})));if(1!==o.length)throw new Error("InternalError: experimental parquet XZ display optimization only supports a single file.");const[a]=o,h=a.fields().map(t=>({name:t.name,alias:t.name,type:t.type,column:a.columnForFieldName(t.name)})),{timeZoneByFieldName:c}=s.metadata.fieldsIndex,l=jo.A.fromJSON({fields:h,timeZoneByFieldName:c}),u=new Uint32Array(Array.from(i.values()).map(t=>l.get(t)?.column).filter(t=>null!=t)),d=s.geometryInfo.displayOptimization;if(!d)throw new Error("InternalError: tiled parquet load requires display optimization");return new oc(e,await Promise.all(o),l,u,r,i,d)}constructor(t,e,s,i,r,n,o){this._metadata=t,this._files=e,this._fieldsIndex=s,this._fieldIndices=i,this._store=r,this._availableFields=n,this._displayOptimization=o,this.fileIndex=0,this._queue=new qo.QueueProcessor({concurrency:1,process:t=>this._ensureLoaded(t)}),this._tileIdToChunkId=new Map}get file(){return this._files[0]}async ensureLoaded(t){return this._queue.push(t)}unload(t){const e=this._tileIdToChunkId.get(t.id);if(null!=e){for(const t of e)this._store.removeById(t);this._tileIdToChunkId.delete(t.id)}}async _ensureLoaded(t){const e=this._metadata.outSpatialReference,s=t.tile,{xmin:i,ymin:r,xmax:n,ymax:o}=function(t,e){const s=[t.xmin,t.ymin,t.xmax,t.ymax],i=Js.A.fromExtent((0,X.w1)(s,e)),r=(0,Vo.Cv)(i,e,y.A.WGS84);if(!r)return null;const n=(0,Nn.Ye)(r,!1,!1),o=n.coords.filter((t,e)=>!(e%2)),a=n.coords.filter((t,e)=>e%2);return{xmin:Math.min(...o),ymin:Math.min(...a),xmax:Math.max(...o),ymax:Math.max(...a)}}(s.extent,e);let a=0;const h={extent:s.extent,extent_lat_lng:{xmin:i,ymin:r,xmax:n,ymax:o},tile_level:s.level,attributes:this._fieldIndices};if("z"===this._displayOptimization.mode?await this.file.queryZChunks(h.extent_lat_lng,this._fieldIndices,t.signal,e=>{if(t.signal.aborted)return;const i=new sc.s(this._metadata,this._fieldsIndex,e,a,this.fileIndex),r=new rc(this._metadata,i,s,a++,!1);this._insertChunk(s,r)}):await this.file.queryXZChunks(h,t.signal,e=>{if(t.signal.aborted)return;const i=new sc.s(this._metadata,this._fieldsIndex,e,a,this.fileIndex),r=new rc(this._metadata,i,s,a++,!1);this._insertChunk(s,r)}),t.signal.aborted)return;const c=new rc(this._metadata,null,s,a++,!0);this._insertChunk(s,c)}_insertChunk(t,e){let s=this._tileIdToChunkId.get(t.id);null==s&&(s=[],this._tileIdToChunkId.set(t.id,s)),s.push(e.chunkId),this._store.insert(e)}async updateFields(t){const e=new Set(t),s=(0,O.iv)(e,this._availableFields);if(this._availableFields=(0,O.KC)(s,this._availableFields),s.size)for(const t of this._files){const e=Array.from(s).map(t=>this._fieldsIndex.get(t)?.column);await t.ensureFields(new Uint32Array(e))}}}class ac{constructor(t){this.size=0,this._start=0,this.maxSize=t,this._buffer=new Array(t)}get entries(){return this._buffer}enqueue(t){if(this.size===this.maxSize){const e=this._buffer[this._start];return this._buffer[this._start]=t,this._start=(this._start+1)%this.maxSize,e}return this._buffer[(this._start+this.size++)%this.maxSize]=t,null}dequeue(){if(0===this.size)return null;const t=this._buffer[this._start];return this._buffer[this._start]=null,this.size--,this._start=(this._start+1)%this.maxSize,t}peek(){return 0===this.size?null:this._buffer[this._start]}peekLast(){return 0===this.size?null:this._buffer[(this._start+(this.size-1))%this.maxSize]}find(t){if(0===this.size)return null;for(const e of this._buffer)if(null!=e&&t(e))return e;return null}clear(t){let e=this.dequeue();for(;null!=e;)t&&t(e),e=this.dequeue()}}class hc{constructor(t,e,s,r,n=128){if(this._trackIdToObservations=new Map,this._idCounter=0,this._lastPurge=performance.now(),this._addOrUpdated=new Map,this._removed=[],this._maxAge=0,this._timeInfo=s,this._purgeOptions=r,this.store=t,"unique-id-composite"===e.type)throw new i.A("stream-layer","composite uniqueIds are not supported");this.idField=e.fieldName,this.purgeInterval=n,this._useGeneratedIds=this.idField===ot.DN}removeById(t){this._removed.push(t)}removeByTrackId(t){const e=this._trackIdToObservations.get(t);if(e)for(const t of e.entries)this._removed.push(t)}add(t){if(this._useGeneratedIds){const e=this._nextId();t.attributes[this.idField]=e,t.objectId=e}else t.objectId=t.attributes[this.idField];const e=t.objectId;if(this._addOrUpdated.set(e,t),this._maxAge=Math.max(this._maxAge,t.attributes[this._timeInfo.startTimeField]),!this._timeInfo.trackIdField)return null==this._trackIdLessObservations&&(this._trackIdLessObservations=new ac(1e5)),void this._trackIdLessObservations.enqueue(e);const s=t.attributes[this._timeInfo.trackIdField];if(!this._trackIdToObservations.has(s)){const t=null!=this._purgeOptions?.maxObservations?this._purgeOptions.maxObservations:1e3,e=(0,Ps.qE)(t,0,1e3);this._trackIdToObservations.set(s,new ac(e))}const i=this._trackIdToObservations.get(s),r=i?.enqueue(e);null!=r&&(this._addOrUpdated.has(r)?this._addOrUpdated.delete(r):this._removed.push(r))}checkForUpdates(){const t=this._getToAdd(),e=this._getToRemove(),s=performance.now(),i=s-this._lastPurge,r=Date.now();i>=this.purgeInterval&&(this._purge(s),this._lastPurge=s);const n=[];if(null!=e)for(const t of e){const e=this.store.removeById(t);null!=e&&n.push(e)}const o=[];if(null!=t){const i=new Set(e??[]);for(const e of t)i.has(e.objectId)||(e.attributes[ot.Gm]=s,e.attributes[ot.Aw]=r,this.store.add(e),o.push(e))}return!(!o.length&&!n?.length||(this.store.update(o,n),0))}_getToAdd(){if(!this._addOrUpdated.size)return null;const t=new Array(this._addOrUpdated.size);let e=0;return this._addOrUpdated.forEach(s=>t[e++]=s),this._addOrUpdated.clear(),t}_getToRemove(){const t=this._removed;return this._removed.length?(this._removed=[],t):null}_nextId(){const t=this._idCounter;return this._idCounter=(this._idCounter+1)%4294967294+1,t}_purge(t){const e=this._purgeOptions;null!=e&&(this._purgeSomeByDisplayCount(e),this._purgeByAge(e),this._purgeByAgeReceived(t,e),this._purgeTracks())}_purgeSomeByDisplayCount(t){if(!t.displayCount)return;let e=this.store.size;if(e>t.displayCount){if(this._timeInfo.trackIdField)for(const s of this._trackIdToObservations.values())if(e>t.displayCount&&s.size){const t=s.dequeue();this._removed.push(t),e--}if(null!=this._trackIdLessObservations){let s=e-t.displayCount;for(;s-- >0;){const t=this._trackIdLessObservations.dequeue();null!=t&&this._removed.push(t)}}}}_purgeByAge(t){const e=this._timeInfo?.startTimeField;if(!t.age||!e)return;const s=60*t.age*1e3,i=this._maxAge-s;this.store.forEach(t=>{t.attributes[e]<i&&this._removed.push(t.objectId)})}_purgeByAgeReceived(t,e){if(!e.ageReceived)return;const s=t-60*e.ageReceived*1e3;this.store.forEach(t=>{t.attributes[ot.Gm]<s&&this._removed.push(t.objectId)})}_purgeTracks(){this._trackIdToObservations.forEach((t,e)=>{0===t.size&&this._trackIdToObservations.delete(e)})}}var cc=s(30624);let lc=class extends z.A{constructor(t){super(t)}get connectionStatus(){return this.connection?.connectionStatus}get errorString(){return this.connection?.errorString}};(0,E.Cg)([(0,L.MZ)()],lc.prototype,"connection",void 0),(0,E.Cg)([(0,L.MZ)()],lc.prototype,"connectionStatus",null),(0,E.Cg)([(0,L.MZ)()],lc.prototype,"errorString",null),lc=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.features.sources.StreamConnectionState")],lc);class uc{constructor(t,e){this._metadata=t,this._onUpdate=e,this._objectIdToFeature=new Map}get size(){return this._objectIdToFeature.size}get reader(){return Fa.K.fromFeatures([...this._objectIdToFeature.values()],this._metadata)}add(t){this._objectIdToFeature.set(t.objectId,t)}forEach(t){this._objectIdToFeature.forEach(t)}removeById(t){const e=this._objectIdToFeature.get(t);return e?(this._objectIdToFeature.delete(t),e):null}clear(){this._objectIdToFeature=new Map}update(t,e){this._onUpdate(t?.length??0)}}class dc extends Yh.K{constructor(t){super(),this._reader=t,this.chunkId="stream-chunk",this.normalizedChunkId="stream-chunk"}get reader(){return this._reader}get first(){return!0}get end(){return!0}get queryInfo(){return{type:"stream",chunkId:this.chunkId,size:this.size(),end:this.end}}get isTiled(){return!1}getTileReader(t){const e=this.queryFeaturesInBounds(t.bounds);return e.setTransformForDisplay(t.transform),e}}class pc extends _h{constructor(t,e,s){super(t.metadata,e,s),this._service=t,this._connectionState=new lc,this._forceRefresh=!1,this.events=new Ho.bk;const{timeInfo:i}=this.metadata,{purgeOptions:r}=e.full;this._stagingStore=new uc(this.metadata.weakCloneWithAdditionalFields([{name:ot.Aw,alias:"timeReceived",type:"esriFieldTypeDate"}]),t=>this.events.emit("features-updated",t)),this._manager=new hc(this._stagingStore,this.metadata.featureIdInfo,i,r),this.connect()}destroy(){super.destroy(),this.disconnect()}get about(){return{willQueryAllFeatures:!1,willQueryFullResolutionGeometry:!1}}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState?.errorString}get availableFields(){return this._schema.full.availableFields}get definitionExpression(){return this._schema.full.definitionExpression}async tryUpdate(t,e){const s=null!=this._chunk;if(e.sourceRefreshVersion!==this._refreshVersion){if(this._refreshVersion=e.sourceRefreshVersion,!this._manager.checkForUpdates()&&s&&!this._forceRefresh)return this.events.emit("tick"),!0;this._chunk&&(this.store.remove(this._chunk),t.requireInvalidation()),this._forceRefresh=!1,this._chunk=new dc(this._stagingStore.reader),this.store.insert(this._chunk),this.events.emit("tick")}return this._schema.partial=e,!0}async load(t){}unload(t){}disconnect(){this._streamConnection=(0,f.pR)(this._streamConnection),this._connectionState.connection=null,this._handlesGroup?.remove()}connect(){if(null!=this._streamConnection)return;const{geometryType:t,spatialReference:e}=this.metadata,{maxReconnectionAttempts:s,maxReconnectionInterval:i,geometryDefinition:n,definitionExpression:o,customParameters:a}=this._schema.full;this._streamConnection=(0,cc.createConnection)(this._service.source,e,this._service.outSpatialReference,t,o,n,s,i,a),this._handlesGroup=(0,r.vE)([this._streamConnection.on("data-received",t=>this._onFeature(t)),this._streamConnection.on("message-received",t=>this._onWebSocketMessage(t))]),this._connectionState.connection=this._streamConnection}clear(){this._manager.checkForUpdates(),this._stagingStore.clear(),this._forceRefresh=!0}updateCustomParameters(t){this._streamConnection?.updateCustomParameters(t)}sendMessageToSocket(t){this._streamConnection?.sendMessageToSocket(t)}sendMessageToClient(t){this._streamConnection?.sendMessageToClient(t)}_onOverride(){}_onWebSocketMessage(t){if("type"in t)switch(t.type){case"delete":if(t.objectIds)for(const e of t.objectIds)this._manager.removeById(e);if(t.trackIds)for(const e of t.trackIds)this._manager.removeByTrackId(e);break;case"clear":this.clear()}this.events.emit("message-received",t)}_onFeature(t){try{this._manager.add(t),this.events.emit("data-received",t)}catch(t){}}}var _c=s(44320),fc=s(79897);let mc=class extends z.A{constructor(t){super(t),this.debugName="",this._updatingHandles=new fc.U,this._idToUpdatingState=new q.A}destroy(){this._updatingHandles=(0,f.pR)(this._updatingHandles),this._idToUpdatingState.clear()}get updating(){const t=!this.destroyed&&(this._updatingHandles?.updating||Array.from(this._idToUpdatingState.values()).some(t=>t));if((0,n.A)("esri-2d-log-updating")){const e=Array.from(this._idToUpdatingState.entries()).map(([t,e])=>`-> ${t}: ${e}`).join("\n");console.log(`${this.debugName}: Updating: ${t}\n-> Handles: ${this._updatingHandles.updating}\n${e}`)}return t}addUpdateTracking(t,e){const s=(0,c.wB)(()=>e.updating,e=>this._idToUpdatingState.set(t,e),{sync:!0});this.addHandles(s)}addPromise(t){return this._updatingHandles.addPromise(t)}};(0,E.Cg)([(0,L.MZ)({constructOnly:!0})],mc.prototype,"debugName",void 0),(0,E.Cg)([(0,L.MZ)({readOnly:!0})],mc.prototype,"updating",null),mc=(0,E.Cg)([(0,G.$)("esri.views.2d.layers.support.UpdateTracking2D")],mc);class gc{constructor(t,e,s,i){this._aggregateAdapter=t,this._subscriptions=e,this._connection=s,this._cachedObjectIds=i,this._updateTracking=new mc({debugName:"FeatureSource"}),this.store=new _c.I(()=>{if(null==this._overrideParameters)throw new Error("InternalError: Override parameters must be defined");return this._overrideParameters})}destroy(){this._strategy?.destroy(),this._streamMessenger?.destroy(),this._updateTracking?.destroy(),this.store.destroy()}get metadata(){return this._strategy.metadata}get streamMessenger(){return null==this._streamMessenger&&this._initStreamMessenger(),this._streamMessenger}get statistics(){return uh.from(this.store)}get updateTracking(){return this._updateTracking}get usedMemory(){return this.store.usedMemory}get queryEngine(){if(!this._queryEngine){if(!this.store||!this._strategy)return null;this._queryEngine=new Zo.do({featureStore:this.store,fieldsIndex:this.metadata.fieldsIndex,geometryType:this.metadata.geometryType,featureIdInfo:this.metadata.featureIdInfo,hasM:!1,hasZ:!1,spatialReference:this.metadata.outSpatialReference,aggregateAdapter:this._aggregateAdapter,timeInfo:this.metadata.timeInfo,definitionExpression:this._strategy?.definitionExpression,availableFields:this._strategy?.availableFields})}return this._queryEngine}get isStream(){return"stream"===this._schema.type}get hasQueryDisplayFilter(){if(!this._schema)return!1;switch(this._schema.type){case"feature":return null!=this._schema.strategy.full.displayFilterInfo;case"parquet":case"stream":return!1}}chunks(){return Array.from(this.store.chunks())}prepareCacheUpdate(t,e){const s=new Set,i=new Set;for(const e of t)this._cachedObjectIds.has(e)||(this._cachedObjectIds.add(e),s.add(e));for(const t of e)this._cachedObjectIds.delete(t),i.add(t);this.hasQueryDisplayFilter&&this._strategy.prepareCacheUpdate(s,i)}async applyCacheUpdate(){this.hasQueryDisplayFilter&&await this._updateTracking.addPromise(this._strategy.applyCacheUpdate())}cleanup(){return this.store.cleanup()}onSubscribe(t){if(this._connection.onEvent({type:"subscribe",tile:t.tile.id}),!this._strategy)return;const e=this._strategy.load(t);e.then(()=>this._connection.onEvent({type:"loaded",tile:t.tile.id})).catch(e=>this._connection.onEvent({type:"error",tile:t.tile.id,error:e})),this._updateTracking.addPromise(e)}onResume(t){this._updateTracking.addPromise((0,a.QZ)(this._strategy?.load(t)))}onUnsubscribe(t){this._connection.onEvent({type:"unsubscribe",tile:t.tile.id}),this._strategy?.unload(t)}applyOverride(t){this._strategy?.applyOverride(t)}takeOverrideUpdate(){return this._strategy?.takeOverrideUpdate()}async update(t,e){const s=this._schema;if(this._schema=t,this._queryEngine=(0,f.pR)(this._queryEngine),s&&s.type!==t.type)throw new Error("InternalError: Reconfiguring source types is not supported.");const i=new ph;if(!s||(0,m.i8)(s.service,t.service)||s.strategy.type!==t.strategy.type||(0,m.i8)(t.strategy.full,s.strategy.full)||!await this._strategy.tryUpdate(i,t.strategy.partial)){await this._updateStrategyType(this._schema.service,t,e);const s=this._schema.strategy.full.definitionExpression;return this._overrideParameters=await Ba.HJ.create(this._strategy.metadata,s),!0}return i.requiresInvalidation}unsafeSetQueryHistoricMoment(t){"feature"===this._schema.type&&(this._schema.strategy.full.historicMoment=t,this._strategy.unsafeSetQueryHistoricMoment(new Date(t)))}_initStreamMessenger(){null==this._streamMessenger&&(this._streamMessenger=new dh(this._connection))}async normalizeOverrides(t){const e={historicMoment:t.historicMoment,commands:{updateWeak:t.commands.updateWeak.map(Wo.Om.fromJSON),removeWeak:t.commands.removeWeak,update:t.commands.update.map(Wo.Om.fromJSON),remove:t.commands.remove,release:t.commands.release}},s=t.commands.updateByIdWeak,i=await this._queryOptimizedFeatures(s);if(i.length!==s.length){const t=new Set(i.map(t=>t.objectId));for(const i of s)t.has(i)||e.commands.removeWeak.push(i)}return e.commands.updateWeak.push(...i),e}async _queryOptimizedFeatures(t){if(0===t.length)return[];const e=[],s=(await this._strategy.queryByObjectId(t)).getCursor();for(;s.next();)e.push(s.readOptimizedFeatureWorldSpace());return e}getObjectIdsFromGlobalIds(t){const e=this.metadata.globalIdField;if(null==e)throw new Error("InternalError: Recieved an edit with globalIds, but not supported by the service");const s=this.store.mapObjectIdsFromGlobalIds(t,e).values();return Array.from(s)}async _updateStrategyType(t,e,s){const i=this._createStrategy(t,e);this._connection.onEvent({type:"updateStrategyStart",about:i.about});const r=!!this._strategy;this.store.clear(),this._strategy?.destroy(),this._strategy=i,(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${s}] FeatureSource.updateStrategy`,{strategy:i});const o=Array.from(this._subscriptions.values());if(!o.length)return void this._connection.onEvent({type:"updateStrategyEnd"});const h=Promise.all(o.map(t=>this._strategy.load(t).then(()=>this._connection.onEvent({type:"loaded",tile:t.tile.id})).catch(e=>this._connection.onEvent({type:"error",tile:t.tile.id,error:e}))));this._updateTracking.addPromise(h),this._strategy.prepareCacheUpdate(this._cachedObjectIds);try{r&&await h}catch(t){(0,a.jH)(t)}this._connection.onEvent({type:"updateStrategyEnd"}),(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${s}] FeatureSource.updateStrategyEnd`,{strategy:i})}_createStrategy(t,e){const s={connection:this._connection,store:this.store};switch(e.type){case"feature":return this._createFeatureLoadStrategy(t,e.strategy,s);case"parquet":return this._createParquetLoadStrategy(t,e.strategy,s);case"stream":return this._createStreamLoadStrategy(t,e.strategy,s)}}_createFeatureLoadStrategy(t,e,s){switch(e.type){case"drill-down":return new $h(t,e,s);case"paged-tile":return new Jh(t,e,s);case"snapshot":return new tc(t,e,s)}}_createParquetLoadStrategy(t,e,s){switch(e.type){case"xz":return new nc(t,e,s);case"snapshot":return new ic(t,e,s)}}_createStreamLoadStrategy(t,e,s){const i=new pc(t,e,s);return this.streamMessenger.strategy=i,i}}class yc{constructor(t,e){this.tile=t,this.version=e,this._abortController=new AbortController}get key(){return this.tile.key}get signal(){return this._abortController.signal}abort(){this._abortController.abort()}}var xc=s(98291);class bc{constructor(t,e){this.key=new b.A(0,0,0,0),this.bounds=(0,X.vt)(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.level=s.level,this.scale=s.scale,this.minScale=t.zoomToScale(s.level-1),this.maxScale=t.zoomToScale(s.level+1)}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){return(0,X.w1)(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createArcadeEvaluationOptions(t){return(0,qa.N)(this.scale,t)}createChildTiles(){const t=this.key.getChildKeys(),e=xc.A.acquire();for(let s=0;s<t.length;s++)e[s]=new bc(this.tileInfoView,t[s]);return e}getQuantizationParameters(){return Kh.A.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.tileInfo.spatialReference}})}}class wc{constructor(t){this.inner=t,this.resolver=(0,a.Tw)()}}class vc{constructor(){this._aggregateAdapter={getFeatureObjectIds:t=>this._processor.getFeatureObjectIdsForAggregate(t)},this._subscriptions=new Map,this._cachedObjectIds=new Set,this._updateRequested=!1,this._didSourceRefresh=!1,this._updateSubscriptionRequests=[],this._updateHighlightRequests=[]}destroy(){this._subscriptions.clear(),this._processor?.destroy(),this._source?.destroy(),this._handles?.remove(),this._updateOverridesRequest=null,this._tileInfoView=null}onAttach(t){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onAttach");const e=this._connection,s=d.A.fromJSON(t.tileInfoJSON);this._tileInfoView=new F(s),this._source=new gc(this._aggregateAdapter,this._subscriptions,e,this._cachedObjectIds),this._processor=new ch(e,this._source),this._handles=(0,r.vE)([this._source.store.events.on("changed",()=>this._requestUpdate()),this._source.store.events.on("refresh",()=>this._requestRefresh()),(0,c.wB)(()=>this._source.updateTracking.updating,()=>{this._requestUpdate(),(0,a.QZ)(this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}))})])}onDetach(){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.onDetach"),this.destroy()}set remoteClient(t){this._connection=new _(t)}get features(){const t=this._source?.queryEngine;if(!t)throw new i.A("no-queryEngine","No query engine defined");return t}get aggregates(){const t=this._processor?.aggregateQueryEngine;if(!t)throw new i.A("no-queryEngine","No aggregate query engine defined");return t}get processor(){return this._processor}get streamMessenger(){return this._source.streamMessenger}getUsedMemory(){return this._source.usedMemory+this._processor.usedMemory}getDisplayFeatures(t){return this._processor.getDisplayFeatures(t)}getDisplayIds(t){return this._processor.getDisplayIds(t)}getObjectIdsFromGlobalIds(t){return this._source.getObjectIdsFromGlobalIds(t)}async updateSchema(t,e){return(0,n.A)("esri-2d-update-debug")&&this._updateSchemaRequest&&console.error("InternalError: Schema already updating"),this._updateSchemaRequest=new wc({schema:t,version:e}),this._requestUpdate(),this._updateSchemaRequest.resolver.promise}updateSubscriptions(t){const e=new wc(t);return this._updateSubscriptionRequests.push(e),this._requestUpdate(),e.resolver.promise}updateHighlight(t){const e=new wc(t);return this._updateHighlightRequests.push(e),this._requestUpdate(),e.resolver.promise}async onOverride(t){if(null!=this._updateOverridesRequest)throw new i.A("featurelayer","InternalError - Already processing an edit");this._updateOverridesRequest=new wc(t);const e=this._updateOverridesRequest.resolver.promise;return this._requestUpdate(),e}queryStatistics(){return this._source.statistics.toJSON()}async queryVisibleFeatures(t,e){return this.features.executeQuery(t,e)}async queryHeatmapStatistics(t){const e=Math.round((0,l.Lz)(t.radius));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const r="string"==typeof t.fieldOffset,n=t.fieldOffset??0,o=Array.from(this._subscriptions.values()),a=this._source.chunks(),h=e**2,c=3/(Math.PI*h),u=2*e,d=Math.ceil(p.CQ/u);for(const e of o){const o=e.tile,l=new Float64Array(d*d);for(const e of a){const s=e.getTileReader(o);if(!s)continue;const i=s.getCursor();for(;i.next();){let e=1;if(null!=t.field){const s=i.readAttribute(t.field);e=r?-1*+s:+s+n}const s=i.readXForDisplay()/u,o=i.readYForDisplay()/u,a=Math.floor(s),p=Math.floor(o);if(a<0||p<0||a>=d||p>=d)continue;const _=((.5+a-s)*u)**2+((.5+p-o)*u)**2;if(_>h)continue;const f=e*(c*(1-_/h)**2);l[p+a*d]+=f}}for(let t=0;t<l.length;t++)s=Math.min(s,l[t]),i=Math.max(i,l[t])}return{max:i,min:s}}async getSampleFeatures(t){const e=this._source.chunks();if(e.reduce((t,e)=>t+e.size(),0)<=t.minFeatureCount){if(!this._source.updateTracking.updating){const t=[];return this._source.store.forEachUnsafe(e=>t.push(e.readLegacyFeatureWorldSpace())),t}return null}const s=new Set,i=[],r=e.map(t=>t.reader.getCursor()),n=new h.A,o=3*t.sampleSize;for(let a=0;a<o&&i.length<t.sampleSize;a++){const t=r[n.getIntRange(0,e.length-1)];if(0===t.getSize())continue;const o=n.getIntRange(0,t.getSize()-1);t.setIndex(o);const a=t.getObjectId();s.has(a)||(s.add(a),i.push(t.readLegacyFeatureWorldSpace()))}return i.length>=t.sampleSize?i:null}_requestUpdate(){this._updateRequested||(this._updateRequested=!0,(0,o.d)(()=>this._scheduleNextUpdate()))}_requestRefresh(){this._didSourceRefresh=!0,this._requestUpdate()}_scheduleNextUpdate(){this._updateRequested&&(this._ongoingUpdate||(this._ongoingUpdate=(0,u.oV)(this._doUpdate()).finally(()=>{this._ongoingUpdate=null,this._scheduleNextUpdate()}),this._updateRequested=!1))}_subscribe(t){const e=t.tileId;if(this._subscriptions.has(e))return;(0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${e}] Pipeline.subscribe`);const s=new bc(this._tileInfoView,e),i=new yc(s,t.version);this._subscriptions.set(e,i),this._source.onSubscribe(i),this._processor.onSubscribe(i)}_unsubscribe(t){const e=this._subscriptions.get(t);e&&((0,n.A)("esri-2d-update-debug")&&console.debug(`Tile[${t}] Pipeline.unsubscribe`),e.abort(),this._source.onUnsubscribe(e),this._processor.onUnsubscribe(e),this._subscriptions.delete(e.key.id))}async _doUpdate(){if((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateStart"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0}),this._updateSubscriptionRequests.length){const t=this._updateSubscriptionRequests;this._updateSubscriptionRequests=[];for(const e of t)this._doUpdateSubscriptions(e.inner),e.resolver.resolve()}if(this._updateHighlightRequests.length){const t=this._updateHighlightRequests,e=new Set,s=new Set;for(const i of t)for(const{objectId:t,highlightFlags:r}of i.inner.highlights)r?(e.add(t),s.delete(t)):(s.add(t),e.delete(t));this._source.prepareCacheUpdate(e,s)}const t=this._updateSchemaRequest;this._updateSchemaRequest=null;let e=!1;if(null!=t){const{schema:s,version:i}=t.inner;e=await this._doUpdateSchema(s,i)}this._processor.requiresInvalidation()&&(e=!0),this._didSourceRefresh&&(e=!0,this._didSourceRefresh=!1),e&&(this._processor.invalidate(),await this._connection.container.updateRenderState(this._processor.version));const s=this._updateOverridesRequest;if(this._updateOverridesRequest=null,null!=s){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverride",s.inner),null!=s.inner.historicMoment&&this._source.unsafeSetQueryHistoricMoment(s.inner.historicMoment);const t=await this._source.normalizeOverrides(s.inner);this._source.applyOverride(t),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.endOverride",s.inner)}if(await this._source.applyCacheUpdate(),this._updateHighlightRequests.length){const t=this._updateHighlightRequests;this._updateHighlightRequests=[];for(const e of t)this._processor.updateHighlight(e.inner),e.resolver.resolve()}const i=this._source.cleanup();this._processor.removeChunks(i);try{const t=this._source.takeOverrideUpdate();if(null!=t&&this._subscriptions.size){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesStart"),await this._connection.container.lockForOverrides();try{await this._processor.applyOverrideUpdate(t)}catch(t){(0,n.A)("esri-2d-update-debug")&&console.debug("InternalError",t)}await this._connection.container.unlockForOverrides(),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.applyOverrideChangesEnd")}this._subscriptions.size&&((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksStart"),await this._processor.updateChunks(),(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateChunksEnd"))}catch(t){(0,a.jH)(t)}null!=s&&s.resolver.resolve(),null!=t&&t.resolver.resolve(),null==t&&e&&await this._connection.container.trySwapRenderState(),this._connection.onEvent({type:"performance",usedMemory:this.getUsedMemory()}),this._updateRequested?((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=true]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:!0})):((0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline._doUpdateEnd [updateRequested=false, After flush]"),await this._connection.layerView.setUpdating({source:this._source.updateTracking.updating,pipeline:this._updateRequested}))}async _doUpdateSchema(t,e){(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${e}] Pipeline.updateStart`,{schema:t});const s={tileInfo:this._tileInfoView?.tileInfo},i=await this._source.update(t.source,e),r=Array.from(this._subscriptions.values()),o=this._processor.update(t,e,s,i,r);return(0,n.A)("esri-2d-update-debug")&&console.debug(`Version[${e}] Pipeline.updateEnd`),o}_doUpdateSubscriptions(t){(0,n.A)("esri-2d-update-debug")&&console.debug("Pipeline.updateSubscriptions",t);for(const e of t.subscribe)this._subscribe(e);for(const e of t.unsubscribe)this._unsubscribe(e)}}}}]);
|