@arcgis/core 4.32.0-next.20250105 → 4.32.0-next.20250107

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.
Files changed (167) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/applications/MapViewer/templateUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  6. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  7. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  8. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  12. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  13. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{00c0fbe19c12691cf2c3.js → 368a36be515e60e35154.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  21. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  22. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  24. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  25. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 4423aac6e44c3dbf184e.js} +1 -1
  26. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  27. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  28. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  29. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  30. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  32. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  33. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  35. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  36. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  37. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  38. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  43. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  44. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  47. package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +1 -0
  48. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  49. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js → c05e0bd145a1c27d6857.js} +2 -2
  50. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → c05e0bd145a1c27d6857.js.LICENSE.txt} +1 -1
  51. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  52. package/assets/esri/core/workers/chunks/c49707b577f3805f0142.js +1 -0
  53. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  54. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  55. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  56. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  57. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  60. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → dca0eb66116e4b5403fc.js} +1 -1
  61. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  62. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  63. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  64. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  66. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  67. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → f6d6bc43ac1c13892d44.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  69. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  70. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  71. package/chunks/bufferOperator.js +1 -1
  72. package/chunks/geodesicBufferOperator.js +1 -1
  73. package/chunks/terrainUtilsPlanar.js +1 -1
  74. package/chunks/terrainUtilsSpherical.js +1 -1
  75. package/core/MemCachePool.js +1 -1
  76. package/geometry/operators/graphicBufferOperator.js +1 -1
  77. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  78. package/interfaces.d.ts +101 -5
  79. package/layers/graphics/data/QueryEngineResult.js +1 -1
  80. package/layers/graphics/data/queryUtils.js +1 -1
  81. package/layers/graphics/data/queryValidationUtils.js +1 -1
  82. package/layers/graphics/sources/WFSSource.js +1 -1
  83. package/layers/support/capabilities.js +1 -1
  84. package/layers/support/featureLayerUtils.js +1 -1
  85. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  86. package/package.json +2 -2
  87. package/renderers/RasterStretchRenderer.js +1 -1
  88. package/rest/query/executeAttributeBinsQuery.js +1 -1
  89. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  90. package/rest/support/AttributeBinsQuery.js +1 -1
  91. package/rest/support/BinParametersAttributes.js +1 -1
  92. package/rest/support/BinParametersBase.js +1 -1
  93. package/rest/support/DateBinParameters.js +1 -1
  94. package/rest/support/FeatureSet.js +1 -1
  95. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  96. package/rest/support/Query.js +1 -1
  97. package/rest/support/TopFeaturesQuery.js +1 -1
  98. package/smartMapping/renderers/dotDensity.js +1 -1
  99. package/smartMapping/renderers/pieChart.js +1 -1
  100. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  101. package/support/revision.js +1 -1
  102. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  103. package/symbols/cim/cimAnalyzer.js +1 -1
  104. package/views/2d/engine/Bitmap.js +1 -1
  105. package/views/2d/engine/BitmapContainer.js +1 -1
  106. package/views/2d/engine/BitmapTileContainer.js +1 -1
  107. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  108. package/views/2d/input/MapViewInputManager.js +1 -1
  109. package/views/2d/input/handlers/DragPan.js +1 -1
  110. package/views/2d/input/handlers/DragRotate.js +1 -1
  111. package/views/2d/input/handlers/MouseWheelZoom.js +1 -1
  112. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  113. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  114. package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
  115. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  116. package/views/3d/input/SceneInputManager.js +1 -1
  117. package/views/3d/input/handlers/DragRotate.js +1 -1
  118. package/views/3d/input/handlers/DragZoom.js +1 -1
  119. package/views/3d/input/handlers/MouseWheelZoom.js +1 -1
  120. package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
  121. package/views/3d/layerViewModuleImportUtils.js +1 -1
  122. package/views/3d/layers/GroupLayerView3D.js +5 -0
  123. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  124. package/views/3d/state/NearFarHeuristic.js +1 -1
  125. package/views/3d/terrain/OverlayManager.js +1 -1
  126. package/views/3d/terrain/TerrainRenderer.js +1 -1
  127. package/views/3d/terrain/TerrainSurface.js +1 -1
  128. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  129. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  130. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  131. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  132. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  133. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  134. package/views/View2D.js +1 -1
  135. package/views/draw/support/HighlightHelper.js +1 -1
  136. package/views/input/handlers/support.js +1 -1
  137. package/views/layers/DimensionLayerView.js +1 -1
  138. package/views/navigation/Navigation.js +1 -1
  139. package/views/navigation/NavigationActionMap.d.ts +4 -0
  140. package/views/navigation/NavigationActionMap.js +5 -0
  141. package/views/webgl/Texture.js +1 -1
  142. package/views/webgl/textureUtils.js +5 -0
  143. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  144. package/widgets/Editor/UpdateWorkflow.js +1 -1
  145. package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
  146. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  147. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  148. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  149. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  150. package/widgets/support/ColorPicker.js +1 -1
  151. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  152. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  153. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  154. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  155. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  156. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  157. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  158. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  159. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  160. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  161. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  162. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  163. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  164. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  165. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  166. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  167. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{findLayerView as t}from"./layerUtils.js";import{highlightsSupported as i}from"../../support/layerViewUtils.js";import{getHighlightKeyForFeature as l}from"../../../widgets/Feature/support/featureUtils.js";let a=class extends s{constructor(r){super(r),this.view=null}add(r){const s=!r||Array.isArray(r)?r:[r];s?.length&&s.forEach((r=>this._highlight(r)))}remove(r){const s=!r||Array.isArray(r)?r:[r];s?.length&&s.forEach((r=>this._removeHighlight(r)))}removeAll(){this.removeAllHandles()}_highlight(r){const s=t(this.view,r.layer);i(s)&&this.addHandles(s.highlight(r),l(r))}_removeHighlight(r){r&&this.removeHandles(l(r))}};r([o()],a.prototype,"view",void 0),a=r([e("esri.views.draw.support.HighlightHelper")],a);const h=a;export{h as default};
