@arcgis/core 6.0.0-next.28 → 6.0.0-next.29
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/arcgisGlobal.d.ts +0 -2
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/131185d26343a997495e.js +1 -0
- package/assets/esri/core/workers/chunks/{dbda982485d3fe26c729.js → 13c64087be3b2985a21b.js} +1 -1
- package/assets/esri/core/workers/chunks/144bad0c2415c345736a.js +1 -0
- package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +1 -0
- package/assets/esri/core/workers/chunks/{b0ca81a07cff25df19d2.js → 176d75e76318bfc25a53.js} +1 -1
- package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +1 -0
- package/assets/esri/core/workers/chunks/{e35641a3a4da8cfbcf54.js → 189321d88026bd7e6d3e.js} +1 -1
- package/assets/esri/core/workers/chunks/18e7fa4d3e0b1a084cc6.js +1 -0
- package/assets/esri/core/workers/chunks/{1168bc5c9f0a7e1f63a2.js → 1989410a618865f02dec.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c0cb214fedb29487eef.js → 199a7f97916679e0257c.js} +1 -1
- package/assets/esri/core/workers/chunks/1c406ab2bf99ac563316.js +1 -0
- package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +1 -0
- package/assets/esri/core/workers/chunks/{42d44c7d532df5ee70e9.js → 1deca3de77b1a9a07da4.js} +1 -1
- package/assets/esri/core/workers/chunks/{45f826554499c38968c6.js → 1ee4df0fd61440cb5f02.js} +1 -1
- package/assets/esri/core/workers/chunks/22e73501e1435a896826.js +1 -0
- package/assets/esri/core/workers/chunks/25657f70c5f04a4ed978.js +1 -0
- package/assets/esri/core/workers/chunks/276a0b549acf048e8673.js +1 -0
- package/assets/esri/core/workers/chunks/{56e903ccef66cbe18f92.js → 2cd60fd062d954322c1f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad96132bc89671e595f3.js → 2d3e0e4442dbc6ec6def.js} +1 -1
- package/assets/esri/core/workers/chunks/2de4296590bf9f9e9add.js +1 -0
- package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +1 -0
- package/assets/esri/core/workers/chunks/{0363d29fc665d169ebc4.js → 3105336a05f38a95ebea.js} +1 -1
- package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +1 -0
- package/assets/esri/core/workers/chunks/3aafdb905c697bc9b1ad.js +1 -0
- package/assets/esri/core/workers/chunks/40c2674dae73f0942751.js +1 -0
- package/assets/esri/core/workers/chunks/418addce122dbb8897b4.js +1 -0
- package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +1 -0
- package/assets/esri/core/workers/chunks/4976f5567fc7f1b63d10.js +1 -0
- package/assets/esri/core/workers/chunks/4e17665dd9048c300d87.js +1 -0
- package/assets/esri/core/workers/chunks/5396b6e99a0546a25d19.js +1 -0
- package/assets/esri/core/workers/chunks/53c7510df09b71ab5646.js +1 -0
- package/assets/esri/core/workers/chunks/561c48cb4d49b150765b.js +1 -0
- package/assets/esri/core/workers/chunks/{d90a3bfd45b5ed4092e0.js → 590fe0f56bc4c33a50e7.js} +1 -1
- package/assets/esri/core/workers/chunks/5bb6c255bdc8aa9ba23e.js +1 -0
- package/assets/esri/core/workers/chunks/5f1cb79aec9c4a9b7ddc.js +29 -0
- package/assets/esri/core/workers/chunks/{23a4806b4cdf7cc32e4d.js → 5f787809b74eed7b9a91.js} +1 -1
- package/assets/esri/core/workers/chunks/636e9c4ac1f9ae98f9d1.js +1 -0
- package/assets/esri/core/workers/chunks/654f5441227579d2b6b4.js +1 -0
- package/assets/esri/core/workers/chunks/692f0093c444fcc752b5.js +1 -0
- package/assets/esri/core/workers/chunks/69627b2634da64dd885f.js +1 -0
- package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +1 -0
- package/assets/esri/core/workers/chunks/7030a4d0714a35995a58.js +1 -0
- package/assets/esri/core/workers/chunks/72d20d3957d612f86431.js +1 -0
- package/assets/esri/core/workers/chunks/7862abd24fb5c3b12e6b.js +1 -0
- package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +1 -0
- package/assets/esri/core/workers/chunks/{5eec1c1162779574f46e.js → 7c75a8ee266c36baa902.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab1660f5f8a5268c2fac.js → 84038dd85005fea413eb.js} +1 -1
- package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +1 -0
- package/assets/esri/core/workers/chunks/{8ac2098ecdc40ad41055.js → 8502274806ea52308822.js} +1 -1
- package/assets/esri/core/workers/chunks/865cebc5c982c040ab6f.js +1 -0
- package/assets/esri/core/workers/chunks/{76196c414e48834f7b92.js → 8f008eedb11685ee2048.js} +1 -1
- package/assets/esri/core/workers/chunks/90d797ab82d4a68ba32f.js +1 -0
- package/assets/esri/core/workers/chunks/9184c947cdefe06bf551.js +1 -0
- package/assets/esri/core/workers/chunks/9976eaa81085c0d17e14.js +1 -0
- package/assets/esri/core/workers/chunks/{177f353ce72133e2eeed.js → 9c2436464b7dfd666678.js} +1 -1
- package/assets/esri/core/workers/chunks/a125650edbed802e419a.js +1 -0
- package/assets/esri/core/workers/chunks/{23fd4de56de352f63e2d.js → a2196a49f89d57a0a1c7.js} +1 -1
- package/assets/esri/core/workers/chunks/ad21757d78e372fa2ed6.js +1 -0
- package/assets/esri/core/workers/chunks/b01688ccc29d33bfc82d.js +1 -0
- package/assets/esri/core/workers/chunks/b5eff28cf482d920b9ea.js +1 -0
- package/assets/esri/core/workers/chunks/{04ecf15524ff3838c01c.js → ba4520ddcb6a49988da6.js} +1 -1
- package/assets/esri/core/workers/chunks/be55771758e4bcef0976.js +1 -0
- package/assets/esri/core/workers/chunks/bead830a677690eeb6fb.js +1 -0
- package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +1 -0
- package/assets/esri/core/workers/chunks/c1cf3edce15f09648eb4.js +1 -0
- package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +1 -0
- package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +1 -0
- package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +1 -0
- package/assets/esri/core/workers/chunks/c9feffb9884cfed52c4b.js +1 -0
- package/assets/esri/core/workers/chunks/cc97e4fd0dacad970a23.js +1 -0
- package/assets/esri/core/workers/chunks/ce324dde6d7daea33638.js +1 -0
- package/assets/esri/core/workers/chunks/d1d6154b4af1c9cc497b.js +1 -0
- package/assets/esri/core/workers/chunks/d3c3fb079ad97970f834.js +1 -0
- package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +1 -0
- package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +1 -0
- package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +1 -0
- package/assets/esri/core/workers/chunks/dd30b02c5978c1c5f511.js +1 -0
- package/assets/esri/core/workers/chunks/de3f140058aa0b907b65.js +1 -0
- package/assets/esri/core/workers/chunks/df375d1b0dab5ecbd1be.js +1 -0
- package/assets/esri/core/workers/chunks/{ef2c3febcceedc44b3ac.js → dfd4782b11d6fdca0492.js} +1 -1
- package/assets/esri/core/workers/chunks/{48cc58890fddbcf69cef.js → e121d15b883184ee83e7.js} +1 -1
- package/assets/esri/core/workers/chunks/{67e06d606c7fd2064adf.js → e2c6cd8dac01e129ccfe.js} +1 -1
- package/assets/esri/core/workers/chunks/e3b212f8af448ec29eef.js +1 -0
- package/assets/esri/core/workers/chunks/e4042e43f0081fe49f7b.js +1 -0
- package/assets/esri/core/workers/chunks/e480e7d5f40049a2053b.js +1 -0
- package/assets/esri/core/workers/chunks/eaab787a5f2445be5e5a.js +1 -0
- package/assets/esri/core/workers/chunks/edd36a1fc80b1d29907e.js +1 -0
- package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +1 -0
- package/assets/esri/core/workers/chunks/f07fb9b3fa30d7ee1681.js +1 -0
- package/assets/esri/core/workers/chunks/f09bc86cd52224febfcb.js +1 -0
- package/assets/esri/core/workers/chunks/{037c67ef5c4398d5954d.js → f2dab9fcd90ce38ae3d1.js} +1 -1
- package/assets/esri/core/workers/chunks/f39c700f3db7db52b522.js +1 -0
- package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +1 -0
- package/assets/esri/core/workers/chunks/f3dc0bc0e00635855a7a.js +1 -0
- package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +1 -0
- package/assets/esri/core/workers/chunks/{dc7aa0a1eb6c6e361f9f.js → f7398cfd8bbd041bd635.js} +1 -1
- package/assets/esri/core/workers/chunks/f9dc38761b314d33890f.js +1 -0
- package/assets/esri/core/workers/chunks/fe6dcb21570395e46ce8.js +1 -0
- package/assets/esri/core/workers/chunks/{9c4961213ac6ec283dd9.js → fefdd10bdd5a4c8d8ed0.js} +44 -47
- package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +1 -0
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Component.glsl.js +48 -48
- package/chunks/EmissionComposite.glsl.js +1 -1
- package/chunks/Fog.glsl.js +1 -1
- package/chunks/GaussianSplatDepth.glsl.js +15 -7
- package/chunks/GaussianSplatShadow.glsl.js +14 -4
- package/config.d.ts +12 -9
- package/config.js +1 -1
- package/form/FormTemplate.d.ts +1 -1
- package/form/elements/AttachmentElement.d.ts +2 -0
- package/form/elements/FieldElement.d.ts +2 -2
- package/form/elements/FieldElement.js +1 -1
- package/form/elements/RelationshipElement.d.ts +1 -1
- package/form/elements/TextElement.d.ts +2 -2
- package/form/elements/UtilityNetworkAssociationsElement.d.ts +1 -1
- package/form/elements/inputs/inputUtils.js +1 -1
- package/form/elements/inputs/types.d.ts +19 -0
- package/form/elements/inputs.d.ts +3 -2
- package/form/elements/inputs.js +1 -1
- package/interfaces.d.ts +0 -14
- package/kernel.js +1 -1
- package/layers/VideoLayer.d.ts +5 -5
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/rotationUtils.js +2 -0
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/save/parquetLayerUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +2 -2
- package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSource.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONVectorTileSourceWorker.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +2 -0
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/support/visualVariableSimpleUtils.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +23 -26
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +18 -21
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +10 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +22 -25
- package/views/3d/webgl-engine/effects/RenderPluginContext.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatDepthRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeUtil.glsl.js +30 -35
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +62 -53
- package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
- package/views/VideoView.d.ts +10 -0
- package/views/VideoView.js +1 -1
- package/views/layers/LayerView.d.ts +10 -2
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +2 -2
- package/widgets/Editor/EditorViewModel.d.ts +10 -12
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
- package/widgets/OrientedImageryViewer/ImageMeasurementWorker.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementWorkerUtils.js +2 -0
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer/support/superimposeUtils.js +1 -1
- package/widgets/support/iconUtils.js +1 -1
- package/assets/esri/core/workers/chunks/010f57ec7fdbedf78d02.js +0 -1
- package/assets/esri/core/workers/chunks/03f33cb78b5405ab7e23.js +0 -1
- package/assets/esri/core/workers/chunks/0487e1d7a7cecf7c1c25.js +0 -1
- package/assets/esri/core/workers/chunks/09300e74e5b014ce6269.js +0 -1
- package/assets/esri/core/workers/chunks/0d9c4c6c571ce26d356b.js +0 -1
- package/assets/esri/core/workers/chunks/112ed86f812e4400a7e0.js +0 -1
- package/assets/esri/core/workers/chunks/151e5799ede763a03ee2.js +0 -1
- package/assets/esri/core/workers/chunks/173f89c55a5c79ff065b.js +0 -1
- package/assets/esri/core/workers/chunks/2447d2e2a4a3ab8fcf94.js +0 -1
- package/assets/esri/core/workers/chunks/2a36fe3f3f257a779a1b.js +0 -1
- package/assets/esri/core/workers/chunks/2a97268000c6d03ef720.js +0 -1
- package/assets/esri/core/workers/chunks/2cf8172be83b10b11bdc.js +0 -1
- package/assets/esri/core/workers/chunks/2df37a9a95ceebb87a5f.js +0 -1
- package/assets/esri/core/workers/chunks/2e00c155e447e4930442.js +0 -1
- package/assets/esri/core/workers/chunks/2f91fd61019d2a37476d.js +0 -1
- package/assets/esri/core/workers/chunks/30af63b3b750142faadb.js +0 -1
- package/assets/esri/core/workers/chunks/3a47fc97c400fca2c736.js +0 -1
- package/assets/esri/core/workers/chunks/3cd04d23b73beaf79650.js +0 -1
- package/assets/esri/core/workers/chunks/426b4eb500fdfe9df325.js +0 -1
- package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +0 -1
- package/assets/esri/core/workers/chunks/47c97640ec525676918b.js +0 -1
- package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +0 -1
- package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +0 -1
- package/assets/esri/core/workers/chunks/4cb751dc8d00bdaeb04c.js +0 -1
- package/assets/esri/core/workers/chunks/518ab22f80c3300bcfff.js +0 -1
- package/assets/esri/core/workers/chunks/53ff68d4f9e365fc15cd.js +0 -1
- package/assets/esri/core/workers/chunks/58609bf94f72bc4f1952.js +0 -1
- package/assets/esri/core/workers/chunks/586a929bc037e23857af.js +0 -1
- package/assets/esri/core/workers/chunks/5c7780f804d789cb37f5.js +0 -1
- package/assets/esri/core/workers/chunks/5d76f4d97beee494bbbf.js +0 -1
- package/assets/esri/core/workers/chunks/603fdbbe9534c614928f.js +0 -1
- package/assets/esri/core/workers/chunks/611e3cdf67283c11576f.js +0 -1
- package/assets/esri/core/workers/chunks/6431480ba0fa8c8d487f.js +0 -1
- package/assets/esri/core/workers/chunks/652faf4359ac072c5dde.js +0 -1
- package/assets/esri/core/workers/chunks/65c98f3449044fa4fd79.js +0 -1
- package/assets/esri/core/workers/chunks/6b9961261241fdce0e94.js +0 -1
- package/assets/esri/core/workers/chunks/6dfe96b056bec30068df.js +0 -1
- package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +0 -1
- package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +0 -1
- package/assets/esri/core/workers/chunks/7159d9c36869cd82599e.js +0 -29
- package/assets/esri/core/workers/chunks/7393f63043a1da3d05a6.js +0 -1
- package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +0 -1
- package/assets/esri/core/workers/chunks/75d551a449bba61ce238.js +0 -1
- package/assets/esri/core/workers/chunks/76e27e36050a3dd9d249.js +0 -1
- package/assets/esri/core/workers/chunks/76f877e2d2493d56afab.js +0 -1
- package/assets/esri/core/workers/chunks/7748c2886d0122b40eeb.js +0 -1
- package/assets/esri/core/workers/chunks/78643f116677950ea29a.js +0 -1
- package/assets/esri/core/workers/chunks/78fbe330f16bdbdb886e.js +0 -1
- package/assets/esri/core/workers/chunks/7e0f04a5038e2a4f6e4b.js +0 -1
- package/assets/esri/core/workers/chunks/7f16ae01ccd9b6114d1c.js +0 -1
- package/assets/esri/core/workers/chunks/90153b5230b3a4985c14.js +0 -1
- package/assets/esri/core/workers/chunks/9189dfe19a2a2ccd5173.js +0 -1
- package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +0 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +0 -1
- package/assets/esri/core/workers/chunks/99f51d5d9da6e9bfc430.js +0 -1
- package/assets/esri/core/workers/chunks/9aebe876b1a2fb075f9c.js +0 -1
- package/assets/esri/core/workers/chunks/9b6929faf649e81265fb.js +0 -1
- package/assets/esri/core/workers/chunks/9dd48e75b4e8d9811d81.js +0 -1
- package/assets/esri/core/workers/chunks/a163c6005aba3378edaa.js +0 -1
- package/assets/esri/core/workers/chunks/a8286febe371dc186aaa.js +0 -1
- package/assets/esri/core/workers/chunks/acb265a22be5e12f38e5.js +0 -1
- package/assets/esri/core/workers/chunks/b12acf1f694f82e00df9.js +0 -1
- package/assets/esri/core/workers/chunks/b83cef2d3f528726d492.js +0 -1
- package/assets/esri/core/workers/chunks/b9596d862da1ec342cd3.js +0 -1
- package/assets/esri/core/workers/chunks/bc1fcc9c897461e68e29.js +0 -1
- package/assets/esri/core/workers/chunks/bdc221d94300c225665a.js +0 -1
- package/assets/esri/core/workers/chunks/be97a629e2ae4d13ceb3.js +0 -1
- package/assets/esri/core/workers/chunks/bfb39590c548188f5052.js +0 -1
- package/assets/esri/core/workers/chunks/c2318c014e97ba519be8.js +0 -1
- package/assets/esri/core/workers/chunks/c62237c344e341619341.js +0 -1
- package/assets/esri/core/workers/chunks/cdb5c26fed7d9a97db49.js +0 -1
- package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +0 -1
- package/assets/esri/core/workers/chunks/cea0db3ee326f60610eb.js +0 -1
- package/assets/esri/core/workers/chunks/d7f2f1708d2a2668676c.js +0 -1
- package/assets/esri/core/workers/chunks/daf9b691817e83a11f3c.js +0 -1
- package/assets/esri/core/workers/chunks/db41490bd39d863305bf.js +0 -1
- package/assets/esri/core/workers/chunks/ddc95cdac6c06fc4794c.js +0 -1
- package/assets/esri/core/workers/chunks/df26ec0b508cf4716e0a.js +0 -1
- package/assets/esri/core/workers/chunks/e11159e3dc3353b27c57.js +0 -1
- package/assets/esri/core/workers/chunks/e4a57a0a9629faafd6c6.js +0 -1
- package/assets/esri/core/workers/chunks/ebc1a2ef3aed8aa29424.js +0 -1
- package/assets/esri/core/workers/chunks/ec1c4d66142b6efb0e8b.js +0 -1
- package/assets/esri/core/workers/chunks/ef12fa3574d4cbf8b084.js +0 -1
- package/assets/esri/core/workers/chunks/f2d56f5c15d5977e1d19.js +0 -1
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +0 -1
- package/assets/esri/core/workers/chunks/f905f1a1aa4c123cbe83.js +0 -1
- package/assets/esri/core/workers/chunks/fc139f251dc0523074e7.js +0 -1
- package/assets/esri/themes/base/widgets/_VideoPlayer.scss +0 -129
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ar.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.bg.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.bs.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ca.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.cs.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.da.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.de.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.el.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.en.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.es.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.et.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.fi.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.fr.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.he.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.hr.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.hu.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.id.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.it.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ja.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ko.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.lt.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.lv.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.nl.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.no.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.pl.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.pt-BR.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.pt-PT.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ro.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.ru.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.sk.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.sl.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.sr.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.sv.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.th.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.tr.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.uk.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.vi.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-CN.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-HK.json +0 -1
- package/assets/esri/widgets/VideoPlayer/t9n/messages.zh-TW.json +0 -1
- package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +0 -232
- package/widgets/VideoPlayer/VideoPlayerViewModel.js +0 -2
- package/widgets/VideoPlayer/components/MetadataSection.js +0 -2
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +0 -2
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +0 -2
- package/widgets/VideoPlayer/components/SettingsButton.js +0 -2
- package/widgets/VideoPlayer/css.js +0 -2
- package/widgets/VideoPlayer.d.ts +0 -119
- package/widgets/VideoPlayer.js +0 -2
package/views/VideoView.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import{EventedMixin as i}from"../core/Evented.js";import{destroyMaybe as a}from"../core/maybe.js";import{EsriPromiseMixin as o}from"../core/Promise.js";import{watch as s,syncAndInitial as c,whenOnce as l,when as u}from"../core/reactiveUtils.js";import{property as d,cast as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{create as h,fromValues as g}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{projectLoad as b,projectExecute as x}from"../geometry/operators/projectOperator.js";import S from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as C}from"../layers/support/MediaElementView.js";import w from"../layers/support/TileInfo.js";import T from"../layers/support/VideoElement.js";import{DOMContainer as E}from"./DOMContainer.js";import{Viewport2DBaseMixin as D}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as O}from"./Viewport2DMixin.js";import k from"./2d/AnimationManager.js";import A from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"../core/memoryEstimations.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as j}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import M from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as N}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import F from"./2d/engine/webgl/OverlayContainer.js";import I from"./navigation/Navigation.js";import L from"./ui/DefaultUI.js";import R from"./ui/video/DefaultUIVideo.js";const z=new t(`#000`);let B;async function V(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);B=e}const H=.01,U=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let W=class extends O(D(E(i(o(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new I,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new N({constraints:new A({view:this,minScale:1,maxScale:H})}),this.type=`2d`,this.ui=new R,this.view2dType=`video`,this.addHandles([s(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),s(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),s(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),s(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},c)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([s(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},c)]),this.addResolvingPromise(V().then(()=>(this._isValid=!0,l(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=a(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(l(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(h(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:z,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new B(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new k({view:this});this._set(`animationManager`,r);let i=new M({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new v({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([s(()=>this.stationary,t=>e.stationary=t,c),s(()=>this.state.id,()=>e.state=this.state,c),s(()=>this.renderingOptions,t=>e.renderingOptions=t,c)],`video-view`),this._extent=new _({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new C({element:new T({video:this.layer?.videoElement,georeference:new S({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new P(this._videoElementView);this._overlayContainer=new F,this._overlayContainer.addChild(t),this._effectsContainer=new j,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([s(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(U).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>g(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),l(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},c),s(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await b();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=x(new v(a,n),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=_.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},c)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>H;e/=2)n.push(e);n.push(H);let{lods:r}=w.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(u(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([d()],W.prototype,`_overlayContainer`,void 0),e([d()],W.prototype,`_isValid`,void 0),e([d()],W.prototype,`_readyCycleForced`,void 0),e([d()],W.prototype,`_effectsContainer`,void 0),e([d()],W.prototype,`constraintsInfo`,null),e([d()],W.prototype,`operationalDataVisible`,void 0),e([d()],W.prototype,`layer`,null),e([d()],W.prototype,`map`,void 0),e([d({type:I,nonNullable:!0})],W.prototype,`navigation`,void 0),e([d({readOnly:!0})],W.prototype,`preconditionsReady`,null),e([d({readOnly:!0})],W.prototype,`ready`,void 0),e([d({readOnly:!0})],W.prototype,`rendering`,null),e([d()],W.prototype,`scale`,null),e([d()],W.prototype,`spatialReference`,void 0),e([d()],W.prototype,`stateManager`,void 0),e([d()],W.prototype,`type`,void 0),e([d(),f(e=>e instanceof L?e:m(R,e))],W.prototype,`ui`,void 0),e([d({readOnly:!0})],W.prototype,`videoSize`,null),e([d({readOnly:!0})],W.prototype,`view2dType`,void 0),W=e([p(`esri.views.VideoView`)],W);const G=W;export{G as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import{EventedMixin as a}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as s}from"../core/Promise.js";import{watch as c,syncAndInitial as l,whenOnce as u,when as d}from"../core/reactiveUtils.js";import{property as f,cast as p,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureClass as h}from"../core/accessorSupport/ensureType.js";import{create as g,fromValues as _}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import v from"../geometry/Extent.js";import y from"../geometry/Point.js";import b from"../geometry/SpatialReference.js";import{projectLoad as x,projectExecute as S}from"../geometry/operators/projectOperator.js";import C from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import T from"../layers/support/TileInfo.js";import E from"../layers/support/VideoElement.js";import{DOMContainer as D}from"./DOMContainer.js";import{Viewport2DBaseMixin as O}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as k}from"./Viewport2DMixin.js";import A from"./2d/AnimationManager.js";import j from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"../core/memoryEstimations.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as M}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import N from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as P}from"./2d/ViewStateManager.js";import F from"./2d/engine/webgl/Overlay.js";import I from"./2d/engine/webgl/OverlayContainer.js";import{createScreenshotRegion as L}from"./2d/support/screenshotUtils.js";import R from"./navigation/Navigation.js";import{getMaximumResolutionScale as z,encode as B,getFormatAndQuality as V}from"./support/screenshotUtils.js";import H from"./ui/DefaultUI.js";import U from"./ui/video/DefaultUIVideo.js";const W=new t(`#000`);let G;async function K(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);G=e}const q=.01,J=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let Y=class extends k(O(D(a(s(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new R,this.ready=!1,this.spatialReference=new b({wkid:0}),this.stateManager=new P({constraints:new j({view:this,minScale:1,maxScale:q})}),this.type=`2d`,this.ui=new U,this.view2dType=`video`,this.addHandles([c(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),c(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),c(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),c(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([c(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},l)]),this.addResolvingPromise(K().then(()=>(this._isValid=!0,u(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(u(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(g(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}async takeScreenshot(e){let t=this.stage,[n,r]=this.size;if(!this.ready||!t||n<=0||r<=0)throw new i(`videoview:not-ready`,`The VideoView must be ready before taking a screenshot.`);let a=L(e||{},Math.min(4,z(this.size,Math.min(4096,t.context.parameters.maxTextureSize))),this.size,this.padding),o=await t.takeScreenshot(a,void 0,e?.ignoreBackground?null:W,e?.rotation);return B(o,V(e?.format,e?.quality),{flipY:!0,premultipliedAlpha:!0})}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new G(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new A({view:this});this._set(`animationManager`,r);let i=new N({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([c(()=>this.stationary,t=>e.stationary=t,l),c(()=>this.state.id,()=>e.state=this.state,l),c(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],`video-view`),this._extent=new v({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new E({video:this.layer?.videoElement,georeference:new C({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new F(this._videoElementView);this._overlayContainer=new I,this._overlayContainer.addChild(t),this._effectsContainer=new M,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([c(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(J).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>_(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),u(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),c(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await x();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=S(new y(a,n),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=v.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>q;e/=2)n.push(e);n.push(q);let{lods:r}=T.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(d(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([f()],Y.prototype,`_overlayContainer`,void 0),e([f()],Y.prototype,`_isValid`,void 0),e([f()],Y.prototype,`_readyCycleForced`,void 0),e([f()],Y.prototype,`_effectsContainer`,void 0),e([f()],Y.prototype,`constraintsInfo`,null),e([f()],Y.prototype,`operationalDataVisible`,void 0),e([f()],Y.prototype,`layer`,null),e([f()],Y.prototype,`map`,void 0),e([f({type:R,nonNullable:!0})],Y.prototype,`navigation`,void 0),e([f({readOnly:!0})],Y.prototype,`preconditionsReady`,null),e([f({readOnly:!0})],Y.prototype,`ready`,void 0),e([f({readOnly:!0})],Y.prototype,`rendering`,null),e([f()],Y.prototype,`scale`,null),e([f()],Y.prototype,`spatialReference`,void 0),e([f()],Y.prototype,`stateManager`,void 0),e([f()],Y.prototype,`type`,void 0),e([f(),p(e=>e instanceof H?e:h(U,e))],Y.prototype,`ui`,void 0),e([f({readOnly:!0})],Y.prototype,`videoSize`,null),e([f({readOnly:!0})],Y.prototype,`view2dType`,void 0),Y=e([m(`esri.views.VideoView`)],Y);const X=Y;export{X as default};
|
|
@@ -42,9 +42,17 @@ export default abstract class LayerView extends LayerViewSuperclass {
|
|
|
42
42
|
*/
|
|
43
43
|
get spatialReferenceSupported(): boolean;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Indicates whether the layer view is suspended. While suspended, the layer is not rendered
|
|
46
|
+
* in the associated view and is excluded from the results of the
|
|
47
|
+
* [Map](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-map/#hitTest)
|
|
48
|
+
* and [Scene](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-scene/#hitTest)
|
|
49
|
+
* component's `hitTest()` methods.
|
|
47
50
|
*
|
|
51
|
+
* Data already loaded by the layer view may be retained for reuse when the layer view is no longer suspended.
|
|
52
|
+
*
|
|
53
|
+
* @see [visible](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/#visible)
|
|
54
|
+
* @see [visibleAtCurrentScale](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/#visibleAtCurrentScale)
|
|
55
|
+
* @see [visibleAtCurrentTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/#visibleAtCurrentTimeExtent)
|
|
48
56
|
* @see [spatialReferenceSupported](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/#spatialReferenceSupported)
|
|
49
57
|
*/
|
|
50
58
|
get suspended(): boolean;
|
|
@@ -2,7 +2,7 @@ import type Graphic from "../../../Graphic.js";
|
|
|
2
2
|
import type Field from "../../../layers/support/Field.js";
|
|
3
3
|
import type EditableInput from "./EditableInput.js";
|
|
4
4
|
import type GroupInput from "./GroupInput.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { InputUnion } from "../../../form/elements/inputs/types.js";
|
|
6
6
|
import type { FieldValue } from "../../../layers/support/fieldUtils.js";
|
|
7
7
|
import type { NumericRange } from "../../../layers/support/NumericRange.js";
|
|
8
8
|
import type { DomainUnion as Domain } from "../../../layers/support/types.js";
|
|
@@ -68,7 +68,7 @@ export default class FieldInput extends EditableInput<any> {
|
|
|
68
68
|
*/
|
|
69
69
|
get includeTimeOffset(): boolean;
|
|
70
70
|
/** The configured input for this field. */
|
|
71
|
-
get input():
|
|
71
|
+
get input(): InputUnion | null | undefined;
|
|
72
72
|
/** @internal */
|
|
73
73
|
accessor inputController: InputController | null;
|
|
74
74
|
/** An array of features that do not have a valid value for this field. */
|
|
@@ -26,10 +26,10 @@ import type { SketchTooltipOptionsProperties } from "../../views/interactive/ske
|
|
|
26
26
|
import type { SketchValueOptionsProperties } from "../../views/interactive/sketch/SketchValueOptions.js";
|
|
27
27
|
|
|
28
28
|
export interface EditorViewModelProperties extends Partial<Pick<EditorViewModel, "formSystem" | "layerInfos" | "selectionManager" | "syncViewSelection" | "useLegacyCreateTools" | "useViewOptions" | "view">> {
|
|
29
|
-
/** The [AttachmentsViewModel]
|
|
29
|
+
/** The [AttachmentsViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attachments/AttachmentsViewModel/) for supporting the editor widget. Attachment editing is enabled by default if the layer has support for it. */
|
|
30
30
|
attachmentsViewModel?: AttachmentsViewModelProperties;
|
|
31
31
|
/**
|
|
32
|
-
* The [FeatureTemplatesViewModel]
|
|
32
|
+
* The [FeatureTemplatesViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTemplates/FeatureTemplatesViewModel/)
|
|
33
33
|
* for supporting the editor widget.
|
|
34
34
|
*/
|
|
35
35
|
featureTemplatesViewModel?: FeatureTemplatesViewModelProperties;
|
|
@@ -145,7 +145,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
145
145
|
* @see [Sample - Popup with edit action](https://developers.arcgis.com/javascript/latest/sample-code/popup-editaction/)
|
|
146
146
|
*/
|
|
147
147
|
get activeWorkflow(): CreateFeaturesWorkflow | UpdateWorkflow | null | undefined;
|
|
148
|
-
/** The [AttachmentsViewModel]
|
|
148
|
+
/** The [AttachmentsViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Attachments/AttachmentsViewModel/) for supporting the editor widget. Attachment editing is enabled by default if the layer has support for it. */
|
|
149
149
|
get attachmentsViewModel(): AttachmentsViewModel;
|
|
150
150
|
set attachmentsViewModel(value: AttachmentsViewModelProperties);
|
|
151
151
|
/** Convenience property that indicates at least one layer supports a `create-features` workflow. */
|
|
@@ -167,12 +167,13 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
167
167
|
*/
|
|
168
168
|
get failures(): FailedOperation[];
|
|
169
169
|
/**
|
|
170
|
-
* The [FeatureFormViewModel]
|
|
171
|
-
*
|
|
170
|
+
* The [FeatureFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/FeatureFormViewModel/) for supporting the editor widget.
|
|
171
|
+
*
|
|
172
|
+
* @deprecated since 5.2. Please use [formViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Editor/EditorViewModel/#formViewModel) instead.
|
|
172
173
|
*/
|
|
173
174
|
get featureFormViewModel(): FeatureFormViewModel | null | undefined;
|
|
174
175
|
/**
|
|
175
|
-
* The [FeatureTemplatesViewModel]
|
|
176
|
+
* The [FeatureTemplatesViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTemplates/FeatureTemplatesViewModel/)
|
|
176
177
|
* for supporting the editor widget.
|
|
177
178
|
*/
|
|
178
179
|
get featureTemplatesViewModel(): FeatureTemplatesViewModel;
|
|
@@ -189,8 +190,8 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
189
190
|
accessor formSystem: "legacy" | "next";
|
|
190
191
|
/**
|
|
191
192
|
* The form's view model used to support the Editor widget.
|
|
192
|
-
* This can be either the [BatchAttributeFormViewModel]
|
|
193
|
-
* or the [FeatureFormViewModel]
|
|
193
|
+
* This can be either the [BatchAttributeFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/)
|
|
194
|
+
* or the [FeatureFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/FeatureFormViewModel/) and is dependent on the active workflow.
|
|
194
195
|
*
|
|
195
196
|
* @since 4.33
|
|
196
197
|
*/
|
|
@@ -247,10 +248,7 @@ export default class EditorViewModel extends EventedAccessor {
|
|
|
247
248
|
* @since 5.0
|
|
248
249
|
*/
|
|
249
250
|
accessor selectionManager: SelectionManager | null | undefined;
|
|
250
|
-
/**
|
|
251
|
-
* The [SketchViewModel][SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/)
|
|
252
|
-
* for supporting the editor widget.
|
|
253
|
-
*/
|
|
251
|
+
/** The [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/) for supporting the editor widget. */
|
|
254
252
|
get sketchViewModel(): SketchViewModel | null | undefined;
|
|
255
253
|
/**
|
|
256
254
|
* The [SnappingOptions](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/) for sketching. It supports [self](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/#selfEnabled) and [feature](https://developers.arcgis.com/javascript/latest/references/core/views/interactive/snapping/SnappingOptions/#featureEnabled) snapping.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as n,fetchMessageBundle as r}from"../../intl.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Collection.js";import{referenceSetter as o}from"../../core/collectionUtils.js";import s from"../../core/Error.js";import c from"../../core/Logger.js";import{debounce as l,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{watch as d,initial as f,on as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as v}from"../../editing/fieldUtils.js";import{geometryTypes as y}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as b}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as x,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as C}from"../../support/popupUtils.js";import w from"../../tables/AttributeTableTemplate.js";import{syncAttributeTableTemplateWithColumns as T}from"../../tables/support/templateUtils.js";import E from"../../time/TimeExtent.js";import{isSelectableLayerWithObjectIds as D}from"../../views/support/selectionUtils.js";import O from"./ActionColumn.js";import k from"./AttachmentsColumn.js";import A from"./FieldColumn.js";import j from"./RelationshipColumn.js";import M from"./Grid/Column.js";import N from"./Grid/Grid.js";import P from"./Grid/GridViewModel.js";import F from"./Grid/GroupColumn.js";import I from"./support/AttachmentsColumnTemplate.js";import L from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as R,isFieldColumn as z,isRelationshipColumn as B}from"./support/columnUtils.js";import{downloadAttachmentInfo as V,exportToCSV as H}from"./support/exportUtils.js";import U from"./support/FeatureStore.js";import W from"./support/FieldColumnTemplate.js";import G from"./support/RelationshipColumnTemplate.js";import K from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as q,isIFeatureTableSupportedLayerWithRelationships as J,findRelatedLayerInSources as ee,findRelationship as te,uniqueColumnNames as Y,hasColumnForField as ne,findField as X,isIFeatureTableSupportedLayerWithAttachments as re,getRelationshipIdsToShow as ie}from"./support/tableUtils.js";import{goTo as ae}from"../support/goToUtils.js";import{messageBundle as Z}from"../support/widget.js";const Q=`80px`;let $=class extends P{constructor(e){super(e),this._refreshDebounced=l(()=>this._refresh()),this._syncTemplateThrottled=h(()=>this._syncAttributeTableTemplate()),this.attachmentsViewOptions=new L,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new a,this.dataProvider=async(e,t)=>{let{layer:n,store:r}=this;if(!t)return;if(!n||!r){t&&t([]);return}try{await n.load()}catch{return}let{objectIds:i}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||i.length===1&&i.items[0]===-1){t([]);return}if(r.state!==`loaded`&&r.state!==`loading`)try{await r.load()}catch{return}let a=this.paginationEnabled?this.pageIndex:e.page;try{let n=await r.queryPage({...e,pageIndex:a});t?.(n)}catch{return}},this.grid=null,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new a,this.relationshipColumnConfigs=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set(`store`,new U),this._set(`grid`,new N({viewModel:this}))}initialize(){let e=async()=>{this.messages=await r(`esri/widgets/FeatureTable/t9n/FeatureTable`),this.messagesCommon=await r(`esri/t9n/common`),this.messagesUnits=await r(`esri/core/t9n/Units`),this.messagesURIUtils=await r(`esri/widgets/support/t9n/uriUtils`)};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),d(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{let e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},f),d(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),d(()=>this.layer,async(e,t)=>{let n=this.grid;n&&(n.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad().catch(()=>{}):e.load().catch(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&this.attachmentsViewOptions.objectId!=null&&(this.attachmentsViewOptions.objectId=null)}),d(()=>this.layer?.loaded,e=>{e&&this._onLayerLoad().catch(()=>{})}),d(()=>this.store.state,e=>{e===`loaded`&&(this.scrollToTop(),this.refreshCellContent())}),d(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),d(()=>this.editingEnabled,()=>this.refreshCellContent()),d(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),d(()=>this.effectiveWhere,()=>{this.store.state===`loaded`&&this.reset().catch(()=>{})}),d(()=>this.effectiveTimeExtent,()=>void this.refresh()),p(()=>this.layer,`refresh`,e=>this._onLayerRefresh(e)),p(()=>this.grid,[`cell-click`,`cell-dblclick`,`cell-pointerover`,`cell-pointerout`,`cell-keydown`,`column-reorder`],({index:e,item:t,native:n,path:r,type:i})=>{let a=t?.feature,o=a?.getObjectId(),s=i===`cell-keydown`&&n&&n instanceof KeyboardEvent&&n.key===`Enter`;this.emit(i,{feature:a,index:e,native:n,type:i,fieldName:r??void 0,objectId:o}),(s||i===`cell-click`)&&this._onCellInteraction(o)}),d(()=>this.actionColumnConfig,e=>{let{actionColumn:t,columns:n}=this;t?e?t.set(e):n.remove(t):e&&n.length&&n.add(this._generateActionColumn(),e.frozenToEnd===!1?this._getIndexOfFirstFrozenToEndColumn():void 0)}),d(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),p(()=>this.objectIds,`change`,()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),d(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),d(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),d(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),d(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),d(()=>this.state,e=>{e===`disabled`&&this.relatedTables.length&&this.drainRelatedTables()}),p(()=>this.tableParent?.highlightIds,`change`,({added:e})=>{let{relationshipConfig:t}=this,n=e[0];if(n==null||!t)return;let{relatedLayer:r,relationshipId:i}=t;this.relationshipConfig={objectId:n,relatedLayer:r,relationshipId:i}}),p(()=>this.tableParent,`cell-click`,async e=>{let{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),d(()=>this.attachmentsViewOptions.objectId,(e,t)=>{e==null?this.hideAttachmentsView():t??this.showAttachmentsView({objectId:e})}),d(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),p(()=>this.highlightIds,`change`,e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),d(()=>this.effectiveSelectionManager,()=>this._syncSelection(),m),p(()=>this.effectiveSelectionManager,`selection-change`,()=>this._syncSelection(),m)])}destroy(){this._drainColumns(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return b(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _subtypes(){return x(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){let{filterGeometry:e,objectIds:t,filterBySelectionEnabled:n,highlightIds:r}=this,i=new a;return e&&i.push({type:`geometry`,geometry:e}),n?i.push({type:`selection`,objectIds:r.toArray()}):t.length&&i.push({type:`objectId`,objectIds:t.toArray()}),i}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>R(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get cachedPageCount(){return this.store.cachedPageCount}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome(`clearPrompt`,e)}get defaultSelectionManager(){return this.store.defaultSelectionManager}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){return this.store.effectiveSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get effectiveTimeExtent(){return this.store.effectiveTimeExtent}get effectiveWhere(){return this.store.effectiveWhere}get fieldColumns(){return this.allColumns.filter(e=>z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=e}get filterByLayerScaleRange(){return this.store.filterByLayerScaleRange}set filterByLayerScaleRange(e){this.store.filterByLayerScaleRange=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get(`filterBySelectionEnabled`)}set filterBySelectionEnabled(e){let{objectIds:t}=this,n=t.length;e?(n&&(t.removeAll(),this._logWarning(`Selection filter has been applied with an objectID filter. Object ID filter has been removed.`)),this.filterGeometry&&this._logWarning(`Selection filter has been applied with a geometry filter. Results may appear inconsistent`),this._syncObjectIdsWithStore(this.highlightIds.toArray())):n||this._syncObjectIdsWithStore(null),this._set(`filterBySelectionEnabled`,e)}get groupColumns(){return super.groupColumns}get hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get(`hiddenFields`)??new a}set hiddenFields(e){this._set(`hiddenFields`,o(e,this._get(`hiddenFields`),a))}get highlightEnabled(){return this.store.highlightEnabled}set highlightEnabled(e){this.store.highlightEnabled=e}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get(`layer`)}set layer(e){this.drainRelatedTables(),this._set(`layer`,e)}get layerFieldConfigurations(){let e=this.layer;return q(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>B(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){let{layer:e,layers:t,relationships:n,tableController:r}=this,i=this.store.relationshipInfos;if(i.length||!J(e)||!n?.length)return i;let a=[],o=r?.layers||t||[];return n.forEach(t=>{let n=ee(e,o,t);n&&(n.load().catch(()=>{}),a.push({layer:e,relatedLayer:n,relationshipId:t.id}))}),a}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get selectionManager(){return this.store.selectionManager}set selectionManager(e){this.store.selectionManager=e}get selectionSource(){return`table`}set selectionSource(e){this.syncViewSelection=e===`view`,this._overrideIfSome(`selectionSource`,e)}get showAllRelatedTables(){return this._get(`showAllRelatedTables`)}set showAllRelatedTables(e){let{relatedTable:t}=this;this._set(`showAllRelatedTables`,e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome(`showPrompt`,e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){let{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){let{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get syncViewSelection(){return this.store.syncViewSelection}set syncViewSelection(e){this.store.syncViewSelection=e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this.store.timeZone}set timeZone(e){this.store.timeZone=e}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get viewTimeEnabled(){return this.store.viewTimeEnabled}set viewTimeEnabled(e){this.store.viewTimeEnabled=e}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){let{attachmentsViewOptions:n,store:r}=this,i=n.objectId===e;await r.addAttachment(e,t).catch(e=>{i&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),n.error=e.error)}),i&&!n.error&&(n.onEditComplete(),n.attachmentInfos=await r.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){let{relatedLayer:n,objectId:r,relationshipId:i}=t,{objectIdField:o}=n,s=te(n,i),c=n.displayField||s?.keyField||o;e.set({highlightIds:new a([r]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,c,i)});let l=e.hiddenFields;l.includes(Y.action)||l.add(Y.action),l.includes(Y.attachments)||l.add(Y.attachments),e.scrollLeft()}async deleteAttachments(e,t){let{attachmentsViewOptions:n,store:r}=this,i=n.objectId===e;await r.deleteAttachments(e,t).catch(e=>{i&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),n.error=e.error)}),i&&!n.error&&(n.onEditComplete(),n.attachmentInfos=await r.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteSelection(){let e=this.highlightIds.toArray();if(!e?.length)return;let{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),n=t.filter(e=>!e.error).map(e=>e.objectId);n.length&&(this.highlightIds.removeMany(n),await this.refresh())}async discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){let n=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await V(n)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([Y.action,Y.attachments])}drainRelatedTablesAboveIndex(e){let{relatedTables:t}=this,n=t.slice(e+1);t.removeMany(n).forEach(e=>e.destroy());let r=t.at(-1);r&&(r.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(r):this._hideAllRelatedTables(r))}async exportSelectionToCSV(e){let{highlightIds:t,layer:n,outFields:r}=this;!n||!t.length?this._logWarning(`Export failed.`):await H({layer:n,objectIds:t.toArray(),outFields:r,includeGeometry:e})}getCachedFeaturesByPageIndex(e){return this.store.getCachedFeaturesByPageIndex(e)}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){let t=this.layer;if(!t)return`${e}`;let n=`${t.objectIdField}: ${e}`;return e==null?n:this.store.featureTitleMap.get(e)??n}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){return this.getFeatureStoreItemByObjectId(e)?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(e==null||!Number.isInteger(e)){this._logWarning(`Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.`);return}let{pageCount:t}=this;(e>=t||e===-1)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(Y.action)}nextPage(){let e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){let e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),u(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await this.grid?.reset()}async savePendingEdits(){this.relatedTableHasPendingEdits&&!this.relatedTableHasInvalidPendingEdits?await this.relatedTable?.savePendingEdits():this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){let t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning(`Row not found. Associated data may not be loaded yet.`)}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){let{attachmentId:e,form:t,objectId:n}=this.attachmentsViewOptions;n!=null&&t&&(e==null?await this.addAttachment(n,t):await this.updateAttachment(n,e,t))}async showAttachmentsView({objectId:e}){let{attachmentsViewOptions:t,hiddenFields:n,layer:r}=this;if(!this.attachmentsEnabled||!r){this._logWarning(`The 'attachmentsEnabled' property is currently false.`);return}await r.load();let i=this._getDefaultLayerDisplayField(r),o=await this.store.getAttachmentsByObjectId(e,!0),s=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:o,mode:o.length?`list`:`file`,objectId:e}),this.set({highlightIds:new a([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)}),n.includes(Y.action)||n.add(Y.action),s!=null&&this.scrollToIndex(s)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){this.store.syncSelectionSources()}async updateAttachment(e,t,n){let{attachmentsViewOptions:r,store:i}=this,a=r.objectId===e;await i.updateAttachment(e,t,n).catch(e=>{a&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),r.error=e.error)}),a&&!r.error&&(r.onEditComplete(),r.attachmentInfos=await i.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){let{layer:e,view:t}=this,n=this.highlightIds.toArray();if(!e||!t||!n.length)return;let r=e.createQuery();r.objectIds=n,r.returnGeometry=!0;let i=await e.queryFeatures(r);try{await ae(t,i.features)}catch(e){e.name!==`AbortError`&&console.error(e)}}_syncAttributeTableTemplate(e=!1){let{_effectiveAttributeTableTemplate:t,layer:n,tableTemplateOverride:r,syncTemplateOnChangesEnabled:i}=this;if(!n||!t||!i&&!e||r||this.tableParent||this.relatedTable||this.attachmentsViewOptions.objectId!==null)return;let a=JSON.stringify(t.toJSON());T(t,this.columns.toArray(),this.activeSortOrders),t===n.attributeTableTemplate&&JSON.stringify(t.toJSON())!==a&&(n.attributeTableTemplate=t.clone())}async _refresh(){await super.refresh();let e=this.highlightIds.toArray();e.length&&(await this.store.verifyFeaturesByObjectId(e)).forEach((t,n)=>{t||this.highlightIds.remove(e[n])}),this.refreshPageCache();let t=this.attachmentsViewOptions;t?.objectId!=null&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){let{layer:e,pageSize:t}=this;if(!e)return;e.parent&&S(e.parent)&&await e.parent.loadAll();let n=e.capabilities.query?.maxRecordCount,r=n&&n<t,i=r?n:t;r&&(this._logWarning(`The value for 'pageSize' has been adjusted due to the provided layer's max record count.`),this.pageSize=i),this.grid?.set(`pageSize`,i);try{this._generateColumns(),await this.store.load(),this.refreshPageCache()}catch{c.getLogger(this).error(`Unable to load the provided layer.`)}}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();let{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:n}=this,r=e?.columnTemplates;if(!n)return;let i=this._generateColumnsFromColumnTemplates(n,r)??this._generateColumnsFromAttributeTableTemplate(n,t)??this._generateDefaultFieldColumns(n);i.length&&(this.attachmentsEnabled&&!i.some(e=>R(e))&&i.push(this._generateDefaultAttachmentsColumn(n)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!i.some(e=>B(e))&&i.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&i.push(this._generateActionColumn()),i.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(i))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;let{elements:n,orderByFields:r}=t,a=C(e),o=[];o.push(...this._generateColumnsFromAttributeTableElements(e,n,r));let s=a.map(t=>{if(!t.fieldName||ne(t.fieldName,o))return null;let{fieldName:n}=t,i=X(e,n);return i?this._generateDefaultFieldColumn(e,i,{hidden:!0,orderByFields:r}):(this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`),null)}).filter(i);return o.push(...s),this.attachmentsEnabled&&re(e)&&!o.some(e=>R(e))&&o.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&J(e)&&e.relationships?.forEach(({id:e},t)=>{let n=this.relationshipInfos.find(t=>t.relationshipId===e);n&&!o.some(t=>B(t)&&t.relationshipId===e)&&o.push(this._generateDefaultRelationshipColumn({hidden:!0,info:n,index:t}))}),o.length?o:null}_generateColumnsFromAttributeTableElements(e,t,n){return t?.map((t,r)=>{switch(t.type){case`field`:return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:n});case`group`:return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:n});case`attachment`:return this._createAttachmentColumnFromElement({layer:e,element:t,index:r});case`relationship`:return this._createRelationshipColumnFromElement({element:t,index:r})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){let{layer:t,element:n,orderByFields:r}=e,{fieldName:i}=n;if(i==null)return this._logTemplateWarning(`A valid 'fieldName' must be provided.`),null;let a=X(t,i);if(!a)return this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`),null;let{description:o,label:s}=n,c=r?.findIndex(({field:e})=>e&&e===i)??-1,l=c>-1?r?.at(c)?.order:void 0,u=c>-1?c:void 0,{grid:d,messages:f,messagesCommon:p,messagesURIUtils:m,store:h,view:g}=this;return new A({description:o,direction:l,field:a,fieldName:i,grid:d,initialSortPriority:u,label:s,layer:t,messages:f,messagesCommon:p,messagesURIUtils:m,store:h,view:g,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){let{layer:t,element:n,orderByFields:r}=e,{description:i,label:a}=n;if(!a)return this._logTemplateWarning(`Group columns require a label.`),null;if(!n.elements.length)return this._logTemplateWarning(`Group columns require child columns.`),null;let{grid:o,messages:s,messagesCommon:c,messagesURIUtils:l,store:u}=this;return new F({columns:this._generateColumnsFromAttributeTableElements(t,n.elements,r),description:i,grid:o,label:a,messages:s,messagesCommon:c,messagesURIUtils:l,store:u})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled){this._logTemplateWarning(`The 'attachmentsEnabled' property is currently false.`);return}let{layer:t,element:n,index:r}=e,{description:i,label:a}=n,{grid:o,messages:s,messagesCommon:c,messagesURIUtils:l,store:u}=this;return new k({description:i,fieldName:`${Y.attachments}-${r}`,grid:o,label:a,layer:t,messages:s,messagesCommon:c,messagesURIUtils:l,store:u,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled){this._logTemplateWarning(`Relationship columns require related records to be enabled on the table.`);return}let{element:t,index:n}=e,{description:r,label:i,relationshipId:a}=t,o=this.relationshipInfos.find(e=>e.relationshipId===a);if(!o)return this._logTemplateWarning(`Unable to find valid related layer target based on the provided relationship id.`),null;let{grid:s,messages:c,messagesCommon:l,messagesURIUtils:u,store:d}=this;return new j({description:r,fieldName:`${Y.relationship}-${a}-${n}`,grid:s,label:i,messages:c,messagesCommon:l,messagesURIUtils:u,relationshipId:a,store:d,layer:o.relatedLayer,relatedLayer:o.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){let{grid:n,messages:r,messagesCommon:i,messagesURIUtils:a,store:o,view:s}=this;if(!t?.length)return null;let c=[];return t.forEach((t,l)=>{let{autoWidth:u,description:d,direction:f,flexGrow:p,fieldName:m,formatFunction:h,frozen:g,frozenToEnd:_,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,menuConfig:w,resizable:T,sortable:E,textAlign:D,textWrap:O,timeZone:k,type:j,width:N}=t;if(!j){this._logTemplateWarning(`Property 'type' is missing from the provided template.`);return}if(g&&_){this._logTemplateWarning(`Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.`);return}let P=t.visible===!1;if(j===`group`){if(!t.columnTemplates?.length){this._logTemplateWarning(`Group columns must contain column templates.`);return}if(!t.label){this._logTemplateWarning(`Group columns require a label.`);return}let o=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),s=P||this._isFieldHidden(t.label);c.push(new F({autoWidth:u,columns:o,description:d,flexGrow:p,frozen:g,frozenToEnd:_,grid:n,hidden:s,icon:v,iconText:y,invalid:x,label:S,labelTooltipText:C,menuConfig:w,messages:r,messagesCommon:i,messagesURIUtils:a,resizable:T,textAlign:D,textWrap:O,timeZone:k,width:N}))}else if(j===`attachment`){if(!this.attachmentsEnabled){this._logTemplateWarning(`Attachment columns require attachments to be enabled on the table.`);return}c.push(this._generateAttachmentsColumnFromTemplate(e,t,l))}else if(j===`relationship`){if(!this.relatedRecordsEnabled){this._logTemplateWarning(`Relationship columns require related records to be enabled on the table.`);return}let{relationshipId:e}=t;if(e==null){this._logTemplateWarning(`Property 'relationshipId' is missing from the provided template.`);return}let n=this.relationshipInfos.find(t=>t.relationshipId===e);if(!n){this._logTemplateWarning(`Unable to find valid related layer target based on the provided relationship id.`);return}c.push(this._generateRelationshipColumnFromTemplate(n,t,l))}else if(!m){this._logTemplateWarning(`Value for 'fieldName' property was missing from the provided template.`);return}let I=P||this._isFieldHidden(m);if(j===`column`)c.push(new M({autoWidth:u,description:d,direction:f,fieldName:m,flexGrow:p,formatFunction:h,frozen:g,frozenToEnd:_,grid:n,hidden:I,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,menuConfig:w,messages:r,messagesCommon:i,messagesURIUtils:a,resizable:T,sortable:E,store:o,textAlign:D,textWrap:O,timeZone:k,width:N}));else if(j===`field`){let l=X(e,t.fieldName);if(!l){this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`);return}let{editable:m,required:j}=t;c.push(new A({autoWidth:u,description:d,direction:f,editable:m,field:l,fieldName:l.name,flexGrow:p,formatFunction:h,frozen:g,frozenToEnd:_,grid:n,hidden:I,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,layer:e,messages:r,messagesCommon:i,messagesURIUtils:a,menuConfig:w,required:j,resizable:T,sortable:E,store:o,template:t,textAlign:D,textWrap:O,timeZone:k,width:N,view:s,onShowPromptCallback:this._onShowPromptCallback}))}}),c.length?c:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(i)??[]}_generateDefaultFieldColumn(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s,view:c}=this;if(!t.visible||t.type===`geometry`)return null;let l=n?.orderByFields,u=t.name,d=l?.findIndex(({field:e})=>e&&e===u)??-1,f=d>-1?l?.at(d)?.order:void 0,p=d>-1?d:void 0;return new A({direction:f,field:t,fieldName:u,grid:r,hidden:n?.hidden||this._isFieldHidden(u),initialSortPriority:p,layer:e,messages:i,messagesCommon:a,messagesURIUtils:o,store:s,view:c,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s}=this,{attachmentsViewEnabled:c,autoWidth:l,description:u,flexGrow:d,fieldName:f,formatFunction:p,frozen:m,frozenToEnd:h,icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,resizable:S,textAlign:C,textWrap:w,thumbnailAppearance:T,thumbnailCount:E,thumbnailIconScale:D,thumbnailsEnabled:O,timeZone:A,width:j}=t;return new k({attachmentsViewEnabled:c,autoWidth:l,description:u,fieldName:`${Y.attachments}-${n}`,flexGrow:d,formatFunction:p,frozen:m,frozenToEnd:h,grid:r,hidden:t.visible===!1||this._isFieldHidden(y)||this._isFieldHidden(f),icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,layer:e,menuConfig:x,messages:i,messagesCommon:a,messagesURIUtils:o,resizable:S,store:s,textAlign:C,textWrap:w,thumbnailAppearance:T,thumbnailCount:E,thumbnailIconScale:D,thumbnailsEnabled:O,timeZone:A,width:j,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){let{grid:n,messages:r,messagesCommon:i,messagesURIUtils:a,store:o}=this,s=Y.attachments;return new k({fieldName:s,grid:n,hidden:t?.hidden||this._isFieldHidden(s),layer:e,messages:r,messagesCommon:i,messagesURIUtils:a,store:o,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s}=this,{autoWidth:c,collapsed:l,description:u,flexGrow:d,fieldName:f,formatFunction:p,frozen:m,frozenToEnd:h,icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,relationshipId:S,resizable:C,textAlign:w,textWrap:T,timeZone:E,width:D}=t;return new j({autoWidth:c,collapsed:l,description:u,fieldName:`${Y.relationship}-${S}-${n}`,flexGrow:d,formatFunction:p,frozen:m,frozenToEnd:h,grid:r,hidden:t.visible===!1||this._isFieldHidden(y)||this._isFieldHidden(f),icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,messages:i,messagesCommon:a,messagesURIUtils:o,relationshipId:S,resizable:C,store:s,textAlign:w,textWrap:T,timeZone:E,width:D,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){let{relationshipInfos:e,relationshipColumnConfigs:t}=this,n=[];return e?.length&&(t?t.forEach((t,r)=>{let{relationshipId:i}=t,a=e.find(e=>e.relationshipId===i);a&&n.push(this._generateDefaultRelationshipColumn({config:t,index:r,info:a}))}):e.forEach((e,t)=>n.push(this._generateDefaultRelationshipColumn({index:t,info:e})))),n}_generateDefaultRelationshipColumn(e){let{config:t,hidden:n,index:r,info:i}=e,{grid:a,messages:o,messagesCommon:s,messagesURIUtils:c,store:l}=this,{relationshipId:u}=i;return new j({...t,fieldName:`${Y.relationship}-${u}-${r}`,grid:a,hidden:!!n,messages:o,messagesCommon:s,messagesURIUtils:c,layer:i.relatedLayer,relatedLayer:i.layer,relationshipId:u,store:l,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){let e=this.actionColumnConfig,t=e?.frozen===!0?!1:e?.frozenToEnd??!0;return new O({hidden:this._isFieldHidden(Y.action),store:this.store,...e,frozenToEnd:t})}_isFieldHidden(e){let t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_syncSelection(){let{layer:e}=this;D(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){let t=this.layer;D(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){let t=this.layer;D(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){let{added:t,removed:n}=e,{attachmentsViewOptions:r}=this;if(this._removeFromSelection(n),this._addToSelection(t),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),r.objectId!=null){let e=this.highlightIds.at(0);if(e!=null){let t=await this.store.getAttachmentsByObjectId(e,!0);r.set({attachmentInfos:t,objectId:e,mode:t.length?`list`:`file`}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){let{tableParent:t}=this;t&&e!=null&&t.highlightIds.add(e)}_onShowRelatedTable(e){let{highlightIds:t}=this,{objectId:n}=e;t.removeAll(),t.add(n),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit(`show-related-table`,e)}_onObjectIdsChange(){let e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning(`Object ID filter was applied while a selection filter was applied. Selection filter has been removed.`)),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){let t=e.layer;if(!t)return;let n=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,n)});let r=e.hiddenFields;r.includes(Y.action)||r.add(Y.action),r.includes(Y.attachments)||r.add(Y.attachments)}_hideAllRelatedTables(e){let{layer:t,relationship:n}=e;if(t&&n?.id!=null){if(e.attachmentsViewOptions.objectId!=null){let n=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:ie(t,n.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([Y.action,Y.attachments])}}_getTableTemplateForRelatedTableView(e,t,n){return new K({columnTemplates:[new W({fieldName:t,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([r,i])=>({selected:r===t,label:i||r,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,r,n)}}))},resizable:!1}),new G({autoWidth:!1,collapsed:!0,flexGrow:0,label:``,resizable:!1,relationshipId:n,width:Q})]})}_getTableTemplateForShowAllTablesView(e,t){let n=[new W({fieldName:t,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([n,r])=>({selected:n===t,label:r||n,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,n)}}))},resizable:!1})];return e.attachmentsViewOptions.objectId!=null&&n.push(new I({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:``,resizable:!1,thumbnailsEnabled:!1,width:Q})),new K({columnTemplates:n})}async _onShowPromptCallback(e){let{column:t,objectId:n,oldValue:r,value:i}=e,{_subtypes:a,layer:o}=this;if(!o||!a.length){t.cancel();return}let s=a.find(e=>e.code===i);if(!s){t.cancel();return}let c=Promise.withResolvers(),l=this._createSubtypeEditPrompt(r,s,c),u=!!o.parent&&this.autoSaveEnabled;try{this.showPrompt(l);let e=await c.promise,r=[{fieldName:t.fieldName,value:i}];switch(e){case`update-fields`:for(let[e,t]of Object.entries(s.defaultValues))t!=null&&r.push({fieldName:e,value:t});await t.updateItems({objectId:n,updates:r}),u&&this.refresh();break;case`keep-existing`:await t.updateItems({objectId:n,updates:r}),u&&this.refresh();break;case`undo`:t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,r){let{_subtypes:i,messages:a,messagesCommon:o}=this,s=i.find(t=>t.code===e)?.name??`${e}`,c=`update-fields`,l=[{label:a.subtypes.useDefaultValuesOption,value:`update-fields`},{label:a.subtypes.keepCurrentValuesOption,value:`keep-existing`}];return{context:`info`,title:a.subtypes.changeWarningTitle,message:n(a.subtypes.changeWarning,{originalType:s,newType:t.name}),radios:l,defaultRadioSelection:`update-fields`,onRadioSelection:e=>{c=e},actions:{primary:{label:o.apply,action:()=>r.resolve(c),type:`positive`},secondary:{label:o.cancel,type:`neutral`,action:()=>r.resolve(`undo`)}},cancel:()=>r.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new K({columnTemplates:[new W({fieldName:e,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,n])=>({selected:t===e,label:n||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new I({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:``,resizable:!1,thumbnailsEnabled:!1,width:Q})]})}_extractFieldColumnInfosFromTableTemplate(e){let{layer:t,tableTemplate:n}=e??this;return n?n.columnTemplates.filter(({type:e})=>e===`field`||e===`column`).map(({fieldName:e,label:n})=>{if(n!=null&&n!==``)return[e,n];let r=t?.fieldsIndex.get(e);return[e,r&&v(r,t)]}):t?.fields.map(e=>[e.name,v(e,t)])??[]}_getDefaultLayerDisplayField(e){let{displayField:t,objectIdField:n}=e;return t&&t.trim()!==``?t:n||(e.fields.length?e.fields[0].name:``)}_getIndexOfFirstFrozenToEndColumn(){let e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?c.getLogger(this).warnOnce(e):c.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){e!=null&&this.attachmentsViewOptions.objectId!=null&&this.highlightIds.add(e)}};e([g()],$.prototype,`_defaultHiddenFields`,null),e([g()],$.prototype,`_effectiveTableTemplate`,null),e([g()],$.prototype,`_effectiveAttributeTableTemplate`,null),e([g()],$.prototype,`_subtypes`,null),e([g()],$.prototype,`activeFilters`,null),e([g({readOnly:!0})],$.prototype,`activeSortOrders`,null),e([g()],$.prototype,`allRelatedTablesVisible`,null),e([g()],$.prototype,`attachmentsColumns`,null),e([g()],$.prototype,`attachmentsEnabled`,null),e([g()],$.prototype,`attachmentsViewOptions`,void 0),e([g({type:w})],$.prototype,`attributeTableTemplate`,void 0),e([g()],$.prototype,`autoRefreshEnabled`,void 0),e([g()],$.prototype,`autoSaveEnabled`,null),e([g()],$.prototype,`cachedPageCount`,null),e([g()],$.prototype,`canAddRelatedFeature`,null),e([g()],$.prototype,`clearPrompt`,null),e([g({readOnly:!0})],$.prototype,`columns`,void 0),e([g()],$.prototype,`dataProvider`,void 0),e([g()],$.prototype,`defaultSelectionManager`,null),e([g()],$.prototype,`definitionExpression`,null),e([g()],$.prototype,`effectiveSelectionManager`,null),e([g()],$.prototype,`effectiveTimeExtent`,null),e([g()],$.prototype,`effectiveWhere`,null),e([g()],$.prototype,`fieldColumns`,null),e([g()],$.prototype,`filterByViewExtent`,null),e([g()],$.prototype,`filterByLayerScaleRange`,null),e([g({types:y})],$.prototype,`filterGeometry`,null),e([g()],$.prototype,`filterBySelectionEnabled`,null),e([g({readOnly:!0})],$.prototype,`grid`,void 0),e([g()],$.prototype,`hasContingentValues`,null),e([g()],$.prototype,`hasInvalidPendingEdits`,null),e([g()],$.prototype,`hasPendingEdits`,null),e([g()],$.prototype,`hiddenFields`,null),e([g()],$.prototype,`highlightEnabled`,null),e([g()],$.prototype,`initialSize`,null),e([g()],$.prototype,`isQueryingOrSyncing`,null),e([g()],$.prototype,`isSyncingAttachments`,null),e([g()],$.prototype,`layer`,null),e([g()],$.prototype,`layers`,void 0),e([g()],$.prototype,`layerFieldConfigurations`,null),e([g()],$.prototype,`layerView`,null),e([g()],$.prototype,`menuConfig`,void 0),e([g()],$.prototype,`messages`,void 0),e([g(),Z(`esri/t9n/common`)],$.prototype,`messagesCommon`,void 0),e([g(),Z(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,void 0),e([g(),Z(`esri/widgets/support/t9n/uriUtils`)],$.prototype,`messagesURIUtils`,void 0),e([g()],$.prototype,`outFields`,null),e([g()],$.prototype,`pendingEditsCount`,null),e([g()],$.prototype,`prompt`,void 0),e([g()],$.prototype,`relatedRecordsEnabled`,null),e([g()],$.prototype,`relatedTable`,null),e([g()],$.prototype,`relatedTableHasContingentValues`,null),e([g()],$.prototype,`relatedTables`,void 0),e([g()],$.prototype,`relationship`,null),e([g()],$.prototype,`relationshipColumnConfigs`,void 0),e([g()],$.prototype,`relationshipColumns`,null),e([g()],$.prototype,`relationshipConfig`,null),e([g()],$.prototype,`relationshipInfos`,null),e([g()],$.prototype,`relationships`,null),e([g()],$.prototype,`returnGeometryEnabled`,null),e([g()],$.prototype,`returnMEnabled`,null),e([g()],$.prototype,`returnZEnabled`,null),e([g()],$.prototype,`selectionManager`,null),e([g()],$.prototype,`selectionSource`,null),e([g()],$.prototype,`showAllRelatedTables`,null),e([g()],$.prototype,`showPrompt`,null),e([g()],$.prototype,`showRelatedTableCallback`,void 0),e([g({readOnly:!0,type:U})],$.prototype,`store`,void 0),e([g()],$.prototype,`supportsAttachments`,null),e([g()],$.prototype,`supportsAddAttachments`,null),e([g()],$.prototype,`supportsDeleteAttachments`,null),e([g()],$.prototype,`supportsResizeAttachments`,null),e([g()],$.prototype,`supportsUpdateAttachments`,null),e([g()],$.prototype,`syncTemplateOnChangesEnabled`,void 0),e([g()],$.prototype,`syncViewSelection`,null),e([g()],$.prototype,`tableController`,void 0),e([g()],$.prototype,`tableParent`,void 0),e([g({type:K})],$.prototype,`tableTemplate`,void 0),e([g()],$.prototype,`tableTemplateOverride`,void 0),e([g({type:E})],$.prototype,`timeExtent`,null),e([g()],$.prototype,`timeZone`,null),e([g()],$.prototype,`view`,null),e([g()],$.prototype,`viewTimeEnabled`,null),$=e([_(`esri.widgets.FeatureTable.FeatureTableViewModel`)],$);const oe=$;export{oe as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as n,fetchMessageBundle as r}from"../../intl.js";import{isSome as i}from"../../core/arrayUtils.js";import a from"../../core/Collection.js";import{referenceSetter as o}from"../../core/collectionUtils.js";import s from"../../core/Error.js";import c from"../../core/Logger.js";import{debounce as l,ignoreAbortErrors as u}from"../../core/promiseUtils.js";import{watch as d,initial as f,on as p,syncAndInitial as m}from"../../core/reactiveUtils.js";import{throttle as h}from"../../core/throttle.js";import{property as g,subclass as _}from"../../core/accessorSupport/decorators.js";import{getEffectiveFieldAlias as v}from"../../editing/fieldUtils.js";import{geometryTypes as y}from"../../geometry/support/typeUtils.js";import{getLowerCaseDefaultHiddenFields as b}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as x,isSubtypeGroupLayer as S}from"../../layers/support/layerUtils.js";import{createFieldInfos as C}from"../../support/popupUtils.js";import w from"../../tables/AttributeTableTemplate.js";import{syncAttributeTableTemplateWithColumns as T}from"../../tables/support/templateUtils.js";import E from"../../time/TimeExtent.js";import{isSelectableLayerWithObjectIds as D}from"../../views/support/selectionUtils.js";import O from"./ActionColumn.js";import k from"./AttachmentsColumn.js";import A from"./FieldColumn.js";import j from"./RelationshipColumn.js";import M from"./Grid/Column.js";import N from"./Grid/Grid.js";import P from"./Grid/GridViewModel.js";import F from"./Grid/GroupColumn.js";import I from"./support/AttachmentsColumnTemplate.js";import L from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as R,isFieldColumn as z,isRelationshipColumn as B}from"./support/columnUtils.js";import{downloadAttachmentInfo as V,exportToCSV as H}from"./support/exportUtils.js";import U from"./support/FeatureStore.js";import W from"./support/FieldColumnTemplate.js";import G from"./support/RelationshipColumnTemplate.js";import K from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithFieldConfigurations as q,isIFeatureTableSupportedLayerWithRelationships as J,findRelatedLayerInSources as ee,findRelationship as te,uniqueColumnNames as Y,hasColumnForField as ne,findField as X,isIFeatureTableSupportedLayerWithAttachments as re,getRelationshipIdsToShow as ie}from"./support/tableUtils.js";import{goTo as ae}from"../support/goToUtils.js";import{messageBundle as Z}from"../support/widget.js";const Q=`80px`;let $=class extends P{constructor(e){super(e),this._refreshDebounced=l(()=>this._refresh()),this._syncTemplateThrottled=h(()=>this._syncAttributeTableTemplate()),this.attachmentsViewOptions=new L,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new a,this.dataProvider=async(e,t)=>{let{layer:n,store:r}=this;if(!t)return;if(!n||!r){t&&t([]);return}try{await n.load()}catch{return}let{objectIds:i}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||i.length===1&&i.items[0]===-1){t([]);return}if(r.state!==`loaded`&&r.state!==`loading`)try{await r.load()}catch{return}let a=this.paginationEnabled?this.pageIndex:e.page;try{let n=await r.queryPage({...e,pageIndex:a});t?.(n)}catch{return}},this.grid=null,this.layers=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new a,this.relationshipColumnConfigs=null,this.showRelatedTableCallback=null,this.store=null,this.syncTemplateOnChangesEnabled=!0,this.tableController=null,this.tableParent=null,this.tableTemplate=null,this.tableTemplateOverride=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._onShowPromptCallback=this._onShowPromptCallback.bind(this),this._set(`store`,new U),this._set(`grid`,new N({viewModel:this}))}initialize(){let e=async()=>{this.messages=await r(`esri/widgets/FeatureTable/t9n/FeatureTable`),this.messagesCommon=await r(`esri/t9n/common`),this.messagesUnits=await r(`esri/core/t9n/Units`),this.messagesURIUtils=await r(`esri/widgets/support/t9n/uriUtils`)};e(),this.addHandles([t(()=>{e(),this._generateColumns()}),d(()=>[this.messages,this.messagesCommon,this.messagesURIUtils],()=>{let e=this.messages;this.grid&&(this.grid.messages=e),this.allColumns.forEach(t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils}),this.refreshCellContent()},f),d(()=>this.attachmentsEnabled,()=>this.layer?.loaded&&this._generateColumns()),d(()=>this.layer,async(e,t)=>{let n=this.grid;n&&(n.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad().catch(()=>{}):e.load().catch(()=>{})),this.syncViewSelection&&this._syncSelection(),t&&this.attachmentsViewOptions.objectId!=null&&(this.attachmentsViewOptions.objectId=null)}),d(()=>this.layer?.loaded,e=>{e&&this._onLayerLoad().catch(()=>{})}),d(()=>this.store.state,e=>{e===`loaded`&&(this.scrollToTop(),this.refreshCellContent())}),d(()=>this._effectiveTableTemplate,()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()}),d(()=>this.editingEnabled,()=>this.refreshCellContent()),d(()=>this.timeZone??this.view?.timeZone,()=>this.refreshCellContent()),d(()=>this.effectiveWhere,()=>{this.store.state===`loaded`&&this.reset().catch(()=>{})}),d(()=>this.effectiveTimeExtent,()=>void this.refresh()),p(()=>this.layer,`refresh`,e=>this._onLayerRefresh(e)),p(()=>this.grid,[`cell-click`,`cell-dblclick`,`cell-pointerover`,`cell-pointerout`,`cell-keydown`,`column-reorder`],({index:e,item:t,native:n,path:r,type:i})=>{let a=t?.feature,o=a?.getObjectId(),s=i===`cell-keydown`&&n&&n instanceof KeyboardEvent&&n.key===`Enter`;this.emit(i,{feature:a,index:e,native:n,type:i,fieldName:r??void 0,objectId:o}),(s||i===`cell-click`)&&this._onCellInteraction(o)}),d(()=>this.actionColumnConfig,e=>{let{actionColumn:t,columns:n}=this;t?e?t.set(e):n.remove(t):e&&n.length&&n.add(this._generateActionColumn(),e.frozenToEnd===!1?this._getIndexOfFirstFrozenToEndColumn():void 0)}),d(()=>this.relatedRecordsEnabled,()=>this.layer?.loaded&&this._generateColumns()),p(()=>this.objectIds,`change`,()=>this._onObjectIdsChange(),{onListenerAdd:()=>this._onObjectIdsChange()}),d(()=>[this.paginationEnabled,this.pageIndex],()=>this.refreshPageCache()),d(()=>this.activeSortOrders,e=>{this.store.sortOrders=e,this._syncTemplateThrottled()}),d(()=>this.allVisibleColumns,()=>this._syncTemplateThrottled()),d(()=>this.pageCount,()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)}),d(()=>this.state,e=>{e===`disabled`&&this.relatedTables.length&&this.drainRelatedTables()}),p(()=>this.tableParent?.highlightIds,`change`,({added:e})=>{let{relationshipConfig:t}=this,n=e[0];if(n==null||!t)return;let{relatedLayer:r,relationshipId:i}=t;this.relationshipConfig={objectId:n,relatedLayer:r,relationshipId:i}}),p(()=>this.tableParent,`cell-click`,async e=>{let{objectId:t}=e;this.tableController&&this.hasPendingEdits?await this.tableController.discardPendingEdits(void 0,!0).then(e=>e&&this._syncTableParentSelection(t)):this._syncTableParentSelection(t)}),d(()=>this.attachmentsViewOptions.objectId,(e,t)=>{e==null?this.hideAttachmentsView():t??this.showAttachmentsView({objectId:e})}),d(()=>[this.layerFieldConfigurations,this.pendingEditsCount],()=>this.refreshCellContent()),p(()=>this.highlightIds,`change`,e=>this._onHighlightIdsChange(e),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this.defaultSelectionManager.clear()}),d(()=>this.effectiveSelectionManager,()=>this._syncSelection(),m),p(()=>this.effectiveSelectionManager,`selection-change`,()=>this._syncSelection(),m)])}destroy(){this._drainColumns(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return b(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _subtypes(){return x(this.layer)}get actionColumn(){return super.actionColumn}get activeFilters(){let{filterGeometry:e,objectIds:t,filterBySelectionEnabled:n,highlightIds:r}=this,i=new a;return e&&i.push({type:`geometry`,geometry:e}),n?i.push({type:`selection`,objectIds:r.toArray()}):t.length&&i.push({type:`objectId`,objectIds:t.toArray()}),i}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map(({path:e,direction:t})=>({fieldName:e,direction:t})).filter(e=>e.fieldName&&e.direction):[]}get allColumns(){return super.allColumns}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get allVisibleColumns(){return super.allVisibleColumns}get attachmentsColumns(){return this.allColumns.filter(e=>R(e))}get attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get autoSaveEnabled(){return this.store.autoSaveEnabled}set autoSaveEnabled(e){this.store.autoSaveEnabled=e}get cachedPageCount(){return this.store.cachedPageCount}get canAddRelatedFeature(){return this.store.canAddRelatedFeature}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome(`clearPrompt`,e)}get defaultSelectionManager(){return this.store.defaultSelectionManager}get definitionExpression(){return this.store.where}set definitionExpression(e){this.store.where=e}get editingEnabled(){return super.editingEnabled}set editingEnabled(e){super.editingEnabled=e}get effectiveSelectionManager(){return this.store.effectiveSelectionManager}get effectiveMultipleSelectionEnabled(){return super.effectiveMultipleSelectionEnabled}get effectiveSize(){return super.effectiveSize}get effectiveTimeExtent(){return this.store.effectiveTimeExtent}get effectiveWhere(){return this.store.effectiveWhere}get fieldColumns(){return this.allColumns.filter(e=>z(e))}get filterByViewExtent(){return this.store.filterByViewExtent}set filterByViewExtent(e){this.store.filterByViewExtent=e}get filterByLayerScaleRange(){return this.store.filterByLayerScaleRange}set filterByLayerScaleRange(e){this.store.filterByLayerScaleRange=e}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get(`filterBySelectionEnabled`)}set filterBySelectionEnabled(e){let{objectIds:t}=this,n=t.length;e?(n&&(t.removeAll(),this._logWarning(`Selection filter has been applied with an objectID filter. Object ID filter has been removed.`)),this.filterGeometry&&this._logWarning(`Selection filter has been applied with a geometry filter. Results may appear inconsistent`),this._syncObjectIdsWithStore(this.highlightIds.toArray())):n||this._syncObjectIdsWithStore(null),this._set(`filterBySelectionEnabled`,e)}get groupColumns(){return super.groupColumns}get hasContingentValues(){return this.relatedTableHasContingentValues||this.store.hasContingentValues}get hasInvalidPendingEdits(){return this.relatedTableHasInvalidPendingEdits||this.store.hasInvalidPendingEdits}get hasPendingEdits(){return this.relatedTableHasPendingEdits||this.store.hasPendingEdits}get hiddenFields(){return this._get(`hiddenFields`)??new a}set hiddenFields(e){this._set(`hiddenFields`,o(e,this._get(`hiddenFields`),a))}get highlightEnabled(){return this.store.highlightEnabled}set highlightEnabled(e){this.store.highlightEnabled=e}get highlightIds(){return super.highlightIds}set highlightIds(e){super.highlightIds=e}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isEditing(){return super.isEditing}get isQuerying(){return super.isQuerying}get isSyncing(){return super.isSyncing}get isQueryingOrSyncing(){return this.isQuerying||this.isSyncing||this.relatedTables.some(e=>!!e.isQueryingOrSyncing)}get isSyncingAttachments(){return this.store.isSyncingAttachmentEdits||this.relatedTables.some(e=>!!e.isSyncingAttachments)}get layer(){return this._get(`layer`)}set layer(e){this.drainRelatedTables(),this._set(`layer`,e)}get layerFieldConfigurations(){let e=this.layer;return q(e)?e.fieldConfigurations:void 0}get layerView(){return this.store.layerView}get maxSize(){return super.maxSize}set maxSize(e){super.maxSize=e}get objectIds(){return super.objectIds}set objectIds(e){super.objectIds=e}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get pageCount(){return super.pageCount}get pageIndex(){return super.pageIndex}set pageIndex(e){super.pageIndex=e}get pageSize(){return super.pageSize}set pageSize(e){super.pageSize=e}get paginationEnabled(){return super.paginationEnabled}set paginationEnabled(e){super.paginationEnabled=e}get pendingEditsCount(){return this.store.pendingEditsCount}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relatedTableHasContingentValues(){return!!this.relatedTable?.hasContingentValues}get relatedTableHasInvalidPendingEdits(){return!!this.relatedTable?.hasInvalidPendingEdits}get relatedTableHasPendingEdits(){return!!this.relatedTable?.hasPendingEdits}get relationship(){return this.store.relationship}get relationshipColumns(){return this.allColumns.filter(e=>B(e))}get relationshipConfig(){return this.store.relationshipConfig}set relationshipConfig(e){this.highlightIds.removeAll(),this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e}get relationshipInfos(){let{layer:e,layers:t,relationships:n,tableController:r}=this,i=this.store.relationshipInfos;if(i.length||!J(e)||!n?.length)return i;let a=[],o=r?.layers||t||[];return n.forEach(t=>{let n=ee(e,o,t);n&&(n.load().catch(()=>{}),a.push({layer:e,relatedLayer:n,relationshipId:t.id}))}),a}get relationships(){return this.store.relationships}get returnGeometryEnabled(){return this.store.returnGeometry}set returnGeometryEnabled(e){this.store.returnGeometry=e}get returnMEnabled(){return this.store.returnM}set returnMEnabled(e){this.store.returnM=e}get returnZEnabled(){return this.store.returnZ}set returnZEnabled(e){this.store.returnZ=e}get rowHighlightIds(){return super.rowHighlightIds}set rowHighlightIds(e){super.rowHighlightIds=e}get selectionManager(){return this.store.selectionManager}set selectionManager(e){this.store.selectionManager=e}get selectionSource(){return`table`}set selectionSource(e){this.syncViewSelection=e===`view`,this._overrideIfSome(`selectionSource`,e)}get showAllRelatedTables(){return this._get(`showAllRelatedTables`)}set showAllRelatedTables(e){let{relatedTable:t}=this;this._set(`showAllRelatedTables`,e),t&&(e?this._showAllRelatedTables(t):this._hideAllRelatedTables(t))}get showPrompt(){return e=>{this.prompt?.cancel?.(),this.prompt=e}}set showPrompt(e){this._overrideIfSome(`showPrompt`,e)}get size(){return super.size}get state(){return super.state}get supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){let{store:{supportsAddAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){return this.supportsUpdateAttachments}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){let{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get syncViewSelection(){return this.store.syncViewSelection}set syncViewSelection(e){this.store.syncViewSelection=e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this.store.timeZone}set timeZone(e){this.store.timeZone=e}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach(t=>t.view=e),this.refreshCellContent()}get viewTimeEnabled(){return this.store.viewTimeEnabled}set viewTimeEnabled(e){this.store.viewTimeEnabled=e}get visibleColumns(){return super.visibleColumns}async addAttachment(e,t){let{attachmentsViewOptions:n,store:r}=this,i=n.objectId===e;await r.addAttachment(e,t).catch(e=>{i&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),n.error=e.error)}),i&&!n.error&&(n.onEditComplete(),n.attachmentInfos=await r.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}addPendingEdits(e){this.store.addPendingEdits(e)}collapseRelatedTable(e,t){let{relatedLayer:n,objectId:r,relationshipId:i}=t,{objectIdField:o}=n,s=te(n,i),c=n.displayField||s?.keyField||o;e.set({highlightIds:new a([r]),multipleSelectionEnabledOverride:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,c,i)});let l=e.hiddenFields;l.includes(Y.action)||l.add(Y.action),l.includes(Y.attachments)||l.add(Y.attachments),e.scrollLeft()}async deleteAttachments(e,t){let{attachmentsViewOptions:n,store:r}=this,i=n.objectId===e;await r.deleteAttachments(e,t).catch(e=>{i&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),n.error=e.error)}),i&&!n.error&&(n.onEditComplete(),n.attachmentInfos=await r.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteSelection(){let e=this.highlightIds.toArray();if(!e?.length)return;let{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),n=t.filter(e=>!e.error).map(e=>e.objectId);n.length&&(this.highlightIds.removeMany(n),await this.refresh())}async discardPendingEdits(e){return this.relatedTable&&this.relatedTableHasPendingEdits?this.relatedTable.discardPendingEdits(e):(this.store.discardPendingEdits(e),!0)}async downloadAttachmentById(e,t){let n=(await this.store.getAttachmentsByObjectId(e,!0)).find(e=>e.id===t);await V(n)}drainRelatedTables(){this.relatedTables.drain(e=>e.destroy()),this.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([Y.action,Y.attachments])}drainRelatedTablesAboveIndex(e){let{relatedTables:t}=this,n=t.slice(e+1);t.removeMany(n).forEach(e=>e.destroy());let r=t.at(-1);r&&(r.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(r):this._hideAllRelatedTables(r))}async exportSelectionToCSV(e){let{highlightIds:t,layer:n,outFields:r}=this;!n||!t.length?this._logWarning(`Export failed.`):await H({layer:n,objectIds:t.toArray(),outFields:r,includeGeometry:e})}getCachedFeaturesByPageIndex(e){return this.store.getCachedFeaturesByPageIndex(e)}getFeatureStoreItemByObjectId(e){return this.store.getItemByObjectId(e)}async getFeatureTitle(e,t){return this.store.getFeatureTitle(e,t)}getFeatureTitleSync(e){let t=this.layer;if(!t)return`${e}`;let n=`${t.objectIdField}: ${e}`;return e==null?n:this.store.featureTitleMap.get(e)??n}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){return this.getFeatureStoreItemByObjectId(e)?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(e==null||!Number.isInteger(e)){this._logWarning(`Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.`);return}let{pageCount:t}=this;(e>=t||e===-1)&&(e=t-1),e<-1&&(e=0),e!==this.pageIndex&&(this.pageIndex=e),this.paginationEnabled||this.scrollToIndex(e*this.pageSize)}hideAttachmentsView(){this.attachmentsViewOptions.objectId=null,this.set({relationshipColumnConfigs:null,multipleSelectionEnabledOverride:null,tableTemplateOverride:null}),this.hiddenFields.remove(Y.action)}nextPage(){let e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){let e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){await Promise.all([...this.relatedTables.map(e=>e.refresh()),u(this._refreshDebounced())])}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await this.grid?.reset()}async savePendingEdits(){this.relatedTableHasPendingEdits&&!this.relatedTableHasInvalidPendingEdits?await this.relatedTable?.savePendingEdits():this.hasPendingEdits&&!this.relatedTable&&(await this.store.savePendingEdits(),await this.refresh())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){let t=this.store.getItemIndexByObjectId(e);t>-1?this.grid?.scrollToIndex(t):this._logWarning(`Row not found. Associated data may not be loaded yet.`)}scrollToTop(){this.grid?.scrollToTop()}async saveAttachmentsViewForm(){let{attachmentId:e,form:t,objectId:n}=this.attachmentsViewOptions;n!=null&&t&&(e==null?await this.addAttachment(n,t):await this.updateAttachment(n,e,t))}async showAttachmentsView({objectId:e}){let{attachmentsViewOptions:t,hiddenFields:n,layer:r}=this;if(!this.attachmentsEnabled||!r){this._logWarning(`The 'attachmentsEnabled' property is currently false.`);return}await r.load();let i=this._getDefaultLayerDisplayField(r),o=await this.store.getAttachmentsByObjectId(e,!0),s=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:o,mode:o.length?`list`:`file`,objectId:e}),this.set({highlightIds:new a([e]),multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(i)}),n.includes(Y.action)||n.add(Y.action),s!=null&&this.scrollToIndex(s)}syncAttributeTableTemplate(){this._syncAttributeTableTemplate(!0)}syncSelectionSources(){this.store.syncSelectionSources()}async updateAttachment(e,t,n){let{attachmentsViewOptions:r,store:i}=this,a=r.objectId===e;await i.updateAttachment(e,t,n).catch(e=>{a&&e&&typeof e==`object`&&`error`in e&&e.error instanceof s&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),r.error=e.error)}),a&&!r.error&&(r.onEditComplete(),r.attachmentInfos=await i.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){let{layer:e,view:t}=this,n=this.highlightIds.toArray();if(!e||!t||!n.length)return;let r=e.createQuery();r.objectIds=n,r.returnGeometry=!0;let i=await e.queryFeatures(r);try{await ae(t,i.features)}catch(e){e.name!==`AbortError`&&console.error(e)}}_syncAttributeTableTemplate(e=!1){let{_effectiveAttributeTableTemplate:t,layer:n,tableTemplateOverride:r,syncTemplateOnChangesEnabled:i}=this;if(!n||!t||!i&&!e||r||this.tableParent||this.relatedTable||this.attachmentsViewOptions.objectId!==null)return;let a=JSON.stringify(t.toJSON());T(t,this.columns.toArray(),this.activeSortOrders),t===n.attributeTableTemplate&&JSON.stringify(t.toJSON())!==a&&(n.attributeTableTemplate=t.clone())}async _refresh(){await super.refresh();let e=this.highlightIds.toArray();e.length&&(await this.store.verifyFeaturesByObjectId(e)).forEach((t,n)=>{t||this.highlightIds.remove(e[n])}),this.refreshPageCache();let t=this.attachmentsViewOptions;t?.objectId!=null&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){let{layer:e,pageSize:t}=this;if(!e)return;e.parent&&S(e.parent)&&await e.parent.loadAll();let n=e.capabilities.query?.maxRecordCount,r=n&&n<t,i=r?n:t;r&&(this._logWarning(`The value for 'pageSize' has been adjusted due to the provided layer's max record count.`),this.pageSize=i),this.grid?.set(`pageSize`,i);try{this._generateColumns(),await this.store.load(),this.refreshPageCache()}catch{c.getLogger(this).error(`Unable to load the provided layer.`)}}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();let{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t,layer:n}=this,r=e?.columnTemplates;if(!n)return;let i=this._generateColumnsFromColumnTemplates(n,r)??this._generateColumnsFromAttributeTableTemplate(n,t)??this._generateDefaultFieldColumns(n);i.length&&(this.attachmentsEnabled&&!i.some(e=>R(e))&&i.push(this._generateDefaultAttachmentsColumn(n)),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!i.some(e=>B(e))&&i.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&i.push(this._generateActionColumn()),i.sort((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0),this.columns.addMany(i))}_generateColumnsFromAttributeTableTemplate(e,t){if(!t)return null;let{elements:n,orderByFields:r}=t,a=C(e),o=[];o.push(...this._generateColumnsFromAttributeTableElements(e,n,r));let s=a.map(t=>{if(!t.fieldName||ne(t.fieldName,o))return null;let{fieldName:n}=t,i=X(e,n);return i?this._generateDefaultFieldColumn(e,i,{hidden:!0,orderByFields:r}):(this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`),null)}).filter(i);return o.push(...s),this.attachmentsEnabled&&re(e)&&!o.some(e=>R(e))&&o.push(this._generateDefaultAttachmentsColumn(e,{hidden:!0})),this.relatedRecordsEnabled&&J(e)&&e.relationships?.forEach(({id:e},t)=>{let n=this.relationshipInfos.find(t=>t.relationshipId===e);n&&!o.some(t=>B(t)&&t.relationshipId===e)&&o.push(this._generateDefaultRelationshipColumn({hidden:!0,info:n,index:t}))}),o.length?o:null}_generateColumnsFromAttributeTableElements(e,t,n){return t?.map((t,r)=>{switch(t.type){case`field`:return this._createFieldColumnFromElement({layer:e,element:t,orderByFields:n});case`group`:return this._createGroupColumnFromElement({layer:e,element:t,orderByFields:n});case`attachment`:return this._createAttachmentColumnFromElement({layer:e,element:t,index:r});case`relationship`:return this._createRelationshipColumnFromElement({element:t,index:r})}}).filter(e=>!!e)??[]}_createFieldColumnFromElement(e){let{layer:t,element:n,orderByFields:r}=e,{fieldName:i}=n;if(i==null)return this._logTemplateWarning(`A valid 'fieldName' must be provided.`),null;let a=X(t,i);if(!a)return this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`),null;let{description:o,label:s}=n,c=r?.findIndex(({field:e})=>e&&e===i)??-1,l=c>-1?r?.at(c)?.order:void 0,u=c>-1?c:void 0,{grid:d,messages:f,messagesCommon:p,messagesURIUtils:m,store:h,view:g}=this;return new A({description:o,direction:l,field:a,fieldName:i,grid:d,initialSortPriority:u,label:s,layer:t,messages:f,messagesCommon:p,messagesURIUtils:m,store:h,view:g,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){let{layer:t,element:n,orderByFields:r}=e,{description:i,label:a}=n;if(!a)return this._logTemplateWarning(`Group columns require a label.`),null;if(!n.elements.length)return this._logTemplateWarning(`Group columns require child columns.`),null;let{grid:o,messages:s,messagesCommon:c,messagesURIUtils:l,store:u}=this;return new F({columns:this._generateColumnsFromAttributeTableElements(t,n.elements,r),description:i,grid:o,label:a,messages:s,messagesCommon:c,messagesURIUtils:l,store:u})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled){this._logTemplateWarning(`The 'attachmentsEnabled' property is currently false.`);return}let{layer:t,element:n,index:r}=e,{description:i,label:a}=n,{grid:o,messages:s,messagesCommon:c,messagesURIUtils:l,store:u}=this;return new k({description:i,fieldName:`${Y.attachments}-${r}`,grid:o,label:a,layer:t,messages:s,messagesCommon:c,messagesURIUtils:l,store:u,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled){this._logTemplateWarning(`Relationship columns require related records to be enabled on the table.`);return}let{element:t,index:n}=e,{description:r,label:i,relationshipId:a}=t,o=this.relationshipInfos.find(e=>e.relationshipId===a);if(!o)return this._logTemplateWarning(`Unable to find valid related layer target based on the provided relationship id.`),null;let{grid:s,messages:c,messagesCommon:l,messagesURIUtils:u,store:d}=this;return new j({description:r,fieldName:`${Y.relationship}-${a}-${n}`,grid:s,label:i,messages:c,messagesCommon:l,messagesURIUtils:u,relationshipId:a,store:d,layer:o.relatedLayer,relatedLayer:o.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e,t){let{grid:n,messages:r,messagesCommon:i,messagesURIUtils:a,store:o,view:s}=this;if(!t?.length)return null;let c=[];return t.forEach((t,l)=>{let{autoWidth:u,description:d,direction:f,flexGrow:p,fieldName:m,formatFunction:h,frozen:g,frozenToEnd:_,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,menuConfig:w,resizable:T,sortable:E,textAlign:D,textWrap:O,timeZone:k,type:j,width:N}=t;if(!j){this._logTemplateWarning(`Property 'type' is missing from the provided template.`);return}if(g&&_){this._logTemplateWarning(`Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.`);return}let P=t.visible===!1;if(j===`group`){if(!t.columnTemplates?.length){this._logTemplateWarning(`Group columns must contain column templates.`);return}if(!t.label){this._logTemplateWarning(`Group columns require a label.`);return}let o=this._generateColumnsFromColumnTemplates(e,t.columnTemplates),s=P||this._isFieldHidden(t.label);c.push(new F({autoWidth:u,columns:o,description:d,flexGrow:p,frozen:g,frozenToEnd:_,grid:n,hidden:s,icon:v,iconText:y,invalid:x,label:S,labelTooltipText:C,menuConfig:w,messages:r,messagesCommon:i,messagesURIUtils:a,resizable:T,textAlign:D,textWrap:O,timeZone:k,width:N}))}else if(j===`attachment`){if(!this.attachmentsEnabled){this._logTemplateWarning(`Attachment columns require attachments to be enabled on the table.`);return}c.push(this._generateAttachmentsColumnFromTemplate(e,t,l))}else if(j===`relationship`){if(!this.relatedRecordsEnabled){this._logTemplateWarning(`Relationship columns require related records to be enabled on the table.`);return}let{relationshipId:e}=t;if(e==null){this._logTemplateWarning(`Property 'relationshipId' is missing from the provided template.`);return}let n=this.relationshipInfos.find(t=>t.relationshipId===e);if(!n){this._logTemplateWarning(`Unable to find valid related layer target based on the provided relationship id.`);return}c.push(this._generateRelationshipColumnFromTemplate(n,t,l))}else if(!m){this._logTemplateWarning(`Value for 'fieldName' property was missing from the provided template.`);return}let I=P||this._isFieldHidden(m);if(j===`column`)c.push(new M({autoWidth:u,description:d,direction:f,fieldName:m,flexGrow:p,formatFunction:h,frozen:g,frozenToEnd:_,grid:n,hidden:I,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,menuConfig:w,messages:r,messagesCommon:i,messagesURIUtils:a,resizable:T,sortable:E,store:o,textAlign:D,textWrap:O,timeZone:k,width:N}));else if(j===`field`){let l=X(e,t.fieldName);if(!l){this._logTemplateWarning(`A valid 'field' could not be found for the provided template.`);return}let{editable:m,required:j}=t;c.push(new A({autoWidth:u,description:d,direction:f,editable:m,field:l,fieldName:l.name,flexGrow:p,formatFunction:h,frozen:g,frozenToEnd:_,grid:n,hidden:I,icon:v,iconText:y,initialSortPriority:b,invalid:x,label:S,labelTooltipText:C,layer:e,messages:r,messagesCommon:i,messagesURIUtils:a,menuConfig:w,required:j,resizable:T,sortable:E,store:o,template:t,textAlign:D,textWrap:O,timeZone:k,width:N,view:s,onShowPromptCallback:this._onShowPromptCallback}))}}),c.length?c:null}_generateDefaultFieldColumns(e){return e.fields?.map(t=>this._generateDefaultFieldColumn(e,t)).filter(i)??[]}_generateDefaultFieldColumn(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s,view:c}=this;if(!t.visible||t.type===`geometry`)return null;let l=n?.orderByFields,u=t.name,d=l?.findIndex(({field:e})=>e&&e===u)??-1,f=d>-1?l?.at(d)?.order:void 0,p=d>-1?d:void 0;return new A({direction:f,field:t,fieldName:u,grid:r,hidden:n?.hidden||this._isFieldHidden(u),initialSortPriority:p,layer:e,messages:i,messagesCommon:a,messagesURIUtils:o,store:s,view:c,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s}=this,{attachmentsViewEnabled:c,autoWidth:l,description:u,flexGrow:d,fieldName:f,formatFunction:p,frozen:m,frozenToEnd:h,icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,resizable:S,textAlign:C,textWrap:w,thumbnailAppearance:T,thumbnailCount:E,thumbnailIconScale:D,thumbnailsEnabled:O,timeZone:A,width:j}=t;return new k({attachmentsViewEnabled:c,autoWidth:l,description:u,fieldName:`${Y.attachments}-${n}`,flexGrow:d,formatFunction:p,frozen:m,frozenToEnd:h,grid:r,hidden:t.visible===!1||this._isFieldHidden(y)||this._isFieldHidden(f),icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,layer:e,menuConfig:x,messages:i,messagesCommon:a,messagesURIUtils:o,resizable:S,store:s,textAlign:C,textWrap:w,thumbnailAppearance:T,thumbnailCount:E,thumbnailIconScale:D,thumbnailsEnabled:O,timeZone:A,width:j,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e,t){let{grid:n,messages:r,messagesCommon:i,messagesURIUtils:a,store:o}=this,s=Y.attachments;return new k({fieldName:s,grid:n,hidden:t?.hidden||this._isFieldHidden(s),layer:e,messages:r,messagesCommon:i,messagesURIUtils:a,store:o,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,n){let{grid:r,messages:i,messagesCommon:a,messagesURIUtils:o,store:s}=this,{autoWidth:c,collapsed:l,description:u,flexGrow:d,fieldName:f,formatFunction:p,frozen:m,frozenToEnd:h,icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,relationshipId:S,resizable:C,textAlign:w,textWrap:T,timeZone:E,width:D}=t;return new j({autoWidth:c,collapsed:l,description:u,fieldName:`${Y.relationship}-${S}-${n}`,flexGrow:d,formatFunction:p,frozen:m,frozenToEnd:h,grid:r,hidden:t.visible===!1||this._isFieldHidden(y)||this._isFieldHidden(f),icon:g,iconText:_,invalid:v,label:y,labelTooltipText:b,menuConfig:x,messages:i,messagesCommon:a,messagesURIUtils:o,relationshipId:S,resizable:C,store:s,textAlign:w,textWrap:T,timeZone:E,width:D,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){let{relationshipInfos:e,relationshipColumnConfigs:t}=this,n=[];return e?.length&&(t?t.forEach((t,r)=>{let{relationshipId:i}=t,a=e.find(e=>e.relationshipId===i);a&&n.push(this._generateDefaultRelationshipColumn({config:t,index:r,info:a}))}):e.forEach((e,t)=>n.push(this._generateDefaultRelationshipColumn({index:t,info:e})))),n}_generateDefaultRelationshipColumn(e){let{config:t,hidden:n,index:r,info:i}=e,{grid:a,messages:o,messagesCommon:s,messagesURIUtils:c,store:l}=this,{relationshipId:u}=i;return new j({...t,fieldName:`${Y.relationship}-${u}-${r}`,grid:a,hidden:!!n,messages:o,messagesCommon:s,messagesURIUtils:c,layer:i.relatedLayer,relatedLayer:i.layer,relationshipId:u,store:l,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){let e=this.actionColumnConfig,t=e?.frozen===!0?!1:e?.frozenToEnd??!0;return new O({hidden:this._isFieldHidden(Y.action),store:this.store,...e,frozenToEnd:t})}_isFieldHidden(e){let t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some(e=>e.toLowerCase()===t)}_syncSelection(){let{layer:e}=this;D(e)?this.highlightIds.items=this.effectiveSelectionManager.getSelection(e)??[]:this.highlightIds.removeAll()}_addToSelection(e){let t=this.layer;D(t)&&this.effectiveSelectionManager.add(t,e)}_removeFromSelection(e){let t=this.layer;D(t)&&this.effectiveSelectionManager.remove(t,e)}async _onHighlightIdsChange(e){let{added:t,removed:n}=e,{attachmentsViewOptions:r}=this;if(this._removeFromSelection(n),this._addToSelection(t),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),r.objectId!=null){let e=this.highlightIds.at(0);if(e!=null){let t=await this.store.getAttachmentsByObjectId(e,!0);r.set({attachmentInfos:t,objectId:e,mode:t.length?`list`:`file`}),this.getFeatureTitle(e)}}}_syncTableParentSelection(e){let{tableParent:t}=this;t&&e!=null&&t.highlightIds.add(e)}_onShowRelatedTable(e){let{highlightIds:t}=this,{objectId:n}=e;t.removeAll(),t.add(n),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit(`show-related-table`,e)}_onObjectIdsChange(){let e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning(`Object ID filter was applied while a selection filter was applied. Selection filter has been removed.`)),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.refreshPageCache()}_drainColumns(){this.columns.drain(e=>!e.destroyed&&e.destroy())}_showAllRelatedTables(e){let t=e.layer;if(!t)return;let n=this._getDefaultLayerDisplayField(t);e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,n)});let r=e.hiddenFields;r.includes(Y.action)||r.add(Y.action),r.includes(Y.attachments)||r.add(Y.attachments)}_hideAllRelatedTables(e){let{layer:t,relationship:n}=e;if(t&&n?.id!=null){if(e.attachmentsViewOptions.objectId!=null){let n=this._getDefaultLayerDisplayField(t);e.set({multipleSelectionEnabledOverride:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(n)})}else e.set({multipleSelectionEnabledOverride:null,relationshipColumnConfigs:ie(t,n.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([Y.action,Y.attachments])}}_getTableTemplateForRelatedTableView(e,t,n){return new K({columnTemplates:[new W({fieldName:t,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([r,i])=>({selected:r===t,label:i||r,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,r,n)}}))},resizable:!1}),new G({autoWidth:!1,collapsed:!0,flexGrow:0,label:``,resizable:!1,relationshipId:n,width:Q})]})}_getTableTemplateForShowAllTablesView(e,t){let n=[new W({fieldName:t,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map(([n,r])=>({selected:n===t,label:r||n,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,n)}}))},resizable:!1})];return e.attachmentsViewOptions.objectId!=null&&n.push(new I({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:``,resizable:!1,thumbnailsEnabled:!1,width:Q})),new K({columnTemplates:n})}async _onShowPromptCallback(e){let{column:t,objectId:n,oldValue:r,value:i}=e,{_subtypes:a,layer:o}=this;if(!o||!a.length){t.cancel();return}let s=a.find(e=>e.code===i);if(!s){t.cancel();return}let c=Promise.withResolvers(),l=this._createSubtypeEditPrompt(r,s,c),u=!!o.parent&&this.autoSaveEnabled;try{this.showPrompt(l);let e=await c.promise,r=[{fieldName:t.fieldName,value:i}];switch(e){case`update-fields`:for(let[e,t]of Object.entries(s.defaultValues))t!=null&&r.push({fieldName:e,value:t});await t.updateItems({objectId:n,updates:r}),u&&this.refresh();break;case`keep-existing`:await t.updateItems({objectId:n,updates:r}),u&&this.refresh();break;case`undo`:t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,r){let{_subtypes:i,messages:a,messagesCommon:o}=this,s=i.find(t=>t.code===e)?.name??`${e}`,c=`update-fields`,l=[{label:a.subtypes.useDefaultValuesOption,value:`update-fields`},{label:a.subtypes.keepCurrentValuesOption,value:`keep-existing`}];return{context:`info`,title:a.subtypes.changeWarningTitle,message:n(a.subtypes.changeWarning,{originalType:s,newType:t.name}),radios:l,defaultRadioSelection:`update-fields`,onRadioSelection:e=>{c=e},actions:{primary:{label:o.apply,action:()=>r.resolve(c),type:`positive`},secondary:{label:o.cancel,type:`neutral`,action:()=>r.resolve(`undo`)}},cancel:()=>r.reject()}}_onShowAttachments({objectId:e}){this.hasPendingEdits||(this.attachmentsViewOptions.objectId=e)}_getTableTemplateForAttachmentsView(e){return new K({columnTemplates:[new W({fieldName:e,editable:!1,menuConfig:{selectionMode:`single`,icon:`chevron-down`,items:this._extractFieldColumnInfosFromTableTemplate(this).map(([t,n])=>({selected:t===e,label:n||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}}))},resizable:!1}),new I({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:``,resizable:!1,thumbnailsEnabled:!1,width:Q})]})}_extractFieldColumnInfosFromTableTemplate(e){let{layer:t,tableTemplate:n}=e??this;return n?n.columnTemplates.filter(({type:e})=>e===`field`||e===`column`).map(({fieldName:e,label:n})=>{if(n!=null&&n!==``)return[e,n];let r=t?.fieldsIndex.get(e);return[e,r&&v(r,t)]}):t?.fields.map(e=>[e.name,v(e,t)])??[]}_getDefaultLayerDisplayField(e){let{displayField:t,objectIdField:n}=e;return e.fieldsIndex.get(t)?.name||n||(e.fields.length?e.fields[0].name:``)}_getIndexOfFirstFrozenToEndColumn(){let e=this.columns.findIndex(e=>e.frozenToEnd);return e>-1?e:void 0}_logWarning(e,t){t?c.getLogger(this).warnOnce(e):c.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){e!=null&&this.attachmentsViewOptions.objectId!=null&&this.highlightIds.add(e)}};e([g()],$.prototype,`_defaultHiddenFields`,null),e([g()],$.prototype,`_effectiveTableTemplate`,null),e([g()],$.prototype,`_effectiveAttributeTableTemplate`,null),e([g()],$.prototype,`_subtypes`,null),e([g()],$.prototype,`activeFilters`,null),e([g({readOnly:!0})],$.prototype,`activeSortOrders`,null),e([g()],$.prototype,`allRelatedTablesVisible`,null),e([g()],$.prototype,`attachmentsColumns`,null),e([g()],$.prototype,`attachmentsEnabled`,null),e([g()],$.prototype,`attachmentsViewOptions`,void 0),e([g({type:w})],$.prototype,`attributeTableTemplate`,void 0),e([g()],$.prototype,`autoRefreshEnabled`,void 0),e([g()],$.prototype,`autoSaveEnabled`,null),e([g()],$.prototype,`cachedPageCount`,null),e([g()],$.prototype,`canAddRelatedFeature`,null),e([g()],$.prototype,`clearPrompt`,null),e([g({readOnly:!0})],$.prototype,`columns`,void 0),e([g()],$.prototype,`dataProvider`,void 0),e([g()],$.prototype,`defaultSelectionManager`,null),e([g()],$.prototype,`definitionExpression`,null),e([g()],$.prototype,`effectiveSelectionManager`,null),e([g()],$.prototype,`effectiveTimeExtent`,null),e([g()],$.prototype,`effectiveWhere`,null),e([g()],$.prototype,`fieldColumns`,null),e([g()],$.prototype,`filterByViewExtent`,null),e([g()],$.prototype,`filterByLayerScaleRange`,null),e([g({types:y})],$.prototype,`filterGeometry`,null),e([g()],$.prototype,`filterBySelectionEnabled`,null),e([g({readOnly:!0})],$.prototype,`grid`,void 0),e([g()],$.prototype,`hasContingentValues`,null),e([g()],$.prototype,`hasInvalidPendingEdits`,null),e([g()],$.prototype,`hasPendingEdits`,null),e([g()],$.prototype,`hiddenFields`,null),e([g()],$.prototype,`highlightEnabled`,null),e([g()],$.prototype,`initialSize`,null),e([g()],$.prototype,`isQueryingOrSyncing`,null),e([g()],$.prototype,`isSyncingAttachments`,null),e([g()],$.prototype,`layer`,null),e([g()],$.prototype,`layers`,void 0),e([g()],$.prototype,`layerFieldConfigurations`,null),e([g()],$.prototype,`layerView`,null),e([g()],$.prototype,`menuConfig`,void 0),e([g()],$.prototype,`messages`,void 0),e([g(),Z(`esri/t9n/common`)],$.prototype,`messagesCommon`,void 0),e([g(),Z(`esri/core/t9n/Units`)],$.prototype,`messagesUnits`,void 0),e([g(),Z(`esri/widgets/support/t9n/uriUtils`)],$.prototype,`messagesURIUtils`,void 0),e([g()],$.prototype,`outFields`,null),e([g()],$.prototype,`pendingEditsCount`,null),e([g()],$.prototype,`prompt`,void 0),e([g()],$.prototype,`relatedRecordsEnabled`,null),e([g()],$.prototype,`relatedTable`,null),e([g()],$.prototype,`relatedTableHasContingentValues`,null),e([g()],$.prototype,`relatedTables`,void 0),e([g()],$.prototype,`relationship`,null),e([g()],$.prototype,`relationshipColumnConfigs`,void 0),e([g()],$.prototype,`relationshipColumns`,null),e([g()],$.prototype,`relationshipConfig`,null),e([g()],$.prototype,`relationshipInfos`,null),e([g()],$.prototype,`relationships`,null),e([g()],$.prototype,`returnGeometryEnabled`,null),e([g()],$.prototype,`returnMEnabled`,null),e([g()],$.prototype,`returnZEnabled`,null),e([g()],$.prototype,`selectionManager`,null),e([g()],$.prototype,`selectionSource`,null),e([g()],$.prototype,`showAllRelatedTables`,null),e([g()],$.prototype,`showPrompt`,null),e([g()],$.prototype,`showRelatedTableCallback`,void 0),e([g({readOnly:!0,type:U})],$.prototype,`store`,void 0),e([g()],$.prototype,`supportsAttachments`,null),e([g()],$.prototype,`supportsAddAttachments`,null),e([g()],$.prototype,`supportsDeleteAttachments`,null),e([g()],$.prototype,`supportsResizeAttachments`,null),e([g()],$.prototype,`supportsUpdateAttachments`,null),e([g()],$.prototype,`syncTemplateOnChangesEnabled`,void 0),e([g()],$.prototype,`syncViewSelection`,null),e([g()],$.prototype,`tableController`,void 0),e([g()],$.prototype,`tableParent`,void 0),e([g({type:K})],$.prototype,`tableTemplate`,void 0),e([g()],$.prototype,`tableTemplateOverride`,void 0),e([g({type:E})],$.prototype,`timeExtent`,null),e([g()],$.prototype,`timeZone`,null),e([g()],$.prototype,`view`,null),e([g()],$.prototype,`viewTimeEnabled`,null),$=e([_(`esri.widgets.FeatureTable.FeatureTableViewModel`)],$);const oe=$;export{oe as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{types as r}from"../../../form/elements/inputs.js";const i=i=>{let a=i,o=class extends a{constructor(){super(...arguments),this.editable=!0,this.hint=null,this.input=null,this.required=!1}};return e([t({type:Boolean,json:{write:!0}})],o.prototype,`editable`,void 0),e([t({type:String,json:{write:!0}})],o.prototype,`hint`,void 0),e([t({types:r,json:{read:{source:`inputType`},write:{target:`inputType`}}})],o.prototype,`input`,void 0),e([t()],o.prototype,`required`,void 0),o=e([n(`esri.widgets.FeatureTable.support.EditableColumnTemplateMixin`)],o),o};export{i as EditableColumnTemplateMixin};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import{types as r}from"../../../form/elements/inputs/inputUtils.js";const i=i=>{let a=i,o=class extends a{constructor(){super(...arguments),this.editable=!0,this.hint=null,this.input=null,this.required=!1}};return e([t({type:Boolean,json:{write:!0}})],o.prototype,`editable`,void 0),e([t({type:String,json:{write:!0}})],o.prototype,`hint`,void 0),e([t({types:r,json:{read:{source:`inputType`},write:{target:`inputType`}}})],o.prototype,`input`,void 0),e([t()],o.prototype,`required`,void 0),o=e([n(`esri.widgets.FeatureTable.support.EditableColumnTemplateMixin`)],o),o};export{i as EditableColumnTemplateMixin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./
|
|
2
|
+
import{generateCombinationsPanoramic as e,generateCombinations as t}from"./imageMeasurementWorkerUtils.js";function n(e){return t(e.imageToWorldProps,e.accuracyParameters,e.cameraHeading)}function r(t){return e(t.imageToWorldProps,t.accuracyParameters)}export{r as generateCombinationsPanoramicWorker,n as generateCombinationsWorker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as n}from"../../../../core/asyncUtils.js";import{EsriPromise as r}from"../../../../core/Promise.js";import{isAbortError as i,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{load as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import f from"../../../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as p,convertPixelToHeadingPitch as m,convertHeadingPitchToSphereVertex as h}from"../../../../layers/orientedImagery/transformations/utils.js";import{getMeasurementProperties as g,getMeasurementPropertiesPanoramic as _,pixelAreaMeasurement2D as v,pixelAreaMeasurementPanoramic as y,pixelDistanceMeasurement2D as b,pixelDistanceMeasurementPanoramic as x,getPixelLocationFromSphereVertices as S,formatPixels as C,imageToImageTransform as w,imageToImageTransformPanoramic as T}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as E}from"../../utils.js";import{SketchHandlerMixin as D}from"../../mixins/SketchHandlerMixin.js";import O from"../../../Sketch/SketchViewModel.js";let k=[],A=[],j=0,M=class extends D(r){constructor(e){super(e),this.type=`measurement`,this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(u())}async handleCreate(e){try{let t=e.toolEventInfo;switch(e.tool){case`polyline`:await this.handlePolylineEvents(e,t);break;case`polygon`:await this.handlePolygonEvents(e,t)}}catch(e){if(!i(e))throw e}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}async calculateAreaMeasurement(e,t,n){if(e.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize||this.viewModel.mode===`none`)return null;let r=t==="default"?await g(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent):await _(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent);return a(n),r?t==="default"?await v(e,r,!0):await y(e,r,!0,n):null}async calculateDistanceMeasurement(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel;if(e.length<2||!r||!i?.imageSize||t===`none`)return null;let o=t==="default"?await g(r,i?.imageSize,this.viewModel.footprintExtent):await _(r,i?.imageSize,this.viewModel.footprintExtent);return a(n),o?t==="default"?await b([e.at(0),e.at(-1)],o,!0):await x([e.at(0),e.at(-1)],o,!0):null}cursorUpdatePolylineHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;if(t==="default")this.measurementArray.push(e.coordinates);else{let t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},r=p(t,n.imageSize[0],n.imageSize[1]);this.measurementArray.push([r.x,r.y])}let r=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=r}async cursorUpdatePolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;let r=e.coordinates;if(k=[...this.polygonVertices],t==="default")k.push(r);else{let e={x:r[0],y:r[1],z:r[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);k.push([t.x,t.y])}if(k.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let i=k[0];k=k.filter((e,t)=>t===0||t===k.length-1||JSON.stringify(e)!==JSON.stringify(i));let a=await this._getAreaFromTask(k);a?.area&&a?.perimeter&&(j=a.area)}async handlePolylineEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a}=this.viewModel,o=!this.viewModel.accuracyParametersMissing;if(e.state===`cancel`){this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[];return}if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.paths[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetDistanceMeasurements();return}switch(t?.type){case`cursor-update`:this.cursorUpdatePolylineHandler(t);break;case`vertex-add`:if(this.measurementArray.length&&o){let e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}let s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a,accuracyParametersMissing:o}=this.viewModel;if(e.state===`cancel`)this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0;else if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),!o&&!this.viewModel.triangularMeasurementActive){let e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e||this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.rings[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetAreaMeasurements()}else{switch(t?.type){case`vertex-add`:await this.vertexAddPolygonHandler(t);break;case`cursor-update`:await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=j>0?j:this.pixelAreaMeasurement}}async vertexAddPolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel,r=e.added,i=r[r.length-1];if(!Array.isArray(i)||t===`none`||!n?.imageSize)return;if(t==="default")this.polygonVertices.push(i);else{let e={x:i[0],y:i[1],z:i[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let a=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter((e,t)=>t===0||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(a));let o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;let{area:s}=o;this.pixelAreaMeasurement=s}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);let e=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&A.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,A=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,j=0}async _editOverlayedGraphics(e){this.viewModel.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.viewModel.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.viewModel.sketchTriangularGraphicsLayer.add(e),this.viewModel.sketchTriangular||(this._initializeSketchTriangular(),await this._loadTriangulatedMeasurementAdapter()),this._updateOverlayedGeometry(e)}_handleDestroyedTriangularSketchLayer(){this.viewModel.sketchTriangularGraphicsLayer&&this.viewModel.activeTriangulatedViewer&&(this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangular&&(this.viewModel.sketchTriangular.layer=this.viewModel.sketchTriangularGraphicsLayer,this.viewModel.sketchTriangular.view=this.viewModel.activeTriangulatedViewer.imageRenderer))}_initializeSketchTriangular(){if(!this.viewModel.activeTriangulatedViewer)return;let e=this.viewModel.mode===`panoramic`;this.viewModel.sketchTriangular=new O({view:this.viewModel.activeTriangulatedViewer.imageRenderer,layer:this.viewModel.sketchTriangularGraphicsLayer,updateOnGraphicClick:!0,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.viewModel.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:`offset`,shapeOperation:`move-xy`,vertexOperation:`move-xy`})}_initializeSketchTriangularGraphicsLayer(){this.viewModel.activeTriangulatedViewer&&(this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer))}async _overlayFirstMeasurement(e,t){switch(t){case`polyline`:await this._overlayFirstDistanceMeasurement(e);break;case`polygon`:await this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,activeViewer:a,footprintExtent:o,currentBestFeatureMeasurementImage:s}=this.viewModel,c=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=[...c.paths[0]],m=E(r?.media),h=n==="default";if(n===`none`||n===`video`||!f||!i||!a?.imageSize||!s)return;let v=h?p:S(p,f,m),y=h?C(v,!0):v,b=h?await g(i,a?.imageSize,o):await _(i,a?.imageSize,o),x=h?await g(s,this.viewModel.imageMeasurementViewer?.imageSize,o):await _(s,this.viewModel.activeTriangulatedViewer?.imageSize,o);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,2).map(e=>P(e,f,m)),i=new l({paths:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _overlayFirstAreaGeometry(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,currentBestFeatureMeasurementImage:a,activeViewer:o,footprintExtent:s}=this.viewModel,l=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=E(r?.media),m=[...l.rings[0]],h=n==="default";if(n===`none`||n===`video`||!f||!i||!o?.imageSize||!a)return;let v=h?m:S(m,f,p),y=h?C(v,!0):v,b=h?await g(i,o?.imageSize,s):await _(i,o?.imageSize,s),x=h?await g(a,this.viewModel.imageMeasurementViewer?.imageSize,s):await _(a,this.viewModel.activeTriangulatedViewer?.imageSize,s);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,h?2:e.length).map(e=>P(e,f,p)),i=new c({rings:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _loadTriangulatedMeasurementAdapter(e){if(!this.viewModel.triangulatedMeasurementAdapter){let{default:t}=await import(`./TriangulatedMeasurementAdapter.js`);if(a(e),this.viewModel.triangulatedMeasurementAdapter=new t({viewModel:this.viewModel,measurementService:this.measurementService}),!this.viewModel.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.viewModel.triangulatedMeasurementAdapter}async _getAreaFromTask(e){let{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._areaCalculation=null;let r=await this.calculateAreaMeasurement(e,t,n);a(n),this._areaCalculation=r}),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){let{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async t=>{this._distanceCalculation=0;let n=await this.calculateDistanceMeasurement(this.measurementArray,e,t);a(t),this._distanceCalculation=n}),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){let{mode:e,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s}=this.viewModel,c=i?.imageSize;return e===`none`||!c?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let l={measurementArray:this.measurementArray,measurementType:`distance`,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,imageSize:c,triangularMeasurementActive:!1,footprintExtent:s,signal:n},u={measurementArray:this.measurementArray,measurementType:`distance`,secondaryViewer:!1,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s,signal:n},d=e==="default"?await this.measurementService?.calculateAccuracy(l):await this.measurementService?.calculateAccuracyPanoramic(u);a(n),this._distanceCalculation=d}),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){let{mode:t,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c}=this.viewModel,l=o?.imageSize;return t===`none`||!l?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let u={measurementArray:e,measurementType:`area`,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,imageSize:l,triangularMeasurementActive:!1,footprintExtent:c,signal:n},d={measurementArray:e,measurementType:`area`,secondaryViewer:!1,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c,signal:n},f=t==="default"?await this.measurementService?.calculateAccuracy(u):await this.measurementService?.calculateAccuracyPanoramic(d);a(n),this._distanceCalculation=f}),await this._calculationTask.promise,this._distanceCalculation)}_updateOverlayedGeometry(e){this.viewModel.sketchTriangular?.update([e],{tool:`reshape`}).catch(()=>{})}};e([o()],M.prototype,`type`,void 0),e([o()],M.prototype,`measurementArray`,void 0),e([o()],M.prototype,`pixelMeasurement`,void 0),e([o()],M.prototype,`pixelAreaMeasurement`,void 0),e([o()],M.prototype,`polygonVertices`,void 0),M=e([s(`esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter`)],M);const N=M,P=(e,t,n)=>{let{heading:r,pitch:i}=m(e,t[0],t[1]);return h(r,i,n)};export{N as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as n}from"../../../../core/asyncUtils.js";import{EsriPromise as r}from"../../../../core/Promise.js";import{isAbortError as i,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{load as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import f from"../../../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as p,convertPixelToHeadingPitch as m,convertHeadingPitchToSphereVertex as h}from"../../../../layers/orientedImagery/transformations/utils.js";import{getMeasurementProperties as g,getMeasurementPropertiesPanoramic as _,pixelAreaMeasurement2D as v,pixelAreaMeasurementPanoramic as y,pixelDistanceMeasurement2D as b,pixelDistanceMeasurementPanoramic as x,getPixelLocationFromSphereVertices as S,formatPixels as C,imageToImageTransform as w,imageToImageTransformPanoramic as T}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as E}from"../../utils.js";import{SketchHandlerMixin as D}from"../../mixins/SketchHandlerMixin.js";import O from"../../../Sketch/SketchViewModel.js";let k=[],A=[],j=0,M=class extends D(r){constructor(e){super(e),this.type=`measurement`,this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(u())}async handleCreate(e){try{let t=e.toolEventInfo;switch(e.tool){case`polyline`:await this.handlePolylineEvents(e,t);break;case`polygon`:await this.handlePolygonEvents(e,t)}}catch(e){if(!i(e))throw e}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}async calculateAreaMeasurement(e,t,n){if(e.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize||this.viewModel.mode===`none`)return null;let r=this.viewModel.activeViewer.imageSize,i=(t==="default"?this.measurementService?.getCachedMeasurementProperties(`default`,r):this.measurementService?.getCachedMeasurementProperties(`panoramic`,r))??(t==="default"?await g(this.viewModel.currentBestFeature,r,this.viewModel.footprintExtent,n):await _(this.viewModel.currentBestFeature,r,this.viewModel.footprintExtent,n));return a(n),i?t==="default"?await v(e,i,!0):await y(e,i,!0,n):null}async calculateDistanceMeasurement(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel;if(e.length<2||!r||!i?.imageSize||t===`none`)return null;let o=i.imageSize,s=(t==="default"?this.measurementService?.getCachedMeasurementProperties(`default`,o):this.measurementService?.getCachedMeasurementProperties(`panoramic`,o))??(t==="default"?await g(r,o,this.viewModel.footprintExtent,n):await _(r,o,this.viewModel.footprintExtent,n));return a(n),s?t==="default"?await b([e.at(0),e.at(-1)],s,!0):await x([e.at(0),e.at(-1)],s,!0):null}cursorUpdatePolylineHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;if(t==="default")this.measurementArray.push(e.coordinates);else{let t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},r=p(t,n.imageSize[0],n.imageSize[1]);this.measurementArray.push([r.x,r.y])}let r=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=r}async cursorUpdatePolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;let r=e.coordinates;if(k=[...this.polygonVertices],t==="default")k.push(r);else{let e={x:r[0],y:r[1],z:r[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);k.push([t.x,t.y])}if(k.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let i=k[0];k=k.filter((e,t)=>t===0||t===k.length-1||JSON.stringify(e)!==JSON.stringify(i));let a=await this._getAreaFromTask(k);a?.area&&a?.perimeter&&(j=a.area)}async handlePolylineEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a}=this.viewModel,o=!this.viewModel.accuracyParametersMissing;if(e.state===`cancel`){this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[];return}if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.paths[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetDistanceMeasurements();return}switch(t?.type){case`cursor-update`:this.cursorUpdatePolylineHandler(t);break;case`vertex-add`:if(this.measurementArray.length&&o){let e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}let s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a,accuracyParametersMissing:o}=this.viewModel;if(e.state===`cancel`)this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0;else if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),!o&&!this.viewModel.triangularMeasurementActive){let e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e||this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.rings[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetAreaMeasurements()}else{switch(t?.type){case`vertex-add`:await this.vertexAddPolygonHandler(t);break;case`cursor-update`:await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=j>0?j:this.pixelAreaMeasurement}}async vertexAddPolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel,r=e.added,i=r[r.length-1];if(!Array.isArray(i)||t===`none`||!n?.imageSize)return;if(t==="default")this.polygonVertices.push(i);else{let e={x:i[0],y:i[1],z:i[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let a=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter((e,t)=>t===0||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(a));let o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;let{area:s}=o;this.pixelAreaMeasurement=s}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);let e=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&A.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,A=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,j=0}async _editOverlayedGraphics(e){this.viewModel.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.viewModel.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.viewModel.sketchTriangularGraphicsLayer.add(e),this.viewModel.sketchTriangular||(this._initializeSketchTriangular(),await this._loadTriangulatedMeasurementAdapter()),this._updateOverlayedGeometry(e)}_handleDestroyedTriangularSketchLayer(){this.viewModel.sketchTriangularGraphicsLayer&&this.viewModel.activeTriangulatedViewer&&(this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangular&&(this.viewModel.sketchTriangular.layer=this.viewModel.sketchTriangularGraphicsLayer,this.viewModel.sketchTriangular.view=this.viewModel.activeTriangulatedViewer.imageRenderer))}_initializeSketchTriangular(){if(!this.viewModel.activeTriangulatedViewer)return;let e=this.viewModel.mode===`panoramic`;this.viewModel.sketchTriangular=new O({view:this.viewModel.activeTriangulatedViewer.imageRenderer,layer:this.viewModel.sketchTriangularGraphicsLayer,updateOnGraphicClick:!0,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.viewModel.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:`offset`,shapeOperation:`move-xy`,vertexOperation:`move-xy`})}_initializeSketchTriangularGraphicsLayer(){this.viewModel.activeTriangulatedViewer&&(this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer))}async _overlayFirstMeasurement(e,t){switch(t){case`polyline`:await this._overlayFirstDistanceMeasurement(e);break;case`polygon`:await this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,activeViewer:a,footprintExtent:o,currentBestFeatureMeasurementImage:s}=this.viewModel,c=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=[...c.paths[0]],m=E(r?.media),h=n==="default";if(n===`none`||n===`video`||!f||!i||!a?.imageSize||!s)return;let v=h?p:S(p,f,m),y=h?C(v,!0):v,b=h?await g(i,a?.imageSize,o):await _(i,a?.imageSize,o),x=h?await g(s,this.viewModel.imageMeasurementViewer?.imageSize,o):await _(s,this.viewModel.activeTriangulatedViewer?.imageSize,o);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,2).map(e=>P(e,f,m)),i=new l({paths:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _overlayFirstAreaGeometry(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,currentBestFeatureMeasurementImage:a,activeViewer:o,footprintExtent:s}=this.viewModel,l=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=E(r?.media),m=[...l.rings[0]],h=n==="default";if(n===`none`||n===`video`||!f||!i||!o?.imageSize||!a)return;let v=h?m:S(m,f,p),y=h?C(v,!0):v,b=h?await g(i,o?.imageSize,s):await _(i,o?.imageSize,s),x=h?await g(a,this.viewModel.imageMeasurementViewer?.imageSize,s):await _(a,this.viewModel.activeTriangulatedViewer?.imageSize,s);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,h?2:e.length).map(e=>P(e,f,p)),i=new c({rings:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _loadTriangulatedMeasurementAdapter(e){if(!this.viewModel.triangulatedMeasurementAdapter){let{default:t}=await import(`./TriangulatedMeasurementAdapter.js`);if(a(e),this.viewModel.triangulatedMeasurementAdapter=new t({viewModel:this.viewModel,measurementService:this.measurementService}),!this.viewModel.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.viewModel.triangulatedMeasurementAdapter}async _getAreaFromTask(e){let{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._areaCalculation=null;let r=await this.calculateAreaMeasurement(e,t,n);a(n),this._areaCalculation=r}),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){let{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async t=>{this._distanceCalculation=0;let n=await this.calculateDistanceMeasurement(this.measurementArray,e,t);a(t),this._distanceCalculation=n}),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){let{mode:e,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s}=this.viewModel,c=i?.imageSize;return e===`none`||!c?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let l={measurementArray:this.measurementArray,measurementType:`distance`,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,imageSize:c,triangularMeasurementActive:!1,footprintExtent:s,signal:n},u={measurementArray:this.measurementArray,measurementType:`distance`,secondaryViewer:!1,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s,signal:n},d=e==="default"?await this.measurementService?.calculateAccuracy(l):await this.measurementService?.calculateAccuracyPanoramic(u);a(n),this._distanceCalculation=d}),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){let{mode:t,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c}=this.viewModel,l=o?.imageSize;return t===`none`||!l?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let u={measurementArray:e,measurementType:`area`,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,imageSize:l,triangularMeasurementActive:!1,footprintExtent:c,signal:n},d={measurementArray:e,measurementType:`area`,secondaryViewer:!1,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c,signal:n},f=t==="default"?await this.measurementService?.calculateAccuracy(u):await this.measurementService?.calculateAccuracyPanoramic(d);a(n),this._distanceCalculation=f}),await this._calculationTask.promise,this._distanceCalculation)}_updateOverlayedGeometry(e){this.viewModel.sketchTriangular?.update([e],{tool:`reshape`}).catch(()=>{})}};e([o()],M.prototype,`type`,void 0),e([o()],M.prototype,`measurementArray`,void 0),e([o()],M.prototype,`pixelMeasurement`,void 0),e([o()],M.prototype,`pixelAreaMeasurement`,void 0),e([o()],M.prototype,`polygonVertices`,void 0),M=e([s(`esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter`)],M);const N=M,P=(e,t,n)=>{let{heading:r,pitch:i}=m(e,t[0],t[1]);return h(r,i,n)};export{N as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import{subtract as a,length as o,normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../../geometry/Mesh.js";import u from"../../../../geometry/Point.js";import{projectAsync as d}from"../../../../geometry/projectionUtils.js";import{projectPointToVector as f}from"../../../../geometry/projection/projectPointToVector.js";import p from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as m,updateFrustum as h}from"../../../../layers/orientedImagery/core/coverageUtils.js";import g from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{toRenderCamera as _}from"../../../../views/3d/webgl.js";import{directionToHeadingTilt as v}from"../../../../views/3d/support/viewingModeUtils.js";import{getPointerActions as y,eventMatchesMousePointerActions as b}from"../../../../views/input/handlers/support.js";import{fixedImageSize as x,invalidCameraHeading as S}from"../../constants.js";import{createFeatureCoverage as C}from"../../featureCoverage.js";import{activeFrustumSymbol as w,additionalFrustumSymbol as T}from"../../symbols.js";import{getDefaultSuperimposeFov as E,panoramicSuperimposeMaxFov as D,panoramicSuperimposeMinFov as O,panoramicSuperimposeZoomOutFactor as k,panoramicSuperimposeZoomInFactor as A,getViewCameraFieldOfView as j,panoramicSuperimposeMaxTilt as M,panoramicSuperimposeMinTilt as N,panoramicSuperimposeKeyboardAngleStep as P}from"../../support/superimposeUtils.js";class F{constructor(u){this.viewModel=u,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:a,isAdditionalCoverageVisible:o,view:s}=this.viewModel,c=i.filter(t);for(let t of c){let i=t.clone();if(!s.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:o,vertexSpace:c}=i;if(c.type===`local`){let e=await d(a,s.spatialReference,n);r(n),i.centerAt(e)}else{let a=o.position,c=Float64Array.from(await m([...a],t.clone(),s.spatialReference.clone(),n));r(n),i=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:s.spatialReference.clone()})}}t.imageID===a.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:w.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:T.clone(),visible:o}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:s,activeViewer:c,footprintExtent:l,view:u,mode:f}=this.viewModel,p=f===`video`?x:c?.imageSize,m=i??s;if(!s||!o?.geometry||!p||!l||!m||!u?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:g,location:_,cameraPitch:v,horizontalFieldOfView:y,verticalFieldOfView:b,cameraRoll:S}}=m,C=null;i&&(C=await this._computeFeatureFootprint(i,a));let T=m.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&C?C:o).geometry,O=await I(E,D,_.spatialReference),k=await this.viewModel.getMapPoint(n);r(a);let A=k.filter(t);if(!A.length)return;A[0].spatialReference.equals(_.spatialReference)||(A=await Promise.all(A.map(async e=>{let t=await d(e,_.spatialReference,a);return r(a),t})));let j=await h(n.map(({x:e,y:t})=>[e,t]),A.map(e=>e.toArray()),{cameraHeight:g,cameraLocation:T,cameraPitch:v,frustumVertices:O,horizontalFieldOfView:y,imageHeight:p[1],imageWidth:p[0],inSRS:{wkid:_.spatialReference.wkid},outSRS:{wkid:u.spatialReference.wkid},verticalFieldOfView:b,cameraRoll:S??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:m.attributes.objectId},geometry:j,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:s}=n,{bestFeatureFootprint:c,currentBestFeature:l,activeViewer:u,footprintExtent:f,view:p,mode:m}=this.viewModel,g=m===`video`?x:u?.imageSize,_=a??l;if(!l||!c?.geometry||!g||!f||!_||!p?.spatialReference||m===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:S,verticalFieldOfView:C,cameraRoll:T}}=_,E=null;a&&(E=await this._computeFeatureFootprint(a,s));let D=_.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:k}=(a&&E?E:c).geometry,A=await I(O,k,y.spatialReference),j={feature:_,mode:m,imageSize:g,footprintExtent:f},M=await this.viewModel.getMapPointForFeature(i,j,s);r(s);let N=M.filter(t);if(!N.length)return;N[0].spatialReference.equals(y.spatialReference)||(N=await Promise.all(N.map(async e=>{let t=await d(e,y.spatialReference,s);return r(s),t})));let P=await h(i.map(({x:e,y:t})=>[e,t]),N.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:D,cameraPitch:b,frustumVertices:A,horizontalFieldOfView:S,imageHeight:g[1],imageWidth:g[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:p.spatialReference.wkid},verticalFieldOfView:C,cameraRoll:T??0,options:s});if(o&&P){let e=R(P);P.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:_.attributes.objectId},geometry:P,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:s,feature:c}=t,l=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!l)return;let{attributes:u}=l;u.orientedImageryType=null,u.cameraHeading=s,u.cameraPitch=a,u.horizontalFieldOfView=r,u.verticalFieldOfView=o,u.cameraRoll=0;let{frustum:d}=C(u);!d||!this.viewModel.view?.spatialReference.equals(d.spatialReference)?this.viewModel.updateCurrentCoveragePolygon(null):this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:d.clone(),symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,s=o.spatialReference.equals(a.spatialReference)?o:await d(o,a.spatialReference,t);if(r(t),!s)return;let c=n.clone();c.position=s.clone(),a.camera=c,this._enablePanoramicSuperimposeNavigation(s)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i,target:l}=e,{view:u}=this.viewModel;if(u?.type!==`3d`)return;let{cameraHeading:p,cameraPitch:m,cameraRoll:h,horizontalFieldOfView:g,location:y,verticalFieldOfView:b}=i.attributes,x=y.spatialReference.equals(u.spatialReference)?y.clone():await d(y,u.spatialReference,t);if(r(t),!x)return;let C=E(u,g,b,h??0),w=u.camera.clone();if(w.position=x,w.fov=n(w.fov,O,D),p!=null&&p!==S&&(w.heading=p),m!=null&&(w.tilt=m),C!=null&&(w.fov=C),l){let e=_(u,w),t=c();if(e&&f(l,t,u.renderSpatialReference)&&(a(t,t,e.eye),o(t)>0)){s(t,t);let{heading:n,tilt:r}=v(u,e.eye,t,e.up);w.heading=n,w.tilt=r}}u.camera=w},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation.actionMap;this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)])},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],e?.type!==`3d`||t==null||(e.navigation.actionMap.dragSecondary=t),this._defaultSuperimposeSecondaryDragAction=null},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=y(`rotate`,t.navigation.actionMap);b(e,n)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?k:A;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,O,D),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=j(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),N,M),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=P;break;case`ArrowRight`:r.heading+=P;break;case`ArrowUp`:r.tilt=n(r.tilt-P,N,M);break;case`ArrowDown`:r.tilt=n(r.tilt+P,N,M);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?k:A),O,D),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await g(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return L(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function I(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await d(new u(e,t),n,r)).toArray()))).flat())}const L=async(t,n,i)=>{let{frustum:a}=C(t.attributes),o=a.clone();if(!n.equals(o.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:s,vertexSpace:c}=o;if(c.type===`local`){let e=await d(a,n,i);r(i),o.centerAt(e)}else{let a=s.position,c=Float64Array.from(await m([...a],t.clone(),n.clone(),i));r(i),o=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:a.imageID},geometry:o,symbol:w.clone(),visible:!1})},R=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new u({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{F as default};
|
|
2
|
+
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import{subtract as a,length as o,normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../../geometry/Mesh.js";import u from"../../../../geometry/Point.js";import{projectAsync as d}from"../../../../geometry/projectionUtils.js";import{projectPointToVector as f}from"../../../../geometry/projection/projectPointToVector.js";import p from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as m,updateFrustum as h}from"../../../../layers/orientedImagery/core/coverageUtils.js";import g from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{toRenderCamera as _}from"../../../../views/3d/webgl.js";import{directionToHeadingTilt as v}from"../../../../views/3d/support/viewingModeUtils.js";import{getPointerActions as y,eventMatchesMousePointerActions as b}from"../../../../views/input/handlers/support.js";import{fixedImageSize as x,invalidCameraHeading as S}from"../../constants.js";import{createFeatureCoverage as C}from"../../featureCoverage.js";import{activeFrustumSymbol as w,additionalFrustumSymbol as T}from"../../symbols.js";import{getDefaultSuperimposeFov as E,panoramicSuperimposeMaxFov as D,panoramicSuperimposeMinFov as O,panoramicSuperimposeZoomOutFactor as k,panoramicSuperimposeZoomInFactor as A,getViewCameraFieldOfView as j,panoramicSuperimposeMaxTilt as M,panoramicSuperimposeMinTilt as N,panoramicSuperimposeKeyboardAngleStep as P}from"../../support/superimposeUtils.js";class F{constructor(u){this.viewModel=u,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:a,isAdditionalCoverageVisible:o,view:s}=this.viewModel,c=i.filter(t);for(let t of c){let i=t.clone();if(!s.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:o,vertexSpace:c}=i;if(c.type===`local`){let e=await d(a,s.spatialReference,n);r(n),i.centerAt(e)}else{let a=o.position,c=Float64Array.from(await m([...a],t.clone(),s.spatialReference.clone(),n));r(n),i=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:s.spatialReference.clone()})}}t.imageID===a.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:w.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:T.clone(),visible:o}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:s,activeViewer:c,footprintExtent:l,view:u,mode:f}=this.viewModel,p=f===`video`?x:c?.imageSize,m=i??s;if(!s||!o?.geometry||!p||!l||!m||!u?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:g,location:_,cameraPitch:v,horizontalFieldOfView:y,verticalFieldOfView:b,cameraRoll:S}}=m,C=null;i&&(C=await this._computeFeatureFootprint(i,a));let T=m.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&C?C:o).geometry,O=await I(E,D,_.spatialReference),k=await this.viewModel.getMapPoint(n);r(a);let A=k.filter(t);if(!A.length)return;A[0].spatialReference.equals(_.spatialReference)||(A=await Promise.all(A.map(async e=>{let t=await d(e,_.spatialReference,a);return r(a),t})));let j=await h(n.map(({x:e,y:t})=>[e,t]),A.map(e=>e.toArray()),{cameraHeight:g,cameraLocation:T,cameraPitch:v,frustumVertices:O,horizontalFieldOfView:y,imageHeight:p[1],imageWidth:p[0],inSRS:{wkid:_.spatialReference.wkid},outSRS:{wkid:u.spatialReference.wkid},verticalFieldOfView:b,cameraRoll:S??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:m.attributes.objectId},geometry:j,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:s}=n,{bestFeatureFootprint:c,currentBestFeature:l,activeViewer:u,footprintExtent:f,view:p,mode:m}=this.viewModel,g=m===`video`?x:u?.imageSize,_=a??l;if(!l||!c?.geometry||!g||!f||!_||!p?.spatialReference||m===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:S,verticalFieldOfView:C,cameraRoll:T}}=_,E=null;a&&(E=await this._computeFeatureFootprint(a,s));let D=_.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:k}=(a&&E?E:c).geometry,A=await I(O,k,y.spatialReference),j={feature:_,mode:m,imageSize:g,footprintExtent:f},M=await this.viewModel.getMapPointForFeature(i,j,s);r(s);let N=M.filter(t);if(!N.length)return;N[0].spatialReference.equals(y.spatialReference)||(N=await Promise.all(N.map(async e=>{let t=await d(e,y.spatialReference,s);return r(s),t})));let P=await h(i.map(({x:e,y:t})=>[e,t]),N.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:D,cameraPitch:b,frustumVertices:A,horizontalFieldOfView:S,imageHeight:g[1],imageWidth:g[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:p.spatialReference.wkid},verticalFieldOfView:C,cameraRoll:T??0,options:s});if(o&&P){let e=R(P);P.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:_.attributes.objectId},geometry:P,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:s,feature:c}=t,l=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!l)return;let{attributes:u}=l;u.orientedImageryType=null,u.cameraHeading=s,u.cameraPitch=a,u.horizontalFieldOfView=r,u.verticalFieldOfView=o,u.cameraRoll=0;let{frustum:d}=C(u);!d||!this.viewModel.view?.spatialReference.equals(d.spatialReference)?this.viewModel.updateCurrentCoveragePolygon(null):this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:d.clone(),symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,s=o.spatialReference.equals(a.spatialReference)?o:await d(o,a.spatialReference,t);if(r(t),!s)return;let c=n.clone();c.position=s.clone(),a.camera=c,this._enablePanoramicSuperimposeNavigation(s)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i,target:l}=e,{view:u}=this.viewModel;if(u?.type!==`3d`)return;let{cameraHeading:p,cameraPitch:m,cameraRoll:h,horizontalFieldOfView:g,location:y,verticalFieldOfView:b}=i.attributes,x=y.spatialReference.equals(u.spatialReference)?y.clone():await d(y,u.spatialReference,t);if(r(t),!x)return;let C=E(u,g,b,h??0),w=u.camera.clone();if(w.position=x,w.fov=n(w.fov,O,D),p!=null&&p!==S&&(w.heading=p),m!=null&&(w.tilt=m),C!=null&&(w.fov=C),l){let e=_(u,w),t=c();if(e&&f(l,t,u.renderSpatialReference)&&(a(t,t,e.eye),o(t)>0)){s(t,t);let{heading:n,tilt:r}=v(u,e.eye,t,e.up);w.heading=n,w.tilt=r}}u.camera=w},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation?.actionMap;t&&(this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)]))},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],this._defaultSuperimposeSecondaryDragAction=null;let n=e?.type===`3d`?e.navigation?.actionMap:null;n&&t!=null&&(n.dragSecondary=t)},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=t.navigation?.actionMap;if(!n)return;let r=y(`rotate`,n);b(e,r)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?k:A;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,O,D),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=j(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),N,M),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=P;break;case`ArrowRight`:r.heading+=P;break;case`ArrowUp`:r.tilt=n(r.tilt-P,N,M);break;case`ArrowDown`:r.tilt=n(r.tilt+P,N,M);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?k:A),O,D),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await g(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return L(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function I(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await d(new u(e,t),n,r)).toArray()))).flat())}const L=async(t,n,i)=>{let{frustum:a}=C(t.attributes),o=a.clone();if(!n.equals(o.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:s,vertexSpace:c}=o;if(c.type===`local`){let e=await d(a,n,i);r(i),o.centerAt(e)}else{let a=s.position,c=Float64Array.from(await m([...a],t.clone(),n.clone(),i));r(i),o=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:a.imageID},geometry:o,symbol:w.clone(),visible:!1})},R=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new u({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{F as default};
|