5
+ import{_ as r}from"../../../chunks/tslib.es6.js";import o from"../../../core/Accessor.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{findLayerView as e}from"./layerUtils.js";import{defaultHighlightName as i}from"../../support/HighlightDefaults.js";import{highlightsSupported as h}from"../../support/layerViewUtils.js";import{getHighlightKeyForFeature as l}from"../../../widgets/Feature/support/featureUtils.js";let p=class extends o{constructor(r){super(r),this.view=null,this.highlightGroup=i}add(r){const o=!r||Array.isArray(r)?r:[r];o?.length&&o.forEach((r=>this._highlight(r)))}remove(r){const o=!r||Array.isArray(r)?r:[r];o?.length&&o.forEach((r=>this._removeHighlight(r)))}removeAll(){this.removeAllHandles()}_highlight(r){const o=e(this.view,r.layer);h(o)&&this.addHandles(o.highlight(r,this.highlightGroup),l(r))}_removeHighlight(r){r&&this.removeHandles(l(r))}};r([t()],p.prototype,"view",void 0),r([t({constructOnly:!0})],p.prototype,"highlightGroup",void 0),p=r([s("esri.views.draw.support.HighlightHelper")],p);const a=p;export{a as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- function t(t,r){switch(r){case"primary":return"touch"===t.pointerType||0===t.button;case"secondary":return"touch"!==t.pointerType&&2===t.button;case"tertiary":return"touch"!==t.pointerType&&1===t.button}}function r(t,r){if("touch"===t.pointerType)return!1;switch(r){case"primary":return 0===t.button;case"secondary":return 2===t.button;case"tertiary":return 1===t.button}}export{r as eventMatchesMousePointerAction,t as eventMatchesPointerAction};
5
+ function r(r,e){switch(e){case"primary":return"touch"===r.pointerType||0===r.button;case"secondary":return"touch"!==r.pointerType&&2===r.button;case"tertiary":return"touch"!==r.pointerType&&1===r.button}}function e(e,t){return t.some((t=>r(e,t)))}function t(r,e){const{button:t,pointerType:n}=r;return"touch"!==n&&e.some((r=>"primary"===r&&0===t||"secondary"===r&&2===t||"tertiary"===r&&1===t))}function n(r,{dragPrimary:e,dragSecondary:t,dragTertiary:n}){return[{key:"primary",value:e},{key:"secondary",value:t},{key:"tertiary",value:n}].filter((e=>e.value===r)).map((r=>r.key))}export{t as eventMatchesMousePointerActions,r as eventMatchesPointerAction,e as eventMatchesPointerActions,n as getPointerActions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Collection.js";import{createAbortError as i}from"../../core/promiseUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";const n=n=>{let o=class extends n{constructor(...e){super(...e),this.layer=null}get interactive(){return null!=this.analysisView&&this.analysisView.interactive}set interactive(e){null!=this.analysisView&&(this.analysisView.interactive=e)}get results(){return null!=this.analysisView?this.analysisView.results:new s}get selectedDimension(){return null!=this.analysisView?this.analysisView.selectedDimension:null}set selectedDimension(e){null!=this.analysisView&&(this.analysisView.selectedDimension=e)}async createLengthDimensions(e){if(null==this.analysisView)throw i();await this.analysisView.createLengthDimensions(e)}};return e([t()],o.prototype,"layer",void 0),e([t()],o.prototype,"interactive",null),e([t({readOnly:!0})],o.prototype,"results",null),e([t()],o.prototype,"selectedDimension",null),o=e([r("esri.views.layers.DimensionLayerView")],o),o};export{n as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import s from"../../core/Collection.js";import{createAbortError as i}from"../../core/promiseUtils.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";const n=n=>{let o=class extends n{constructor(...e){super(...e),this.layer=null}get interactive(){return null!=this.analysisView&&this.analysisView.interactive}set interactive(e){null!=this.analysisView&&(this.analysisView.interactive=e)}get results(){return this.analysisView?.results??new s}get selectedDimension(){return null!=this.analysisView?this.analysisView.selectedDimension:null}set selectedDimension(e){null!=this.analysisView&&(this.analysisView.selectedDimension=e)}async createLengthDimensions(e){if(null==this.analysisView)throw i();await this.analysisView.createLengthDimensions(e)}};return e([t()],o.prototype,"layer",void 0),e([t()],o.prototype,"interactive",null),e([t({readOnly:!0})],o.prototype,"results",null),e([t()],o.prototype,"selectedDimension",null),o=e([r("esri.views.layers.DimensionLayerView")],o),o};export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../core/a11yUtils.js";import t from"../../core/Accessor.js";import{property as r}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import a from"./gamepad/GamepadSettings.js";let m=class extends t{constructor(o){super(o),this.browserTouchPanEnabled=!0,this.gamepad=new a,this.momentumEnabled=!0,this.mouseWheelZoomEnabled=!0}get effectiveMomentumEnabled(){return this.momentumEnabled&&!e()}};o([r({type:Boolean})],m.prototype,"browserTouchPanEnabled",void 0),o([r({type:a,nonNullable:!0})],m.prototype,"gamepad",void 0),o([r({type:Boolean})],m.prototype,"momentumEnabled",void 0),o([r({type:Boolean})],m.prototype,"mouseWheelZoomEnabled",void 0),m=o([s("esri.views.navigation.Navigation")],m);const p=m;export{p as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import{prefersReducedMotion as e}from"../../core/a11yUtils.js";import t from"../../core/Accessor.js";import{deprecatedProperty as r}from"../../core/deprecate.js";import a from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import n from"./NavigationActionMap.js";import p from"./gamepad/GamepadSettings.js";let i=class extends t{constructor(o){super(o),this.actionMap=new n,this.browserTouchPanEnabled=!0,this.gamepad=new p,this.momentumEnabled=!0}get effectiveMomentumEnabled(){return this.momentumEnabled&&!e()}get mouseWheelZoomEnabled(){return"zoom"===this.actionMap.mouseWheel}set mouseWheelZoomEnabled(o){r(a.getLogger(this),"mouseWheelZoomEnabled",{replacement:"actionMap.mouseWheel",version:"4.32",warnOnce:!0}),this.actionMap.mouseWheel=o?"zoom":"none"}};o([s({type:n,nonNullable:!0})],i.prototype,"actionMap",void 0),o([s({type:Boolean})],i.prototype,"browserTouchPanEnabled",void 0),o([s({type:p,nonNullable:!0})],i.prototype,"gamepad",void 0),o([s({type:Boolean})],i.prototype,"momentumEnabled",void 0),o([s({type:Boolean})],i.prototype,"mouseWheelZoomEnabled",null),i=o([m("esri.views.navigation.Navigation")],i);const l=i;export{l as default};
@@ -0,0 +1,4 @@
1
+ import "../../interfaces";
2
+
3
+ import NavigationActionMap = __esri.NavigationActionMap;
4
+ export default NavigationActionMap;
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Accessor.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";const s=()=>e({type:["pan","rotate","zoom","none"],nonNullable:!0});let a=class extends r{constructor(o){super(o),this.dragPrimary="pan",this.dragSecondary="rotate",this.dragTertiary="zoom",this.mouseWheel="zoom"}};o([s()],a.prototype,"dragPrimary",void 0),o([s()],a.prototype,"dragSecondary",void 0),o([s()],a.prototype,"dragTertiary",void 0),o([e({type:["zoom","none"],nonNullable:!0})],a.prototype,"mouseWheel",void 0),a=o([t("esri.views.navigation.NavigationActionMap")],a);const p=a;export{p as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../core/Error.js";import"../../core/has.js";import{signal as e}from"../../core/signal.js";import{getTextureCompressionWorker as i,isCompressionCandidate as r}from"../support/TextureCompressionHelper.js";import{checkWebGLError as s}from"./checkWebGLError.js";import{TextureType as o,ResourceType as a,CompressedTextureFormat as n,TextureSamplingMode as l,PixelFormat as p,PixelType as h,SizedPixelFormat as m}from"./enums.js";import{GLObjectType as d}from"./GLObjectType.js";import{estimateMemory as _}from"./TextureDescriptor.js";import{ValidatedTextureDescriptor as c}from"./ValidatedTextureDescriptor.js";const u=null;let g=class u{constructor(i,r=null,s=null){if(this.type=d.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,this._isCompressing=e(!1),"context"in i)this._descriptor=i,s=r;else{const e=c.validate(i,r);if(!e)throw new t("Texture descriptor invalid");this._descriptor=e}this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(s):this.setData(s)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return _(this._descriptor)}get cachedMemory(){return this.usedMemory}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}get isCompressing(){return this._isCompressing.value}set isCompressing(t){t?(this._compressionWorkerAbortController=new AbortController,this._isCompressing.value=!0):(this._compressionWorkerAbortController=null,this._isCompressing.value=!1)}dispose(){this._compressionWorkerAbortController?.abort(),this._glName&&this._descriptor.context.instanceCounter.decrement(a.Texture,this),this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("Immutable textures can't be resized!");r.width=e,r.height=i,this._descriptor.target===o.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.shouldCompress=t}_setDataCubeMap(t=null){for(let e=o.TEXTURE_CUBE_MAP_POSITIVE_X;e<=o.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}setData(t){return this.isCompressing&&(this._compressionWorkerAbortController.abort(),this.isCompressing=!1),!I(t)&&this._descriptor.internalFormat&&this._descriptor.internalFormat in n&&(this._descriptor.internalFormat=void 0),this._setData(t),i()&&!I(t)&&r(t)&&this._descriptor.shouldCompress&&(this.isCompressing=!0,this.compressOnWorker(t)),this.isCompressing}async compressOnWorker(t){const e=this._descriptor.context?.gl.getExtension("WEBGL_compressed_texture_etc"),r=this._descriptor.context?.gl.getExtension("WEBGL_compressed_texture_s3tc"),s=i(),o=await createImageBitmap(t);if(s&&(e||r)){const i={data:o,flipped:this.descriptor.flipped,width:t.width,height:t.height,hasMipmap:this._descriptor.hasMipmap,hasETC:!!e,hasS3TC:!!r,buffer:[new ArrayBuffer(0)]};s.invoke(i,this._compressionWorkerAbortController.signal).then((t=>{t&&this.glName&&(this._descriptor.internalFormat=t.internalFormat,this._setData(t.compressedTexture)),this.isCompressing=!1})).catch((()=>{this.isCompressing=!1}))}}_setData(e,i){const r=this._descriptor.context?.gl;if(!r)return;s(r),this._glName||(this._glName=r.createTexture(),this._glName&&this._descriptor.context.instanceCounter.increment(a.Texture,this));const o=this._descriptor,n=i??o.target,l=D(n),p=this._descriptor.context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),T(o),this._configurePixelStorage(),s(r);const h=this._deriveInternalFormat();if(w(e)){let t="width"in e?e.width:e.codedWidth,i="height"in e?e.height:e.codedHeight;const a=1;e instanceof HTMLVideoElement&&(t=e.videoWidth,i=e.videoHeight),o.width&&o.height,l&&o.depth,o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(n,h,o.hasMipmap,t,i,a),this._texImage(n,0,h,t,i,a,e),s(r),o.hasMipmap&&(this.generateMipmap(),s(r)),o.width||(o.width=t),o.height||(o.height=i),l&&!o.depth&&(o.depth=a)}else{const{width:i,height:a,depth:p}=o;if(null==i||null==a)throw new t("Width and height must be specified!");if(l&&null==p)throw new t("Depth must be specified!");if(o.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(n,h,o.hasMipmap,i,a,p),I(e)){const s=e.levels,l=b(n,i,a,p),m=Math.min(l,s.length)-1;r.texParameteri(o.target,this._descriptor.context.gl.TEXTURE_MAX_LEVEL,m);const d=h;if(!f(d))throw new t("Attempting to use compressed data with an uncompressed format!");this._forEachMipmapLevel(((t,e,i,r)=>{const o=s[Math.min(t,s.length-1)];this._compressedTexImage(n,t,d,e,i,r,o)}),m)}else this._texImage(n,0,h,i,a,p,e),s(r),o.hasMipmap&&this.generateMipmap()}E(r,this._descriptor),x(r,this._descriptor),M(this._descriptor.context,this._descriptor),s(r),this._descriptor.context.bindTexture(p,u.TEXTURE_UNIT_FOR_UPDATES)}updateData(e,i,r,s,o,a,n=0){a||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const l=this._descriptor,p=this._deriveInternalFormat(),{context:h,pixelFormat:m,dataType:d,target:_,isImmutable:c}=l;if(c&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");const g=h.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES,!0);(i<0||r<0||i+s>l.width||r+o>l.height)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:T}=h;n&&T.pixelStorei(T.UNPACK_SKIP_ROWS,n),w(a)?T.texSubImage2D(_,e,i,r,s,o,m,d,a):I(a)?T.compressedTexSubImage2D(_,e,i,r,s,o,p,a.levels[e]):T.texSubImage2D(_,e,i,r,s,o,m,d,a),n&&T.pixelStorei(T.UNPACK_SKIP_ROWS,0),h.bindTexture(g,u.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(e,i,r,s,o,a,n,l){l||console.error("An attempt to use uninitialized data!"),this._glName||console.error("An attempt to update uninitialized texture!");const p=this._descriptor,h=this._deriveInternalFormat(),{context:m,pixelFormat:d,dataType:_,isImmutable:c,target:g}=p;if(c&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");D(g)||console.warn("Attempting to set 3D texture data on a non-3D texture");const T=m.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);m.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),(i<0||r<0||s<0||i+o>p.width||r+a>p.height||s+n>p.depth)&&console.error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:E}=m;if(I(l))l=l.levels[e],E.compressedTexSubImage3D(g,e,i,r,s,o,a,n,h,l);else{const t=l;E.texSubImage3D(g,e,i,r,s,o,a,n,d,_,t)}m.bindTexture(T,u.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const e=this._descriptor;if(!e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot add mipmaps to immutable texture after allocation");e.hasMipmap=!0,this._samplingModeDirty=!0,T(e)}e.samplingMode===l.LINEAR?(this._samplingModeDirty=!0,e.samplingMode=l.LINEAR_MIPMAP_NEAREST):e.samplingMode===l.NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=l.NEAREST_MIPMAP_NEAREST);const i=this._descriptor.context.bindTexture(this,u.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(u.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(e.target),this._descriptor.context.bindTexture(i,u.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,T(e)}e.samplingMode===l.LINEAR_MIPMAP_NEAREST?(this._samplingModeDirty=!0,e.samplingMode=l.LINEAR):e.samplingMode===l.NEAREST_MIPMAP_NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=l.NEAREST)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,T(this._descriptor),this._wrapModeDirty=!0)}applyChanges(){const t=this._descriptor,e=t.context.gl;this._samplingModeDirty&&(E(e,t),this._samplingModeDirty=!1),this._wrapModeDirty&&(x(e,t),this._wrapModeDirty=!1)}_deriveInternalFormat(){if(null!=this._descriptor.internalFormat)return this._descriptor.internalFormat===p.DEPTH_STENCIL&&(this._descriptor.internalFormat=p.DEPTH24_STENCIL8),this._descriptor.internalFormat;switch(this._descriptor.dataType){case h.FLOAT:switch(this._descriptor.pixelFormat){case p.RGBA:return this._descriptor.internalFormat=m.RGBA32F;case p.RGB:return this._descriptor.internalFormat=m.RGB32F;default:throw new t("Unable to derive format")}case h.UNSIGNED_BYTE:switch(this._descriptor.pixelFormat){case p.RGBA:return this._descriptor.internalFormat=m.RGBA8;case p.RGB:return this._descriptor.internalFormat=m.RGB8}}return this._descriptor.internalFormat=this._descriptor.pixelFormat===p.DEPTH_STENCIL?p.DEPTH24_STENCIL8:this._descriptor.pixelFormat}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!A(i))throw new t("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const l=r?b(e,s,o,a):1;if(D(e)){if(null==a)throw new t("Missing depth dimension for 3D texture upload");n.texStorage3D(e,l,i,s,o,a)}else n.texStorage2D(e,l,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const l=this._descriptor.context.gl,p=D(e),{isImmutable:h,pixelFormat:m,dataType:d}=this._descriptor;if(h){if(null!=n){const r=n;if(p){if(null==a)throw new t("Missing depth dimension for 3D texture upload");l.texSubImage3D(e,i,0,0,0,s,o,a,m,d,r)}else l.texSubImage2D(e,i,0,0,s,o,m,d,r)}}else{const h=n;if(p){if(null==a)throw new t("Missing depth dimension for 3D texture upload");l.texImage3D(e,i,r,s,o,a,0,m,d,h)}else l.texImage2D(e,i,r,s,o,0,m,d,h)}}_compressedTexImage(e,i,r,s,o,a,n){const l=this._descriptor.context.gl,p=D(e);if(this._descriptor.isImmutable){if(null!=n)if(p){if(null==a)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else l.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(p){if(null==a)throw new t("Missing depth dimension for 3D texture upload");l.compressedTexImage3D(e,i,r,s,o,a,0,n)}else l.compressedTexImage2D(e,i,r,s,o,0,n)}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:a,hasMipmap:n,target:l}=this._descriptor;const p=l===o.TEXTURE_3D;if(null==r||null==s||p&&null==a)throw new t("Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,a),n&&(1!==r||1!==s||p&&1!==a)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(a=Math.max(1,a>>1))}};function T(t){(null!=t.width&&t.width<0||null!=t.height&&t.height<0||null!=t.depth&&t.depth<0)&&console.error("Negative dimension parameters are not allowed!")}function E(t,e){let i=e.samplingMode,r=e.samplingMode;i===l.LINEAR_MIPMAP_NEAREST||i===l.LINEAR_MIPMAP_LINEAR?(i=l.LINEAR,e.hasMipmap||(r=l.LINEAR)):i!==l.NEAREST_MIPMAP_NEAREST&&i!==l.NEAREST_MIPMAP_LINEAR||(i=l.NEAREST,e.hasMipmap||(r=l.NEAREST)),t.texParameteri(e.target,t.TEXTURE_MAG_FILTER,i),t.texParameteri(e.target,t.TEXTURE_MIN_FILTER,r)}function x(t,e){"number"==typeof e.wrapMode?(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode)):(t.texParameteri(e.target,t.TEXTURE_WRAP_S,e.wrapMode.s),t.texParameteri(e.target,t.TEXTURE_WRAP_T,e.wrapMode.t))}function M(t,e){const i=t.capabilities.textureFilterAnisotropic;if(!i)return;t.gl.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY,e.maxAnisotropy??1)}function A(t){return t in m}function f(t){return t in n}function I(t){return null!=t&&"type"in t&&"compressed"===t.type}function R(t){return null!=t&&"byteLength"in t}function w(t){return null!=t&&!I(t)&&!R(t)}function D(t){return t===o.TEXTURE_3D||t===o.TEXTURE_2D_ARRAY}function b(t,e,i,r=1){let s=Math.max(e,i);return t===o.TEXTURE_3D&&(s=Math.max(s,r)),Math.floor(Math.log2(s))+1}g.TEXTURE_UNIT_FOR_UPDATES=0;export{g as Texture,u as tracer};
5
+ import t from"../../core/Error.js";import"../../core/has.js";import e from"../../core/Logger.js";import{signal as i}from"../../core/signal.js";import{getTextureCompressionWorker as s,isCompressionCandidate as r}from"../support/TextureCompressionHelper.js";import{checkWebGLError as o}from"./checkWebGLError.js";import{TextureType as a,ResourceType as n,CompressedTextureFormat as p,TextureSamplingMode as l}from"./enums.js";import{GLObjectType as m}from"./GLObjectType.js";import{estimateMemory as h}from"./TextureDescriptor.js";import{isCompressedData as _,deriveInternalFormat as d,isTexImageSource as c,getDimensions as g,is3DTarget as u,validateTexture as T,isCompressedFormat as x,calcMipmapLevels as E,isSizedPixelFormat as M}from"./textureUtils.js";import{ValidatedTextureDescriptor as A}from"./ValidatedTextureDescriptor.js";const f=null,I=()=>e.getLogger("esri/views/webgl/Texture");let w=class e{constructor(e,s=null,r=null){if(this.type=m.Texture,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._wasImmutablyAllocated=!1,this._isCompressing=i(!1),"context"in e)this._descriptor=e,r=s;else{const i=A.validate(e,s);if(!i)throw new t("Texture descriptor invalid");this._descriptor=i}this._descriptor.target===a.TEXTURE_CUBE_MAP?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return h(this._descriptor)}get cachedMemory(){return this.usedMemory}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty}get isCompressing(){return this._isCompressing.value}set isCompressing(t){t?(this._compressionWorkerAbortController=new AbortController,this._isCompressing.value=!0):(this._compressionWorkerAbortController=null,this._isCompressing.value=!1)}dispose(){this.abortCompression(),this._glName&&this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.gl&&this._glName&&(this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null)}release(){this.dispose()}resize(e,i){const s=this._descriptor;if(s.width!==e||s.height!==i){if(this._wasImmutablyAllocated)throw new t("Immutable textures can't be resized!");s.width=e,s.height=i,this._descriptor.target===a.TEXTURE_CUBE_MAP?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.shouldCompress=t}setData(t){return this.abortCompression(),!_(t)&&this._descriptor.internalFormat&&this._descriptor.internalFormat in p&&(this._descriptor.internalFormat=void 0),this._setData(t),s()&&!_(t)&&r(t)&&this._descriptor.shouldCompress&&(this.isCompressing=!0,this.compressOnWorker(t)),this.isCompressing}updateData(i,s,r,o,a,n,p=0){n||I().error("An attempt to use uninitialized data!"),this._glName||I().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=d(l);const{context:m,pixelFormat:h,dataType:u,target:T,isImmutable:x}=l;if(x&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");const E=m.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(s<0||r<0||s+o>l.width||r+a>l.height)&&I().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=m;if(p&&(o&&a||I().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),M.pixelStorei(M.UNPACK_SKIP_ROWS,p)),c(n)){const{width:t,height:e}=g(n);t===o&&e===a||I().warn("The size of the data does not match the provided dimensions"),M.texSubImage2D(T,i,s,r,o,a,h,u,n)}else _(n)?M.compressedTexSubImage2D(T,i,s,r,o,a,l.internalFormat,n.levels[i]):M.texSubImage2D(T,i,s,r,o,a,h,u,n);p&&M.pixelStorei(M.UNPACK_SKIP_ROWS,0),m.bindTexture(E,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(i,s,r,o,a,n,p,l){l||I().error("An attempt to use uninitialized data!"),this._glName||I().error("An attempt to update an uninitialized texture!");const m=this._descriptor;m.internalFormat=d(m);const{context:h,pixelFormat:c,dataType:g,isImmutable:T,target:x}=m;if(T&&!this._wasImmutablyAllocated)throw new t("Cannot update immutable texture before allocation!");u(x)||I().warn("Attempting to set 3D texture data on a non-3D texture");const E=h.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);h.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(s<0||r<0||o<0||s+a>m.width||r+n>m.height||o+p>m.depth)&&I().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=h;if(_(l))l=l.levels[i],M.compressedTexSubImage3D(x,i,s,r,o,a,n,p,m.internalFormat,l);else{const t=l;M.texSubImage3D(x,i,s,r,o,a,n,p,c,g,t)}h.bindTexture(E,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const i=this._descriptor;if(!i.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot add mipmaps to immutable texture after allocation");i.hasMipmap=!0,this._samplingModeDirty=!0,T(i)}i.samplingMode===l.LINEAR?(this._samplingModeDirty=!0,i.samplingMode=l.LINEAR_MIPMAP_NEAREST):i.samplingMode===l.NEAREST&&(this._samplingModeDirty=!0,i.samplingMode=l.NEAREST_MIPMAP_NEAREST);const s=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(i.target),this._descriptor.context.bindTexture(s,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,T(e)}e.samplingMode===l.LINEAR_MIPMAP_NEAREST?(this._samplingModeDirty=!0,e.samplingMode=l.LINEAR):e.samplingMode===l.NEAREST_MIPMAP_NEAREST&&(this._samplingModeDirty=!0,e.samplingMode=l.NEAREST)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,T(this._descriptor),this._wrapModeDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1)}_setData(i,s){const r=this._descriptor,a=r.context?.gl;if(!a)return;o(a),this._glName||(this._glName=a.createTexture(),this._glName&&r.context.instanceCounter.increment(n.Texture,this)),T(r);const p=r.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);r.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),o(a);const l=s??r.target,m=u(l);if(c(i))this._setDataFromTexImageSource(i,l);else{const{width:e,height:s,depth:n}=r;if(null==e||null==s)throw new t("Width and height must be specified!");if(m&&null==n)throw new t("Depth must be specified!");if(r.internalFormat=d(r),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,r.internalFormat,r.hasMipmap,e,s,n),_(i)){if(!x(r.internalFormat))throw new t("Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(i,r.internalFormat,l)}else this._texImage(l,0,r.internalFormat,e,s,n,i),o(a),r.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),o(a),r.context.bindTexture(p,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=a.TEXTURE_CUBE_MAP_POSITIVE_X;e<=a.TEXTURE_CUBE_MAP_NEGATIVE_Z;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:s}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,s=this._descriptor;s.internalFormat=d(s);const r=u(e),{width:a,height:n,depth:p}=g(t);s.width&&s.height,s.width||(s.width=a),s.height||(s.height=n),r&&s.depth,r&&(s.depth=p),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,s.internalFormat,s.hasMipmap,a,n,p),this._texImage(e,0,s.internalFormat,a,n,p,t),o(i),s.hasMipmap&&(this.generateMipmap(),o(i))}_setDataFromCompressedSource(t,e,i){const s=this._descriptor,{width:r,height:o,depth:a}=s,n=t.levels,p=E(i,r,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(s.target,s.context.gl.TEXTURE_MAX_LEVEL,l),this._forEachMipmapLevel(((t,s,r,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,s,r,o,a)}),l)}_texStorage(e,i,s,r,o,a){const{gl:n}=this._descriptor.context;if(!M(i))throw new t("Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=s?E(e,r,o,a):1;if(u(e)){if(null==a)throw new t("Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,r,o,a)}else n.texStorage2D(e,p,i,r,o);this._wasImmutablyAllocated=!0}_texImage(e,i,s,r,o,a,n){const p=this._descriptor.context.gl,l=u(e),{isImmutable:m,pixelFormat:h,dataType:_}=this._descriptor;if(m){if(null!=n){const s=n;if(l){if(null==a)throw new t("Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,r,o,a,h,_,s)}else p.texSubImage2D(e,i,0,0,r,o,h,_,s)}}else{const m=n;if(l){if(null==a)throw new t("Missing depth dimension for 3D texture upload");p.texImage3D(e,i,s,r,o,a,0,h,_,m)}else p.texImage2D(e,i,s,r,o,0,h,_,m)}}_compressedTexImage(e,i,s,r,o,a,n){const p=this._descriptor.context.gl,l=u(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,r,o,a,s,n)}else p.compressedTexSubImage2D(e,i,0,0,r,o,s,n)}else if(l){if(null==a)throw new t("Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,s,r,o,a,0,n)}else p.compressedTexImage2D(e,i,s,r,o,0,n)}async compressOnWorker(t){const e=this._descriptor.context?.gl.getExtension("WEBGL_compressed_texture_etc"),i=this._descriptor.context?.gl.getExtension("WEBGL_compressed_texture_s3tc"),r=s(),o=await createImageBitmap(t);if(r&&(e||i)){const s={data:o,flipped:this.descriptor.flipped,width:t.width,height:t.height,hasMipmap:this._descriptor.hasMipmap,hasETC:!!e,hasS3TC:!!i,buffer:[new ArrayBuffer(0)]};r.invoke(s,this._compressionWorkerAbortController.signal).then((t=>{t&&this.glName&&(this._descriptor.internalFormat=t.internalFormat,this._setData(t.compressedTexture)),this.isCompressing=!1})).catch((()=>{this.isCompressing=!1}))}}abortCompression(){this.isCompressing&&(this._compressionWorkerAbortController.abort(),this.isCompressing=!1)}_forEachMipmapLevel(e,i=1/0){let{width:s,height:r,depth:o,hasMipmap:n,target:p}=this._descriptor;const l=p===a.TEXTURE_3D;if(null==s||null==r||l&&null==o)throw new t("Missing texture dimensions for mipmap calculation");for(let t=0;e(t,s,r,o),n&&(1!==s||1!==r||l&&1!==o)&&!(t>=i);++t)s=Math.max(1,s>>1),r=Math.max(1,r>>1),l&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,s=t.samplingMode;i===l.LINEAR_MIPMAP_NEAREST||i===l.LINEAR_MIPMAP_LINEAR?(i=l.LINEAR,t.hasMipmap||(s=l.LINEAR)):i!==l.NEAREST_MIPMAP_NEAREST&&i!==l.NEAREST_MIPMAP_LINEAR||(i=l.NEAREST,t.hasMipmap||(s=l.NEAREST)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,s)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}};w.TEXTURE_UNIT_FOR_UPDATES=0;export{w as Texture,f as tracer};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
+ */
5
+ import t from"../../core/Error.js";import e from"../../core/Logger.js";import{SizedPixelFormat as n,CompressedTextureFormat as r,TextureType as i,PixelFormat as o,PixelType as a}from"./enums.js";const u=()=>e.getLogger("esri/views/webgl/textureUtils");function l(t){(null!=t.width&&t.width<0||null!=t.height&&t.height<0||null!=t.depth&&t.depth<0)&&u().error("Negative dimension parameters are not allowed!")}function h(t){return t in n}function c(t){return t in r}function d(t){return null!=t&&"type"in t&&"compressed"===t.type}function s(t){return null!=t&&"byteLength"in t}function m(t){return null!=t&&!d(t)&&!s(t)}function f(t){return t===i.TEXTURE_3D||t===i.TEXTURE_2D_ARRAY}function E(t,e,n,r=1){let o=Math.max(e,n);return t===i.TEXTURE_3D&&(o=Math.max(o,r)),Math.floor(Math.log2(o))+1}function T(e){if(null!=e.internalFormat)return e.internalFormat===o.DEPTH_STENCIL?o.DEPTH24_STENCIL8:e.internalFormat;switch(e.dataType){case a.FLOAT:switch(e.pixelFormat){case o.RGBA:return n.RGBA32F;case o.RGB:return n.RGB32F;default:throw new t("Unable to derive format")}case a.UNSIGNED_BYTE:switch(e.pixelFormat){case o.RGBA:return n.RGBA8;case o.RGB:return n.RGB8}}return e.internalFormat=e.pixelFormat===o.DEPTH_STENCIL?o.DEPTH24_STENCIL8:e.pixelFormat}function g(t){let e="width"in t?t.width:t.codedWidth,n="height"in t?t.height:t.codedHeight;const r=1;return t instanceof HTMLVideoElement&&(e=t.videoWidth,n=t.videoHeight),{width:e,height:n,depth:r}}export{E as calcMipmapLevels,T as deriveInternalFormat,g as getDimensions,f as is3DTarget,s as isArrayBufferView,d as isCompressedData,c as isCompressedFormat,h as isSizedPixelFormat,m as isTexImageSource,l as validateTexture};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{abortHandle as i,makeHandle as r}from"../../core/handleUtils.js";import{isAborted as a}from"../../core/promiseUtils.js";import{watch as o}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../views/draw/support/HighlightHelper.js";import d from"./UpdateRecordWorkflowData.js";import c from"./Workflow.js";import{fetchFullFeature as u}from"./workflowUtils.js";import m from"../FeatureForm/FeatureFormViewModel.js";var p;const h={exit:Symbol()};let f=p=class extends c{constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:e}=this,{edits:o}=e,{view:s}=e.viewModel,l=o.feature,d=new AbortController;this.addHandles(i(d)),this._updatingHandles.addPromise(u(l,e.viewModel.view.spatialReference,d.signal).then((e=>{a(d)||(this._onFullFeatureLoaded(e),this._initializeFeatureFormViewModel())}),(e=>this.cancel({force:!0,error:new t("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:e}})})))),s&&(this._highlightHelper=new n({view:s}),this.addHandles(r((()=>this._highlightHelper?.removeAll()))))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){return this.data.edits.modified}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async deleteAndCommit(){return this.data.edits.stageDelete(),this.commit()}async enter(){this._configureAttachmentsViewModel()}exit(e){this.removeHandles(h.exit)}async start(){return await super.start(),null}_configureAttachmentsViewModel(){const{data:e,fullFeature:t}=this,{attachmentsCapabilities:i,viewModel:a}=e,{attachmentsViewModel:s}=a;s.set({capabilities:i,graphic:t,filesEnabled:!1,mode:"view"}),this.addHandles([r((()=>s.fileInfos.removeAll())),o((()=>s.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}))],h.exit)}_initializeFeatureFormViewModel(){const{edits:e,formTemplate:t,viewModel:{view:i}}=this.data,r=this._featureFormViewModel=new m({arcadeEditType:"UPDATE",feature:this.fullFeature,formTemplate:t,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i.spatialReference,timeZone:i?.timeZone});r.callbacks={...this.data.featureFormCallbacks,showAllRelatedRecords:e=>r.relationshipId=e.relationshipId};const{initialFeature:a}=e;a&&r.overrideInitialFeature(a),this.addHandles([r.on("value-change",(()=>{e.updateAttributes(r.getValues()),this.fullFeature.attributes=e.feature.attributes})),o((()=>i?.timeZone),(e=>r.timeZone=e))])}_onFullFeatureLoaded(e){this.fullFeature=e;const{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){const t=new p({data:await d.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){const{attachmentsViewModel:t}=e.data.viewModel;return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){t.mode="view"}},{id:"editing-attachment",async setUp(){},async tearDown(){t.mode="view"}}]}};f._onCommitFactory=e=>async t=>{const{edits:i}=t,{feature:r}=i;if(!r)return;const a=r.sourceLayer,o=r.clone();if(!i.attributesModified||i.stagedForDelete){const e=a.objectIdField;if(o.attributes={[e]:r.getAttribute(e)},"scene"===a.type&&null!=a.infoFor3D){const e=a.associatedLayer?.globalIdField;null!=e&&o.setAttribute(e,r.getAttribute(e))}}i.geometryModified&&!i.stagedForDelete||(o.geometry=null);const s=i.stagedForDelete?"deleteFeatures":"updateFeatures";await e(a,{[s]:[o]})},e([s()],f.prototype,"editorItem",null),e([s()],f.prototype,"featureFormViewModel",null),e([s()],f.prototype,"fullFeature",void 0),e([s()],f.prototype,"hasPendingEdits",null),e([s()],f.prototype,"layer",null),e([s()],f.prototype,"parent",null),e([s()],f.prototype,"parentLayer",null),e([s()],f.prototype,"shouldShowAttachments",null),e([s()],f.prototype,"shouldAllowAttachmentEditing",null),e([s()],f.prototype,"reliesOnOwnerAdminPrivileges",null),f=p=e([l("esri.widgets.Editor.UpdateRecordWorkflow")],f);export{f as UpdateRecordWorkflow,h as handleKeys};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{makeHandle as i,abortHandle as r}from"../../core/handleUtils.js";import{isAborted as a}from"../../core/promiseUtils.js";import{watch as o}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import n from"../../views/draw/support/HighlightHelper.js";import{temporaryHighlightName as d}from"../../views/support/HighlightDefaults.js";import c from"./UpdateRecordWorkflowData.js";import u from"./Workflow.js";import{fetchFullFeature as p}from"./workflowUtils.js";import m from"../FeatureForm/FeatureFormViewModel.js";var h;const f={exit:Symbol()};let g=h=class extends u{constructor(e){super(e),this._highlightHelper=null,this.fullFeature=null,this.type="update-table-record"}initialize(){const{data:e}=this,{edits:o}=e,{view:s}=e.viewModel,l=o.feature;s&&(this._highlightHelper=new n({view:s,highlightGroup:d}),this.addHandles(i((()=>this._highlightHelper?.removeAll()))));const c=new AbortController;this.addHandles(r(c)),this._updatingHandles.addPromise(p(l,e.viewModel.view.spatialReference,c.signal).then((e=>{a(c)||(this._onFullFeatureLoaded(e),this._initializeFeatureFormViewModel())}),(e=>this.cancel({force:!0,error:new t("editor:failed-to-fetch-full-feature","Failed to retrieve all information for this feature. The update cannot proceed.",{detail:{error:e}})}))))}get editorItem(){return this.data.editorItem}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){return this.data.edits.modified}get layer(){return this.data.editorItem.layer}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get shouldShowAttachments(){return this.editorItem.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return this.editorItem.capabilities.update.attachments.enabled}get reliesOnOwnerAdminPrivileges(){const e=this.editorItem.capabilities;return e.update.reliesOnOwnerAdminPrivileges||e.delete.reliesOnOwnerAdminPrivileges}async deleteAndCommit(){return this.data.edits.stageDelete(),this.commit()}async enter(){this._configureAttachmentsViewModel()}exit(e){this.removeHandles(f.exit)}async start(){return await super.start(),null}_configureAttachmentsViewModel(){const{data:e,fullFeature:t}=this,{attachmentsCapabilities:r,viewModel:a}=e,{attachmentsViewModel:s}=a;s.set({capabilities:r,graphic:t,filesEnabled:!1,mode:"view"}),this.addHandles([i((()=>s.fileInfos.removeAll())),o((()=>s.mode),(e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}))],f.exit)}_initializeFeatureFormViewModel(){const{edits:e,formTemplate:t,viewModel:{view:i}}=this.data,r=this._featureFormViewModel=new m({arcadeEditType:"UPDATE",feature:this.fullFeature,formTemplate:t,highlightHelper:this._highlightHelper,map:i?.map,spatialReference:i.spatialReference,timeZone:i?.timeZone});r.callbacks={...this.data.featureFormCallbacks,showAllRelatedRecords:e=>r.relationshipId=e.relationshipId};const{initialFeature:a}=e;a&&r.overrideInitialFeature(a),this.addHandles([r.on("value-change",(()=>{e.updateAttributes(r.getValues()),this.fullFeature.attributes=e.feature.attributes})),o((()=>i?.timeZone),(e=>r.timeZone=e))])}_onFullFeatureLoaded(e){this.fullFeature=e;const{edits:t}=this.data;t.updateAttributes(e.attributes),t.trackChanges()}static async create(e){const t=new h({data:await c.create(e),onCommit:this._onCommitFactory(e.applyEdits)});return t._set("steps",this._createWorkflowSteps(t)),t}static _createWorkflowSteps(e){const{attachmentsViewModel:t}=e.data.viewModel;return[{id:"editing-attributes",async setUp(){},async tearDown(){}},{id:"adding-attachment",async setUp(){},async tearDown(){t.mode="view"}},{id:"editing-attachment",async setUp(){},async tearDown(){t.mode="view"}}]}};g._onCommitFactory=e=>async t=>{const{edits:i}=t,{feature:r}=i;if(!r)return;const a=r.sourceLayer,o=r.clone();if(!i.attributesModified||i.stagedForDelete){const e=a.objectIdField;if(o.attributes={[e]:r.getAttribute(e)},"scene"===a.type&&null!=a.infoFor3D){const e=a.associatedLayer?.globalIdField;null!=e&&o.setAttribute(e,r.getAttribute(e))}}i.geometryModified&&!i.stagedForDelete||(o.geometry=null);const s=i.stagedForDelete?"deleteFeatures":"updateFeatures";await e(a,{[s]:[o]})},e([s()],g.prototype,"_featureFormViewModel",void 0),e([s()],g.prototype,"editorItem",null),e([s()],g.prototype,"featureFormViewModel",null),e([s()],g.prototype,"fullFeature",void 0),e([s()],g.prototype,"hasPendingEdits",null),e([s()],g.prototype,"layer",null),e([s()],g.prototype,"parent",null),e([s()],g.prototype,"parentLayer",null),e([s()],g.prototype,"shouldShowAttachments",null),e([s()],g.prototype,"shouldAllowAttachmentEditing",null),e([s()],g.prototype,"reliesOnOwnerAdminPrivileges",null),g=h=e([l("esri.widgets.Editor.UpdateRecordWorkflow")],g);export{g as UpdateRecordWorkflow,f as handleKeys};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import i from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as n,onAbort as s,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as w,watch as h,sync as f}from"../../core/reactiveUtils.js";import{last as m}from"../../core/SetUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isEditableLayer as v}from"../../layers/support/editableLayers.js";import{isSubtypeGroupLayer as y,isTable as W}from"../../layers/support/layerUtils.js";import b from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as _}from"../../views/input/InputManager.js";import M from"../../views/interactive/sketch/SketchOptions.js";import C from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as S}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as F}from"./UpdateRecordWorkflow.js";import A from"./UpdateWorkflowData.js";import j from"./Workflow.js";import{createWorkflowSteps as I,fetchCandidates as U}from"./workflowUtils.js";import{isGraphicForRelatableFeatureSupportedLayer as E}from"../Feature/support/featureUtils.js";import{getAllTemplatesForLayer as P}from"../support/templateUtils.js";var x;const O="esri.widgets.Editor.UpdateWorkflow",R=()=>i.getLogger(O);let V=x=class extends j{constructor(e){super(e),this._workflowStack=new p(m),this._sketchStack=new p(m),this.data=void 0,this.type="update"}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){return this._stepIndex>0||this.nestedWorkflowCount>1||null!=this.activeWorkflow?.featureFormViewModel.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this;if(null==t?.featureFormViewModel.relationshipId)if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else t.featureFormViewModel.relationshipId=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:o,addAttachmentsCallback:i,applyEditsCallback:r}=e,n=e.sketchOptions??new M,s=new x({data:new A({addAttachmentsCallback:i,applyEditsCallback:r,sketchOptions:n,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return s._set("steps",this._createWorkflowSteps(s,o)),s}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e){try{const t=await this._createNestedUpdateWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:t})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");T(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():await this._popWorkflow()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:o,applyEditsCallback:i,sketchOptions:r,snappingManager:n,viewModel:s}=this.data;if(!v(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const l=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),d=l.template||l.initialFeature?"creating-features":"awaiting-feature-creation-info",c="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return C.create({addAttachmentsCallback:o,applyEditsCallback:i,creationInfo:l,isNested:!0,parent:c,sketchOptions:r,snappingManager:n,startAt:d,viewModel:s})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:o}=e;if(!v(o)||y(o))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const i={layer:o,maxFeatures:1},r=this._makeRelatedRecordAttributes(e),n=P(o);return n?.length>0?(i.attributeOverrides=r,1===n.length&&(i.template=n[0])):i.initialFeature=new t({sourceLayer:o,attributes:r}),i}async _createNestedUpdateWorkflow(e){const t=W(e.sourceLayer)?F:S,{applyEditsCallback:a,sketchOptions:o,snappingManager:i,viewModel:r}=this.data,n="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,s=await t.create({feature:e,parent:n,sketchOptions:o,snappingManager:i,viewModel:r,applyEdits:a,featureFormCallbacks:{addRelatedRecord:async e=>await this.startCreatingRelatedRecord(e),editRelatedRecord:async({relatedFeature:e})=>await this.startUpdating(e)}});return await u((()=>!s.updating)),s}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const o=t.pop();this._sketchStack.pop();const i=e(o).then((()=>o.destroy()));this._updatingHandles.addPromise(i),a.push(i)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:o}=e;if(!E(t))return;const i=a.relationships?.find((e=>e.id===o));if(!i)return void L("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===i.role)return void L("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;i.relatedTableId!==r.layerId&&L("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const n=r.relationships?.find((e=>e.id===o));if(!n)return void L("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const s=H(r,n),l=t.getAttribute(s);l||L("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=H(a,i);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const o=this._sketchStack,i=await(e?.start()),r=o.peek();i?(r?.exit(),o.push(i)):o.push(this._cloneSketchController(r)),this._workflowStack.push(e);const n=await this._reconcileWorkflowStack();if(n.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",n)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:i}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:i+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!W(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return I(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,a=i.viewModel.view;a.activeTool=null;let c=null;e.addHandles(o((()=>{c=r(c)})),this.id),i.rootFeature=null,i.candidates=[];const p=a.on("immediate-click",(async o=>{const r=n();e._updatingHandles.addPromise(r.promise);try{t.location=o.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=i.viewModel;c=new AbortController;const n=await o.async((()=>new Promise(((e,t)=>{s(c?.signal,(()=>t(l()))),e(U(r,a,o,c?.signal))}))));if(d(c),i.candidates=n.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===i.candidates.length,0===i.candidates.length)return;o.stopPropagation(),1===i.candidates.length?(i.rootFeature=i.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),_.TOOL),u=w((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeature=null;const{view:t}=i.viewModel;if(!t)return;const a=new b({view:t});e.addHandles([h((()=>i.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),o((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:o}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),o.spinnerViewModel.visible=!1;const i=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([h((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&i()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}};function H(e,{keyField:t}){return e.getField(t)?.name??t}e([g()],V.prototype,"activeEditorItem",null),e([g()],V.prototype,"activeFeatureFormViewModel",null),e([g()],V.prototype,"activeSketchViewModel",null),e([g()],V.prototype,"activeWorkflow",null),e([g()],V.prototype,"updating",null),e([g()],V.prototype,"data",void 0),e([g()],V.prototype,"hasPreviousStep",null),e([g()],V.prototype,"hasUpdatableCandidates",null),e([g()],V.prototype,"nestedWorkflowCount",null),e([g()],V.prototype,"shouldShowAttachments",null),e([g()],V.prototype,"shouldAllowAttachmentEditing",null),e([g()],V.prototype,"hasPendingEdits",null),e([g()],V.prototype,"helpMessage",null),e([g()],V.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],V.prototype,"hasInvalidFormTemplate",null),V=x=e([k(O)],V);const L=(e,t)=>R().warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature."),T=e=>!!e&&/update-/.test(e.type),D=V;export{D as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as o}from"../../core/handleUtils.js";import i from"../../core/Logger.js";import{abortMaybe as r}from"../../core/maybe.js";import{createResolver as s,onAbort as n,createAbortError as l,throwIfAborted as d,debounce as c}from"../../core/promiseUtils.js";import p from"../../core/Queue.js";import{whenOnce as u,when as h,watch as w,sync as f}from"../../core/reactiveUtils.js";import{last as m}from"../../core/SetUtils.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isEditableLayer as v}from"../../layers/support/editableLayers.js";import{isSubtypeGroupLayer as y,isTable as W}from"../../layers/support/layerUtils.js";import b from"../../views/draw/support/HighlightHelper.js";import{ViewEventPriorities as _}from"../../views/input/InputManager.js";import M from"../../views/interactive/sketch/SketchOptions.js";import{temporaryHighlightName as C}from"../../views/support/HighlightDefaults.js";import S from"./CreateFeaturesWorkflow.js";import{UpdateFeatureWorkflow as F}from"./UpdateFeatureWorkflow.js";import{UpdateRecordWorkflow as j}from"./UpdateRecordWorkflow.js";import A from"./UpdateWorkflowData.js";import I from"./Workflow.js";import{createWorkflowSteps as U,fetchCandidates as E}from"./workflowUtils.js";import{isGraphicForRelatableFeatureSupportedLayer as P}from"../Feature/support/featureUtils.js";import{getAllTemplatesForLayer as x}from"../support/templateUtils.js";var O;const R="esri.widgets.Editor.UpdateWorkflow",V=()=>i.getLogger(R);let H=O=class extends I{constructor(e){super(e),this._workflowStack=new p(m),this._sketchStack=new p(m),this.data=void 0,this.type="update"}get activeEditorItem(){return this.activeWorkflow?.data.editorItem??void 0}get activeFeatureFormViewModel(){return this.activeWorkflow?.featureFormViewModel}get activeSketchViewModel(){return this._sketchStack.peek()?.viewModel}get activeWorkflow(){return this._workflowStack.last()}get updating(){return this._updatingHandles.updating||!!this.activeWorkflow?.updating}get hasPreviousStep(){return this._stepIndex>0||this.nestedWorkflowCount>1||null!=this.activeWorkflow?.featureFormViewModel.relationshipId||"view"!==this.data.viewModel.attachmentsViewModel.mode}get hasUpdatableCandidates(){const{candidates:e,viewModel:t}=this.data;return e.some((({layer:e})=>t.findEditorItemForLayer(e)?.supportsUpdateWorkflow))}get nestedWorkflowCount(){return this._workflowStack.length}get shouldShowAttachments(){return!!this.activeEditorItem?.capabilities.attachments.enabled}get shouldAllowAttachmentEditing(){return!!this.activeEditorItem?.capabilities.update.attachments.enabled}get hasPendingEdits(){return Array.from(this._workflowStack).some((e=>e.hasPendingEdits))}get helpMessage(){return this.activeWorkflow?.helpMessage?this.activeWorkflow.helpMessage:"awaiting-feature-to-update"===this.stepId?"select":void 0}get reliesOnOwnerAdminPrivileges(){return this.activeWorkflow?.reliesOnOwnerAdminPrivileges??!1}get hasInvalidFormTemplate(){return!!this.activeEditorItem?.hasInvalidFormTemplate}async back(e=()=>Promise.resolve(!0)){const{activeWorkflow:t}=this;if(null==t?.featureFormViewModel.relationshipId)if(t){if(t.hasPendingEdits){if(!await e())return}t.hasPreviousStep?await t.previous({cancelCurrentStep:!0}):await this.cancelActiveWorkflow({force:!0})}else this.hasPreviousStep?await this.previous({cancelCurrentStep:!0}):await this.cancel({force:!0});else t.featureFormViewModel.relationshipId=null}async cancelActiveWorkflow(e){await(this.activeWorkflow?.cancel(e)),await this._popWorkflow()}async commit(){await this._drainWorkflowStack((e=>e.commit())),await super.commit()}static create(e){const{viewModel:t,snappingManager:a,startAt:o,addAttachmentsCallback:i,applyEditsCallback:r}=e,s=e.sketchOptions??new M,n=new O({data:new A({addAttachmentsCallback:i,applyEditsCallback:r,sketchOptions:s,snappingManager:a,viewModel:t}),onCommit:async()=>{}});return n._set("steps",this._createWorkflowSteps(n,o)),n}async save(){this.nestedWorkflowCount>1?(await(this.activeWorkflow?.commit()),await this._popWorkflow()):await this.commit()}async startCreatingRelatedRecord(e){try{const t=await this._createNestedCreateFeaturesWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-creating","Could not begin updating the provided feature or table record.",{error:t})}}async startUpdating(e){try{const t=await this._createNestedUpdateWorkflow(e);await this._pushWorkflow(t)}catch(t){throw new a("editor:unable-to-start-updating","Could not begin updating the provided feature or table record.",{error:t})}}async deleteActiveFeature(){const{activeWorkflow:e}=this;if(!e)throw new a("editor:nothing-to-delete","There is no feature to delete");D(e)?await e.deleteAndCommit():await e.cancel(),1===this.nestedWorkflowCount?await this.reset():await this._popWorkflow()}async cancelAll(){await this._drainWorkflowStack((e=>e.cancel({force:!0})))}async _createNestedCreateFeaturesWorkflow(e){const{relatedLayer:t}=e,{addAttachmentsCallback:o,applyEditsCallback:i,sketchOptions:r,snappingManager:s,viewModel:n}=this.data;if(!v(t))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const l=this._getCreationInfoForNestedCreateFeaturesWorkflow(e),d=l.template||l.initialFeature?"creating-features":"awaiting-feature-creation-info",c="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0;return S.create({addAttachmentsCallback:o,applyEditsCallback:i,creationInfo:l,isNested:!0,parent:c,sketchOptions:r,snappingManager:s,startAt:d,viewModel:n})}_getCreationInfoForNestedCreateFeaturesWorkflow(e){const{relatedLayer:o}=e;if(!v(o)||y(o))throw new a("editor:unsupported-layer","Editing is not supported on the provided layer");const i={layer:o,maxFeatures:1},r=this._makeRelatedRecordAttributes(e),s=x(o);return s?.length>0?(i.attributeOverrides=r,1===s.length&&(i.template=s[0])):i.initialFeature=new t({sourceLayer:o,attributes:r}),i}async _createNestedUpdateWorkflow(e){const t=W(e.sourceLayer)?j:F,{applyEditsCallback:a,sketchOptions:o,snappingManager:i,viewModel:r}=this.data,s="create-features"!==this.activeWorkflow?.type?this.activeWorkflow:void 0,n=await t.create({feature:e,parent:s,sketchOptions:o,snappingManager:i,viewModel:r,applyEdits:a,featureFormCallbacks:{addRelatedRecord:async e=>await this.startCreatingRelatedRecord(e),editRelatedRecord:async({relatedFeature:e})=>await this.startUpdating(e)}});return await u((()=>!n.updating)),n}async _drainWorkflowStack(e){const t=this._workflowStack,a=[];for(;t.length>0;){const o=t.pop();this._sketchStack.pop();const i=e(o).then((()=>o.destroy()));this._updatingHandles.addPromise(i),a.push(i)}await Promise.all(a)}_makeRelatedRecordAttributes(e){const{parentFeature:t,relatedLayer:a,relationshipId:o}=e;if(!P(t))return;const i=a.relationships?.find((e=>e.id===o));if(!i)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the destination layer.");if("origin"===i.role)return void T("unsupported-role","Creating new related records in the 'origin' table of a relationship is not yet supported");const r=t.sourceLayer;i.relatedTableId!==r.layerId&&T("invalid-argument-combination","The given parent feature does not belong to the relationship designated by the given relationship ID.");const s=r.relationships?.find((e=>e.id===o));if(!s)return void T("relationship-not-found","Could not begin creating a related record because the relationship specified could not be found on the origin layer.");const n=L(r,s),l=t.getAttribute(n);l||T("no-key-on-origin-feature","The given parent feature does not have a value for the relationship's origin primary key field.");const d=L(a,i);return{[d]:l}}async _popWorkflow(){this._workflowStack.pop()?.destroy(),this._sketchStack.pop();const e=await this._reconcileWorkflowStack();if(e.failureCount>0)throw new a("editor:next-workflow-failed","Popped the top workflow, but the next workflow in the stack failed to activate",e)}async _pushWorkflow(e){const t=this._workflowRequiresSketchViewModel(e);this.activeWorkflow?.exit({removeSketchHandles:t});const o=this._sketchStack,i=await(e?.start()),r=o.peek();i?(r?.exit(),o.push(i)):o.push(this._cloneSketchController(r)),this._workflowStack.push(e);const s=await this._reconcileWorkflowStack();if(s.failureCount>0)throw new a("editor:failed-to-start-updating-feature","Failed to enter the provided workflow.",s)}async _reconcileWorkflowStack(){const e=this._workflowStack,t=this._sketchStack;try{const a=e.peek();return await(a?.enter()),await(t.peek()?.enter()),{activeWorkflow:a,failureCount:0}}catch(a){e.pop().destroy(),t.pop();const{activeWorkflow:o,failureCount:i}=await this._reconcileWorkflowStack();return{activeWorkflow:o,failureCount:i+1}}}_cloneSketchController(e){return{enter:e?.enter??(async()=>{}),exit:e?.exit??(async()=>{}),viewModel:e?.viewModel}}_workflowRequiresSketchViewModel(e){const{type:t}=e;return"update-feature"===t||"create-features"===t&&!W(e.data.creationInfo?.layer)}static _createWorkflowSteps(e,t="awaiting-feature-to-update"){const{data:i}=e;return U(["awaiting-feature-to-update","awaiting-update-feature-candidate","editing-existing-feature","adding-attachment","editing-attachment"],t,{"awaiting-feature-to-update":()=>({id:"awaiting-feature-to-update",async setUp(){const{spinnerViewModel:t}=i.viewModel,a=i.viewModel.view;a.activeTool=null;let c=null;e.addHandles(o((()=>{c=r(c)})),this.id),i.rootFeature=null,i.candidates=[];const p=a.on("immediate-click",(async o=>{const r=s();e._updatingHandles.addPromise(r.promise);try{t.location=o.mapPoint,t.visible=!0,c?.abort();const{editorItems:r}=i.viewModel;c=new AbortController;const s=await o.async((()=>new Promise(((e,t)=>{n(c?.signal,(()=>t(l()))),e(E(r,a,o,c?.signal))}))));if(d(c),i.candidates=s.filter((e=>"fulfilled"===e.status)).flatMap((e=>e.value)).filter((e=>!e.isAggregate)),t.visible=1===i.candidates.length,0===i.candidates.length)return;o.stopPropagation(),1===i.candidates.length?(i.rootFeature=i.candidates[0],e.go("editing-existing-feature").catch((()=>{})).then((()=>t.visible=!1))):e.next()}finally{r.resolve()}}),_.TOOL),u=h((()=>null!=a.activeTool),(()=>e.cancel({force:!0})),{once:!0});a.focus(),e.addHandles([p,u],this.id)},async tearDown(){0===i.candidates.length&&(i.viewModel.spinnerViewModel.visible=!1),e.removeHandles(this.id)}}),"awaiting-update-feature-candidate":()=>({id:"awaiting-update-feature-candidate",async setUp(){i.rootFeature=null;const{view:t}=i.viewModel;if(!t)return;const a=new b({view:t,highlightGroup:C});e.addHandles([w((()=>i.rootFeature),((e,t)=>{a.remove(t),a.add(e)}),f),o((()=>a.removeAll()))],this.id)},async tearDown(){e.removeHandles(this.id)}}),"editing-existing-feature":()=>({id:"editing-existing-feature",async setUp(){const{rootFeature:t,viewModel:o}=e.data;if(!t)throw new a("editor:no-feature-specified","Cannot setup the 'updating-existing-feature' step until the root feature is defined");await e.startUpdating(t),o.spinnerViewModel.visible=!1;const i=c((async()=>{await u((()=>!e.updating)),e.previous()}));e.addHandles([w((()=>e.nestedWorkflowCount),((e,t)=>{0===e&&0!==t&&i()}),f)],this.id)},async tearDown(){await e.cancelAll(),e.removeHandles(this.id)}}),"adding-attachment":()=>({id:"adding-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"editing-existing-feature",async setUp(){},async tearDown(){i.viewModel.attachmentsViewModel.mode="view"}})})}};function L(e,{keyField:t}){return e.getField(t)?.name??t}e([g()],H.prototype,"activeEditorItem",null),e([g()],H.prototype,"activeFeatureFormViewModel",null),e([g()],H.prototype,"activeSketchViewModel",null),e([g()],H.prototype,"activeWorkflow",null),e([g()],H.prototype,"updating",null),e([g()],H.prototype,"data",void 0),e([g()],H.prototype,"hasPreviousStep",null),e([g()],H.prototype,"hasUpdatableCandidates",null),e([g()],H.prototype,"nestedWorkflowCount",null),e([g()],H.prototype,"shouldShowAttachments",null),e([g()],H.prototype,"shouldAllowAttachmentEditing",null),e([g()],H.prototype,"hasPendingEdits",null),e([g()],H.prototype,"helpMessage",null),e([g()],H.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],H.prototype,"hasInvalidFormTemplate",null),H=O=e([k(R)],H);const T=(e,t)=>V().warn(`editor:${e}`,t,"The create operation will be allowed to proceed, but the resulting feature may not be related to the given parent feature."),D=e=>!!e&&/update-/.test(e.type),N=H;export{N as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as i}from"../../core/memoize.js";import{watch as o,on as n}from"../../core/reactiveUtils.js";import{union as s}from"../../core/SetUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../core/unitUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../chunks/vec32.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as v}from"../../geometry/support/ray.js";import{GeometryDescriptor as y}from"../../layers/support/ElevationQuery.js";import{externalToInternalIntersectOptions as f}from"../../views/3d/support/hitTest.js";import{newIntersector as h}from"../../views/3d/webgl-engine/lib/Intersector.js";import{StoreResults as w}from"../../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as _}from"../../views/3d/webgl-engine/lib/intersectorUtilsConversions.js";import g from"./ElevationProfileLine.js";const j=2e5;let I=class extends g{constructor(e){super(e),this.type="view",this.color=new t("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=i(((e,t,r,i,o,n,s)=>({inputGraphicUid:null!=e?x(e):null,visibleLayers:t,maxIntersectionDistance:r,intersectOptions:i,view:o,stationary:n,spatialReference:s}))),this._vecA=p(),this._vecB=p(),this._ray=m()}get minDemResolution(){const e=this._viewModel?.view;if(null==e||"3d"!==e.type)return null;const t=e.pointsOfInterest?.focus?.worldUnitsPerContentPixel;return null==t?null:t*l(e.spatialReference)}get queryElevationDependencies(){const e=this._view;return e?this._getQueryElevationDependencies(this._viewModel?.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter((e=>e.visible)).toArray()??[]}get _intersectOptions(){const e=this._view;if(null==e||e.destroyed)return{};const t=f(e,{include:this.include,exclude:this.exclude}),r=f(e,{exclude:this._pointCloudLayers});return t.exclude=s(t.exclude,r.exclude),t}get _pointCloudLayers(){const e=this._view;return null==e?[]:e.allLayerViews.toArray().filter((e=>"point-cloud"===e.layer?.type)).map((e=>e.layer))}get _view(){const e=this._viewModel?.view;return null!=e&&"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return e?.renderCoordsHelper?d(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(null==e)return null;const t=h(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=w.ALL,t}async queryElevation(e,{noDataValue:t,signal:r}){const i=this.queryElevationDependencies;if(null==i)throw new Error("ElevationProfileLineInput: no dependencies");const o=this._intersector;if(null==o)throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:n,view:s,spatialReference:l}=i,c=s.renderCoordsHelper,a=s.sceneIntersectionHelper,p=this._vecA,d=this._vecA,m=this._vecB,f=this._ray;if(!l)return{geometry:e,noDataValue:t};const h=await y.fromGeometry(e).project(l,r);if(!h)return{geometry:e,noDataValue:t};const w=h.coordinates,_=w.length;for(let y=0;y<_;++y){const e=w[y];u(m,e.x,e.y,e.z??0),c.toRenderCoords(m,l,m),c.setAltitude(p,j,m);const r=v(p,m,f);a.computeIntersection(r,o,n,!0);const s=b(i,o.results.all);s?(s.getIntersectionPoint(d),c.fromRenderCoords(d,d,l),e.z=d[2]):e.z=t}return{geometry:h.export(),noDataValue:t}}attach(e){const t=()=>this._onChange();return r([super.attach(e),o((()=>this.queryElevationDependencies),t),n((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};function b({view:e,inputGraphicUid:t,maxIntersectionDistance:r},i){for(const o of i){if(null!=o.distanceInRenderSpace&&o.distanceInRenderSpace>r)continue;const i=_(o,e);if(null==i||x(i)!==t)return o}return null}function x(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}e([c({type:t,nonNullable:!0})],I.prototype,"color",void 0),e([c()],I.prototype,"viewVisualizationEnabled",void 0),e([c()],I.prototype,"include",void 0),e([c()],I.prototype,"exclude",void 0),e([c({readOnly:!0})],I.prototype,"minDemResolution",null),e([c()],I.prototype,"queryElevationDependencies",null),e([c()],I.prototype,"_visibleLayers",null),e([c()],I.prototype,"_intersectOptions",null),e([c()],I.prototype,"_pointCloudLayers",null),e([c()],I.prototype,"_view",null),e([c()],I.prototype,"_maxIntersectionDistance",null),e([c()],I.prototype,"_intersector",null),I=e([a("esri.widgets.ElevationProfile.ElevationProfileLineView")],I);const L=I;export{L as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Color.js";import{handlesGroup as r}from"../../core/handleUtils.js";import{memoize as i}from"../../core/memoize.js";import{watch as o,on as n}from"../../core/reactiveUtils.js";import{union as s}from"../../core/SetUtils.js";import{getMetersPerVerticalUnitForSR as l}from"../../core/unitUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import{i as u}from"../../chunks/vec32.js";import{create as p}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as d}from"../../geometry/ellipsoidUtils.js";import{create as m,fromPoints as v}from"../../geometry/support/ray.js";import{GeometryDescriptor as y}from"../../layers/support/ElevationQuery.js";import{externalToInternalIntersectOptions as f}from"../../views/3d/support/hitTest.js";import{newIntersector as h}from"../../views/3d/webgl-engine/lib/Intersector.js";import{StoreResults as w}from"../../views/3d/webgl-engine/lib/IntersectorInterfaces.js";import{toGraphic as _}from"../../views/3d/webgl-engine/lib/intersectorUtilsConversions.js";import g from"./ElevationProfileLine.js";const j=2e5;let b=class extends g{constructor(e){super(e),this.type="view",this.color=new t("#cf4ccf"),this.viewVisualizationEnabled=!0,this.include=null,this.exclude=null,this.numSamplesForPreview=50,this.numSamplesPerChunk=25,this._getQueryElevationDependencies=i(((e,t,r,i,o,n,s)=>({inputGraphicUid:null!=e?x(e):null,visibleLayers:t,maxIntersectionDistance:r,intersectOptions:i,view:o,stationary:n,spatialReference:s}))),this._vecA=p(),this._vecB=p(),this._ray=m()}get minDemResolution(){const e=this._viewModel?.view;if(null==e||"3d"!==e.type)return null;const t=e.pointsOfInterest?.focus?.worldUnitsPerContentPixel;return null==t?null:t*l(e.spatialReference)}get queryElevationDependencies(){const e=this._view;return e?this._getQueryElevationDependencies(this._viewModel?.input,this._visibleLayers,this._maxIntersectionDistance,this._intersectOptions,e,e.stationary,e.spatialReference):null}get _visibleLayers(){return this._view?.map?.allLayers?.filter((e=>e.visible)).toArray()??[]}get _intersectOptions(){const e=this._view;if(null==e||e.destroyed)return{};const t=f(e,{include:this.include,exclude:this.exclude}),r=f(e,{exclude:this._pointCloudLayers});return t.exclude=s(t.exclude,r.exclude),t}get _pointCloudLayers(){const e=this._view;return null==e?[]:e.allLayerViews.toArray().filter((e=>"point-cloud"===e.layer?.type)).map((e=>e.layer))}get _view(){const e=this._viewModel?.view;return null!=e&&"3d"===e.type?e:null}get _maxIntersectionDistance(){const e=this._view;return e?.renderCoordsHelper?d(e.spatialReference).radius/e.renderCoordsHelper.unitInMeters:Number.POSITIVE_INFINITY}get _intersector(){const e=this._view;if(null==e)return null;const t=h(e.state.viewingMode),r=t.options;return r.hud=!1,r.invisibleTerrain=!1,r.backfacesTerrain=!1,r.selectionMode=!1,r.store=w.ALL,t}async queryElevation(e,{noDataValue:t,signal:r}){const i=this.queryElevationDependencies;if(null==i)throw new Error("ElevationProfileLineInput: no dependencies");const o=this._intersector;if(null==o)throw new Error("ElevationProfileLineInput: no view");const{intersectOptions:n,view:s,spatialReference:l}=i,c=s.renderCoordsHelper,a=s.sceneIntersectionHelper,p=this._vecA,d=this._vecA,m=this._vecB,f=this._ray;if(!l)return{geometry:e,noDataValue:t};const h=await y.fromGeometry(e).project(l,r);if(!h)return{geometry:e,noDataValue:t};const w=h.coordinates,_=w.length;for(let y=0;y<_;++y){const e=w[y];u(m,e.x,e.y,e.z??0),c.toRenderCoords(m,l,m),c.setAltitude(p,j,m);const r=v(p,m,f);a.computeIntersection(r,o,n,!0);const s=I(i,o.results.all);s?(s.getIntersectionPoint(d),c.fromRenderCoords(d,d,l),e.z=d[2]):e.z=t}return{geometry:h.export(),noDataValue:t}}attach(e){const t=()=>this._onChange();return r([super.attach(e),o((()=>this.queryElevationDependencies),t),n((()=>e.elevationProvider),"elevation-change",t,{onListenerAdd:t,onListenerRemove:t})])}};function I({view:e,inputGraphicUid:t,maxIntersectionDistance:r},i){for(const o of i){if(!o.withinDistance(r))continue;const i=_(o,e);if(null==i||x(i)!==t)return o}return null}function x(e){if(e.layer&&"objectIdField"in e.layer){const t=e.attributes[e.layer.objectIdField];if(t)return`o-${e.layer.id}-${t}`}return`u-${e.uid}`}e([c({type:t,nonNullable:!0})],b.prototype,"color",void 0),e([c()],b.prototype,"viewVisualizationEnabled",void 0),e([c()],b.prototype,"include",void 0),e([c()],b.prototype,"exclude",void 0),e([c({readOnly:!0})],b.prototype,"minDemResolution",null),e([c()],b.prototype,"queryElevationDependencies",null),e([c()],b.prototype,"_visibleLayers",null),e([c()],b.prototype,"_intersectOptions",null),e([c()],b.prototype,"_pointCloudLayers",null),e([c()],b.prototype,"_view",null),e([c()],b.prototype,"_maxIntersectionDistance",null),e([c()],b.prototype,"_intersector",null),b=e([a("esri.widgets.ElevationProfile.ElevationProfileLineView")],b);const L=b;export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{deprecatedFunction as l}from"../../core/deprecate.js";import o from"../../core/Error.js";import n from"../../core/Handles.js";import a from"../../core/Logger.js";import{debounce as r,ignoreAbortErrors as h,createResolver as d}from"../../core/promiseUtils.js";import{watch as m,initial as c,on as p}from"../../core/reactiveUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as b}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as f,isSubtypeGroupLayer as y}from"../../layers/support/layerUtils.js";import{createFieldInfos as w}from"../../support/popupUtils.js";import T from"../../tables/AttributeTableTemplate.js";import{highlightsSupported as _}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as I}from"../../views/support/selectionUtils.js";import C from"./ActionColumn.js";import v from"./AttachmentsColumn.js";import E from"./FieldColumn.js";import A from"./RelationshipColumn.js";import F from"./Grid/Column.js";import j from"./Grid/Grid.js";import S from"./Grid/GridViewModel.js";import R from"./Grid/GroupColumn.js";import x from"./support/AttachmentsColumnTemplate.js";import U from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as O,isRelationshipColumn as V}from"./support/columnUtils.js";import{downloadAttachmentInfo as P,exportToCSV as W}from"./support/exportUtils.js";import z from"./support/FeatureStore.js";import B from"./support/FieldColumnTemplate.js";import L from"./support/RelationshipColumnTemplate.js";import Z from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as G,findRelatedLayerInSources as k,findRelationship as N,uniqueColumnNames as M,hasColumnForField as H,findField as $,isIFeatureTableSupportedLayerWithAttachments as D,getRelationshipIdsToShow as q}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as Q}from"../support/decorators/messageBundle.js";import{onLocaleChange as K}from"../../intl/locale.js";import{substitute as J}from"../../intl/substitute.js";import{fetchMessageBundle as X}from"../../intl/messages.js";const Y="80px";let ee=class extends S{constructor(e){super(e),this._debounceRefresh=r((()=>this._refresh())),this._highlights=new n,this.actionColumnConfig=null,this.attachmentsViewOptions=new U,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new i,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:o});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layers=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new i,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,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 z),this._set("grid",new j({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await X("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await X("esri/t9n/common"),this.messagesUnits=await X("esri/core/t9n/Units"),this.messagesURIUtils=await X("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([K((()=>{e(),this._generateColumns()})),m((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const 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()}),c),p((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),m((()=>this.attachmentsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),m((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),m((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),m((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),m((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),m((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),m((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),m((()=>this.editingEnabled),(e=>{this.editableColumns.forEach((t=>t.tableEditingEnabled=e)),this.refreshCellContent()})),m((()=>this.timeZone??this.view?.timeZone),(()=>this.refreshCellContent())),m((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),m((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),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:i,path:s,type:l})=>{const o=t?.feature,n=o?.getObjectId(),a="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:n}),(a||"cell-click"===l)&&this._onCellInteraction(n)})),m((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),m((()=>this.relatedRecordsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),p((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),m((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),m((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),m((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)})),m((()=>this.state),(e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()})),p((()=>this.tableParent?.highlightIds),"change",(({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}})),p((()=>this.tableParent),"cell-click",(e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)})),m((()=>this.attachmentsViewOptions.objectId),((e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),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 _highlightableLayerView(){const e=this.layerView;return _(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return I(e)&&this._selectionManager?.sources.includes(e)?e:null}get _subtypes(){return f(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:s,highlightIds:l}=this,o=new i;return e&&o.push({type:"geometry",geometry:e}),s?o.push({type:"selection",objectIds:l.toArray()}):t.length&&o.push({type:"objectId",objectIds:t.toArray()}),o}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 attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(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())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new i}set hiddenFields(e){this._set("hiddenFields",s(e,this._get("hiddenFields"),i))}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get isSyncingAttachments(){return this.store.syncingAttachmentEdits||this.relatedTables.some((e=>!!e.isSyncingAttachments))}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===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(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!G(e)||!i?.length)return l;const o=[],n=s?.layers||t||[];return i.forEach((t=>{const i=k(e,n,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))})),o}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 showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{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 supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){const{store:{supportsDeletingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach((t=>t.tableTimeZone=e)),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach((t=>t.view=e)),this.refreshCellContent()}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:s,objectId:l,relationshipId:o}=t,{objectIdField:n}=s,a=N(s,o),r=s.displayField||a?.keyField||n;e.set({highlightIds:new i([l]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,r,o)});const h=e.hiddenFields;h.includes(M.action)||h.add(M.action),h.includes(M.attachments)||h.add(M.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find((e=>e.id===t));P(i)}drainRelatedTables(){this.relatedTables.drain((e=>e.destroy())),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([M.action,M.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach((e=>e.destroy()));const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await W({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(l(a.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(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,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(M.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return this.relatedTables.forEach((async e=>await e.refresh())),h(this._debounceRefresh())}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const 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(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:s,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const o=l.displayField||l.objectIdField,n=await this.store.getAttachmentsByObjectId(e,!0),a=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:n,mode:n.length?"list":"file",objectId:e}),this.set({highlightIds:new i([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(o)}),s.includes(M.action)||s.add(M.action),null!=a&&this.scrollToIndex(a)}clearSelectionFilter(){l(a.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch((e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)})),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await t.goTo(l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&y(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some((e=>O(e)))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some((e=>V(e)))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:i}=this;if(!e||!i)return null;const{elements:s,orderByFields:l}=e,o=w(i),n=[];n.push(...this._generateColumnsFromAttributeTableElements(s,l));const a=o.map((e=>{if(!e.fieldName||H(e.fieldName,n))return null;const{fieldName:t}=e,s=$(i,t);return s?this._generateDefaultFieldColumn(s,{hidden:!0,orderByFields:l}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)})).filter(t);return n.push(...a),this.attachmentsEnabled&&D(i)&&!n.some((e=>O(e)))&&n.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&G(i)&&i.relationships?.forEach((({id:e},t)=>{const i=this.relationshipInfos.find((t=>t.relationshipId===e));i&&!n.some((t=>V(t)&&t.relationshipId===e))&&n.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))})),n.length?n:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map(((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}})).filter((e=>!!e))??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=$(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:n,label:a}=i,r=s?.findIndex((({field:e})=>e&&e===l))??-1,h=r>-1?s?.at(r)?.order:void 0,d=r>-1?r:null,{editingEnabled:m,grid:c,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,timeZone:f,view:y}=this;return new E({description:n,direction:h,field:o,fieldName:l,grid:c,initialSortPriority:d,label:a,layer:t,messages:p,messagesCommon:u,messagesURIUtils:g,store:b,tableEditingEnabled:m,tableTimeZone:f,view:y,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:n,messagesCommon:a,messagesURIUtils:r,store:h,timeZone:d}=this;return new R({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:n,messagesCommon:a,messagesURIUtils:r,store:h,tableTimeZone:d})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:n,messages:a,messagesCommon:r,messagesURIUtils:h,store:d,timeZone:m}=this;return new v({description:s,fieldName:`${M.attachments}-${i}`,grid:o,label:l,layer:n,messages:a,messagesCommon:r,messagesURIUtils:h,store:d,tableTimeZone:m,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,n=this.relationshipInfos.find((e=>e.relationshipId===o));if(!n)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:a,messages:r,messagesCommon:h,messagesURIUtils:d,store:m,timeZone:c}=this;return new A({description:s,fieldName:`${M.relationship}-${o}-${i}`,grid:a,label:l,messages:r,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,tableTimeZone:c,layer:n.relatedLayer,relatedLayer:n.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:a,timeZone:r,view:h}=this;if(!e?.length||!s)return null;const d=[];return e.forEach(((e,m)=>{const{autoWidth:c,description:p,direction:u,flexGrow:g,fieldName:b,formatFunction:f,frozen:y,frozenToEnd:w,icon:T,initialSortPriority:_,invalid:I,label:C,menuConfig:v,resizable:A,sortable:j,textAlign:S,textWrap:x,timeZone:U,type:O,width:V}=e;if(!O)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(y&&w)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const P=!1===e.visible;if("group"===O){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromColumnTemplates(e.columnTemplates),s=P||this._isFieldHidden(e.label);d.push(new R({autoWidth:c,columns:t,description:p,flexGrow:g,frozen:y,frozenToEnd:w,grid:i,hidden:s,icon:T,invalid:I,label:C,menuConfig:v,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:A,tableTimeZone:r,textAlign:S,textWrap:x,timeZone:U,width:V}))}else if("attachment"===O){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");d.push(this._generateAttachmentsColumnFromTemplate(e,m))}else if("relationship"===O){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find((e=>e.relationshipId===t));if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");d.push(this._generateRelationshipColumnFromTemplate(i,e,m))}else if(!b)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const W=P||this._isFieldHidden(b);if("column"===O)d.push(new F({autoWidth:c,description:p,direction:u,fieldName:b,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:w,grid:i,hidden:W,icon:T,initialSortPriority:_,invalid:I,label:C,menuConfig:v,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:A,sortable:j,tableTimeZone:r,textAlign:S,textWrap:x,timeZone:U,width:V}));else if("field"===O){const m=$(s,e.fieldName);if(!m)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:b,required:F}=e;d.push(new E({autoWidth:c,description:p,direction:u,editable:b,field:m,fieldName:m.name,flexGrow:g,formatFunction:f,frozen:y,frozenToEnd:w,grid:i,hidden:W,icon:T,initialSortPriority:_,invalid:I,label:C,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,menuConfig:v,required:F,resizable:A,sortable:j,store:a,tableEditingEnabled:t,tableTimeZone:r,template:e,textAlign:S,textWrap:x,timeZone:U,width:V,view:h,onShowPromptCallback:this._onShowPromptCallback}))}})),d.length?d:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map((e=>this._generateDefaultFieldColumn(e))).filter(t)??[]}_generateDefaultFieldColumn(e,t){const{editingEnabled:i,grid:s,layer:l,messages:o,messagesCommon:n,messagesURIUtils:a,store:r,timeZone:h,view:d}=this,m=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const c=e.name,p=m?.findIndex((e=>e.field&&e.field===c)),u=null!=p?m?.at(p)?.order:null,g=null!=p&&p>-1?p:void 0;return new E({direction:u,field:e,fieldName:c,grid:s,hidden:t?.hidden||this._isFieldHidden(c),initialSortPriority:g,layer:l,messages:o,messagesCommon:n,messagesURIUtils:a,store:r,tableEditingEnabled:i,tableTimeZone:h,view:d,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:a,timeZone:r}=this,{attachmentsViewEnabled:h,autoWidth:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,resizable:_,textAlign:I,textWrap:C,thumbnailAppearance:E,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:S,width:R}=e;return new v({attachmentsViewEnabled:h,autoWidth:d,description:m,fieldName:`${M.attachments}-${t}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,layer:s,menuConfig:T,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:_,store:a,tableTimeZone:r,textAlign:I,textWrap:C,thumbnailAppearance:E,thumbnailCount:A,thumbnailIconScale:F,thumbnailsEnabled:j,timeZone:S,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,timeZone:a}=this,r=M.attachments;return new v({fieldName:r,grid:t,hidden:e?.hidden||this._isFieldHidden(r),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,tableTimeZone:a,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:a,timeZone:r}=this,{autoWidth:h,collapsed:d,description:m,flexGrow:c,fieldName:p,formatFunction:u,frozen:g,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,relationshipId:_,resizable:I,textAlign:C,textWrap:v,timeZone:E,width:F}=t;return new A({autoWidth:h,collapsed:d,description:m,fieldName:`${M.relationship}-${_}-${i}`,flexGrow:c,formatFunction:u,frozen:g,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,menuConfig:T,messages:l,messagesCommon:o,messagesURIUtils:n,relationshipId:_,resizable:I,store:a,tableTimeZone:r,textAlign:C,textWrap:v,timeZone:E,width:F,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach(((t,s)=>{const{relationshipId:l}=t,o=e.find((e=>e.relationshipId===l));o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))})):e.forEach(((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e})))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:n,messagesCommon:a,messagesURIUtils:r}=this,{relationshipId:h}=l;return new A({...t,fieldName:`${M.relationship}-${h}-${s}`,grid:o,hidden:i,messages:n,messagesCommon:a,messagesURIUtils:r,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new C({hidden:this._isFieldHidden(M.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const 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){const t=e.layer;if(!t)return;const i=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(M.action)||s.add(M.action),s.includes(M.attachments)||s.add(M.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const t=e.layer?.displayField||e.layer?.objectIdField||"";e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(t)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:q(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([M.action,M.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new Z({columnTemplates:[new B({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}})))},resizable:!1}),new L({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:Y})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new B({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}})))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new x({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:Y})),new Z({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:n}=this;if(!n||!o.length)return void t.cancel();const a=o.find((e=>e.code===l));if(!a)return void t.cancel();const r=d(),h=this._createSubtypeEditPrompt(s,a,r),m=!!n.parent;try{this.showPrompt(h);const e=await r.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(a.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),m&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),m&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:l,messagesCommon:o}=this,n=s.find((t=>t.code===e))?.name??`${e}`;let a="update-fields";const r=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:J(l.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:r,defaultRadioSelection:"update-fields",onRadioSelection:e=>{a=e},actions:{primary:{label:o.apply,action:()=>i.resolve(a),type:"positive"},secondary:{label:o.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new Z({columnTemplates:[new B({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map((([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}})))},resizable:!1}),new x({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:Y})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter((({type:e})=>"field"===e||"column"===e)).map((({fieldName:e,label:t})=>[e,t])):i?.fields.map((e=>[e.name,e.alias]))??[]}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e,t){t?a.getLogger(this).warnOnce(e):a.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([u()],ee.prototype,"_defaultHiddenFields",null),e([u()],ee.prototype,"_effectiveTableTemplate",null),e([u()],ee.prototype,"_effectiveAttributeTableTemplate",null),e([u()],ee.prototype,"_highlights",void 0),e([u()],ee.prototype,"_highlightableLayerView",null),e([u()],ee.prototype,"_selectionManager",null),e([u()],ee.prototype,"_selectableLayer",null),e([u()],ee.prototype,"_subtypes",null),e([u()],ee.prototype,"_tableHighlightsReady",null),e([u()],ee.prototype,"_viewSelection",null),e([u()],ee.prototype,"_viewSelectionReady",null),e([u()],ee.prototype,"actionColumnConfig",void 0),e([u()],ee.prototype,"allRelatedTablesVisible",null),e([u()],ee.prototype,"activeFilters",null),e([u({readOnly:!0})],ee.prototype,"activeSortOrders",null),e([u()],ee.prototype,"attachmentsEnabled",null),e([u()],ee.prototype,"attachmentsViewOptions",void 0),e([u({type:T})],ee.prototype,"attributeTableTemplate",void 0),e([u()],ee.prototype,"autoRefreshEnabled",void 0),e([u()],ee.prototype,"clearPrompt",null),e([u({readOnly:!0})],ee.prototype,"columns",void 0),e([u()],ee.prototype,"dataProvider",void 0),e([u()],ee.prototype,"editingEnabled",void 0),e([u()],ee.prototype,"filterGeometry",null),e([u()],ee.prototype,"filterBySelectionEnabled",null),e([u({readOnly:!0})],ee.prototype,"grid",void 0),e([u()],ee.prototype,"hiddenFields",null),e([u()],ee.prototype,"highlightEnabled",void 0),e([u()],ee.prototype,"initialSize",null),e([u()],ee.prototype,"isQueryingOrSyncing",null),e([u()],ee.prototype,"isSyncingAttachments",null),e([u({readOnly:!0})],ee.prototype,"itemIdPath",void 0),e([u()],ee.prototype,"layer",null),e([u()],ee.prototype,"layers",void 0),e([u()],ee.prototype,"layerView",null),e([u()],ee.prototype,"messages",void 0),e([u(),Q("esri/t9n/common")],ee.prototype,"messagesCommon",void 0),e([u(),Q("esri/core/t9n/Units")],ee.prototype,"messagesUnits",void 0),e([u(),Q("esri/widgets/support/t9n/uriUtils")],ee.prototype,"messagesURIUtils",void 0),e([u()],ee.prototype,"outFields",null),e([u()],ee.prototype,"prompt",void 0),e([u()],ee.prototype,"relatedRecordsEnabled",null),e([u()],ee.prototype,"relatedTable",null),e([u()],ee.prototype,"relatedTables",void 0),e([u()],ee.prototype,"relationship",null),e([u()],ee.prototype,"relationshipColumnConfigs",void 0),e([u()],ee.prototype,"relationshipConfig",null),e([u()],ee.prototype,"relationshipInfos",null),e([u()],ee.prototype,"relationships",null),e([u()],ee.prototype,"returnGeometryEnabled",null),e([u()],ee.prototype,"returnMEnabled",null),e([u()],ee.prototype,"returnZEnabled",null),e([u()],ee.prototype,"selectionSource",void 0),e([u()],ee.prototype,"showAllRelatedTables",null),e([u()],ee.prototype,"showPrompt",null),e([u()],ee.prototype,"showRelatedTableCallback",void 0),e([u({readOnly:!0,type:z})],ee.prototype,"store",void 0),e([u()],ee.prototype,"supportsAttachments",null),e([u()],ee.prototype,"supportsAddAttachments",null),e([u()],ee.prototype,"supportsDeleteAttachments",null),e([u()],ee.prototype,"supportsResizeAttachments",null),e([u()],ee.prototype,"supportsUpdateAttachments",null),e([u()],ee.prototype,"tableController",void 0),e([u()],ee.prototype,"tableParent",void 0),e([u({type:Z})],ee.prototype,"tableTemplate",void 0),e([u()],ee.prototype,"tableTemplateOverride",void 0),e([u()],ee.prototype,"timeExtent",null),e([u()],ee.prototype,"timeZone",null),e([u()],ee.prototype,"view",null),ee=e([g("esri.widgets.FeatureTable.FeatureTableViewModel")],ee);const te=ee;export{te as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{isSome as t}from"../../core/arrayUtils.js";import i from"../../core/Collection.js";import{referenceSetter as s}from"../../core/collectionUtils.js";import{deprecatedFunction as l}from"../../core/deprecate.js";import o from"../../core/Error.js";import n from"../../core/Handles.js";import r from"../../core/Logger.js";import{abortMaybe as a}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as d,after as m,throwIfAborted as c,createResolver as p}from"../../core/promiseUtils.js";import{watch as g,initial as u,on as b}from"../../core/reactiveUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as w}from"../../layers/support/fieldUtils.js";import{getSubtypesFromLayer as T,isSubtypeGroupLayer as _}from"../../layers/support/layerUtils.js";import{createFieldInfos as C}from"../../support/popupUtils.js";import I from"../../tables/AttributeTableTemplate.js";import{defaultHighlightName as v,temporaryHighlightName as E}from"../../views/support/HighlightDefaults.js";import{highlightsSupported as A}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as F}from"../../views/support/selectionUtils.js";import j from"./ActionColumn.js";import S from"./AttachmentsColumn.js";import R from"./FieldColumn.js";import x from"./RelationshipColumn.js";import U from"./Grid/Column.js";import O from"./Grid/Grid.js";import V from"./Grid/GridViewModel.js";import P from"./Grid/GroupColumn.js";import W from"./support/AttachmentsColumnTemplate.js";import z from"./support/AttachmentsViewOptions.js";import{isAttachmentsColumn as H,isRelationshipColumn as B}from"./support/columnUtils.js";import{downloadAttachmentInfo as L,exportToCSV as Z}from"./support/exportUtils.js";import G from"./support/FeatureStore.js";import k from"./support/FieldColumnTemplate.js";import N from"./support/RelationshipColumnTemplate.js";import M from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as D,findRelatedLayerInSources as $,findRelationship as q,uniqueColumnNames as Q,hasColumnForField as K,findField as J,isIFeatureTableSupportedLayerWithAttachments as X,getTableHighlightKey as Y,getRelationshipIdsToShow as ee}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as te}from"../support/decorators/messageBundle.js";import{onLocaleChange as ie}from"../../intl/locale.js";import{substitute as se}from"../../intl/substitute.js";import{fetchMessageBundle as le}from"../../intl/messages.js";const oe="80px";let ne=class extends V{constructor(e){super(e),this._debounceRefresh=h((()=>this._refresh())),this._temporaryHighlightAbortController=null,this._currentTemporaryHighlight=null,this._highlights=new n,this.actionColumnConfig=null,this.attachmentsViewOptions=new z,this.attributeTableTemplate=null,this.autoRefreshEnabled=!0,this.columns=new i,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const{objectIds:l}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===l.length&&-1===l.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const o=this.paginationEnabled?this.pageIndex:e.page,n=await s.fetchItems({...e,page:o});t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layers=null,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this.messagesURIUtils=null,this.prompt=null,this.relatedTables=new i,this.relationshipColumnConfigs=null,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,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 G),this._set("grid",new O({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await le("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await le("esri/t9n/common"),this.messagesUnits=await le("esri/core/t9n/Units"),this.messagesURIUtils=await le("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([ie((()=>{e(),this._generateColumns()})),g((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const 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()}),u),b((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),g((()=>this.grid?.temporaryHighlightId),(e=>{this._temporaryHighlightAbortController?.abort(),this._temporaryHighlightAbortController=new AbortController,d(this._syncTemporaryHighlight(e,this._temporaryHighlightAbortController.signal))})),g((()=>this.attachmentsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),g((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),g((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),g((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this.goToPage(0),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),g((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),g((()=>this.store.state),(e=>{"loaded"===e&&(this.scrollToTop(),this.refreshCellContent())})),g((()=>this._effectiveTableTemplate),(()=>{this.scrollLeft(),this.layer?.loaded&&this._generateColumns()})),g((()=>this.editingEnabled),(e=>{this.editableColumns.forEach((t=>t.tableEditingEnabled=e)),this.refreshCellContent()})),g((()=>this.timeZone??this.view?.timeZone),(()=>this.refreshCellContent())),g((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),g((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),b((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),b((()=>this.grid),["cell-click","cell-dblclick","cell-pointerover","cell-pointerout","cell-keydown","column-reorder"],(({index:e,item:t,native:i,path:s,type:l})=>{const o=t?.feature,n=o?.getObjectId(),r="cell-keydown"===l&&i&&i instanceof KeyboardEvent&&"Enter"===i.key;this.emit(l,{feature:o,index:e,native:i,type:l,fieldName:s??void 0,objectId:n}),(r||"cell-click"===l)&&this._onCellInteraction(n)})),g((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),g((()=>this.relatedRecordsEnabled),(()=>this.layer?.loaded&&this._generateColumns())),b((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()}),g((()=>[this.paginationEnabled,this.pageIndex]),(()=>this.refreshPageCache())),g((()=>this.activeSortOrders),(e=>this.store.sortOrders=e)),g((()=>this.pageCount),(()=>{this.pageIndex>=this.pageCount&&this.goToPage(0)})),g((()=>this.state),(e=>{"disabled"===e&&this.relatedTables.length&&this.drainRelatedTables()})),b((()=>this.tableParent?.highlightIds),"change",(({added:e})=>{const{relationshipConfig:t}=this,i=e[0];if(null==i||!t)return;const{relatedLayer:s,relationshipId:l}=t;this.relationshipConfig={objectId:i,relatedLayer:s,relationshipId:l}})),b((()=>this.tableParent),"cell-click",(e=>{const{tableParent:t}=this,{objectId:i}=e;t&&null!=i&&t.highlightIds.add(i)})),g((()=>this.attachmentsViewOptions.objectId),((e,t)=>{null!=e?null==t&&this.showAttachmentsView({objectId:e}):this.hideAttachmentsView()}))])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this._currentTemporaryHighlight?.handle.remove(),this._temporaryHighlightAbortController=a(this._temporaryHighlightAbortController),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return w(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _effectiveAttributeTableTemplate(){return this.attributeTableTemplate||this.layer?.attributeTableTemplate}get _highlightableLayerView(){const e=this.layerView;return A(e)?e:null}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return F(e)&&this._selectionManager?.sources.includes(e)?e:null}get _subtypes(){return T(this.layer)}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get allRelatedTablesVisible(){return!!(this.relatedRecordsEnabled&&this.relatedTables.length&&this.showAllRelatedTables)}get activeFilters(){const{filterGeometry:e,objectIds:t,filterBySelectionEnabled:s,highlightIds:l}=this,o=new i;return e&&o.push({type:"geometry",geometry:e}),s?o.push({type:"selection",objectIds:l.toArray()}):t.length&&o.push({type:"objectId",objectIds:t.toArray()}),o}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 attachmentsEnabled(){return this.store.attachmentsEnabled}set attachmentsEnabled(e){this.store.attachmentsEnabled=e}get clearPrompt(){return()=>this.prompt=null}set clearPrompt(e){this._overrideIfSome("clearPrompt",e)}get filterGeometry(){return this.store.filterGeometry}set filterGeometry(e){this.store.filterGeometry=e}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(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())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new i}set hiddenFields(e){this._set("hiddenFields",s(e,this._get("hiddenFields"),i))}get initialSize(){return this.store.initialSize}set initialSize(e){this.store.initialSize=e}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying||this.relatedTables.some((e=>!!e.isQueryingOrSyncing))}get isSyncingAttachments(){return this.store.syncingAttachmentEdits||this.relatedTables.some((e=>!!e.isSyncingAttachments))}get layer(){return this._get("layer")}set layer(e){this._highlights.removeAll(),this.drainRelatedTables(),this._set("layer",e)}get layerView(){return this.store.layerView}get outFields(){return this.store.outFields}set outFields(e){this.store.outFields=e}get relatedRecordsEnabled(){return this.store.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e}get relatedTable(){return this.relatedTables.at(-1)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===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(){const{layer:e,layers:t,relationships:i,tableController:s}=this,l=this.store.relationshipInfos;if(l.length||!D(e)||!i?.length)return l;const o=[],n=s?.layers||t||[];return i.forEach((t=>{const i=$(e,n,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))})),o}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 showAllRelatedTables(){return this._get("showAllRelatedTables")}set showAllRelatedTables(e){const{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 supportsAttachments(){return this.store.supportsAttachments}get supportsAddAttachments(){const{store:{supportsAddingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsDeleteAttachments(){const{store:{supportsDeletingAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get supportsResizeAttachments(){return this.store.supportsResizeAttachments}get supportsUpdateAttachments(){const{store:{supportsUpdateAttachments:e,supportsEditing:t}}=this;return this.editingEnabled&&t&&e}get timeExtent(){return this.store.timeExtent}set timeExtent(e){this.store.timeExtent=e}get timeZone(){return this._get("timeZone")}set timeZone(e){this.allColumns.forEach((t=>t.tableTimeZone=e)),this._set("timeZone",e)}get view(){return this.store.view}set view(e){this.store.view=e,this.fieldColumns.forEach((t=>t.view=e)),this.refreshCellContent()}async addAttachment(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.addAttachment(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to add attachment. ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async deleteAttachments(e,t){const{attachmentsViewOptions:i,store:s}=this,l=i.objectId===e;await s.deleteAttachments(e,t).catch((e=>{l&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to delete attachment(s). ${e.error.name} ${e.error.message}`),i.error=e.error)})),l&&!i.error&&(i.onEditComplete(),i.attachmentInfos=await s.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}collapseRelatedTable(e,t){const{relatedLayer:s,objectId:l,relationshipId:o}=t,{objectIdField:n}=s,r=q(s,o),a=s.displayField||r?.keyField||n;e.set({highlightIds:new i([l]),multipleSelectionEnabled:!1,tableTemplateOverride:this._getTableTemplateForRelatedTableView(e,a,o)});const h=e.hiddenFields;h.includes(Q.action)||h.add(Q.action),h.includes(Q.attachments)||h.add(Q.attachments),e.scrollLeft()}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}async downloadAttachmentById(e,t){const i=(await this.store.getAttachmentsByObjectId(e,!0)).find((e=>e.id===t));L(i)}drainRelatedTables(){this.relatedTables.drain((e=>e.destroy())),this.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:null,showAllRelatedTables:!1,tableTemplateOverride:null}),this.hiddenFields.removeMany([Q.action,Q.attachments])}drainRelatedTablesAboveIndex(e){const{relatedTables:t}=this,i=t.slice(e+1);t.removeMany(i).forEach((e=>e.destroy()));const s=t.at(-1);s&&(s.attachmentsViewOptions.objectId=null,this.allRelatedTablesVisible?this._showAllRelatedTables(s):this._hideAllRelatedTables(s))}async exportSelectionToCSV(e){const{highlightIds:t,layer:i,outFields:s}=this;i&&t.length?await Z({layer:i,objectIds:t.toArray(),outFields:s,includeGeometry:e}):this._logWarning("Export failed.")}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(l(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}getVirtualPageIndex(){return this.grid?.getVirtualPageIndex()??0}goToPage(e){if(null==e||!Number.isInteger(e))return void this._logWarning("Invalid 'page' parameter provided to 'goToPage()'. Current page will remain the same.");const{pageCount:t}=this;(e>=t||-1===e)&&(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,multipleSelectionEnabled:!0,tableTemplateOverride:null}),this.hiddenFields.remove(Q.action)}nextPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e+1)}previousPage(){const e=this.paginationEnabled?this.pageIndex:this.getVirtualPageIndex();this.goToPage(e-1)}async refresh(){return this.relatedTables.forEach((async e=>await e.refresh())),d(this._debounceRefresh())}refreshCellContent(){this.grid?.requestContentUpdate()}refreshPageCache(){this.grid?.refreshPageCache()}async reset(){this.goToPage(0),await(this.grid?.reset())}scrollLeft(){this.grid?.scrollLeft(0)}scrollToBottom(){this.grid?.scrollToBottom()}scrollToIndex(e){this.grid?.scrollToIndex(e)}scrollToRow(e){const 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(){const{attachmentId:e,form:t,objectId:i}=this.attachmentsViewOptions;null!=i&&t&&(null!=e?await this.updateAttachment(i,e,t):await this.addAttachment(i,t))}async showAttachmentsView({objectId:e}){const{attachmentsViewOptions:t,hiddenFields:s,layer:l}=this;if(!this.attachmentsEnabled||!l)return void this._logWarning("The 'attachmentsEnabled' property is currently false.");await l.load();const o=l.displayField||l.objectIdField,n=await this.store.getAttachmentsByObjectId(e,!0),r=this.store.getItemIndexByObjectId(e);t.set({attachmentInfos:n,mode:n.length?"list":"file",objectId:e}),this.set({highlightIds:new i([e]),multipleSelectionEnabled:!1,relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForAttachmentsView(o)}),s.includes(Q.action)||s.add(Q.action),null!=r&&this.scrollToIndex(r)}clearSelectionFilter(){l(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async updateAttachment(e,t,i){const{attachmentsViewOptions:s,store:l}=this,n=s.objectId===e;await l.updateAttachment(e,t,i).catch((e=>{n&&e&&"object"==typeof e&&"error"in e&&e.error instanceof o&&(this._logWarning(`Unable to update attachment. ${e.error.name} ${e.error.message}`),s.error=e.error)})),n&&!s.error&&(s.onEditComplete(),s.attachmentInfos=await l.getAttachmentsByObjectId(e,!0)),this.refreshCellContent()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const l=await e.queryFeatures(s);try{await t.goTo(l.features)}catch(o){"AbortError"!==o.name&&console.error(o)}}async _refresh(){await this.store.refresh();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.refreshPageCache();const t=this.attachmentsViewOptions;null!=t?.objectId&&(t.attachmentInfos=await this.store.getAttachmentsByObjectId(t.objectId,!0))}async _onLayerLoad(){const{layer:e,pageSize:t}=this;if(!e)return;e.parent&&_(e.parent)&&await e.parent.loadAll();const i=e.capabilities.query?.maxRecordCount,s=i&&i<t,l=s?i:t;s&&(this._logWarning("The value for 'pageSize' has been adjusted due to the provided layer's max record count."),this.pageSize=l),this.grid?.set("pageSize",l),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const{_effectiveTableTemplate:e,_effectiveAttributeTableTemplate:t}=this,i=e?.columnTemplates,s=this._generateColumnsFromColumnTemplates(i)??this._generateColumnsFromAttributeTableTemplate(t)??this._generateDefaultFieldColumns();s.length&&(this.attachmentsEnabled&&!s.some((e=>H(e)))&&s.push(this._generateDefaultAttachmentsColumn()),this.relatedRecordsEnabled&&this.relationshipInfos.length&&!s.some((e=>B(e)))&&s.push(...this._generateDefaultRelationshipColumns()),this.actionColumnConfig&&s.push(this._generateActionColumn()),s.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(s))}_generateColumnsFromAttributeTableTemplate(e){const{layer:i}=this;if(!e||!i)return null;const{elements:s,orderByFields:l}=e,o=C(i),n=[];n.push(...this._generateColumnsFromAttributeTableElements(s,l));const r=o.map((e=>{if(!e.fieldName||K(e.fieldName,n))return null;const{fieldName:t}=e,s=J(i,t);return s?this._generateDefaultFieldColumn(s,{hidden:!0,orderByFields:l}):(this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null)})).filter(t);return n.push(...r),this.attachmentsEnabled&&X(i)&&!n.some((e=>H(e)))&&n.push(this._generateDefaultAttachmentsColumn({hidden:!0})),this.relatedRecordsEnabled&&D(i)&&i.relationships?.forEach((({id:e},t)=>{const i=this.relationshipInfos.find((t=>t.relationshipId===e));i&&!n.some((t=>B(t)&&t.relationshipId===e))&&n.push(this._generateDefaultRelationshipColumn({hidden:!0,info:i,index:t}))})),n.length?n:null}_generateColumnsFromAttributeTableElements(e,t){const{layer:i}=this;return i?e?.map(((e,i)=>{switch(e.type){case"field":return this._createFieldColumnFromElement({element:e,orderByFields:t});case"group":return this._createGroupColumnFromElement({element:e,orderByFields:t});case"attachment":return this._createAttachmentColumnFromElement({element:e,index:i});case"relationship":return this._createRelationshipColumnFromElement({element:e,index:i})}})).filter((e=>!!e))??[]:[]}_createFieldColumnFromElement(e){const{layer:t}=this;if(!t)return null;const{element:i,orderByFields:s}=e,{fieldName:l}=i;if(null==l)return this._logTemplateWarning("A valid 'fieldName' must be provided."),null;const o=J(t,l);if(!o)return this._logTemplateWarning("A valid 'field' could not be found for the provided template."),null;const{description:n,label:r}=i,a=s?.findIndex((({field:e})=>e&&e===l))??-1,h=a>-1?s?.at(a)?.order:void 0,d=a>-1?a:null,{editingEnabled:m,grid:c,messages:p,messagesCommon:g,messagesURIUtils:u,store:b,timeZone:f,view:y}=this;return new R({description:n,direction:h,field:o,fieldName:l,grid:c,initialSortPriority:d,label:r,layer:t,messages:p,messagesCommon:g,messagesURIUtils:u,store:b,tableEditingEnabled:m,tableTimeZone:f,view:y,onShowPromptCallback:this._onShowPromptCallback})}_createGroupColumnFromElement(e){const{element:t,orderByFields:i}=e,{description:s,label:l}=t;if(!l)return this._logTemplateWarning("Group columns require a label."),null;if(!t.elements.length)return this._logTemplateWarning("Group columns require child columns."),null;const{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,timeZone:d}=this;return new P({columns:this._generateColumnsFromAttributeTableElements(t.elements,i),description:s,grid:o,label:l,messages:n,messagesCommon:r,messagesURIUtils:a,store:h,tableTimeZone:d})}_createAttachmentColumnFromElement(e){if(!this.attachmentsEnabled)return void this._logTemplateWarning("The 'attachmentsEnabled' property is currently false.");const{element:t,index:i}=e,{description:s,label:l}=t,{grid:o,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,timeZone:m}=this;return new S({description:s,fieldName:`${Q.attachments}-${i}`,grid:o,label:l,layer:n,messages:r,messagesCommon:a,messagesURIUtils:h,store:d,tableTimeZone:m,onShowAttachments:e=>this._onShowAttachments(e)})}_createRelationshipColumnFromElement(e){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{element:t,index:i}=e,{description:s,label:l,relationshipId:o}=t,n=this.relationshipInfos.find((e=>e.relationshipId===o));if(!n)return this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id."),null;const{grid:r,messages:a,messagesCommon:h,messagesURIUtils:d,store:m,timeZone:c}=this;return new x({description:s,fieldName:`${Q.relationship}-${o}-${i}`,grid:r,label:l,messages:a,messagesCommon:h,messagesURIUtils:d,relationshipId:o,store:m,tableTimeZone:c,layer:n.relatedLayer,relatedLayer:n.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateColumnsFromColumnTemplates(e){const{editingEnabled:t,grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a,view:h}=this;if(!e?.length||!s)return null;const d=[];return e.forEach(((e,m)=>{const{autoWidth:c,description:p,direction:g,flexGrow:u,fieldName:b,formatFunction:f,frozen:y,frozenToEnd:w,icon:T,initialSortPriority:_,invalid:C,label:I,menuConfig:v,resizable:E,sortable:A,textAlign:F,textWrap:j,timeZone:S,type:x,width:O}=e;if(!x)return void this._logTemplateWarning("Property 'type' is missing from the provided template.");if(y&&w)return void this._logTemplateWarning("Properties 'frozen' and 'frozenToEnd' cannot both be true for the same column.");const V=!1===e.visible;if("group"===x){if(!e.columnTemplates?.length)return void this._logTemplateWarning("Group columns must contain column templates.");if(!e.label)return void this._logTemplateWarning("Group columns require a label.");const t=this._generateColumnsFromColumnTemplates(e.columnTemplates),s=V||this._isFieldHidden(e.label);d.push(new P({autoWidth:c,columns:t,description:p,flexGrow:u,frozen:y,frozenToEnd:w,grid:i,hidden:s,icon:T,invalid:C,label:I,menuConfig:v,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:E,tableTimeZone:a,textAlign:F,textWrap:j,timeZone:S,width:O}))}else if("attachment"===x){if(!this.attachmentsEnabled)return void this._logTemplateWarning("Attachment columns require attachments to be enabled on the table.");d.push(this._generateAttachmentsColumnFromTemplate(e,m))}else if("relationship"===x){if(!this.relatedRecordsEnabled)return void this._logTemplateWarning("Relationship columns require related records to be enabled on the table.");const{relationshipId:t}=e;if(null==t)return void this._logTemplateWarning("Property 'relationshipId' is missing from the provided template.");const i=this.relationshipInfos.find((e=>e.relationshipId===t));if(!i)return void this._logTemplateWarning("Unable to find valid related layer target based on the provided relationship id.");d.push(this._generateRelationshipColumnFromTemplate(i,e,m))}else if(!b)return void this._logTemplateWarning("Value for 'fieldName' property was missing from the provided template.");const W=V||this._isFieldHidden(b);if("column"===x)d.push(new U({autoWidth:c,description:p,direction:g,fieldName:b,flexGrow:u,formatFunction:f,frozen:y,frozenToEnd:w,grid:i,hidden:W,icon:T,initialSortPriority:_,invalid:C,label:I,menuConfig:v,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:E,sortable:A,tableTimeZone:a,textAlign:F,textWrap:j,timeZone:S,width:O}));else if("field"===x){const m=J(s,e.fieldName);if(!m)return void this._logTemplateWarning("A valid 'field' could not be found for the provided template.");const{editable:b,required:x}=e;d.push(new R({autoWidth:c,description:p,direction:g,editable:b,field:m,fieldName:m.name,flexGrow:u,formatFunction:f,frozen:y,frozenToEnd:w,grid:i,hidden:W,icon:T,initialSortPriority:_,invalid:C,label:I,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,menuConfig:v,required:x,resizable:E,sortable:A,store:r,tableEditingEnabled:t,tableTimeZone:a,template:e,textAlign:F,textWrap:j,timeZone:S,width:O,view:h,onShowPromptCallback:this._onShowPromptCallback}))}})),d.length?d:null}_generateDefaultFieldColumns(){return this.layer?.fields?.map((e=>this._generateDefaultFieldColumn(e))).filter(t)??[]}_generateDefaultFieldColumn(e,t){const{editingEnabled:i,grid:s,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,timeZone:h,view:d}=this,m=t?.orderByFields;if(!e.visible||"geometry"===e.type)return null;const c=e.name,p=m?.findIndex((e=>e.field&&e.field===c)),g=null!=p?m?.at(p)?.order:null,u=null!=p&&p>-1?p:void 0;return new R({direction:g,field:e,fieldName:c,grid:s,hidden:t?.hidden||this._isFieldHidden(c),initialSortPriority:u,layer:l,messages:o,messagesCommon:n,messagesURIUtils:r,store:a,tableEditingEnabled:i,tableTimeZone:h,view:d,onShowPromptCallback:this._onShowPromptCallback})}_generateAttachmentsColumnFromTemplate(e,t){const{grid:i,layer:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{attachmentsViewEnabled:h,autoWidth:d,description:m,flexGrow:c,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,resizable:_,textAlign:C,textWrap:I,thumbnailAppearance:v,thumbnailCount:E,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:R}=e;return new S({attachmentsViewEnabled:h,autoWidth:d,description:m,fieldName:`${Q.attachments}-${t}`,flexGrow:c,formatFunction:g,frozen:u,frozenToEnd:b,grid:i,hidden:!1===e.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,layer:s,menuConfig:T,messages:l,messagesCommon:o,messagesURIUtils:n,resizable:_,store:r,tableTimeZone:a,textAlign:C,textWrap:I,thumbnailAppearance:v,thumbnailCount:E,thumbnailIconScale:A,thumbnailsEnabled:F,timeZone:j,width:R,onShowAttachments:e=>this._onShowAttachments(e)})}_generateDefaultAttachmentsColumn(e){const{grid:t,layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,timeZone:r}=this,a=Q.attachments;return new S({fieldName:a,grid:t,hidden:e?.hidden||this._isFieldHidden(a),layer:i,messages:s,messagesCommon:l,messagesURIUtils:o,store:n,tableTimeZone:r,onShowAttachments:e=>this._onShowAttachments(e)})}_generateRelationshipColumnFromTemplate(e,t,i){const{grid:s,messages:l,messagesCommon:o,messagesURIUtils:n,store:r,timeZone:a}=this,{autoWidth:h,collapsed:d,description:m,flexGrow:c,fieldName:p,formatFunction:g,frozen:u,frozenToEnd:b,icon:f,invalid:y,label:w,menuConfig:T,relationshipId:_,resizable:C,textAlign:I,textWrap:v,timeZone:E,width:A}=t;return new x({autoWidth:h,collapsed:d,description:m,fieldName:`${Q.relationship}-${_}-${i}`,flexGrow:c,formatFunction:g,frozen:u,frozenToEnd:b,grid:s,hidden:!1===t.visible||this._isFieldHidden(w)||this._isFieldHidden(p),icon:f,invalid:y,label:w,menuConfig:T,messages:l,messagesCommon:o,messagesURIUtils:n,relationshipId:_,resizable:C,store:r,tableTimeZone:a,textAlign:I,textWrap:v,timeZone:E,width:A,layer:e.relatedLayer,relatedLayer:e.layer,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateDefaultRelationshipColumns(){const{relationshipInfos:e,relationshipColumnConfigs:t}=this,i=[];return e?.length?(t?t.forEach(((t,s)=>{const{relationshipId:l}=t,o=e.find((e=>e.relationshipId===l));o&&i.push(this._generateDefaultRelationshipColumn({config:t,index:s,info:o}))})):e.forEach(((e,t)=>i.push(this._generateDefaultRelationshipColumn({index:t,info:e})))),i):i}_generateDefaultRelationshipColumn(e){const{config:t,hidden:i,index:s,info:l}=e,{grid:o,messages:n,messagesCommon:r,messagesURIUtils:a}=this,{relationshipId:h}=l;return new x({...t,fieldName:`${Q.relationship}-${h}-${s}`,grid:o,hidden:i,messages:n,messagesCommon:r,messagesURIUtils:a,layer:l.relatedLayer,relatedLayer:l.layer,relationshipId:h,showRelatedTableCallback:e=>this._onShowRelatedTable(e)})}_generateActionColumn(){return new j({hidden:this._isFieldHidden(Q.action),...this.actionColumnConfig})}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){if(!this.highlightEnabled)return;const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),l=s?.feature??e;this._highlights.add(t.highlight(l,v),Y(i,e))}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(Y(t,e))}async _syncTemporaryHighlight(e,t){if(!this.highlightEnabled)return this._currentTemporaryHighlight?.handle.remove(),void(this._currentTemporaryHighlight=null);if(await m(25),c(t),!this._currentTemporaryHighlight&&!e)return;const{id:i}=this._currentTemporaryHighlight??{};if(i===e)return;this._currentTemporaryHighlight?.handle?.remove(),this._currentTemporaryHighlight=null;const{_highlightableLayerView:s,layer:l,highlightEnabled:o}=this;e&&s&&l&&o&&(this._currentTemporaryHighlight={id:e,handle:s.highlight(e,E)})}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}async _onHighlightIdsChange(e){const{added:t,removed:i}=e,{attachmentsViewOptions:s}=this;if(this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray()),null!=s.objectId){const e=this.highlightIds.at(0);if(null!=e){const t=await this.store.getAttachmentsByObjectId(e,!0);s.set({attachmentInfos:t,objectId:e,mode:t.length?"list":"file"})}}}_onShowRelatedTable(e){const{highlightIds:t}=this,{objectId:i}=e;t.removeAll(),t.add(i),this.showRelatedTableCallback?this.showRelatedTableCallback(e):this.emit("show-related-table",e)}_onObjectIdsChange(){const 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){const t=e.layer;if(!t)return;const i=t.displayField||t.objectIdField;e.set({relationshipColumnConfigs:[],tableTemplateOverride:this._getTableTemplateForShowAllTablesView(e,i)});const s=e.hiddenFields;s.includes(Q.action)||s.add(Q.action),s.includes(Q.attachments)||s.add(Q.attachments)}_hideAllRelatedTables(e){const{layer:t,relationship:i}=e;if(t&&null!=i?.id)if(null!=e.attachmentsViewOptions.objectId){const t=e.layer?.displayField||e.layer?.objectIdField||"";e.set({multipleSelectionEnabled:!1,relationshipColumnConfigs:[],showAllRelatedTables:!1,tableTemplateOverride:this._getTableTemplateForAttachmentsView(t)})}else e.set({multipleSelectionEnabled:!0,relationshipColumnConfigs:ee(t,i.id),showAllRelatedTables:!1,tableTemplateOverride:null}),e.hiddenFields.removeMany([Q.action,Q.attachments])}_getTableTemplateForRelatedTableView(e,t,i){return new M({columnTemplates:[new k({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([s,l])=>({selected:s===t,label:l||s,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForRelatedTableView(e,s,i)}})))},resizable:!1}),new N({autoWidth:!1,collapsed:!0,flexGrow:0,label:"",resizable:!1,relationshipId:i,width:oe})]})}_getTableTemplateForShowAllTablesView(e,t){const i=[new k({fieldName:t,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(e.viewModel).map((([i,s])=>({selected:i===t,label:s||i,clickFunction:()=>{e.tableTemplateOverride=this._getTableTemplateForShowAllTablesView(e,i)}})))},resizable:!1})];return null!=e.attachmentsViewOptions.objectId&&i.push(new W({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:oe})),new M({columnTemplates:i})}async _onShowPromptCallback(e){const{column:t,objectId:i,oldValue:s,value:l}=e,{_subtypes:o,layer:n}=this;if(!n||!o.length)return void t.cancel();const r=o.find((e=>e.code===l));if(!r)return void t.cancel();const a=p(),h=this._createSubtypeEditPrompt(s,r,a),d=!!n.parent;try{this.showPrompt(h);const e=await a.promise,s=[{fieldName:t.fieldName,value:l}];switch(e){case"update-fields":for(const[e,t]of Object.entries(r.defaultValues))null!=t&&s.push({fieldName:e,value:t});await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"keep-existing":await t.updateItems({objectId:i,updates:s}),d&&this.refresh();break;case"undo":t.cancel()}}finally{this.clearPrompt()}}_createSubtypeEditPrompt(e,t,i){const{_subtypes:s,messages:l,messagesCommon:o}=this,n=s.find((t=>t.code===e))?.name??`${e}`;let r="update-fields";const a=[{label:l.subtypes.useDefaultValuesOption,value:"update-fields"},{label:l.subtypes.keepCurrentValuesOption,value:"keep-existing"}];return{context:"info",title:l.subtypes.changeWarningTitle,message:se(l.subtypes.changeWarning,{originalType:n,newType:t.name}),radios:a,defaultRadioSelection:"update-fields",onRadioSelection:e=>{r=e},actions:{primary:{label:o.apply,action:()=>i.resolve(r),type:"positive"},secondary:{label:o.cancel,type:"neutral",action:()=>i.resolve("undo")}},cancel:()=>i.reject()}}_onShowAttachments({objectId:e}){this.attachmentsViewOptions.objectId=e}_getTableTemplateForAttachmentsView(e){return new M({columnTemplates:[new k({fieldName:e,editable:!1,menuConfig:{selectionMode:"single",icon:"chevron-down",items:this._extractFieldColumnInfosFromTableTemplate(this).map((([t,i])=>({selected:t===e,label:i||t,clickFunction:()=>{this.tableTemplateOverride=this._getTableTemplateForAttachmentsView(t)}})))},resizable:!1}),new W({attachmentsViewEnabled:!1,autoWidth:!1,flexGrow:0,label:"",resizable:!1,thumbnailsEnabled:!1,width:oe})]})}_extractFieldColumnInfosFromTableTemplate(e){const t=e??this,{layer:i,tableTemplate:s}=t;return s?s.columnTemplates.filter((({type:e})=>"field"===e||"column"===e)).map((({fieldName:e,label:t})=>[e,t])):i?.fields.map((e=>[e.name,e.alias]))??[]}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e,t){t?r.getLogger(this).warnOnce(e):r.getLogger(this).warn(e)}_logTemplateWarning(e){this._logWarning(`${e} Skipped generating a column using the provided template.`,!0)}_onCellInteraction(e){null!=e&&null!=this.attachmentsViewOptions.objectId&&this.highlightIds.add(e)}};e([f()],ne.prototype,"_defaultHiddenFields",null),e([f()],ne.prototype,"_effectiveTableTemplate",null),e([f()],ne.prototype,"_effectiveAttributeTableTemplate",null),e([f()],ne.prototype,"_highlights",void 0),e([f()],ne.prototype,"_highlightableLayerView",null),e([f()],ne.prototype,"_selectionManager",null),e([f()],ne.prototype,"_selectableLayer",null),e([f()],ne.prototype,"_subtypes",null),e([f()],ne.prototype,"_tableHighlightsReady",null),e([f()],ne.prototype,"_viewSelection",null),e([f()],ne.prototype,"_viewSelectionReady",null),e([f()],ne.prototype,"actionColumnConfig",void 0),e([f()],ne.prototype,"allRelatedTablesVisible",null),e([f()],ne.prototype,"activeFilters",null),e([f({readOnly:!0})],ne.prototype,"activeSortOrders",null),e([f()],ne.prototype,"attachmentsEnabled",null),e([f()],ne.prototype,"attachmentsViewOptions",void 0),e([f({type:I})],ne.prototype,"attributeTableTemplate",void 0),e([f()],ne.prototype,"autoRefreshEnabled",void 0),e([f()],ne.prototype,"clearPrompt",null),e([f({readOnly:!0})],ne.prototype,"columns",void 0),e([f()],ne.prototype,"dataProvider",void 0),e([f()],ne.prototype,"editingEnabled",void 0),e([f()],ne.prototype,"filterGeometry",null),e([f()],ne.prototype,"filterBySelectionEnabled",null),e([f({readOnly:!0})],ne.prototype,"grid",void 0),e([f()],ne.prototype,"hiddenFields",null),e([f()],ne.prototype,"highlightEnabled",void 0),e([f()],ne.prototype,"initialSize",null),e([f()],ne.prototype,"isQueryingOrSyncing",null),e([f()],ne.prototype,"isSyncingAttachments",null),e([f({readOnly:!0})],ne.prototype,"itemIdPath",void 0),e([f()],ne.prototype,"layer",null),e([f()],ne.prototype,"layers",void 0),e([f()],ne.prototype,"layerView",null),e([f()],ne.prototype,"messages",void 0),e([f(),te("esri/t9n/common")],ne.prototype,"messagesCommon",void 0),e([f(),te("esri/core/t9n/Units")],ne.prototype,"messagesUnits",void 0),e([f(),te("esri/widgets/support/t9n/uriUtils")],ne.prototype,"messagesURIUtils",void 0),e([f()],ne.prototype,"outFields",null),e([f()],ne.prototype,"prompt",void 0),e([f()],ne.prototype,"relatedRecordsEnabled",null),e([f()],ne.prototype,"relatedTable",null),e([f()],ne.prototype,"relatedTables",void 0),e([f()],ne.prototype,"relationship",null),e([f()],ne.prototype,"relationshipColumnConfigs",void 0),e([f()],ne.prototype,"relationshipConfig",null),e([f()],ne.prototype,"relationshipInfos",null),e([f()],ne.prototype,"relationships",null),e([f()],ne.prototype,"returnGeometryEnabled",null),e([f()],ne.prototype,"returnMEnabled",null),e([f()],ne.prototype,"returnZEnabled",null),e([f()],ne.prototype,"selectionSource",void 0),e([f()],ne.prototype,"showAllRelatedTables",null),e([f()],ne.prototype,"showPrompt",null),e([f()],ne.prototype,"showRelatedTableCallback",void 0),e([f({readOnly:!0,type:G})],ne.prototype,"store",void 0),e([f()],ne.prototype,"supportsAttachments",null),e([f()],ne.prototype,"supportsAddAttachments",null),e([f()],ne.prototype,"supportsDeleteAttachments",null),e([f()],ne.prototype,"supportsResizeAttachments",null),e([f()],ne.prototype,"supportsUpdateAttachments",null),e([f()],ne.prototype,"tableController",void 0),e([f()],ne.prototype,"tableParent",void 0),e([f({type:M})],ne.prototype,"tableTemplate",void 0),e([f()],ne.prototype,"tableTemplateOverride",void 0),e([f()],ne.prototype,"timeExtent",null),e([f()],ne.prototype,"timeZone",null),e([f()],ne.prototype,"view",null),ne=e([y("esri.widgets.FeatureTable.FeatureTableViewModel")],ne);const re=ne;export{re as default};