@arcgis/core 4.24.0-next.20220511 → 4.24.0-next.20220512

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 (231) hide show
  1. package/assets/components/assets/icon/compactness16.json +1 -0
  2. package/assets/components/assets/icon/compactness24.json +1 -0
  3. package/assets/components/assets/icon/compactness32.json +1 -0
  4. package/assets/components/assets/icon/configure16.json +1 -0
  5. package/assets/components/assets/icon/configure24.json +1 -0
  6. package/assets/components/assets/icon/configure32.json +1 -0
  7. package/assets/components/assets/icon/debugScript16.json +1 -0
  8. package/assets/components/assets/icon/debugScript24.json +1 -0
  9. package/assets/components/assets/icon/debugScript32.json +1 -0
  10. package/assets/components/assets/icon/dissolveFeatures16.json +1 -0
  11. package/assets/components/assets/icon/dissolveFeatures24.json +1 -0
  12. package/assets/components/assets/icon/dissolveFeatures32.json +1 -0
  13. package/assets/components/assets/icon/distanceType16.json +1 -0
  14. package/assets/components/assets/icon/distanceType24.json +1 -0
  15. package/assets/components/assets/icon/distanceType32.json +1 -0
  16. package/assets/components/assets/icon/gridDiamond16.json +1 -0
  17. package/assets/components/assets/icon/gridDiamond24.json +1 -0
  18. package/assets/components/assets/icon/gridDiamond32.json +1 -0
  19. package/assets/components/assets/icon/gridHexagon16.json +1 -0
  20. package/assets/components/assets/icon/gridHexagon24.json +1 -0
  21. package/assets/components/assets/icon/gridHexagon32.json +1 -0
  22. package/assets/components/assets/icon/gridTriangle16.json +1 -0
  23. package/assets/components/assets/icon/gridTriangle24.json +1 -0
  24. package/assets/components/assets/icon/gridTriangle32.json +1 -0
  25. package/assets/components/assets/icon/insets16.json +1 -0
  26. package/assets/components/assets/icon/insets24.json +1 -0
  27. package/assets/components/assets/icon/insets32.json +1 -0
  28. package/assets/components/assets/icon/maximumTerritoryDistance16.json +1 -0
  29. package/assets/components/assets/icon/maximumTerritoryDistance24.json +1 -0
  30. package/assets/components/assets/icon/maximumTerritoryDistance32.json +1 -0
  31. package/assets/components/assets/icon/minDistanceBetweenCenters16.json +1 -0
  32. package/assets/components/assets/icon/minDistanceBetweenCenters24.json +1 -0
  33. package/assets/components/assets/icon/minDistanceBetweenCenters32.json +1 -0
  34. package/assets/components/assets/icon/numberOfTerritories16.json +1 -0
  35. package/assets/components/assets/icon/numberOfTerritories24.json +1 -0
  36. package/assets/components/assets/icon/numberOfTerritories32.json +1 -0
  37. package/assets/components/assets/icon/overlapFeatures16.json +1 -0
  38. package/assets/components/assets/icon/overlapFeatures24.json +1 -0
  39. package/assets/components/assets/icon/overlapFeatures32.json +1 -0
  40. package/assets/components/assets/icon/profileVariables16.json +1 -0
  41. package/assets/components/assets/icon/profileVariables24.json +1 -0
  42. package/assets/components/assets/icon/profileVariables32.json +1 -0
  43. package/assets/components/assets/icon/rasterAnalysis16.json +1 -0
  44. package/assets/components/assets/icon/rasterAnalysis24.json +1 -0
  45. package/assets/components/assets/icon/rasterAnalysis32.json +1 -0
  46. package/assets/components/assets/icon/recurrence16.json +1 -0
  47. package/assets/components/assets/icon/recurrence24.json +1 -0
  48. package/assets/components/assets/icon/recurrence32.json +1 -0
  49. package/assets/components/assets/icon/splitFeatures16.json +1 -0
  50. package/assets/components/assets/icon/splitFeatures24.json +1 -0
  51. package/assets/components/assets/icon/splitFeatures32.json +1 -0
  52. package/assets/components/assets/icon/territoryBufferDistance16.json +1 -0
  53. package/assets/components/assets/icon/territoryBufferDistance24.json +1 -0
  54. package/assets/components/assets/icon/territoryBufferDistance32.json +1 -0
  55. package/assets/components/assets/icon/testData16.json +1 -0
  56. package/assets/components/assets/icon/testData24.json +1 -0
  57. package/assets/components/assets/icon/testData32.json +1 -0
  58. package/assets/esri/core/workers/RemoteClient.js +1 -1
  59. package/assets/esri/core/workers/chunks/07eda3e958d29f86b37e.js +1 -0
  60. package/assets/esri/core/workers/chunks/0ecaa28b8bff1d779d66.js +1 -0
  61. package/assets/esri/core/workers/chunks/{adae54f116f311d72d97.js → 1aba8c73c62a64e0658c.js} +1 -1
  62. package/assets/esri/core/workers/chunks/1d109cd048170e2d529a.js +1 -0
  63. package/assets/esri/core/workers/chunks/366e5c1abd1ab6d3e548.js +1 -0
  64. package/assets/esri/core/workers/chunks/3e94e35f44aadbb332ff.js +1 -0
  65. package/assets/esri/core/workers/chunks/46411f32b29a0e783105.js +1 -0
  66. package/assets/esri/core/workers/chunks/4d1c87e3e0a02efcc082.js +1 -0
  67. package/assets/esri/core/workers/chunks/{b089058b64db3912478f.js → 5e46e60fab93ad034d3a.js} +1 -1
  68. package/assets/esri/core/workers/chunks/6281b15009712a5dee3c.js +1 -0
  69. package/assets/esri/core/workers/chunks/66f627d68dbb0fdb725f.js +1 -0
  70. package/assets/esri/core/workers/chunks/672da24bbf86718bf48d.js +1 -0
  71. package/assets/esri/core/workers/chunks/733625d85602127d62cd.js +1 -0
  72. package/assets/esri/core/workers/chunks/{c51c9b5da855f84b9a48.js → 7391422fc51acb96a25d.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{f435dc615fdc8917f6ca.js → 7cf3cff7b28ff007dbad.js} +1 -1
  74. package/assets/esri/core/workers/chunks/7ea06c86adfc827fda08.js +1 -0
  75. package/assets/esri/core/workers/chunks/{a054a52712a118c6d505.js → 82bc24bdc9c6ebaf58c0.js} +1 -1
  76. package/assets/esri/core/workers/chunks/8965ab74e03506e3475e.js +1 -0
  77. package/assets/esri/core/workers/chunks/{5405f478af3563580926.js → 8b497d9c37a8f577a467.js} +1 -1
  78. package/assets/esri/core/workers/chunks/919d0d8b1c2176760973.js +1 -0
  79. package/assets/esri/core/workers/chunks/ab2a0480dc2b608deda3.js +1 -0
  80. package/assets/esri/core/workers/chunks/ab97a35f7a7d5cf1da19.js +2 -0
  81. package/assets/esri/core/workers/chunks/{dcd0653191cd4a1ccaae.js.LICENSE.txt → ab97a35f7a7d5cf1da19.js.LICENSE.txt} +1 -1
  82. package/assets/esri/core/workers/chunks/ae554c88e862a5761f2e.js +1 -0
  83. package/assets/esri/core/workers/chunks/ae5ce55cd1a32525f101.js +1 -0
  84. package/assets/esri/core/workers/chunks/b597c04a4abb98e29d1c.js +1 -0
  85. package/assets/esri/core/workers/chunks/{287c484fd40eee643f3a.js → b78c3e9d31c4a562cdf0.js} +1 -1
  86. package/assets/esri/core/workers/chunks/be4bf1e4cbe2a593f8b3.js +1 -0
  87. package/assets/esri/core/workers/chunks/{b7572b0921b23aef8b9d.js → c40d9caf5189be2c698e.js} +1 -1
  88. package/assets/esri/core/workers/chunks/{b28539c5a6bedb71b038.js → d63f736b3560c577a8a4.js} +1 -1
  89. package/assets/esri/core/workers/chunks/d869dabe937d3b60504e.js +1 -0
  90. package/assets/esri/core/workers/chunks/dd6c9a114ad38cf622ba.js +1 -0
  91. package/assets/esri/core/workers/chunks/e6b0f74226b9394bfa7a.js +1 -0
  92. package/assets/esri/themes/base/widgets/_Editor.scss +3 -2
  93. package/assets/esri/themes/dark/main.css +1 -1
  94. package/assets/esri/themes/light/main.css +1 -1
  95. package/assets/esri/themes/light/view.css +1 -1
  96. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -0
  97. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -0
  98. package/chunks/EdgeShader.glsl.js +3 -4
  99. package/interfaces.d.ts +463 -30
  100. package/layers/FeatureLayer.js +1 -1
  101. package/layers/GeoJSONLayer.js +1 -1
  102. package/layers/OGCFeatureLayer.js +1 -1
  103. package/layers/RouteLayer.js +1 -1
  104. package/layers/SceneLayer.js +1 -1
  105. package/layers/StreamLayer.js +1 -1
  106. package/layers/SubtypeGroupLayer.js +1 -1
  107. package/layers/WFSLayer.js +1 -1
  108. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  109. package/layers/mixins/ArcGISImageService.js +1 -1
  110. package/layers/save/featureLayerUtils.js +1 -1
  111. package/layers/support/AggregateField.d.ts +4 -0
  112. package/layers/support/AggregateField.js +1 -1
  113. package/layers/support/FeatureReductionBinning.d.ts +4 -0
  114. package/layers/support/FeatureReductionBinning.js +1 -1
  115. package/layers/support/OutStatistic.d.ts +4 -0
  116. package/layers/support/Sublayer.js +1 -1
  117. package/layers/support/SubtypeSublayer.js +1 -1
  118. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  119. package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
  120. package/layers/support/rasterFormats/TiffDecoder.js +1 -1
  121. package/package.json +3 -3
  122. package/portal/support/portalItemUtils.js +1 -1
  123. package/renderers/PieChartRenderer.d.ts +4 -0
  124. package/renderers/PieChartRenderer.js +5 -0
  125. package/renderers/Renderer.js +1 -1
  126. package/renderers/support/AuthoringInfo.js +1 -1
  127. package/renderers/support/RasterSymbolizer.js +1 -1
  128. package/renderers/support/clickToleranceUtils.js +1 -1
  129. package/renderers/support/rasterRendererHelper.js +1 -1
  130. package/renderers/support/types.js +1 -1
  131. package/renderers/support/utils.js +1 -1
  132. package/renderers.js +1 -1
  133. package/request.js +1 -1
  134. package/rest/imageService/fetchRasterInfo.js +5 -0
  135. package/rest/imageService/getCatalogItemRasterInfo.js +5 -0
  136. package/rest/print.js +1 -1
  137. package/smartMapping/renderers/color.js +1 -1
  138. package/smartMapping/renderers/dotDensity.js +1 -1
  139. package/smartMapping/renderers/heatmap.js +1 -1
  140. package/smartMapping/renderers/location.js +1 -1
  141. package/smartMapping/renderers/size.js +1 -1
  142. package/smartMapping/renderers/type.js +1 -1
  143. package/support/arcadeUtils.js +1 -1
  144. package/support/revision.js +1 -1
  145. package/symbols/cim/CIMSymbolHelper.js +1 -1
  146. package/symbols/cim/CurveHelper.js +1 -1
  147. package/symbols/cim/ExpandedCIM.js +1 -1
  148. package/symbols/cim/cimAnalyzer.js +1 -1
  149. package/symbols/cim/placements/PlacementInsidePolygon.js +1 -1
  150. package/views/2d/engine/brushes.js +1 -1
  151. package/views/2d/engine/vectorTiles/GlyphSource.js +1 -1
  152. package/views/2d/engine/vectorTiles/style/Filter.js +1 -1
  153. package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
  154. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  155. package/views/2d/engine/webgl/Painter.js +1 -1
  156. package/views/2d/engine/webgl/Utils.js +1 -1
  157. package/views/2d/engine/webgl/brushes/WGLBrushPieChart.js +5 -0
  158. package/views/2d/engine/webgl/brushes/WGLGeometryBrush.js +1 -1
  159. package/views/2d/engine/webgl/brushes/WGLGeometryBrushFill.js +1 -1
  160. package/views/2d/engine/webgl/brushes/WGLGeometryBrushMarker.js +1 -1
  161. package/views/2d/engine/webgl/color.js +1 -1
  162. package/views/2d/engine/webgl/definitions.js +1 -1
  163. package/views/2d/engine/webgl/enums.js +1 -1
  164. package/views/2d/engine/webgl/mesh/templates/WGLBaseFillTemplate.js +1 -1
  165. package/views/2d/engine/webgl/mesh/templates/WGLBaseLineTemplate.js +1 -1
  166. package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
  167. package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
  168. package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
  169. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  170. package/views/2d/engine/webgl/techniques/dotDensity/TechniqueDotDensity.js +1 -1
  171. package/views/2d/engine/webgl/techniques/pieChart/TechniquePieChart.js +5 -0
  172. package/views/2d/engine/webgl/techniques/utils.js +1 -1
  173. package/views/2d/engine/webgl/util/Matcher.js +1 -1
  174. package/views/2d/layers/features/schemaUtils.js +1 -1
  175. package/views/2d/layers/features/support/AttributeStore.js +1 -1
  176. package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
  177. package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
  178. package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
  179. package/views/3d/analysis/Dimensioning/DimensioningTool.js +1 -1
  180. package/views/3d/analysis/Dimensioning/LengthDimensionVisualization.js +1 -1
  181. package/views/3d/environment/SnowyWeather.d.ts +4 -0
  182. package/views/3d/layers/I3SMeshView3D.js +1 -1
  183. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  184. package/views/3d/terrain/TerrainRenderer.js +1 -1
  185. package/views/3d/terrain/TerrainSurface.js +1 -1
  186. package/views/3d/terrain/TileRenderer.js +1 -1
  187. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  188. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +5 -5
  189. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  190. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  191. package/views/3d/webgl-engine/lib/edgeRendering/EdgeShaderTechniqueConfiguration.js +1 -1
  192. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  193. package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +37 -31
  194. package/views/draw/DrawOperation.js +1 -1
  195. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  196. package/views/interactive/snapping/SceneSnappingEngine.js +5 -0
  197. package/views/interactive/snapping/SnappingManager.js +1 -1
  198. package/views/interactive/snapping/snappingFactory.js +5 -0
  199. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  200. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  201. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  202. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  203. package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
  204. package/widgets/Editor/workflowUtils.js +1 -1
  205. package/widgets/Editor.js +1 -1
  206. package/widgets/Popup/PopupViewModel.js +1 -1
  207. package/widgets/Popup/actionUtils.js +1 -1
  208. package/widgets/Sketch/SketchViewModel.js +1 -1
  209. package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +0 -1
  210. package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +0 -1
  211. package/assets/esri/core/workers/chunks/52478ee2d2a1354b6900.js +0 -1
  212. package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +0 -1
  213. package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +0 -1
  214. package/assets/esri/core/workers/chunks/875f26ee040f3d75c0db.js +0 -1
  215. package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +0 -1
  216. package/assets/esri/core/workers/chunks/89acd5f888d6b8df4aad.js +0 -1
  217. package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +0 -1
  218. package/assets/esri/core/workers/chunks/a3bb600bfcb0282622f1.js +0 -1
  219. package/assets/esri/core/workers/chunks/b50ae3dc7e43ff452568.js +0 -1
  220. package/assets/esri/core/workers/chunks/b5b7bcbc19b3430903ee.js +0 -1
  221. package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +0 -1
  222. package/assets/esri/core/workers/chunks/cf47b605c31063e88357.js +0 -1
  223. package/assets/esri/core/workers/chunks/cfbb332d144e65a4a55d.js +0 -1
  224. package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +0 -1
  225. package/assets/esri/core/workers/chunks/dc3ed59f450283d97a19.js +0 -1
  226. package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +0 -2
  227. package/assets/esri/core/workers/chunks/dfb6a28039e5d5ce6fd4.js +0 -1
  228. package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +0 -1
  229. package/assets/esri/core/workers/chunks/f7e0bb11ba3677069c94.js +0 -1
  230. package/assets/esri/core/workers/chunks/f7f3dde4c8f9c687cc1e.js +0 -1
  231. package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import i from"../../../../core/Logger.js";import{isSome as n,unwrap as l,isNone as s,unwrapOr as o}from"../../../../core/maybe.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{WGLSymbologyType as u}from"../../engine/webgl/enums.js";import{getVVType as f}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as d}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as p}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as c}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as y}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as m,simplifyVisualVariables as g}from"./support/rendererUtils.js";import{convertAggregateFieldFromPublic as b,createClusterRenderer as x}from"../support/clusterUtils.js";import{toJSONGeometryType as h}from"../support/util.js";const v=i.getLogger("esri.views.2d.layers.features.schemaUtils"),w="ValidationError",T={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function E(e){return e}function I(e){let t=0,r=0,i=u.DEFAULT;if(n(e)){if(r=y(e),"visualVariables"in e&&(t=p(e.visualVariables||[]),"dot-density"===e.type&&(i=u.DOT_DENSITY)),"heatmap"===e.type&&(i=u.HEATMAP),"dictionary"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.DEFAULT};if(i!==u.DOT_DENSITY&&i!==u.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,n=!0;for(const e of t)if("cim"===e.type&&(n=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,i=t&&"none"!==t.style&&"solid"!==t.style,l="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||l||i;i&&(r=!1),s&&(n=!1)}r?i=n?u.OUTLINE_FILL_SIMPLE:u.OUTLINE_FILL:n&&(i=u.SIMPLE)}}return{vvFlags:t,maxVVSize:r,symbologyType:i}}function S(t,r){const i=t.labelPlacement,n=T[r];if(!t.symbol)return v.warn("No ILabelClass symbol specified."),!0;if(!n)return v.error(new e("mapview-labeling:unsupported-geometry-type",`Unable to create labels for Feature Layer, ${r} is not supported`)),!0;if(!n.includes(i)){const e=n[0];i&&v.warn(`Found invalid label placement type ${i} for ${r}. Defaulting to ${e}`),t.labelPlacement=e}return!1}function F(e,t){const i=r(e);return i.some((e=>S(e,t)))?[]:i}function V(e){return t("esri-2d-update-debug")&&console.debug("Created new schema",z(e,!0)),z(e)}function z(e,t=!1){try{const r=k(e,t),i=C(e),n={};r.map((t=>N(n,e,t)));return{source:{definitionExpression:e.definitionExpression,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:n}}catch(r){if(r.fieldName===w)return v.error(r),null;throw r}}function N(t,r,i){switch(i.target){case"feature":return void O(t,L(r),i);case"aggregate":{if(!("featureReduction"in r))return;const n=r.featureReduction;switch(n.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",n);case"binning":return O(t,L(r),i),void j(t,n,i);case"cluster":return O(t,L(r),i),void R(t,n,i)}}}}function M(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const n=e.attributes[r];n?(n.context.mesh=n.context.mesh||i.context.mesh,n.context.storage=n.context.storage||i.context.storage):e.attributes[r]=i}return e}function L(e){return[l(e.filter)?.toJSON()??null,l(l(e.featureEffect)?.filter)?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),M(e.feature,r.attributes.fields),e}function j(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel},attributes:{}}),M(e.aggregate,r.attributes.fields),e}function R(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:a(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(a(t.clusterMaxSize)/64),fields:r.aggregateFields}}),M(e.aggregate,r.attributes.fields),e}function B(e,t){return t.field?P(e,{...t,type:"field",field:t.field}):t.valueExpression?P(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:null,fieldIndex:null}}function P(e,t){switch(t.type){case"expression":{const r=E(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=E(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function k(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,n,l=!1){const s=P(t,{type:"label-expression",target:i,context:{mesh:!0},resultType:"string",label:{labelExpression:r.labelExpression,labelExpressionInfo:r.labelExpressionInfo?{expression:r.labelExpressionInfo.expression}:null,symbol:!!r.symbol,where:r.where}}),{fieldIndex:o}=s,a=I(e);return{...c(r,a,l),fieldIndex:o,target:i,index:n}}function D(t,r,i){const n="featureReduction"in r&&r.featureReduction;if(!n)return{fields:[],labels:[],matcher:null,rendererOverride:null};const l="aggregate",s=[];let o=null;const a=h(r.geometryType);let u=[],f=null;if(n)switch(n.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",n);case"cluster":if(f=x(s,r.renderer,n,null),n.symbol){const e=I(f);o={type:"simple",symbol:c(n.symbol,e,i),symbologyType:e.symbologyType}}u=n&&n.labelsVisible&&n.labelingInfo||[];break;case"binning":for(const e of n.fields)b(s,e);f=n.renderer,o=H(null,l,n.renderer,i),u=n&&n.labelsVisible&&n.labelingInfo||[]}$(t,s);return{labels:F(u,a),matcher:o,fields:s,rendererOverride:f}}function A(t,r,i=!1){const l={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const r={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:u.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},f={type:"symbol",target:"feature",aggregateFields:[],attributes:l,storage:o,mesh:{matcher:r,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:u,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=H(l,s,u,i),f=q(l,s,u),g=m&&y;if("visualVariables"in u&&u.visualVariables&&u.visualVariables.length)throw new e(w,"Visual variables are currently not supported for subtype layers");if("dictionary"===t.type)throw new e(w,"Dictionary renderer is not supported in subtype layers");if("subtype"===t.type)throw new e(w,"Nested subtype renderers is not supported");if(n(f)&&"subtype"===f.type)throw new e(w,"Nested subtype storage is not supported");if(n(f)&&n(f.attributeMapping))throw new e(w,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===t.type)throw new e(w,"Heatmaps are not supported in subtype layers");if(d.has(c))throw new e(w,"Subtype codes for sublayers must be unique");d.add(c),r.renderers[c]=t,o.mapping[c]=f,g&&(a.classes[c]=g.map((e=>U(u,l,e,"feature",p++,i))))}return f}if("heatmap"===t.renderer.type&&"raster"===m()){const{blurRadius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:l,target:s,storage:null,mesh:{blurRadius:e,fieldOffset:r,field:B(l,{target:s,field:i,resultType:"numeric"}).field}}}const o=D(l,t,i),a=h(t.geometryType),f=o.rendererOverride??t.renderer,d=H(l,s,f,i),p=q(l,s,f),c=J(l,t.orderBy),y=F(t.labelsVisible&&t.labelingInfo||[],a);let g=0;const b=[...y.map((e=>U(f,l,e,"feature",g++,i))),...o.labels.map((e=>U(f,l,e,"aggregate",g++,i)))];return{type:"symbol",target:s,attributes:l,aggregateFields:o.fields,storage:p,mesh:{matcher:d,labels:{type:"simple",classes:b},aggregateMatcher:o.matcher,sortKey:c}}}function C(e){return"heatmap"===e.renderer?.type&&"raster"===m()?{type:"heatmap"}:{type:"symbol"}}function J(t,r){if(s(r)||!r.length)return null;r.length>1&&v.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],n="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:n};if(i.valueExpression){return{fieldIndex:P(t,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:n}}return v.error(new e(w,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function $(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,outStatistic:n}=i,{statisticType:l,onStatisticField:s}=n;let o=null,a=null,u=null;const f="numeric",d="feature";if("onStatisticValueExpression"in n){a=P(e,{type:"expression",target:d,valueExpression:n.onStatisticValueExpression,resultType:f}).fieldIndex}else if("onStatisticNormalizationField"in n){o=P(e,{type:"field",target:d,field:s,resultType:f}).field,u=n.onStatisticNormalizationField}else{o=P(e,{type:"field",target:d,field:s,resultType:f}).field}P(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inNormalizationField:u,inFieldIndex:a,statisticType:l})}}function q(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=d(r).getStorageSpec(r)}return _(e,t,i,r)}function _(e,t,r,i){if(s(r))return null;const{visualVariables:l,attributes:o}=r;let a=null;l&&"visualVariables"in i&&(a=G(e,t,i.visualVariables));const u=n(a)?4:0;let f=null;return n(o)&&(f=o.map(((r,i)=>{const{field:n,fieldIndex:l}=B(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+u,field:n,fieldIndex:l}}))),{type:"simple",target:t,attributeMapping:f,vvMapping:a}}function G(e,t,r){if(!r||!r.length)return[];const i={storage:!0},n="numeric";return g(r).map((r=>{const l=f(r.type),{field:s,fieldIndex:o}=B(e,{target:t,valueExpression:r.valueExpression,field:r.field,context:i,resultType:n});switch(r.type){case"size":return"$view.scale"===r.valueExpression?null:{type:"size",binding:l,field:s,fieldIndex:o,normalizationField:B(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field,valueRepresentation:r.valueRepresentation??null};case"color":return{type:"color",binding:l,field:s,fieldIndex:o,normalizationField:B(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field};case"opacity":return{type:"opacity",binding:l,field:s,fieldIndex:o,normalizationField:B(e,{target:t,field:r.normalizationField,context:i,resultType:n}).field};case"rotation":return{type:"rotation",binding:l,field:s,fieldIndex:o}}})).filter((e=>e))}function H(e,t,r,i=!1){const n=o(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return K(n,r,i);case"class-breaks":return Y(n,t,r,i);case"unique-value":return Q(n,t,r,i);case"dictionary":return W(n,r,i);case"heatmap":return X(n,r,i)}}function K(e,t,r=!1){const i=t.getSymbols(),n=i.length?i[0]:null,l=I(t);return{type:"simple",symbol:c(n,l,r),symbologyType:l.symbologyType}}function Y(e,t,r,i=!1){const n={mesh:!0,use:"renderer.field"},l=r.backgroundFillSymbol,{field:s,fieldIndex:o}=B(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:n}),a=r.normalizationType,u="log"===a?"esriNormalizeByLog":"percent-of-total"===a?"esriNormalizeByPercentOfTotal":"field"===a?"esriNormalizeByField":null,f=I(r),d=r.classBreakInfos.map((e=>({symbol:c(e.symbol,f,i),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:s,fieldIndex:o,backgroundFillSymbol:c(l,f,i),defaultSymbol:c(r.defaultSymbol,f,i),intervals:d,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:f.symbologyType}}function Q(t,r,i,n=!1){const l=[],s=i.backgroundFillSymbol,o={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new e(w,"Expected renderer.field to be a string",i);const{field:a,fieldIndex:u}=B(t,{...o,field:i.field,valueExpression:i.valueExpression}),f=I(i);for(const e of i.uniqueValueInfos)l.push({value:""+e.value,symbol:c(e.symbol,f,n)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:B(t,{...o,field:i.field2}).field,field3:B(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:c(s,f),defaultSymbol:c(i.defaultSymbol,f),map:l,symbologyType:f.symbologyType}}function W(e,t,r=!1){const i=I(t);return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:i,symbologyType:i.symbologyType}}function X(e,t,r=!1){const i=t.getSymbols(),n=i.length?i[0]:null,l=I(t);return{type:"heatmap",symbol:c(n,l,r),symbologyType:l.symbologyType}}export{$ as addAggregateFields,H as createMatcherSchema,B as createRendererAttributeSchema,V as createSchema,I as createSymbolSchemaOptions};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import i from"../../../../core/Logger.js";import{isSome as l,unwrap as n,isNone as s,unwrapOr as o}from"../../../../core/maybe.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{WGLSymbologyType as u}from"../../engine/webgl/enums.js";import{getVVType as f}from"../../engine/webgl/Utils.js";import{getTechniqueFromRenderer as d}from"../../engine/webgl/techniques/utils.js";import{getVVFlags as p}from"../../engine/webgl/util/vvFlagUtils.js";import{createSymbolSchema as c}from"./createSymbolSchema.js";export{createSymbolSchema}from"./createSymbolSchema.js";import{getPtMaxVVSize as y}from"./support/pixelBuffering.js";import{getSupportedHeatmapRenderer as m,simplifyVisualVariables as g}from"./support/rendererUtils.js";import{convertAggregateFieldFromPublic as b,createClusterRenderer as x}from"../support/clusterUtils.js";import{toJSONGeometryType as h}from"../support/util.js";const v=i.getLogger("esri.views.2d.layers.features.schemaUtils"),w="ValidationError",T={esriGeometryPoint:["above-right","above-center","above-left","center-center","center-left","center-right","below-center","below-left","below-right"],esriGeometryPolygon:["always-horizontal"],esriGeometryPolyline:["center-along"],esriGeometryMultipoint:null};function E(e){return e}function I(e){let t=0,r=0,i=u.DEFAULT;if(l(e)){if(r=y(e),"visualVariables"in e&&(t=p(e.visualVariables||[]),"dot-density"===e.type&&(i=u.DOT_DENSITY)),"heatmap"===e.type&&(i=u.HEATMAP),"dictionary"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.DEFAULT};if("pie-chart"===e.type)return{maxVVSize:r,vvFlags:t,symbologyType:u.PIE_CHART};if(i!==u.DOT_DENSITY&&i!==u.HEATMAP){const t=e.getSymbols();"backgroundFillSymbol"in e&&e.backgroundFillSymbol&&t.push(e.backgroundFillSymbol);let r=!0,l=!0;for(const e of t)if("cim"===e.type&&(l=!1),"simple-fill"===e.type||"picture-fill"===e.type){const t=e.outline,i=t&&"none"!==t.style&&"solid"!==t.style,n="simple-fill"===e.type&&"none"!==e.style&&"solid"!==e.style,s="picture-fill"===e.type||n||i;i&&(r=!1),s&&(l=!1)}r?i=l?u.OUTLINE_FILL_SIMPLE:u.OUTLINE_FILL:l&&(i=u.SIMPLE)}}return{vvFlags:t,maxVVSize:r,symbologyType:i}}function S(t,r){const i=t.labelPlacement,l=T[r];if(!t.symbol)return v.warn("No ILabelClass symbol specified."),!0;if(!l)return v.error(new e("mapview-labeling:unsupported-geometry-type",`Unable to create labels for Feature Layer, ${r} is not supported`)),!0;if(!l.includes(i)){const e=l[0];i&&v.warn(`Found invalid label placement type ${i} for ${r}. Defaulting to ${e}`),t.labelPlacement=e}return!1}function F(e,t){const i=r(e);return i.some((e=>S(e,t)))?[]:i}function V(e){return t("esri-2d-update-debug")&&console.debug("Created new schema",z(e,!0)),z(e)}function z(e,t=!1){try{const r=B(e,t),i=C(e),l={};r.map((t=>N(l,e,t)));return{source:{definitionExpression:e.definitionExpression,fields:e.fields.map((e=>e.toJSON())),gdbVersion:e.gdbVersion,historicMoment:e.historicMoment?.getTime(),outFields:e.availableFields,pixelBuffer:e.pixelBuffer,spatialReference:e.spatialReference.toJSON(),timeExtent:e.timeExtent?.toJSON(),customParameters:e.customParameters},attributes:{fields:{},indexCount:0},processors:r,tileRenderer:i,targets:l}}catch(r){if(r.fieldName===w)return v.error(r),null;throw r}}function N(t,r,i){switch(i.target){case"feature":return void O(t,L(r),i);case"aggregate":{if(!("featureReduction"in r))return;const l=r.featureReduction;switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"binning":return O(t,L(r),i),void j(t,l,i);case"cluster":return O(t,L(r),i),void R(t,l,i)}}}}function M(e,t){for(const r in t){const i=t[r];if(i.target!==e.name)continue;const l=e.attributes[r];l?(l.context.mesh=l.context.mesh||i.context.mesh,l.context.storage=l.context.storage||i.context.storage):e.attributes[r]=i}return e}function L(e){return[n(e.filter)?.toJSON()??null,n(n(e.featureEffect)?.filter)?.toJSON()??null]}function O(e,t,r){return e.feature||(e.feature={name:"feature",input:"source",filters:t,attributes:{}}),M(e.feature,r.attributes.fields),e}function j(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"bin",filters:null,input:"feature",params:{fixedBinLevel:t.fixedBinLevel},attributes:{}}),M(e.aggregate,r.attributes.fields),e}function R(e,t,r){return e.aggregate||(e.aggregate={name:"aggregate",type:"cluster",input:"feature",filters:null,attributes:{},params:{clusterRadius:a(t.clusterRadius/2),clusterPixelBuffer:64*Math.ceil(a(t.clusterMaxSize)/64),fields:r.aggregateFields}}),M(e.aggregate,r.attributes.fields),e}function P(e,t){return t.field?k(e,{...t,type:"field",field:t.field}):t.valueExpression?k(e,{...t,type:"expression",valueExpression:t.valueExpression}):{field:null,fieldIndex:null}}function k(e,t){switch(t.type){case"expression":{const r=E(t.valueExpression);if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"label-expression":{const r=E(JSON.stringify(t.label));if(!e.fields[r]){const i=e.indexCount++;e.fields[r]={...t,name:r,fieldIndex:i}}return{fieldIndex:e.fields[r].fieldIndex}}case"field":{const r=t.field;return"aggregate"===t.target&&e.fields[r]||(e.fields[r]={...t,name:r}),{field:r}}case"statistic":return e.fields[t.name]={...t},{field:t.name}}}function B(e,t=!1){const r=new Array;let i=0;return r.push(A(e,i++,t)),r}function U(e,t,r,i,l,n=!1){const s=k(t,{type:"label-expression",target:i,context:{mesh:!0},resultType:"string",label:{labelExpression:r.labelExpression,labelExpressionInfo:r.labelExpressionInfo?{expression:r.labelExpressionInfo.expression}:null,symbol:!!r.symbol,where:r.where}}),{fieldIndex:o}=s,a=I(e);return{...c(r,a,n),fieldIndex:o,target:i,index:l}}function D(t,r,i){const l="featureReduction"in r&&r.featureReduction;if(!l)return{fields:[],labels:[],matcher:null,rendererOverride:null};const n="aggregate",s=[];let o=null;const a=h(r.geometryType);let u=[],f=null;if(l)switch(l.type){case"selection":throw new e(w,"Mapview does not support `selection` reduction type",l);case"cluster":if(f=x(s,r.renderer,l,null),l.symbol){const e=I(f);o={type:"simple",symbol:c(l.symbol,e,i),symbologyType:e.symbologyType}}u=l&&l.labelsVisible&&l.labelingInfo||[];break;case"binning":for(const e of l.fields)b(s,e);f=l.renderer,o=H(null,n,l.renderer,i),u=l&&l.labelsVisible&&l.labelingInfo||[]}$(t,s);return{labels:F(u,a),matcher:o,fields:s,rendererOverride:f}}function A(t,r,i=!1){const n={indexCount:0,fields:{}},s="featureReduction"in t&&t.featureReduction?"aggregate":"feature";if("sublayers"in t){const r={type:"subtype",subtypeField:t.subtypeField,renderers:{},symbologyType:u.DEFAULT},o={type:"subtype",mapping:{},target:"feature"},a={type:"subtype",classes:{}},f={type:"symbol",target:"feature",aggregateFields:[],attributes:n,storage:o,mesh:{matcher:r,aggregateMatcher:null,labels:a,sortKey:null}},d=new Set;let p=0;for(const{renderer:u,subtypeCode:c,labelingInfo:y,labelsVisible:m}of t.sublayers){const t=H(n,s,u,i),f=_(n,s,u),g=m&&y;if("visualVariables"in u&&u.visualVariables&&u.visualVariables.length)throw new e(w,"Visual variables are currently not supported for subtype layers");if("dictionary"===t.type)throw new e(w,"Dictionary renderer is not supported in subtype layers");if("subtype"===t.type)throw new e(w,"Nested subtype renderers is not supported");if(l(f)&&"subtype"===f.type)throw new e(w,"Nested subtype storage is not supported");if(l(f)&&l(f.attributeMapping))throw new e(w,"Non-visual-variable attributes are not supported in subtype layers");if("heatmap"===t.type)throw new e(w,"Heatmaps are not supported in subtype layers");if("pie-chart"===t.type)throw new e(w,"Pie-charts are not supported in subtype layers");if(d.has(c))throw new e(w,"Subtype codes for sublayers must be unique");d.add(c),r.renderers[c]=t,o.mapping[c]=f,g&&(a.classes[c]=g.map((e=>U(u,n,e,"feature",p++,i))))}return f}if("heatmap"===t.renderer.type&&"raster"===m()){const{blurRadius:e,fieldOffset:r,field:i}=t.renderer;return{type:"heatmap",aggregateFields:[],attributes:n,target:s,storage:null,mesh:{blurRadius:e,fieldOffset:r,field:P(n,{target:s,field:i,resultType:"numeric"}).field}}}const o=D(n,t,i),a=h(t.geometryType),f=o.rendererOverride??t.renderer,d=H(n,s,f,i),p=_(n,s,f),c=J(n,t.orderBy),y=F(t.labelsVisible&&t.labelingInfo||[],a);let g=0;const b=[...y.map((e=>U(f,n,e,"feature",g++,i))),...o.labels.map((e=>U(f,n,e,"aggregate",g++,i)))];return{type:"symbol",target:s,attributes:n,aggregateFields:o.fields,storage:p,mesh:{matcher:d,labels:{type:"simple",classes:b},aggregateMatcher:o.matcher,sortKey:c}}}function C(e){return"heatmap"===e.renderer?.type&&"raster"===m()?{type:"heatmap"}:{type:"symbol"}}function J(t,r){if(s(r)||!r.length)return null;r.length>1&&v.warn(`Layer rendering currently only supports ordering by 1 orderByInfo, but found ${r.length}. All but the first will be discarded`);const i=r[0],l="ascending"===i.order?"asc":"desc";if(i.field)return{field:i.field,order:l};if(i.valueExpression){return{fieldIndex:k(t,{type:"expression",target:"feature",valueExpression:i.valueExpression,resultType:"numeric"}).fieldIndex,order:l}}return v.error(new e(w,"Expected to find a field or valueExpression for OrderByInfo",i)),null}function $(e,t){const r={mesh:!0,storage:!0};for(const i of t){const{name:t,outStatistic:l}=i,{statisticType:n,onStatisticField:s}=l;let o=null,a=null,u=null;const f="numeric",d="feature";if("onStatisticValueExpression"in l){a=k(e,{type:"expression",target:d,valueExpression:l.onStatisticValueExpression,resultType:f}).fieldIndex}else if("onStatisticNormalizationField"in l){o=k(e,{type:"field",target:d,field:s,resultType:f}).field,u=l.onStatisticNormalizationField}else{o=k(e,{type:"field",target:d,field:s,resultType:f}).field}k(e,{type:"statistic",target:"aggregate",name:t,context:r,inField:o,inNormalizationField:u,inFieldIndex:a,statisticType:n})}}function _(e,t,r){let i;switch(r.type){case"simple":case"class-breaks":case"unique-value":case"dictionary":i={visualVariables:!0,attributes:null};break;default:i=d(r).getStorageSpec(r)}return q(e,t,i,r)}function q(e,t,r,i){if(s(r))return null;const{visualVariables:n,attributes:o}=r;let a=null;n&&"visualVariables"in i&&(a=G(e,t,i.visualVariables));const u=l(a)?4:0;let f=null;return l(o)&&(f=o.map(((r,i)=>{const{field:l,fieldIndex:n}=P(e,{valueExpression:r.valueExpression,field:r.field,resultType:"numeric",target:t});return{binding:i+u,field:l,fieldIndex:n}}))),{type:"simple",target:t,attributeMapping:f,vvMapping:a}}function G(e,t,r){if(!r||!r.length)return[];const i={storage:!0},l="numeric";return g(r).map((r=>{const n=f(r.type),{field:s,fieldIndex:o}=P(e,{target:t,valueExpression:r.valueExpression,field:r.field,context:i,resultType:l});switch(r.type){case"size":return"$view.scale"===r.valueExpression?null:{type:"size",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field,valueRepresentation:r.valueRepresentation??null};case"color":return{type:"color",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"opacity":return{type:"opacity",binding:n,field:s,fieldIndex:o,normalizationField:P(e,{target:t,field:r.normalizationField,context:i,resultType:l}).field};case"rotation":return{type:"rotation",binding:n,field:s,fieldIndex:o}}})).filter((e=>e))}function H(e,t,r,i=!1){const l=o(e,{indexCount:0,fields:{}});switch(r.type){case"simple":case"dot-density":return K(l,r,i);case"class-breaks":return Q(l,t,r,i);case"unique-value":return W(l,t,r,i);case"dictionary":return X(l,r,i);case"heatmap":return Z(l,r,i);case"pie-chart":return Y(l,r,i)}}function K(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"simple",symbol:c(l,n,r),symbologyType:n.symbologyType}}function Y(e,t,r=!1){const i=t.getSymbols(),l=i[0],n=i.length>1?i[1]:null,s=I(t);return{type:"pie-chart",markerSymbol:c(l,s,r),fillSymbol:c(n,s,r),symbologyType:s.symbologyType}}function Q(e,t,r,i=!1){const l={mesh:!0,use:"renderer.field"},n=r.backgroundFillSymbol,{field:s,fieldIndex:o}=P(e,{target:t,field:r.field,valueExpression:r.valueExpression,resultType:"numeric",context:l}),a=r.normalizationType,u="log"===a?"esriNormalizeByLog":"percent-of-total"===a?"esriNormalizeByPercentOfTotal":"field"===a?"esriNormalizeByField":null,f=I(r),d=r.classBreakInfos.map((e=>({symbol:c(e.symbol,f,i),min:e.minValue,max:e.maxValue}))).sort(((e,t)=>e.min-t.min));return{type:"interval",attributes:e.fields,field:s,fieldIndex:o,backgroundFillSymbol:c(n,f,i),defaultSymbol:c(r.defaultSymbol,f,i),intervals:d,normalizationField:r.normalizationField,normalizationTotal:r.normalizationTotal,normalizationType:u,isMaxInclusive:r.isMaxInclusive,symbologyType:f.symbologyType}}function W(t,r,i,l=!1){const n=[],s=i.backgroundFillSymbol,o={target:r,context:{mesh:!0},resultType:"string"};if(i.field&&"string"!=typeof i.field)throw new e(w,"Expected renderer.field to be a string",i);const{field:a,fieldIndex:u}=P(t,{...o,field:i.field,valueExpression:i.valueExpression}),f=I(i);for(const e of i.uniqueValueInfos)n.push({value:""+e.value,symbol:c(e.symbol,f,l)});return{type:"map",attributes:t.fields,field:a,fieldIndex:u,field2:P(t,{...o,field:i.field2}).field,field3:P(t,{...o,field:i.field3}).field,fieldDelimiter:i.fieldDelimiter,backgroundFillSymbol:c(s,f),defaultSymbol:c(i.defaultSymbol,f),map:n,symbologyType:f.symbologyType}}function X(e,t,r=!1){const i=I(t);return{type:"dictionary",config:t.config,fieldMap:t.fieldMap,scaleExpression:t.scaleExpression,url:t.url,symbolOptions:i,symbologyType:i.symbologyType}}function Z(e,t,r=!1){const i=t.getSymbols(),l=i.length?i[0]:null,n=I(t);return{type:"heatmap",symbol:c(l,n,r),symbologyType:n.symbologyType}}export{$ as addAggregateFields,H as createMatcherSchema,P as createRendererAttributeSchema,V as createSchema,I as createSymbolSchemaOptions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as b}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as x,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),M=A(D,F),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function v(t,e){return i=>e(t(i))}class C{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class R{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;M(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=x}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e)&&a(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(a(s.vvMapping))for(const t of s.vvMapping)this._bindAttribute(t);if(a(s.attributeMapping))for(const t of s.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i,s){const{service:r,spatialReference:a}=s,{filters:o}=i,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=v(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,v(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(b),M("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;M(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new C(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return M("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{R as default};
5
+ import t from"../../../../../core/Error.js";import e from"../../../../../core/has.js";import i from"../../../../../core/Logger.js";import{clamp as s}from"../../../../../core/mathUtils.js";import{isNone as r,isSome as a,mapMany as o,forEachSome as n,applySome as l,unwrap as h}from"../../../../../core/maybe.js";import{createResolver as c,isAbortError as u}from"../../../../../core/promiseUtils.js";import{diff as d}from"../../../../../core/accessorSupport/diffUtils.js";import p from"../../../../../layers/support/FieldsIndex.js";import{MAX_FILTERS as _,HIGHLIGHT_FLAG as g,ATTRIBUTE_DATA_VV as f,NAN_MAGIC_NUMBER as m,ATTRIBUTE_DATA_ANIMATION as y,ATTRIBUTE_DATA_GPGPU as x}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TYPE_AGGREGATE as b,DISPLAY_ID_TYPE_FEATURE as T,getDisplayIdTexel as z,getDisplayIdType as S,getDisplayIdFilterMask as E}from"../../../engine/webgl/DisplayId.js";import{getPixelArrayCtor as w}from"../../../engine/webgl/Utils.js";import{createDebugLogger as A,DEBUG_ATTR_UPDATES as D}from"../../../engine/webgl/util/debug.js";import{getVisualVariableSizeValueRepresentationRatio as k}from"../tileRenderers/support/visualVariablesUtils.js";import{PixelType as U}from"../../../../webgl/enums.js";const F=i.getLogger("esri.views.layers.2d.features.support.AttributeStore"),M=A(D,F),B={sharedArrayBuffer:e("esri-shared-array-buffer"),atomics:e("esri-atomics")};function v(t,e){return i=>e(t(i))}class C{constructor(t,e,i,s){this.size=0,this.texelSize=4;const{pixelType:r,layout:a,textureOnly:o}=s;this.textureOnly=o||!1,this.pixelType=r,this._ctype=e,this.layout=a,this._resetRange(),this._shared=t,this.size=i,o||(this.data=this._initData(r,i,t,e))}get buffer(){return l(this.data,(t=>t.buffer))}unsetComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]&=~e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponentAllTexels(t,e){const i=h(this.data);for(let s=0;s<this.size*this.size;s++)i[s*this.texelSize+t]|=255&e;this.dirtyStart=0,this.dirtyEnd=this.size*this.size-1}setComponent(t,e,i){const s=h(this.data);for(const r of i)s[r*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r)}setComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]|=e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}unsetComponentTexel(t,e,i){h(this.data)[i*this.texelSize+t]&=~e,this.dirtyStart=Math.min(this.dirtyStart,i),this.dirtyEnd=Math.max(this.dirtyEnd,i)}getData(t,e){const i=z(t);return h(this.data)[i*this.texelSize+e]}setData(t,e,i){const s=z(t),r=1<<e;0!=(this.layout&r)?(this.data[s*this.texelSize+e]=i,this.dirtyStart=Math.min(this.dirtyStart,s),this.dirtyEnd=Math.max(this.dirtyEnd,s)):F.error("mapview-attributes-store","Tried to set a value for a texel's readonly component")}lock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,1)}unlock(){this.pixelType===U.UNSIGNED_BYTE&&this._shared&&B.atomics&&"local"!==this._ctype&&Atomics.store(this.data,0,0)}expand(t){if(this.size=t,!this.textureOnly){const e=this._initData(this.pixelType,t,this._shared,this._ctype),i=h(this.data);e.set(i),this.data=e}}toMessage(){const t=this.dirtyStart,e=this.dirtyEnd,i=this.texelSize;if(t>e)return null;this._resetRange();const s=!(this._shared||"local"===this._ctype),r=this.pixelType,a=this.layout,o=h(this.data);return{start:t,end:e,data:s&&o.slice(t*i,(e+1)*i)||null,pixelType:r,layout:a}}_initData(t,e,i,s){const r=i&&"local"!==s?SharedArrayBuffer:ArrayBuffer,a=w(t),o=new a(new r(e*e*4*a.BYTES_PER_ELEMENT));for(let n=0;n<o.length;n+=4)o[n+1]=255;return o}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}}class R{constructor(t,e){this._client=t,this.config=e,this._attributeComputeMap=new Map,this._blocks=new Array,this._filters=new Array(_),this._targetType=0,this._abortController=new AbortController,this._hasScaleExpr=!1,this._size=32,this._idsToHighlight=new Set;const i=e.supportsTextureFloat?U.FLOAT:U.UNSIGNED_BYTE;M(`Creating AttributeStore ${B.sharedArrayBuffer?"with":"without"} shared memory`),this._blockDescriptors=[{pixelType:U.UNSIGNED_BYTE,layout:1},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:U.UNSIGNED_BYTE,layout:15,textureOnly:!0},{pixelType:i,layout:15},{pixelType:i,layout:15},{pixelType:i,layout:15},{pixelType:i,layout:15}],this._blocks=this._blockDescriptors.map((()=>null))}destroy(){this._abortController.abort()}get hasScaleExpr(){return this._hasScaleExpr}get _signal(){return this._abortController.signal}get hasHighlight(){return this._idsToHighlight.size>0}update(t,i){this.config=i;const s=i.schema.processors[0].storage,o=d(this._schema,s);if((t.targets.feature||t.targets.aggregate)&&(t.storage.data=!0),o&&(e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:",o),t.storage.data=!0,this._schema=s,this._attributeComputeMap.clear(),!r(s))){switch(s.target){case"feature":this._targetType=T;break;case"aggregate":this._targetType=b}if("subtype"===s.type)for(const t in s.mapping){const e=s.mapping[t];if(a(e)&&a(e.vvMapping))for(const t of e.vvMapping)this._bindAttribute(t)}else{if(a(s.vvMapping))for(const t of s.vvMapping)this._bindAttribute(t);if(a(s.attributeMapping))for(const t of s.attributeMapping)this._bindAttribute(t)}}}onTileData(t,e){if(r(e.addOrUpdate))return;const i=e.addOrUpdate.getCursor();for(;i.next();){const t=i.getDisplayId();this.setAttributeData(t,i)}}invalidateResources(){this._createResourcesPromise=null,this._abortController.abort(),this._abortController=new AbortController}async setHighlight(t,e){const i=1,s=this._getBlock(0),r=e.map((t=>z(t)));s.lock(),s.unsetComponentAllTexels(0,i),s.setComponent(0,i,r),s.unlock(),this._idsToHighlight.clear();for(const a of t)this._idsToHighlight.add(a);await this.sendUpdates()}async updateFilters(t,i,s){const{service:r,spatialReference:a}=s,{filters:o}=i,n=o.map(((t,e)=>this._updateFilter(t,e,r,a)));(await Promise.all(n)).some((t=>t))&&(t.storage.filters=!0,e("esri-2d-update-debug")&&console.debug("Applying Update - AttributeStore:","Filters changed"))}setData(t,e,i,s){const r=z(t);this._ensureSizeForTexel(r),this._getBlock(e).setData(t,i,s)}getData(t,e,i){return this._getBlock(e).getData(t,i)}getHighlightFlag(t){return this._idsToHighlight.has(t)?g:0}unsetAttributeData(t){const e=z(t);this._getBlock(0).setData(e,0,0)}setAttributeData(t,e){const i=z(t);if(this._ensureSizeForTexel(i),this._getBlock(0).setData(i,0,this.getFilterFlags(e)),this._targetType!==S(t))return;const r=this._attributeComputeMap,a=this.config.supportsTextureFloat?1:2,o=4;r.size&&r.forEach(((t,r)=>{const n=r*a%o,l=Math.floor(r*a/o),h=this._getBlock(l+f),c=t(e);if(this.config.supportsTextureFloat)h.setData(i,n,c);else if(c===m)h.setData(i,n,255),h.setData(i,n+1,255);else{const t=s(Math.round(c),-32767,32766)+32768,e=255&t,r=(65280&t)>>8;h.setData(i,n,e),h.setData(i,n+1,r)}}))}sendUpdates(){if(this._nextUpdate)return this._nextUpdate.promise;if(this._currUpdate)return this._nextUpdate=c(),this._nextUpdate.promise;const e={blocks:this._blocks.map((t=>a(t)?t.toMessage():null))};return this._currUpdate=this._createResources().then((()=>{const t=()=>{if(this._currUpdate=null,this._nextUpdate){const t=this._nextUpdate;this._nextUpdate=null,this.sendUpdates().then((()=>t.resolve()))}},i=this._client.update(e,this._signal).then(t).catch(t);return this._client.render(this._signal),i})).catch((e=>{if(u(e))return this._createResourcesPromise=null,this._createResources();F.error(new t("mapview-attribute-store","Encountered an error during client update",e))})),this._currUpdate}_ensureSizeForTexel(t){for(;t>=this._size*this._size;)if(this._expand())return}_bindAttribute(t){function e(){return t.normalizationField?e=>{const i=e.readAttribute(t.normalizationField);if(!i)return null;return e.readAttribute(t.field)/i}:e=>e.readAttribute(t.field)}function i(){return t.normalizationField&&F.warn("mapview-arcade","Ignoring normalizationField specified with an arcade expression which is not supported."),e=>e.getComputedNumericAtIndex(t.fieldIndex)}let s;if(null!=t.fieldIndex)s=i();else{if(!t.field)return;s=e()}if(t.valueRepresentation){s=v(s,(e=>k(e,t.valueRepresentation)))}const r=t=>null===t||isNaN(t)||t===1/0?m:t;this._attributeComputeMap.set(t.binding,v(s,r))}_createResources(){if(a(this._createResourcesPromise))return this._createResourcesPromise;this._getBlock(y),this._getBlock(x),M("Initializing AttributeStore");const e={shared:B.sharedArrayBuffer&&!("local"===this._client.type),size:this._size,blocks:o(this._blocks,(t=>({textureOnly:t.textureOnly,buffer:t.buffer,pixelType:t.pixelType})))},i=this._client.initialize(e,this._signal).catch((e=>{u(e)?this._createResourcesPromise=null:F.error(new t("mapview-attribute-store","Encountered an error during client initialization",e))}));return this._createResourcesPromise=i,i.then((()=>r(this._createResourcesPromise)?this._createResources():void 0)),i}_getBlock(t){const e=this._blocks[t];if(a(e))return e;M(`Initializing AttributeBlock at index ${t}`);const i=B.sharedArrayBuffer,s=this._client.type,r=new C(i,s,this._size,this._blockDescriptors[t]);return this._blocks[t]=r,this._createResourcesPromise=null,r}_expand(){if(this._size<this.config.maxTextureSize){const t=this._size<<=1;return M("Expanding block size to",t,this._blocks),n(this._blocks,(e=>e.expand(t))),this._createResourcesPromise=null,this._size=t,0}return F.error(new t("mapview-limitations","Maximum number of onscreen features exceeded.")),-1}async _updateFilter(t,e,i,s){const o=this._filters[e],n=a(o)&&o.hash;if(!o&&!t)return!1;if(n===JSON.stringify(t))return!1;if(r(t)){if(!o)return!1;const t=1<<e+1,i=this._getBlock(0);return this._filters[e]=null,i.setComponentAllTexels(0,t),this.sendUpdates(),!0}const l=await this._getFilter(e,i);return await l.update(t,s),!0}async _getFilter(t,e){const i=this._filters[t];if(a(i))return i;const{default:s}=await import("./FeatureFilter.js"),r=new s({geometryType:e.geometryType,hasM:!1,hasZ:!1,timeInfo:e.timeInfo,fieldsIndex:new p(e.fields)});return this._filters[t]=r,r}isVisible(t){return!!(2&this._getBlock(0).getData(t,0))}getFilterFlags(t){let e=0;const i=E(t.getDisplayId());for(let a=0;a<this._filters.length;a++){const s=!!(i&1<<a),o=this._filters[a];e|=(!s||r(o)||o.check(t)?1:0)<<a}let s=0;if(this._idsToHighlight.size){const e=t.getObjectId();s=this.getHighlightFlag(e)}return e<<1|s}}export{R 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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/has.js";import{isAbortError as i}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as r}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureTile as a}from"../../../engine/webgl/FeatureTile.js";import{simplifyVVRenderer as o}from"../support/rendererUtils.js";import l from"./BaseTileRenderer.js";import{convertVisualVariables as n}from"./support/visualVariablesUtils.js";import{WGLFeatureView as u}from"./support/WGLFeatureView.js";let p=class extends l{constructor(){super(...arguments),this.type="symbol"}install(e){const t=()=>this.notifyChange("updating"),i=new u(this.tileInfoView,this.layerView,this.layer,t);this.featuresView=i,e.addChild(i)}uninstall(e){e.removeChild(this.featuresView),this.featuresView.destroy(),this.featuresView=null}fetchResource(e,t){const{url:s}=e,r=this.featuresView.stage;try{return r.resourceManager.fetchResource(s,{signal:t.signal})}catch(a){return i(a)?Promise.resolve({width:0,height:0}):Promise.reject(a)}}isUpdating(){const e=super.isUpdating(),i=!this.featuresView||this.featuresView.isUpdating(),s=this.featuresView?.hasEmptyAttributeView(),r=e||i||e&&s;return t("esri-2d-log-updating")&&console.log(`Updating SymbolTileRenderer ${r}\n -> updatingTiles ${e}\n -> hasFeaturesView ${!!this.featuresView}\n -> updatingFeaturesView ${i}`),r}hitTest(e){return this.featuresView.hitTest(e)}supportsRenderer(e){return null!=e&&["simple","class-breaks","unique-value","dot-density","dictionary","heatmap"].includes(e.type)}onConfigUpdate(e){let t=null;if("visualVariables"in e){const i=(o(e).visualVariables||[]).map((e=>{const t=e.clone();return"normalizationField"in e&&(t.normalizationField=null),e.valueExpression&&"$view.scale"!==e.valueExpression&&(t.valueExpression=null,t.field="nop"),t}));t=n(i)}this.featuresView.setRendererInfo(e,t,this.layerView.featureEffect)}onTileData(e){const t=this.tiles.get(e.tileKey);t&&e.data&&this.featuresView.onTileData(t,e.data),this.layerView.view.labelManager.requestUpdate()}onTileError(e){const t=this.tiles.get(e.tileKey);t&&this.featuresView.onTileError(t)}forceAttributeTextureUpload(){this.featuresView.attributeView.forceTextureUpload()}lockGPUUploads(){this.featuresView.attributeView.lockTextureUpload(),this.tiles.forEach((e=>e.lock()))}unlockGPUUploads(){this.featuresView.attributeView.unlockTextureUpload(),this.tiles.forEach((e=>e.unlock()))}async getMaterialItems(e){return this.featuresView.getMaterialItems(e)}invalidateLabels(){this.featuresView.hasLabels&&this.layerView.view.labelManager.requestUpdate()}createTile(e){const t=this.tileInfoView.getTileBounds(r(),e),i=()=>this.layerView.view.labelManager.requestUpdate();return new a(e,t[0],t[3],this.featuresView.attributeView,i)}disposeTile(e){this.featuresView.removeChild(e),e.destroy(),this.layerView.view.labelManager.requestUpdate()}};p=e([s("esri.views.2d.layers.features.tileRenderers.SymbolTileRenderer")],p);const c=p;export{c as default};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/has.js";import{isAbortError as i}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/set.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as r}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureTile as a}from"../../../engine/webgl/FeatureTile.js";import{simplifyVVRenderer as o}from"../support/rendererUtils.js";import l from"./BaseTileRenderer.js";import{convertVisualVariables as n}from"./support/visualVariablesUtils.js";import{WGLFeatureView as u}from"./support/WGLFeatureView.js";let p=class extends l{constructor(){super(...arguments),this.type="symbol"}install(e){const t=()=>this.notifyChange("updating"),i=new u(this.tileInfoView,this.layerView,this.layer,t);this.featuresView=i,e.addChild(i)}uninstall(e){e.removeChild(this.featuresView),this.featuresView.destroy(),this.featuresView=null}fetchResource(e,t){const{url:s}=e,r=this.featuresView.stage;try{return r.resourceManager.fetchResource(s,{signal:t.signal})}catch(a){return i(a)?Promise.resolve({width:0,height:0}):Promise.reject(a)}}isUpdating(){const e=super.isUpdating(),i=!this.featuresView||this.featuresView.isUpdating(),s=this.featuresView?.hasEmptyAttributeView(),r=e||i||e&&s;return t("esri-2d-log-updating")&&console.log(`Updating SymbolTileRenderer ${r}\n -> updatingTiles ${e}\n -> hasFeaturesView ${!!this.featuresView}\n -> updatingFeaturesView ${i}`),r}hitTest(e){return this.featuresView.hitTest(e)}supportsRenderer(e){return null!=e&&["simple","class-breaks","unique-value","dot-density","dictionary","heatmap","pie-chart"].includes(e.type)}onConfigUpdate(e){let t=null;if("visualVariables"in e){const i=(o(e).visualVariables||[]).map((e=>{const t=e.clone();return"normalizationField"in e&&(t.normalizationField=null),e.valueExpression&&"$view.scale"!==e.valueExpression&&(t.valueExpression=null,t.field="nop"),t}));t=n(i)}this.featuresView.setRendererInfo(e,t,this.layerView.featureEffect)}onTileData(e){const t=this.tiles.get(e.tileKey);t&&e.data&&this.featuresView.onTileData(t,e.data),this.layerView.view.labelManager.requestUpdate()}onTileError(e){const t=this.tiles.get(e.tileKey);t&&this.featuresView.onTileError(t)}forceAttributeTextureUpload(){this.featuresView.attributeView.forceTextureUpload()}lockGPUUploads(){this.featuresView.attributeView.lockTextureUpload(),this.tiles.forEach((e=>e.lock()))}unlockGPUUploads(){this.featuresView.attributeView.unlockTextureUpload(),this.tiles.forEach((e=>e.unlock()))}async getMaterialItems(e){return this.featuresView.getMaterialItems(e)}invalidateLabels(){this.featuresView.hasLabels&&this.layerView.view.labelManager.requestUpdate()}createTile(e){const t=this.tileInfoView.getTileBounds(r(),e),i=()=>this.layerView.view.labelManager.requestUpdate();return new a(e,t[0],t[3],this.featuresView.attributeView,i)}disposeTile(e){this.featuresView.removeChild(e),e.destroy(),this.layerView.view.labelManager.requestUpdate()}};p=e([s("esri.views.2d.layers.features.tileRenderers.SymbolTileRenderer")],p);const c=p;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as s}from"../../../../engine/brushes.js";import{FeatureContainer as i}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class n extends i{constructor(e,t,s,i){super(e),this._pointToCallbacks=[],this._layer=s,this._layerView=t,this._onUpdate=i}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const s=t();return this._pointToCallbacks.push({point:e,resolver:s}),this.requestRender(),s.promise}onTileData(e,t){const s=a&&"orderBy"in this._layer&&this._layer.orderBy,i=s?.length&&!s[0].valueExpression&&s[0].field,r=s&&this._layerView.orderByFields===i;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:s}=this._layer,i=e.state.scale;i<=(t||1/0)&&i>=s&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){const{rendererSchema:t}=e.rendererInfo;if("dot-density"===t.type&&t.dotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"labelingInfo"in e&&e.labelsVisible&&e.labelingInfo&&e.labelingInfo.length;return this._layer.labelingInfo&&this._layer.labelingInfo.length&&this._layer.labelsVisible||!!t}prepareRenderPasses(e){const t=e.registerRenderPass({name:"label",brushes:[s.label],target:()=>this.hasLabels?this.children:null,drawPhase:r.LABEL|r.LABEL_ALPHA}),i=e.registerRenderPass({name:"geometry",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.heatmap,s.text],target:()=>this.children,enableDefaultDraw:()=>!this._layerView.featureEffectView.hasEffects,effects:[{apply:e.effects.outsideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.excludedEffects},{apply:e.effects.insideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.includedEffects},{apply:e.effects.hittest,enable:()=>!!this._pointToCallbacks.length,args:()=>this._pointToCallbacks}]}),a=e.registerRenderPass({name:"highlight",brushes:[s.fill,s.dotDensity,s.line,s.marker,s.text],target:()=>this.children,drawPhase:r.HIGHLIGHT,enableDefaultDraw:()=>!1,effects:[{apply:e.effects.highlight,enable:()=>!!this._layerView.hasHighlight()}]});return[...super.prepareRenderPasses(e),i,a,t]}}export{n as WGLFeatureView};
5
+ import e from"../../../../../../core/has.js";import{createResolver as t}from"../../../../../../core/promiseUtils.js";import{brushes as i}from"../../../../engine/brushes.js";import{FeatureContainer as s}from"../../../../engine/FeatureContainer.js";import{WGLDrawPhase as r}from"../../../../engine/webgl/enums.js";const a=e("featurelayer-order-by-server-enabled");class n extends s{constructor(e,t,i,s){super(e),this._pointToCallbacks=[],this._layer=i,this._layerView=t,this._onUpdate=s}renderChildren(e){if(this.attributeView.update(),this.hasAnimation){e.painter.effects.integrate.draw(e,e.attributeView)}super.renderChildren(e)}hasEmptyAttributeView(){return this.attributeView.isEmpty()}isUpdating(){return this.attributeView.isUpdating()}hitTest(e){const i=t();return this._pointToCallbacks.push({point:e,resolver:i}),this.requestRender(),i.promise}onTileData(e,t){const i=a&&"orderBy"in this._layer&&this._layer.orderBy,s=i?.length&&!i[0].valueExpression&&i[0].field,r=i&&this._layerView.orderByFields===s;e.patch(t,r),this.contains(e)||this.addChild(e),this.requestRender()}onTileError(e){this.contains(e)||this.addChild(e)}updateTransitionProperties(e,t){super.updateTransitionProperties(e,t),this._layerView.featureEffectView.transitionStep(e,t),this._layerView.featureEffectView.transitioning&&this.requestRender()}doRender(e){const{minScale:t,maxScale:i}=this._layer,s=e.state.scale;s<=(t||1/0)&&s>=i&&super.doRender(e)}onAttributeStoreUpdate(){this.hasLabels&&this._layerView.view.labelManager.requestUpdate(),this._onUpdate()}get hasAnimation(){return this.hasLabels}setStencilReference(e){const{rendererSchema:t}=e.rendererInfo;if("dot-density"===t.type&&t.dotSize>1){const e=1;for(const t of this.children)t.stencilRef=t.key.level+e}else super.setStencilReference(e)}get hasLabels(){if("sublayers"in this._layer)return this._layer.sublayers.some((e=>e.labelingInfo&&e.labelingInfo.length&&e.labelsVisible));const e=this._layer.featureReduction,t=e&&"labelingInfo"in e&&e.labelsVisible&&e.labelingInfo&&e.labelingInfo.length;return this._layer.labelingInfo&&this._layer.labelingInfo.length&&this._layer.labelsVisible||!!t}prepareRenderPasses(e){const t=e.registerRenderPass({name:"label",brushes:[i.label],target:()=>this.hasLabels?this.children:null,drawPhase:r.LABEL|r.LABEL_ALPHA}),s=e.registerRenderPass({name:"geometry",brushes:[i.fill,i.dotDensity,i.line,i.marker,i.heatmap,i.pieChart,i.text],target:()=>this.children,enableDefaultDraw:()=>!this._layerView.featureEffectView.hasEffects,effects:[{apply:e.effects.outsideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.excludedEffects},{apply:e.effects.insideEffect,enable:()=>this._layerView.featureEffectView.hasEffects,args:()=>this._layerView.featureEffectView.includedEffects},{apply:e.effects.hittest,enable:()=>!!this._pointToCallbacks.length,args:()=>this._pointToCallbacks}]}),a=e.registerRenderPass({name:"highlight",brushes:[i.fill,i.dotDensity,i.line,i.marker,i.pieChart,i.text],target:()=>this.children,drawPhase:r.HIGHLIGHT,enableDefaultDraw:()=>!1,effects:[{apply:e.effects.highlight,enable:()=>!!this._layerView.hasHighlight()}]});return[...super.prepareRenderPasses(e),s,a,t]}}export{n as WGLFeatureView};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as a}from"../support/util.js";let l=class extends o{constructor(){super(...arguments),this.container=null,this.layer=null,this.type="raster"}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&a(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}async updateTileSource(e,t){const{bandIds:s}=this.layer,i=this._getLayerInterpolation(),o=this.canUseWebGLForProcessing(),{source:a,symbolizerParams:l,globalSymbolizerParams:n,suspended:c,coords:p,resolution:u}=t,{bitmap:m}=e;if([m.x,m.y]=p,m.resolution=u,a&&r(a)&&r(a.pixelBlock)){const e={extent:a.extent,pixelBlock:a.pixelBlock};if(m.rawPixelData=e,o)m.source=a.pixelBlock,m.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===n?.type?n:null);m.source=r,m.isRendereredSource=!0}m.symbolizerParameters=o?l:null,o?m.transformGrid||(m.transformGrid=a.transformGrid):m.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();m.source=e,m.symbolizerParameters=o?l:null,m.transformGrid=null}m.bandIds=o?s:null,m.width=this._tileInfoView.tileInfo.size[0],m.height=this._tileInfoView.tileInfo.size[1],m.interpolation=i,m.suspended=c,m.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:s,global:i}=t,{bandIds:o}=this.layer,a=this._getLayerInterpolation(),l=this.canUseWebGLForProcessing(),{bitmap:n}=e,{rawPixelData:c}=n;!l&&r(c)?(n.source=await this.layer.applyRenderer(c,"stretch"===i?.type?i:null),n.isRendereredSource=!0):(n.isRendereredSource&&r(c)&&(n.source=c.pixelBlock),n.isRendereredSource=!1),n.symbolizerParameters=l?i||s:null,n.bandIds=l?o:null,n.interpolation=a,n.suspended=!1}_getLayerInterpolation(){const e=this.layer.renderer.type;if("raster-colormap"===e||"unique-value"===e||"class-breaks"===e)return"nearest";const{interpolation:r}=this.layer,{renderer:t}=this.layer;return"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===r||"cubic"===r?"bilinear":"nearest":r}};e([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const n=l;export{n as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as i}from"../../engine/imagery/RasterTileContainer.js";import{BaseImageryTileSubView2D as o}from"./BaseImageryTileSubView2D.js";import{canUseMajorityInterpolationOnDataSource as a}from"../support/util.js";let l=class extends o{constructor(){super(...arguments),this.container=null,this.layer=null,this.type="raster"}attach(){super.attach(),this.container=new i(this._tileInfoView),this.container.isCustomTilingScheme=this._isCustomTilingScheme}detach(){super.detach(),this.container.removeAllChildren(),this.container=null}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&a(this.layer))}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}async updateTileSource(e,t){const{bandIds:s}=this.layer,i=this._getLayerInterpolation(),o=this.canUseWebGLForProcessing(),{source:a,globalSymbolizerParams:l,suspended:n,coords:c,resolution:p}=t,u=this.layerView.hasTilingEffects?l:t.symbolizerParams,{bitmap:m}=e;if([m.x,m.y]=c,m.resolution=p,a&&r(a)&&r(a.pixelBlock)){const e={extent:a.extent,pixelBlock:a.pixelBlock};if(m.rawPixelData=e,o)m.source=a.pixelBlock,m.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===l?.type?l:null);m.source=r,m.isRendereredSource=!0}m.symbolizerParameters=o?u:null,o?m.transformGrid||(m.transformGrid=a.transformGrid):m.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();m.source=e,m.symbolizerParameters=o?u:null,m.transformGrid=null}m.bandIds=o?s:null,m.width=this._tileInfoView.tileInfo.size[0],m.height=this._tileInfoView.tileInfo.size[1],m.interpolation=i,m.suspended=n,m.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:s,global:i}=t,{bandIds:o}=this.layer,a=this._getLayerInterpolation(),l=this.canUseWebGLForProcessing(),{bitmap:n}=e,{rawPixelData:c}=n;!l&&r(c)?(n.source=await this.layer.applyRenderer(c,"stretch"===i?.type?i:null),n.isRendereredSource=!0):(n.isRendereredSource&&r(c)&&(n.source=c.pixelBlock),n.isRendereredSource=!1),n.symbolizerParameters=l?this.layerView.hasTilingEffects?i:s:null,n.bandIds=l?o:null,n.interpolation=a,n.suspended=!1}_getLayerInterpolation(){const e=this.layer.renderer.type;if("raster-colormap"===e||"unique-value"===e||"class-breaks"===e)return"nearest";const{interpolation:r}=this.layer,{renderer:t}=this.layer;return"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===r||"cubic"===r?"bilinear":"nearest":r}};e([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"type",void 0),l=e([s("esri.views.2d.layers.imagery.ImageryTileView2D")],l);const n=l;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.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{isSome as i,isNone as o}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{sv3d as c}from"../../../../geometry/support/vectorStacks.js";import{LengthDimensionSubTool as l}from"./LengthDimensionSubTool.js";import{newIntersector as m}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as h}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{InteractiveToolBase as p}from"../../../interactive/InteractiveToolBase.js";import{createScreenPointArrayFromEvent as u}from"../../../support/screenUtils.js";var d;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(d||(d={}));let v=class extends p{constructor(){super(...arguments),this.preferManipulatorCursor=!0,this.analysisView=null}initialize(){this._intersector=m(this.view.state.viewingMode),this._intersector.options.store=h.MIN,this._lengthDimensionSubTool=new l({view:this.view}),this.own(t(this._lengthDimensionSubTool));for(const e of this.analysis.dimensions.items)this._addDimension(e);this.own(this.analysis.dimensions.on("change",(e=>{for(const t of e.added)this._addDimension(t);for(const t of e.removed)this._removeDimension(t)}))),this.own(s((()=>this.state),(e=>{e===d.Created&&this.finishToolCreation()}),n))}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?this.active?d.Creating:d.Created:d.Ready}get cursor(){return this.active?"crosshair":null}getManipulatorsForDimension(e){return this._lengthDimensionSubTool.getManipulatorsForDimension(e)}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){i(this._activeSubTool)&&i(this._activeSubTool.stagedDimension)&&(this.analysis.dimensions.remove(this._activeSubTool.stagedDimension),this._activeSubTool.stagedDimension=null),this._activeSubTool=null}_clickHandler(e){if(o(this._activeSubTool))return;const t=this._intersectScreen(e);if(!o(t)){if(o(this._activeSubTool.stagedDimension)){const e=this._activeSubTool.stageNewDimension(t);this.analysis.dimensions.add(e)}else this._activeSubTool.onStagedClick(t);e.stopPropagation()}}_pointerMoveHandler(e){if(o(this._activeSubTool))return;const t=this._intersectScreen(e);o(t)||this._activeSubTool.onPointerMove(t)}_intersectScreen(e){const t=u(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const i=this._intersector.results.min,o=c.get();return i.getIntersectionPoint(o)?this.view.renderCoordsHelper.fromRenderCoords(o,this.view.spatialReference):null}_addDimension(e){this._lengthDimensionSubTool.addDimension(e,this.manipulators)}_removeDimension(e){this._lengthDimensionSubTool.removeDimension(e,this.manipulators)}};e([r({constructOnly:!0})],v.prototype,"view",void 0),e([r({constructOnly:!0})],v.prototype,"analysis",void 0),e([r({readOnly:!0})],v.prototype,"state",null),e([r({readOnly:!0})],v.prototype,"cursor",null),e([r({readOnly:!0})],v.prototype,"preferManipulatorCursor",void 0),e([r({constructOnly:!0})],v.prototype,"analysisView",void 0),e([r()],v.prototype,"_activeSubTool",void 0),e([r()],v.prototype,"_lengthDimensionSubTool",void 0),v=e([a("esri.views.3d.analysis.Dimensioning.DimensioningTool")],v);export{v as DimensioningTool};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyHandle as t}from"../../../../core/handleUtils.js";import{isSome as o,isNone as i}from"../../../../core/maybe.js";import{watch as s,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{sv3d as l}from"../../../../geometry/support/vectorStacks.js";import{LengthDimensionSubTool as c}from"./LengthDimensionSubTool.js";import{newIntersector as m}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as h}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{InteractiveToolBase as p}from"../../../interactive/InteractiveToolBase.js";import{createScreenPointArrayFromEvent as u}from"../../../support/screenUtils.js";var d;!function(e){e.Ready="ready",e.Creating="creating",e.Created="created"}(d||(d={}));let v=class extends p{constructor(){super(...arguments),this.preferManipulatorCursor=!0,this.analysisView=null}initialize(){this._intersector=m(this.view.state.viewingMode),this._intersector.options.store=h.MIN,this._lengthDimensionSubTool=new c({view:this.view}),this.own(t(this._lengthDimensionSubTool));for(const e of this.analysis.dimensions.items)this._addDimension(e);this.own(this.analysis.dimensions.on("change",(e=>{for(const t of e.added)this._addDimension(t);for(const t of e.removed)this._removeDimension(t)}))),this.own(s((()=>this.state),(e=>{e===d.Created&&this.finishToolCreation()}),n))}get state(){return this.analysis.dimensions.some((e=>"length"===e.type))?o(this._activeSubTool)?d.Creating:d.Created:d.Ready}get cursor(){return this.active?"crosshair":null}getManipulatorsForDimension(e){return this._lengthDimensionSubTool.getManipulatorsForDimension(e)}onInputEvent(e){switch(e.type){case"immediate-click":this._clickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onActivate(){this._activeSubTool=this._lengthDimensionSubTool}onDeactivate(){o(this._activeSubTool)&&o(this._activeSubTool.stagedDimension)&&(this.analysis.dimensions.remove(this._activeSubTool.stagedDimension),this._activeSubTool.stagedDimension=null),this._activeSubTool=null}_clickHandler(e){if(i(this._activeSubTool))return;const t=this._intersectScreen(e);if(!i(t)){if(i(this._activeSubTool.stagedDimension)){const e=this._activeSubTool.stageNewDimension(t);this.analysis.dimensions.add(e)}else this._activeSubTool.onStagedClick(t);e.stopPropagation()}}_pointerMoveHandler(e){if(i(this._activeSubTool))return;const t=this._intersectScreen(e);i(t)||this._activeSubTool.onPointerMove(t)}_intersectScreen(e){const t=u(e);this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector);const o=this._intersector.results.min,i=l.get();return o.getIntersectionPoint(i)?this.view.renderCoordsHelper.fromRenderCoords(i,this.view.spatialReference):null}_addDimension(e){this._lengthDimensionSubTool.addDimension(e,this.manipulators)}_removeDimension(e){this._lengthDimensionSubTool.removeDimension(e,this.manipulators)}};e([r({constructOnly:!0})],v.prototype,"view",void 0),e([r({constructOnly:!0})],v.prototype,"analysis",void 0),e([r({readOnly:!0})],v.prototype,"state",null),e([r({readOnly:!0})],v.prototype,"cursor",null),e([r({readOnly:!0})],v.prototype,"preferManipulatorCursor",void 0),e([r({constructOnly:!0})],v.prototype,"analysisView",void 0),e([r()],v.prototype,"_activeSubTool",void 0),e([r()],v.prototype,"_lengthDimensionSubTool",void 0),v=e([a("esri.views.3d.analysis.Dimensioning.DimensioningTool")],v);export{v as DimensioningTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as n}from"../../../../core/handleUtils.js";import{isNone as s}from"../../../../core/maybe.js";import{watch as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as a,F as l,c as d}from"../../../../chunks/vec3.js";import{f as c}from"../../../../chunks/vec4f64.js";import{sv3d as p}from"../../../../geometry/support/vectorStacks.js";import{LineVisualElement as u}from"../../interactive/visualElements/LineVisualElement.js";import{EuclideanSegment as h}from"../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as _}from"../../webgl-engine/materials/lineStippleUtils.js";let E=class extends t{constructor(e){super(e),this._directSegment=new h,this._dimensionSegment=new h,this._startExtensionSegment=new h(this._directSegment.startRenderSpace,this._dimensionSegment.startRenderSpace),this._endExtensionSegment=new h(this._directSegment.endRenderSpace,this._dimensionSegment.endRenderSpace);const t={view:e.view,attached:!0,width:1,color:c(1,.5,0,1),renderOccluded:S.OccludeAndTransparent},n={...t,stipplePattern:_(5)};this._dimensionVisualElement=new u(t),this._startExtensionVisualElement=new u(n),this._endExtensionVisualElement=new u(n)}initialize(){this.own([n(this._dimensionVisualElement),n(this._startExtensionVisualElement),n(this._endExtensionVisualElement)]);const e=this.dimension;this.own(i((()=>({startPoint:e.startPoint,endPoint:e.endPoint,offset:e.offset})),(e=>{this._update(e)}),o))}get testInfo(){return{dimensionVisualElement:this._dimensionVisualElement}}_update(e){const{startPoint:t,endPoint:n,offset:i}=e,{renderCoordsHelper:o}=this.view;if(s(t)||s(n)||!o.toRenderCoords(t,this._directSegment.startRenderSpace)||!o.toRenderCoords(n,this._directSegment.endRenderSpace))return this._dimensionVisualElement.visible=!1,this._startExtensionVisualElement.visible=!1,void(this._endExtensionVisualElement.visible=!1);const{startRenderSpace:r,endRenderSpace:m}=this._directSegment,a=this._directSegment.eval(.5,p.get()),l=o.worldUpAtPosition(a,p.get()),d=i/o.unitInMeters,[c,u]=g(r,m,l,d);f(this._startExtensionSegment,l,c,this._startExtensionVisualElement),f(this._endExtensionSegment,l,u,this._endExtensionVisualElement),this._dimensionVisualElement.visible=!0,this._dimensionVisualElement.setGeometryFromSegment(this._dimensionSegment)}};function g(e,t,n,s=0){const i=a(t,n),o=a(e,n),r=a(n,n),m=Math.abs(i-o)/r+s;return i>o?[m,s]:[s,m]}function f(e,t,n,s){0!==n?(l(e.endRenderSpace,e.startRenderSpace,t,n),s.visible=!0,s.setGeometryFromSegment(e)):(d(e.endRenderSpace,e.startRenderSpace),s.visible=!1)}e([r({constructOnly:!0,nonNullable:!0})],E.prototype,"dimension",void 0),e([r({constructOnly:!0,nonNullable:!0})],E.prototype,"view",void 0),E=e([m("esri.views.3d.analysis.Dimensioning.LengthDimensionVisualization")],E);export{E as LengthDimensionVisualization};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyHandle as s}from"../../../../core/handleUtils.js";import{isNone as i}from"../../../../core/maybe.js";import{watch as n,initial as r}from"../../../../core/reactiveUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as m,v as c,f as l,n as d,c as p,F as f}from"../../../../chunks/vec3.js";import{f as u}from"../../../../chunks/vec4f64.js";import{sv3d as h}from"../../../../geometry/support/vectorStacks.js";import{LineVisualElement as S}from"../../interactive/visualElements/LineVisualElement.js";import{EuclideanSegment as _}from"../../interactive/visualElements/support/Segment.js";import{RenderOccludedFlag as g}from"../../webgl-engine/lib/Material.js";import{createStipplePatternSimple as v}from"../../webgl-engine/materials/lineStippleUtils.js";let w=class extends t{constructor(e){super(e),this._directSegment=new _,this._dimensionSegment=new _,this._startOffsetSegment=new _(this._directSegment.startRenderSpace,this._dimensionSegment.startRenderSpace),this._endOffsetSegment=new _(this._directSegment.endRenderSpace,this._dimensionSegment.endRenderSpace);const t={view:e.view,attached:!0,width:1,color:u(1,.5,0,1),renderOccluded:g.OccludeAndTransparent},s={...t,stipplePattern:v(5)};this._dimensionVisualElement=new S(t),this._startOffsetVisualElement=new S(s),this._endOffsetVisualElement=new S(s)}initialize(){this.own([s(this._dimensionVisualElement),s(this._startOffsetVisualElement),s(this._endOffsetVisualElement)]);const e=this.dimension;this.own(n((()=>({startPoint:e.startPoint,endPoint:e.endPoint,offset:e.offset,axis:e.axis})),(e=>this._update(e)),r))}get testInfo(){return{dimensionVisualElement:this._dimensionVisualElement}}_update(e){const{startPoint:t,endPoint:s,offset:n,axis:r}=e,{renderCoordsHelper:o}=this.view;if(i(t)||i(s)||!o.toRenderCoords(t,this._directSegment.startRenderSpace)||!o.toRenderCoords(s,this._directSegment.endRenderSpace))return this._dimensionVisualElement.visible=!1,this._startOffsetVisualElement.visible=!1,void(this._endOffsetVisualElement.visible=!1);const{startRenderSpace:a,endRenderSpace:m}=this._directSegment,c=this._directSegment.eval(.5,h.get()),l=E(a,m,o.worldUpAtPosition(c,h.get()),r),d=n/o.unitInMeters,[p,f]=j(a,m,l,d);V(this._startOffsetSegment,l,p,this._startOffsetVisualElement),V(this._endOffsetSegment,l,f,this._endOffsetVisualElement),this._dimensionVisualElement.visible=!0,this._dimensionVisualElement.setGeometryFromSegment(this._dimensionSegment)}};function E(e,t,s,i){const n=h.get();switch(i){case"horizontal":return p(n,s);case"vertical":return m(e,s)<m(t,s)?c(n,t,e):c(n,e,t),l(n,l(n,n,s),s),d(n,n),n;case"direct":throw Error("not supported yet")}}function j(e,t,s,i=0){const n=m(t,s),r=m(e,s),o=Math.abs(n-r)+i;return n>r?[o,i]:[i,o]}function V(e,t,s,i){0!==s?(f(e.endRenderSpace,e.startRenderSpace,t,s),i.setGeometryFromSegment(e),i.visible=!0):(p(e.endRenderSpace,e.startRenderSpace),i.visible=!1)}e([o({constructOnly:!0,nonNullable:!0})],w.prototype,"dimension",void 0),e([o({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),w=e([a("esri.views.3d.analysis.Dimensioning.LengthDimensionVisualization")],w);export{w as LengthDimensionVisualization};
@@ -0,0 +1,4 @@
1
+ import "../../../interfaces";
2
+
3
+ import SnowyWeather = __esri.SnowyWeather;
4
+ export default SnowyWeather;
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.24/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import a from"../../../core/has.js";import n from"../../../core/Logger.js";import{someMap as l}from"../../../core/MapUtils.js";import{unwrapOr as d,destroyMaybe as h,isSome as c,isNone as u,applySome as _,unwrap as m}from"../../../core/maybe.js";import g from"../../../core/PooledArray.js";import{throwIfAborted as f,createResolver as p}from"../../../core/promiseUtils.js";import{initial as b,watch as y}from"../../../core/reactiveUtils.js";import{schedule as v}from"../../../core/scheduling.js";import{isArrayBuffer as I}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as M}from"../../../core/unitUtils.js";import{property as C}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as O}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as S}from"../../../chunks/mat3f32.js";import{m as E,B as j}from"../../../chunks/mat4.js";import{b as w,c as T}from"../../../chunks/mat4f64.js";import{m as D,s as R,t as N,a as A,c as F}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{s as V}from"../../../chunks/vec4.js";import{f as U}from"../../../chunks/vec4f64.js";import{projectBuffer as H,getProjectorName as G,localLinearScaleFactors as L,projectVectorToVector as B,projectBoundingRect as k,projectBoundingSphere as q}from"../../../geometry/projection.js";import{create as z,empty as K,expandWithBuffer as W,toRect as $}from"../../../geometry/support/aaBoundingBox.js";import{create as X,intersects as Y}from"../../../geometry/support/aaBoundingRect.js";import Q from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as J}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as Z}from"../../../layers/support/layerUtils.js";import ee from"../../../layers/support/SceneModification.js";import{getColor as te,getOpacity as ie}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as se}from"../../../support/arcadeOnDemand.js";import re from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as oe}from"../../../symbols/support/unitConversionUtils.js";import ae from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as ne,toWasmModification as le}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as de,ForAllFeaturesReturnType as he}from"./II3SMeshView3D.js";import{initialize as ce,setModificationsSync as ue,filterObbsForModificationsSync as _e,interpretObbModificationResults as me}from"./SceneLayerWorker.js";import{overrideColor as ge}from"./graphics/graphicUtils.js";import{TextureUsage as fe,TextureEncoding as pe}from"./i3s/enums.js";import be from"./i3s/Highlights.js";import{I3SAttributeOverrides as ye}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as ve,NodeCrossfadeMetaData as Ie}from"./i3s/I3SCrossfadeHelper.js";import Me from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Ce}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Oe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as xe,selectEncoding as Se,defaultMaterial as Ee,createTexture as je,configureMaterial as we}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Te,NodeState as De}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Re,getLocalOrigin as Ne}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ae,checkSceneLayerValid as Fe,checkSceneLayerCompatibleWithView as Pe,getCacheKeySuffix as Ve,whenGraphicAttributes as Ue,computeVisibilityObb as He,filterInPlace as Ge,getCachedAttributeValue as Le,intersectBoundingRectWithMbs as Be,MbsIntersectResult as ke,addWraparound as qe,getSymbolInfo as ze,transparentEdgeMaterial as Ke,getClipRect as We}from"./i3s/I3SUtil.js";import{IDBCache as $e}from"./i3s/IDBCache.js";import{IDBMockCache as Xe}from"./i3s/IDBMockCache.js";import{attributeLookup as Ye}from"./support/attributeUtils.js";import{ColorMixModeEnum as Qe}from"./support/symbolColorUtils.js";import Je from"../support/debugFlags.js";import{toBoundingRect as Ze}from"../support/extentUtils.js";import{create as et,clone as tt}from"../support/orientedBoundingBox.js";import{updatingProgress as it}from"../support/updatingProperties.js";import{glLayout as st}from"../support/buffer/glUtil.js";import{State as rt}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as ot}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as at}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as nt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as lt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const dt=n.getLogger("esri.views.3d.layers.SceneLayerView3D"),ht=[1,1,1,1];class ct extends Ie{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var ut;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(ut||(ut={}));const _t=19,mt=100*r.MEGABYTES,gt=t=>{let r=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=a("enable-feature:idb-mock-cache")?new Xe:new $e("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new ve(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ae(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?fe.AllTexturesPBR:fe.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?fe.GeometryTexturesPBR:fe.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=M(this.i3slayer.spatialReference),i=oe(e.unit);return d(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Nt.Absolute,offset:0};const t=M(this.i3slayer.spatialReference),i=oe(e.unit),s=d(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Nt.Absolute,offset:s};case"relative-to-ground":return{mode:Nt.RelativeToGround,offset:s};case"on-the-ground":return{mode:Nt.OnTheGround,offset:0};default:return{mode:Nt.Absolute,offset:0}}}get supportedTextureEncodings(){return xe(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&pe.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new ye(this.i3slayer,e.memoryController),this._worker=new ne((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Fe(this.i3slayer),Pe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new Q({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new be({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,de.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>c(this._controller.index)&&c(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,c(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Oe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new Me({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),b),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.elevationInfo),(()=>this._elevationInfoChanged()),b),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),b),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),b),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),b),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),b),this.handles.add([y((()=>Je.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Je.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Je.I3S_TREE_SHOW_TILES||(this._treeDebugger=h(this._treeDebugger))}),b),y((()=>Je.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),b)]),this._cacheKeySuffix=Ve(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>dt.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=h(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=h(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=h(this._labeler),this._treeDebugger=h(this._treeDebugger),this._controller=h(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(c(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=c(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=c(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=c(t)?t.node.memory:0)),e}getUnloadedMemory(){return(c(this._controller)?this._controller.unloadedMemoryEstimate:0)+(c(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(Z(this.i3slayer)&&this._supportsLabeling))return void(c(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(c(this._labeler))return;const e=new ae({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>c(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ce().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=le(this._layerClippingArea,this._modifications,t);ue({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new g:null;this._nodeId2Meta.forEach(((e,t)=>{u(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):c(s)&&s.push(e.node)})),c(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),c(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Te.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),c(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(c(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Je.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);c(i)&&c(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);c(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,c(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){c(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>c(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!a("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&pe.Basis)&&_(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&nt()}_getVertexBufferLayout(e,t){const i={hasTexture:xt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return st(ot(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Ye(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return l(this._nodeId2Meta,(e=>{if(u(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(u(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Ye(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(u(i))return Promise.reject();const s=i.objectHandle,r=Ce(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(H(r,o,0,r,a,0,8)){const e=K();return W(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return Ue(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(c)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return u(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${_t}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return c(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){c(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(u(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(u(t))return!0;const s=Se(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(u(r)||null==r.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&c(s.textureData)&&(s.byteSize=jt(s.transformedGeometry,s.textureData),s.textureData.every(Et)&&wt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>dt.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),f(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return St(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(u(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,h=Re(e.mbs,this.elevationOffset,l,d);e.geometryObb=et([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),D(e.geometryObb.center,e.geometryObb.center,h),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:h,geometryObb:e.geometryObb,byteSize:jt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&wt(e,_)){const t=c(_.textureData)?_.textureData.map((e=>Et(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>dt.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return He(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let u=0;u<s.length;++u)r[u]=this._getVertexBufferLayout(s[u],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ne(o,a,n),c=Re(o,a,n,d),_=G(n,l),m=G(l,d);if(u(_)||u(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:c,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){return!this.view?._stage?.renderView.shadowsEnabled}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=tt(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);c(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,rt.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),c(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(u(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=c(t.textureData)?t.textureData.filter((e=>c(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!a("disable-feature:i3s-basis")&&l.some((e=>c(e)&&(e.encoding===pe.Basis||e.encoding===pe.KTX2)))&&await nt(),e.memory=0;const{componentOffsets:d,geometries:h,featureIds:_}=r,g=this._collection,f=h[0],{layout:p,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=o,M=this._materialParameters(f,p),C=d||new Uint32Array([0,b?b.length:y.byteLength/p[0].stride]),O={vertices:{data:y,count:y.byteLength/p[0].stride,layoutParameters:M.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:C},D=f.transformation?w(f.transformation):T();E(D,n,D);const R=j(P(),D),N=x(S(),D),A=this.view.renderSpatialReference,F=this.view.basemapTerrain.spatialReference,V=P(),H=[1,1,1];L(R,A,H,F)||dt.errorOnce("Unsupported coordinate system for IM overlay"),B(R,A,V,F);const G=g.createObject({toMapSpace:U(V[0],V[1],H[0],H[1]),geometry:O,obb:m(e.geometryObb),transform:{position:R,rotationScale:N}}),k=M.geometryParams.textureCoordinates===at.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(G,M.material,l,k);e.memory+=this._memEstimateGeometryAdded(G),e.memory+=q.reduce(((e,t)=>e+(c(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!M.material.hasParametersFromSource,W="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,$=new ct(e,_,G,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);this._updateElevationOffsets($),s.meta=$,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&fe.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(c(t)&&t.updateObjectVisibility($.objectHandle,!1),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(c(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(G,rt.Visible),c(t)&&t.updateObjectVisibility($.objectHandle,!0),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||c(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($,ft.ADD),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),c(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw c(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){dt.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);c(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);c(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Rt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo;if(u(t)||i.mode===Nt.Absolute)return void(e.elevationOffsets=null);const s=this.view.basemapTerrain,r=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const o=At,a=Ft;for(let n=0;n<e.featureIds.length;n++){this._collection.getComponentAabb(e.objectHandle,n,a),R(o,(a[0]+a[3])/2,(a[1]+a[4])/2,a[2]),N(o,o,r.rotationScale),A(o,o,r.position);const l=s.getElevation(o[0],o[1],o[2],t),d=i.mode===Nt.OnTheGround?this.view.renderCoordsHelper.getAltitude(o):0;e.elevationOffsets[n]=i.offset+(c(l)?l-d:0)}}_elevationChanged(e){const t=this._controller.crsIndex;k(e.extent,e.spatialReference,Ot,t);const i=this._controller.updateElevationChanged(Ot,t);u(i)||i.forAll((e=>{const t=this._nodeId2Meta.get(e);c(t)&&(this._updateElevationOffsets(t),this._setObjectSymbolColors(t))}))}_elevationInfoChanged(){this.handles.remove("elevation"),this.elevationInfo.mode!==Nt.Absolute&&this.handles.add(this.view.basemapTerrain.on("elevation-change",(e=>this._elevationChanged(e))),"elevation"),this._nodeId2Meta.forEach((e=>{c(e)&&(this._updateElevationOffsets(e),this._setObjectSymbolColors(e))}))}_safeReschedule(e,t){return f(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=c(e.params.material)?e.params.material:Ee(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=xt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>je(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=we(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?at.Atlas:at.Default:at.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{c(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=X();this._renderClippingArea=Ze(this.view.clippingArea,i,e)?i:null;const s=X();this._layerClippingArea=Ze(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{c(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return c(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(c(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=c(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Ge(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Le(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return q(e.node.mbs,this._controller.crsIndex,Ct,this.view.renderSpatialReference),Be(t,Ct)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,pt),$(pt,bt),Y(i,bt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===ke.INSIDE)return;if(r===ke.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(yt,i,t.objectHandle);Ge(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(u(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){Rt(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t),i.updateObjectVisibility(s,!0),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(c(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);u(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,rt.Hidden),c(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1),this._visibleGeometryChanged(s,ft.REMOVE),c(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),c(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(c(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===De.Hole))}_invalidateAllSymbols(){this._rendererVersion=qe(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return qe(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=qe(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await se()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:dt.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&dt.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),s.externalColorMixMode=t[r+4]&(1<<ut.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<ut.CastShadows),s.pickable=0!=(t[r+4]&1<<ut.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof re))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=ze(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=c(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?c(this._rendererFields)&&this._rendererFields.length>0?J(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=c(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&c(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&c(this._symbologyFields))for(const c of this._symbologyFields){const e=r[c];e&&(n.push(c),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:It,castShadows:!0,pickable:!0,colorMixMode:Qe.Multiply,edgeMaterial:null},h=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let m=null,g=lt.OPAQUE,f=Ke,p=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Le(l[e],b);const r=this._getSymbolInfo(s,t);let h=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=te(this._colorVariable,t,{color:Mt,arcade:this._arcade});e&&(h=It,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=ie(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;h=u(h)||u(y)?ge(h,y,e.color,e.alpha,ht,It):ge(h,y,null,null,ht,It)}if(u(h)&&(h=It,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:Qe.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,c(this._symbologyOverride)&&(d.color=h,this._symbologyOverride(t,d),h=d.color),c(d.edgeMaterial)){const t=h[3]<=0?lt.INVISIBLE:h[3]>=1&&(e.material.isOpaque||d.colorMixMode===Qe.Replace)?lt.OPAQUE:lt.TRANSPARENT;d.edgeMaterial===m&&t===g||(f={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=f}else e.cachedEdgeMaterials[b]=Ke;e.cachedSymbology[p+0]=Math.round(255*h[0]),e.cachedSymbology[p+1]=Math.round(255*h[1]),e.cachedSymbology[p+2]=Math.round(255*h[2]),e.cachedSymbology[p+3]=Math.round(255*h[3]),e.cachedSymbology[p+4]=d.colorMixMode|+d.castShadows<<ut.CastShadows|+d.pickable<<ut.Pickable,p+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||Rt(t,this.fullOpacity),u(e.filteredIds)){return{hasEdges:t.some((e=>e!==Ke)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?Ke:(s=s||t!==Ke,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Rt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,ft.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),c(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{u(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){c(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=de.VISIBLE_ONLY){l(this._nodeId2Meta,(s=>{if(u(s))return!1;if(c(t)){switch(t(s)){case he.EXIT:return!0;case he.SKIP:return!1}}let r=he.CONTINUE;switch(i){case de.ALL:r=this._forAllFeaturesOfNode(s,e);break;case de.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case de.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===he.EXIT}))}_forAllFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===he.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=he.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===he.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(u(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===ke.OUTSIDE)return he.CONTINUE;if(i===ke.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=he.CONTINUE,r=e.featureIds,o=e.objectHandle,a=We(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===he.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=c(t.attributeInfo)&&t.attributeInfo.attributeData;if(c(s))for(const r of Object.keys(s))i[r]=Le(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Ye(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Dt}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=v((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return c(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),he.CONTINUE)),null,de.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return c(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);c(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(u(this._edgeView)||!e.cachedEdgeMaterials)return;Rt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t)}get hasModifications(){return this._isIntegratedMesh&&c(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Tt(e);if(c(s)){const t={context:i,buffer:s.buffer};_e(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=me(i);e.imModificationImpact=s,s!==Te.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||c(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(u(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return{locations:o,type:"components",objectIds:s.featureIds,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{u(t)||e.add(i,t.node.renderMbs)})),t}_updateSnappingSources(e,t){const{index:i,renderMbs:s}=e.node;for(const r of this._snappingSourcesTrackers)t!==ft.REMOVE&&t!==ft.UPDATE||r.events.remove(i),t!==ft.ADD&&t!==ft.UPDATE||r.events.add(i,s)}};return e([C()],r.prototype,"_hasLoadedPBRTextures",void 0),e([C()],r.prototype,"_asyncModuleLoading",void 0),e([C()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([C()],r.prototype,"view",void 0),e([C()],r.prototype,"i3slayer",void 0),e([C()],r.prototype,"_controller",void 0),e([C()],r.prototype,"_labeler",void 0),e([C()],r.prototype,"updating",void 0),e([C()],r.prototype,"suspended",void 0),e([C()],r.prototype,"holeFilling",void 0),e([C(it)],r.prototype,"updatingProgress",void 0),e([C({readOnly:!0,aliasOf:"_controller.updatingProgress"})],r.prototype,"updatingProgressValue",void 0),e([C({readOnly:!0})],r.prototype,"hasTexturesOrVertexColors",null),e([C({readOnly:!0})],r.prototype,"rendererTextureUsage",null),e([C()],r.prototype,"filter",void 0),e([C({readOnly:!0})],r.prototype,"elevationOffset",null),e([C({readOnly:!0})],r.prototype,"elevationInfo",null),e([C({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([C()],r.prototype,"supportedTextureEncodings",null),e([C()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([C({type:[ee]})],r.prototype,"_modifications",void 0),r=e([O("esri.views.3d.layers.I3SMeshView3D")],r),r};var ft;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(ft||(ft={}));const pt=z(),bt=X(),yt=X(),vt=et(),It=[0,0,0,0],Mt=new t([0,0,0,0]),Ct=[0,0,0,0],Ot=X();function xt(e){if(u(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function St(e){return"geometryData"in e}function Et(e){return c(e)&&I(e.data)}function jt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(c(t))for(const s of t)c(s)&&I(s.data)&&(i+=s.data.byteLength);return i}function wt(e,t){return t.byteSize>mt?(dt.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Tt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;u(s)&&(s=vt,F(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Dt={remove(){},pause(){},resume(){}};function Rt(e,t){e.forEach((e=>e.opacity=t))}var Nt;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Nt||(Nt={}));const At=P(),Ft=z();export{Nt as ElevationMode,gt as I3SMeshView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{removeUnordered as s}from"../../../core/arrayUtils.js";import{ByteSizeUnit as r}from"../../../core/byteSizeEstimations.js";import o from"../../../core/Collection.js";import a from"../../../core/has.js";import n from"../../../core/Logger.js";import{someMap as l}from"../../../core/MapUtils.js";import{unwrapOr as d,destroyMaybe as h,isSome as c,isNone as u,applySome as _,unwrap as m}from"../../../core/maybe.js";import g from"../../../core/PooledArray.js";import{throwIfAborted as f,createResolver as p,isAbortError as b}from"../../../core/promiseUtils.js";import{initial as y,watch as v}from"../../../core/reactiveUtils.js";import{schedule as I}from"../../../core/scheduling.js";import{isArrayBuffer as M}from"../../../core/typedArrayUtil.js";import{getMetersPerVerticalUnitForSR as C}from"../../../core/unitUtils.js";import{property as O}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as E}from"../../../core/accessorSupport/decorators/subclass.js";import{f as x}from"../../../chunks/mat3.js";import{c as S}from"../../../chunks/mat3f32.js";import{m as w,B as j}from"../../../chunks/mat4.js";import{b as T,c as D}from"../../../chunks/mat4f64.js";import{m as R,s as A,t as N,a as F,c as V}from"../../../chunks/vec3.js";import{c as P}from"../../../chunks/vec3f64.js";import{s as U}from"../../../chunks/vec4.js";import{f as H}from"../../../chunks/vec4f64.js";import{projectBuffer as G,getProjectorName as L,localLinearScaleFactors as B,projectVectorToVector as k,projectBoundingRect as q,projectBoundingSphere as z}from"../../../geometry/projection.js";import{create as K,empty as W,expandWithBuffer as $,toRect as X}from"../../../geometry/support/aaBoundingBox.js";import{create as Y,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import J from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as Z}from"../../../layers/support/fieldUtils.js";import{areLabelsVisible as ee}from"../../../layers/support/layerUtils.js";import te from"../../../layers/support/SceneModification.js";import{getColor as ie,getOpacity as se}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as re}from"../../../support/arcadeOnDemand.js";import oe from"../../../symbols/Symbol3D.js";import{getMetersPerUnit as ae}from"../../../symbols/support/unitConversionUtils.js";import ne from"./I3SMeshViewLabeler.js";import{I3SMeshWorkerHandle as le,toWasmModification as de}from"./I3SMeshWorkerHandle.js";import{ForAllFeaturesVisibilityMode as he,ForAllFeaturesReturnType as ce}from"./II3SMeshView3D.js";import{initialize as ue,setModificationsSync as _e,filterObbsForModificationsSync as me,interpretObbModificationResults as ge}from"./SceneLayerWorker.js";import{overrideColor as fe}from"./graphics/graphicUtils.js";import{TextureUsage as pe,TextureEncoding as be}from"./i3s/enums.js";import ye from"./i3s/Highlights.js";import{I3SAttributeOverrides as ve}from"./i3s/I3SAttributeOverrides.js";import{I3SCrossfadeHelper as Ie,NodeCrossfadeMetaData as Me}from"./i3s/I3SCrossfadeHelper.js";import Ce from"./i3s/I3SElevationProvider.js";import{boundingBoxCornerPoints as Oe}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Ee}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as xe,selectEncoding as Se,defaultMaterial as we,createTexture as je,configureMaterial as Te}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as De,NodeState as Re}from"./i3s/I3SNode.js";import{computeGlobalTransformation as Ae,getLocalOrigin as Ne}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Fe,checkSceneLayerValid as Ve,checkSceneLayerCompatibleWithView as Pe,getCacheKeySuffix as Ue,whenGraphicAttributes as He,computeVisibilityObb as Ge,filterInPlace as Le,getCachedAttributeValue as Be,intersectBoundingRectWithMbs as ke,MbsIntersectResult as qe,addWraparound as ze,getSymbolInfo as Ke,transparentEdgeMaterial as We,getClipRect as $e}from"./i3s/I3SUtil.js";import{IDBCache as Xe}from"./i3s/IDBCache.js";import{IDBMockCache as Ye}from"./i3s/IDBMockCache.js";import{attributeLookup as Qe}from"./support/attributeUtils.js";import{ColorMixModeEnum as Je}from"./support/symbolColorUtils.js";import Ze from"../support/debugFlags.js";import{toBoundingRect as et}from"../support/extentUtils.js";import{create as tt,clone as it}from"../support/orientedBoundingBox.js";import{updatingProgress as st}from"../support/updatingProperties.js";import{glLayout as rt}from"../support/buffer/glUtil.js";import{State as ot}from"../webgl-engine/collections/Component/ComponentObject.js";import{createVertexBufferLayout as at}from"../webgl-engine/collections/Component/SourceGeometry.js";import{TextureCoordinateAttributeType as nt}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasis as lt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as dt}from"../webgl-engine/lib/edgeRendering/interfaces.js";const ht=n.getLogger("esri.views.3d.layers.SceneLayerView3D"),ct=[1,1,1,1];class ut extends Me{constructor(e,t,i,s,r,o,a){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0,this.cachedSymbology=null}}var _t;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(_t||(_t={}));const mt=19,gt=100*r.MEGABYTES,ft=t=>{let r=class extends t{constructor(...e){super(e),this._elevationProvider=null,this._intersectionHandler=null,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._idbCache=a("enable-feature:idb-mock-cache")?new Ye:new Xe("esri-scenelayer-cache","geometries"),this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.filter=null,this.slicePlaneEnabled=!1,this._modifications=new Array,this._layerUrl="",this._cacheKeySuffix=null,this._arcade=null,this._tmpAttributeOnlyGraphic=new i(null,null,{}),this._crossfadeHelper=new Ie(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Fe(this._currentRenderer)?this._usePBR()||this._hasLoadedPBRTextures?pe.AllTexturesPBR:pe.AllTextures:this._usePBR()||this._hasLoadedPBRTextures?pe.GeometryTexturesPBR:pe.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null!=e&&"absolute-height"===e.mode){const t=C(this.i3slayer.spatialReference),i=ae(e.unit);return d(e.offset,0)*i/t}return 0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return{mode:Nt.Absolute,offset:0};const t=C(this.i3slayer.spatialReference),i=ae(e.unit),s=d(e.offset,0)*i/t;switch(e.mode){case"absolute-height":return{mode:Nt.Absolute,offset:s};case"relative-to-ground":return{mode:Nt.RelativeToGround,offset:s};case"on-the-ground":return{mode:Nt.OnTheGround,offset:0};default:return{mode:Nt.Absolute,offset:0}}}get supportedTextureEncodings(){return xe(this.view._stage.renderView.capabilities)}get uncompressedTextureDownsamplingEnabled(){const e=this.view?.qualitySettings.sceneService.uncompressedTextureDownsamplingEnabled,t=0==(this.supportedTextureEncodings&be.DDS_S3TC);return e&&t}initialize(){this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const e=this.view.resourceController;if(this.attributeOverrides=new ve(this.i3slayer,e.memoryController),this._worker=new le((t=>e.schedule(t))),this.addResolvingPromise(this._worker.promise),this._worker.setLegacySchema(this.layerUid,this.i3slayer.store.defaultGeometrySchema),Ve(this.i3slayer),Pe(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new J({layerView:this}),this.gpuMemoryEstimate=0,this.texMemoryEstimate=0,this.geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this._highlights=new ye({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,he.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)}),this._isIntegratedMesh||!this.i3slayer.store.defaultGeometrySchema)this._hasSymbolColors=!1;else{const e=this.i3slayer.store.defaultGeometrySchema.featureAttributes;this._hasSymbolColors=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=this.i3slayer.store.defaultGeometrySchema.vertexAttributes.color&&(null==this.i3slayer.cachedDrawingInfo||!this.i3slayer.cachedDrawingInfo.color),this._isIntegratedMesh||(this._edgeView=this._stage.renderView.ensureEdgeView());const t=this.view.resourceController.memoryController.newCache(this.i3slayer.uid,(e=>this._deleteComponentObject(e)));this._memCache=t;const i=e=>c(this._controller.index)&&c(this._controller.index.rootNode)?this._controller.index.traverse(this._controller.index.rootNode,(t=>{const i=t.index,s=this._nodeId2Meta.get(i)||this._nodeId2MetaReloading.get(i);return e(t,c(s)?s.objectHandle:null)})):()=>{};this._intersectionHandler=new Ee({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:i}),this._elevationProvider=new Ce({layerView:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR(),this.updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),y),this.updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this.updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this.updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this.updatingHandles.add((()=>this.elevationInfo),(()=>this._elevationInfoChanged()),y),this.updatingHandles.add((()=>this.filter),(()=>this._filterChange()),y),this.updatingHandles.add((()=>this.view.qualitySettings.physicallyBasedRenderingEnabled),(()=>this._updatePBR()));const s=()=>{this._reloadAll(),this.clearMemCache()};this.updatingHandles.add((()=>this.rendererTextureUsage),s),this.updatingHandles.add((()=>this.uncompressedTextureDownsamplingEnabled),s),this.updatingHandles.add((()=>this.suspended),(e=>this._suspendedChange(e)),y),this.updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),y),this.updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),y),this.updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),y),this.handles.add([v((()=>Ze.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&Ze.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||Ze.I3S_TREE_SHOW_TILES||(this._treeDebugger=h(this._treeDebugger))}),y),v((()=>Ze.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),y)]),this._cacheKeySuffix=Ue(this.i3slayer.spatialReference,this.view.renderSpatialReference),this._idbCache.init().catch((e=>ht.warn(`Failed to initialize IndexedDB cache: ${e}`)))}destroy(){this._clearAddTasks(),this.attributeOverrides=h(this.attributeOverrides),this._elevationProvider&&(this._elevationProvider.layerChanged(),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.i3slayer.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=h(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=h(this._labeler),this._treeDebugger=h(this._treeDebugger),this._controller=h(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_memEstimateTextureAdded(e){const t=e.estimatedTexMemRequired;return this.gpuMemoryEstimate+=t,this.texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(c(e)){const t=e.estimatedTexMemRequired;this.gpuMemoryEstimate-=t,this.texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this.gpuMemoryEstimate+=t,this.geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this.gpuMemoryEstimate-=t,this.geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}getUsedMemory(){let e=c(this._labeler)?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=c(t)?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=c(t)?t.node.memory:0)),e}getUnloadedMemory(){return(c(this._controller)?this._controller.unloadedMemoryEstimate:0)+(c(this._labeler)?this._labeler.unloadedMemoryEstimate:0)}ignoresMemoryFactor(){return!1}_labelingChanged(){if(!(ee(this.i3slayer)&&this._supportsLabeling))return void(c(this._labeler)&&(this._labeler.destroy(),this._labeler=null));if(c(this._labeler))return;const e=new ne({view:this.view,layer:this.i3slayer,collection:this._collection});this._nodeId2Meta.forEach((t=>c(t)&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=ue().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.i3slayer.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=de(this._layerClippingArea,this._modifications,t);_e({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new g:null;this._nodeId2Meta.forEach(((e,t)=>{u(e)?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):c(s)&&s.push(e.node)})),c(s)&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),c(s)&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==De.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),c(t)?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t)):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(c(this._modificationGraphics)&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!Ze.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={type:"simple-fill",outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){s.geometry.spatialReference=this.i3slayer.spatialReference;const r={...t,color:e[s.type]};this._modificationGraphics.push(new i({geometry:s.geometry,symbol:r}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_suspendedChange(e){e?(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler)):(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(c(t)&&c(t.attributeInfo))return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);c(i)&&c(i.attributeInfo)&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);c(s)&&(await this.attributeOverrides.apply(s.featureIds,t,i),s.attributeInfo=t,this._attributeValuesChanged(s))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,c(this._labeler)&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){c(this._memCache)&&this._memCache.clear()}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>c(t)&&e.push(t.node))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!a("disable-feature:i3s-basis")&&0!=(this.supportedTextureEncodings&be.Basis)&&_(this.i3slayer.textureSetDefinitions,(e=>e.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))))&&lt()}_getVertexBufferLayout(e,t){const i={hasTexture:xt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion};return rt(at(this._getGeometryParameters(i)))}_getObjectIdField(){return this.i3slayer.objectIdField||"OBJECTID"}_findGraphicNodeAndIndex(e){const t=Qe(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());let i=null;return l(this._nodeId2Meta,(e=>{if(u(e))return!1;const s=e.featureIds.indexOf(t);return-1!==s&&(i={node:e.node,index:s},!0)})),i}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(u(i))return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=Qe(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._nodeId2Meta.get(t.node.index);if(u(i))return Promise.reject();const s=i.objectHandle,r=Oe(t.index,this._collection,s,new Float64Array(24)),o=this.view.renderSpatialReference,a=this.view.spatialReference;if(G(r,o,0,r,a,0,8)){const e=W();return $(e,r,0,8),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}}whenGraphicAttributes(e,t){return He(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(c)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return u(t)||null==t.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${mt}/${e.id}${this._cacheKeySuffix}`}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return c(this._memCache)?this._memCache.pop(this._getMemCacheKey(e.index)):null}deleteCachedGPUData(e){c(e)&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(u(this._memCache))return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,e.node.memory,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(0==(e.usage&this.rendererTextureUsage))return!1;if(u(t))return!0;const s=Se(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(u(r)||null==r.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e)),null):(e.geometryObb=s.geometryObb,this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&c(s.textureData)&&(s.byteSize=jt(s.transformedGeometry,s.textureData),s.textureData.every(wt)&&Tt(e,s)&&this._idbCache.put(this._getCacheKey(e),s).catch((t=>ht.warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),f(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return St(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(u(s))return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,transformedGeometry:n}=s,l=this._controller.crsIndex,d=this.view.renderSpatialReference,h=Ae(e.mbs,this.elevationOffset,l,d);e.geometryObb=tt([r.center.x,r.center.y,r.center.z],[r.extents.x,r.extents.y,r.extents.z],[r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w]),R(e.geometryObb.center,e.geometryObb.center,h),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a));const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:n,globalTrafo:h,geometryObb:e.geometryObb,byteSize:jt(n,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&Tt(e,_)){const t=c(_.textureData)?_.textureData.map((e=>wt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e),{..._,textureData:t}).catch((t=>ht.warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}computeVisibilityObb(e){return Ge(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications)}_transformNode(e,t,i){const s=t.geometryData.geometries,r=new Array(s.length);for(let u=0;u<s.length;++u)r[u]=this._getVertexBufferLayout(s[u],t.geometryDescriptor);const o=e.mbs,a=this.elevationOffset,n=this._controller.crsIndex,l=this._controller.crsVertex,d=this.view.renderSpatialReference,h=Ne(o,a,n),c=Ae(o,a,n,d),_=L(n,l),m=L(l,d);if(u(_)||u(m))return Promise.resolve(null);const g={context:this.i3slayer.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,localOrigin:h,globalTrafo:c,mbs:o,obb:e.serviceObb,elevationOffset:a,needNormals:!this._isIntegratedMesh&&this._controller.isMeshPyramid,normalReferenceFrame:this.i3slayer.normalReferenceFrame||"none",indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get supportsNodeCrossFading(){return!this.view?._stage?.renderView.shadowsEnabled}get nodeCrossfadingEnabled(){return this.supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this.supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(e.geometryObb=it(this._collection.getComponentObb(t.objectHandle)),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);c(this._labeler)&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,ot.Visible),this._updateMaterial(t),this._setNewNodeOpacity(t),this._updateEngineObject(t),this._highlights.objectCreated(t),c(this._treeDebugger)&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async _addCachedNodeData(e,t,i){if(this.suspended||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(u(t))return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:n}=t;await this.attributeOverrides.apply(r.featureIds,s.attributeInfo,i);const l=c(t.textureData)?t.textureData.filter((e=>c(e)&&0!=(e.usage&this.rendererTextureUsage))):[];!a("disable-feature:i3s-basis")&&l.some((e=>c(e)&&(e.encoding===be.Basis||e.encoding===be.KTX2)))&&await lt(),e.memory=0;const{componentOffsets:d,geometries:h,featureIds:_}=r,g=this._collection,f=h[0],{layout:p,indices:b,interleavedVertexData:y,positionData:v,hasColors:I}=o,M=this._materialParameters(f,p),C=d||new Uint32Array([0,b?b.length:y.byteLength/p[0].stride]),O={vertices:{data:y,count:y.byteLength/p[0].stride,layoutParameters:M.geometryParams},positionData:{positions:v.data,indices:v.indices},indices:b,componentOffsets:C},E=f.transformation?T(f.transformation):D();w(E,n,E);const R=j(P(),E),A=x(S(),E),N=this.view.renderSpatialReference,F=this.view.basemapTerrain.spatialReference,V=P(),U=[1,1,1];B(R,N,U,F)||ht.errorOnce("Unsupported coordinate system for IM overlay"),k(R,N,V,F);const G=g.createObject({toMapSpace:H(V[0],V[1],U[0],U[1]),geometry:O,obb:m(e.geometryObb),transform:{position:R,rotationScale:A}}),L=M.geometryParams.textureCoordinates===nt.Atlas,{textures:q,texturePromise:z}=this._initMaterialAndTextures(G,M.material,l,L);e.memory+=this._memEstimateGeometryAdded(G),e.memory+=q.reduce(((e,t)=>e+(c(t)?this._memEstimateTextureAdded(t):0)),0);const K=!!M.material.hasParametersFromSource,W="blend"!==M.material.alphaMode&&M.material.metallicRoughness.baseColorFactor[3]>=1,$=new ut(e,_,G,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:K,isOpaque:W},q);this._updateElevationOffsets($),s.meta=$,!this._hasTextures&&t.requiredTextures?.some((({usage:e})=>0!=(e&pe.ColorTextures)))&&(this._hasTextures=!0),this._hasData=!0,this._hasColors=this._hasColors||I,this._hasTextures=this._hasTextures||!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const X=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering($),z]).then((([t,s])=>(c(t)&&t.updateObjectVisibility($.objectHandle,!1).catch(this._logEdgeViewError),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(c(this._labeler)&&this._addMetaToLabeler(this._labeler,$),this._addNodeMeta(e.index,$),i.meta=null,this.suspended)return void this._removeNodeStageData(e.index,this.elevationOffset);g.setObjectVisibility(G,ot.Visible),c(t)&&t.updateObjectVisibility($.objectHandle,!0).catch(this._logEdgeViewError),$.attributeInfo=i.attributeInfo;const s=$.cachedRendererVersion!==this._rendererVersion,r=X!==this.slicePlaneEnabled;this._setObjectSymbolColors($);const o=this._applyFiltersToNode($);(s||c(t)&&(r||o))&&this._addOrUpdateEdgeRendering($),this._visibleGeometryChanged($,pt.ADD),this._highlights.objectCreated($),this._updateMaterial($),this._setNewNodeOpacity($),c(this._treeDebugger)&&this._treeDebugger.update()}),i)))).catch((e=>{throw c(s.meta)&&(this._cacheGPUData(s.meta),s.meta=null),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){ht.error("Removing duplicated node");const t=this._nodeId2Meta.get(e);c(t)&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);c(t)&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&At(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t)}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this.elevationInfo;if(u(t)||i.mode===Nt.Absolute)return void(e.elevationOffsets=null);const s=this.view.basemapTerrain,r=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const o=Ft,a=Vt;for(let n=0;n<e.featureIds.length;n++){this._collection.getComponentAabb(e.objectHandle,n,a),A(o,(a[0]+a[3])/2,(a[1]+a[4])/2,a[2]),N(o,o,r.rotationScale),F(o,o,r.position);const l=s.getElevation(o[0],o[1],o[2],t),d=i.mode===Nt.OnTheGround?this.view.renderCoordsHelper.getAltitude(o):0;e.elevationOffsets[n]=i.offset+(c(l)?l-d:0)}}_elevationChanged(e){const t=this._controller.crsIndex;q(e.extent,e.spatialReference,Et,t);const i=this._controller.updateElevationChanged(Et,t);u(i)||i.forAll((e=>{const t=this._nodeId2Meta.get(e);c(t)&&(this._updateElevationOffsets(t),this._setObjectSymbolColors(t),this._updateEdgeRendering(t))}))}_elevationInfoChanged(){this.handles.remove("elevation"),this.elevationInfo.mode!==Nt.Absolute&&this.handles.add(this.view.basemapTerrain.on("elevation-change",(e=>this._elevationChanged(e))),"elevation"),this._nodeId2Meta.forEach((e=>{c(e)&&(this._updateElevationOffsets(e),this._setObjectSymbolColors(e),this._updateEdgeRendering(e))}))}_safeReschedule(e,t){return f(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=c(e.params.material)?e.params.material:we(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=xt(i);return{geometryParams:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>je(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Te(e,t,o,i,this.view._stage.renderView.textureRepository,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR(),isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return{textureCoordinates:e.hasTexture?e.hasRegions?nt.Atlas:nt.Default:nt.None,colors:this._hasVertexColors,normals:e.hasNormals&&!this._isIntegratedMesh}}_addData(e,t,i){let s=this._addTasks.get(e.index);return s?s.attributeInfo=t:(s={...p(),attributeInfo:t,meta:null},this._addTasks.set(e.index,s),i().then(s.resolve,s.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))),s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{c(e.meta)&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=Y();this._renderClippingArea=et(this.view.clippingArea,i,e)?i:null;const s=Y();this._layerClippingArea=et(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}_geometryFilterChange(){this._controller.geometryFilterChanged(this.hasGeometryFilter)}get hasGeometryFilter(){return!1}_filterChange(){this._applyFilters(!1)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{c(e)&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,pt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return c(t)&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(c(t)){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=c(t.attributeInfo)&&t.attributeInfo.attributeData;s.every((e=>null!=d[e]||e===n))&&Le(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=Be(d[i],e));try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return z(e.node.mbs,this._controller.crsIndex,Ot,this.view.renderSpatialReference),ke(t,Ot)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,bt),X(bt,yt),Q(i,yt)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===qe.INSIDE)return;if(r===qe.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(vt,i,t.objectHandle);Le(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}_addOrUpdateEdgeRendering(e,t=!0){const i=this._edgeView;if(u(i))return Promise.resolve(null);const s=e.objectHandle,r=i.hasObject(s),{hasEdges:o,perFeatureEdgeMaterials:a}=this._getFilteredEdgeMaterials(e),n={hasSlicePlane:this.slicePlaneEnabled};if(o&&r){if(this.nodeCrossfadingEnabled){At(a,this.getNodeOpacity(e))}return i.updateAllComponentMaterials(s,a,n,t).catch(this._logEdgeViewError),i.updateObjectVisibility(s,!0).catch(this._logEdgeViewError),i.updateAllVerticalOffsets(s,e.elevationOffsets).catch(this._logEdgeViewError),Promise.resolve(i)}return o&&!r?this._collection.addEdges(s,i,a,n).then((t=>(e.edgeMemoryUsage=t,e.node.memory+=t,i.updateAllVerticalOffsets(s,e.elevationOffsets).catch(this._logEdgeViewError),i))):(!o&&r&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,i.removeObject(s)),Promise.resolve(null))}_logEdgeViewError(e){b(e)||ht.error("Error while processing edges. Edges on this layer might not diplay correctly",this.i3slayer,e)}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(c(this._labeler)&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=0===t.getComponentCount(e.objectHandle).invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!i;if(this._updateCachedFilteredIds(e),e.filteredIds===e.featureIds)return!i;const s=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,s),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array;return e.featureIds.forEach(((i,s)=>{e.filteredIds[t.length]===i&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading)))}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);u(s)?i.delete(e):(this._collection.setObjectVisibility(s.objectHandle,ot.Hidden),c(this._edgeView)&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch(this._logEdgeViewError),this._visibleGeometryChanged(s,pt.REMOVE),c(this._labeler)&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),c(this._treeDebugger)&&this._treeDebugger.update())}_deleteComponentObject(e){if(c(this._edgeView)&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===Re.Hole))}_invalidateAllSymbols(){this._rendererVersion=ze(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return ze(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=ze(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await re()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:ht.warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.getSymbols())"mesh-3d"!==t.type&&ht.error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getSymbolColors(e){this._hasSymbolColors&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;U(s.externalColor,t[r+0]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255),s.externalColorMixMode=t[r+4]&(1<<_t.CastShadows)-1,s.castShadows=0!=(t[r+4]&1<<_t.CastShadows),s.pickable=0!=(t[r+4]&1<<_t.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e&&e.getSymbol(t,{arcade:this._arcade});if(!(i instanceof oe))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=Ke(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=c(this._symbologyOverrideFields)&&this._symbologyOverrideFields.length>0?c(this._rendererFields)&&this._rendererFields.length>0?Z(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasSymbolColors)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=c(e.attributeInfo)&&e.attributeInfo.attributeData,o=null!=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&c(this._symbologyFields)&&this._symbologyFields.length>0,n=a?[]:null,l=a?[]:null;if(a&&c(this._symbologyFields))for(const c of this._symbologyFields){const e=r[c];e&&(n.push(c),l.push(e))}e.cachedSymbology||(e.cachedSymbology=new Uint8Array(5*e.featureIds.length));const d={color:Mt,castShadows:!0,pickable:!0,colorMixMode:Je.Multiply,edgeMaterial:null},h=this.fullOpacity,_=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let m=null,g=dt.OPAQUE,f=We,p=0;for(let b=0;b<e.featureIds.length;b++){if(null!=o&&(i[o]=e.featureIds[b]),a)for(let e=0;e<n.length;e++)i[n[e]]=Be(l[e],b);const r=this._getSymbolInfo(s,t);let h=null,y=null;if(s&&"visualVariables"in s){if(this._colorVariable){const e=ie(this._colorVariable,t,{color:Ct,arcade:this._arcade});e&&(h=Mt,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,this._opacityVariable||null===e.a||(y=e.a))}this._opacityVariable&&(y=se(this._opacityVariable,t,{arcade:this._arcade}))}if(r&&r.material){const e=r.material;h=u(h)||u(y)?fe(h,y,e.color,e.alpha,ct,Mt):fe(h,y,null,null,ct,Mt)}if(u(h)&&(h=Mt,h[0]=1,h[1]=1,h[2]=1,h[3]=1),d.pickable=!0,d.castShadows=!r||r.castShadows,d.colorMixMode=r&&r.material?r.material.colorMixMode:Je.Multiply,d.edgeMaterial=r?r.edgeMaterial:null,c(this._symbologyOverride)&&(d.color=h,this._symbologyOverride(t,d),h=d.color),c(d.edgeMaterial)){const t=h[3]<=0?dt.INVISIBLE:h[3]>=1&&(e.material.isOpaque||d.colorMixMode===Je.Replace)?dt.OPAQUE:dt.TRANSPARENT;d.edgeMaterial===m&&t===g||(f={...d.edgeMaterial,opacity:_,objectTransparency:t},m=d.edgeMaterial,g=t),e.cachedEdgeMaterials[b]=f}else e.cachedEdgeMaterials[b]=We;e.cachedSymbology[p+0]=Math.round(255*h[0]),e.cachedSymbology[p+1]=Math.round(255*h[1]),e.cachedSymbology[p+2]=Math.round(255*h[2]),e.cachedSymbology[p+3]=Math.round(255*h[3]),e.cachedSymbology[p+4]=d.colorMixMode|+d.castShadows<<_t.CastShadows|+d.pickable<<_t.Pickable,p+=5}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);if(this.nodeCrossfadingEnabled||At(t,this.fullOpacity),u(e.filteredIds)){return{hasEdges:t.some((e=>e!==We)),perFeatureEdgeMaterials:t}}let i=0,s=!1;const r=t.map(((t,r)=>e.featureIds[r]!==e.filteredIds[i]?We:(s=s||t!==We,i++,t)));return{hasEdges:s,perFeatureEdgeMaterials:r}}_setObjectSymbolColors(e){if(!this._hasSymbolColors)return;const t=e.objectHandle,i=this._getSymbolColors(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),At(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR(),this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._setObjectSymbolColors(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,pt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),c(this._labeler)&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{u(t)||(this._collection.updateMaterial(t.objectHandle,(t=>{t.commonMaterialParameters.hasSlicePlane=e})),this._updateEdgeRendering(t,!1))}))}_updatePBR(){this._nodeId2Meta.forEach((e=>{u(e)||this._collection.updateMaterial(e.objectHandle,(e=>{e.usePBR=this._usePBR()}))})),this._hasLoadedPBRTextures=!0}_usePBR(){return!this._isIntegratedMesh&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){c(this._edgeView)&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_forAllFeatures(e,t,i=he.VISIBLE_ONLY){l(this._nodeId2Meta,(s=>{if(u(s))return!1;if(c(t)){switch(t(s)){case ce.EXIT:return!0;case ce.SKIP:return!1}}let r=ce.CONTINUE;switch(i){case he.ALL:r=this._forAllFeaturesOfNode(s,e);break;case he.VISIBLE_ONLY:r=this._forVisibleFeaturesOfNode(s,e);break;case he.ALL_IN_CLIPPING_AREA:r=this._forAllFeaturesOfNodeInClippingArea(s,e)}return r===ce.EXIT}))}_forAllFeaturesOfNode(e,t){let i=ce.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ce.EXIT)return i;return i}_forVisibleFeaturesOfNode(e,t){let i=ce.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ce.CONTINUE))),i}_forAllFeaturesOfNodeInClippingArea(e,t){if(u(this._renderClippingArea))return this._forAllFeaturesOfNode(e,t);const i=this._boundingRectNodeTest(e,this._renderClippingArea);if(i===qe.OUTSIDE)return ce.CONTINUE;if(i===qe.INSIDE)return this._forAllFeaturesOfNode(e,t);const s=ce.CONTINUE,r=e.featureIds,o=e.objectHandle,a=$e(this._renderClippingArea,this._collection.getObjectTransform(o));for(let n=0;n<r.length;n++){if(!this._boundingRectFeatureTest(e,n,a))continue;const i=t(r[n],n,e);if(i===ce.EXIT)return i}return s}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=c(t.attributeInfo)&&t.attributeInfo.attributeData;if(c(s))for(const r of Object.keys(s))i[r]=Be(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e){const t=this._highlights;if("number"==typeof e||e instanceof i?e=[e]:e instanceof o&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof i){const i=e,s=this.i3slayer.fieldsIndex,r=this._getObjectIdField(),o=i.map((e=>Qe(s,e.attributes,r))),{set:a,handle:n}=t.acquireSet();return t.setFeatureIds(a,o),n}if("number"==typeof e[0]){const i=e,{set:s,handle:r}=t.acquireSet();return t.setFeatureIds(s,i),r}}return Rt}_visibleGeometryChanged(e,t){this._elevationProvider&&(this._elevationProvider.objectChanged(e.node),null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=I((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t))}get performanceInfo(){const e={displayedNumberOfFeatures:0,maximumNumberOfFeatures:0,totalNumberOfFeatures:0,core:null,index:0,nodes:this._nodeId2Meta.size,"Total GPU Memory Estimate":(this.gpuMemoryEstimate/1048576).toFixed(1)+"MB","Geometry Memory Estimate":(this.geoMemoryEstimate/1048576).toFixed(1)+"MB","Texture Memory Estimate":(this.texMemoryEstimate/1048576).toFixed(1)+"MB","Unloaded Memory Estimate":(this.getUnloadedMemory()/1048576).toFixed(1)+"MB"};return c(this._memCache)&&(e.MemCache=Math.round(100*this._memCache.hitRate)+"% hit"),this._controller&&(this._idbCacheEnabled&&(e.IDBCache=Math.round(100*this._idbCache.getHitRate())+"% hit"),this._controller.updateStats(e)),e}get test(){const e=this;return{controller:this._controller,labeler:this._labeler,get visibleObjectIds(){const t=[];return e._forAllFeatures((e=>(t.push(e),ce.CONTINUE)),null,he.VISIBLE_ONLY),t.sort(((e,t)=>e-t)),t},get numNodes(){return e._nodeId2Meta.size}}}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return c(e)?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(((t,i)=>e(i,t)))}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);c(s)&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);c(i)&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(u(this._edgeView)||!e.cachedEdgeMaterials)return;At(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch(this._logEdgeViewError)}get hasModifications(){return this._isIntegratedMesh&&c(this._layerClippingArea)||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.i3slayer.uid,s=Dt(e);if(c(s)){const t={context:i,buffer:s.buffer};me(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=ge(i);e.imModificationImpact=s,s!==De.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||c(this._labeler)&&this._labeler.updating||this._crossfadeHelper.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(u(s))throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return{locations:o,type:"components",objectIds:s.featureIds,origin:r}},remove:()=>{s(this._snappingSourcesTrackers,t)}};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{u(t)||e.add(i,t.node.renderMbs)})),t}_updateSnappingSources(e,t){const{index:i,renderMbs:s}=e.node;for(const r of this._snappingSourcesTrackers)t!==pt.REMOVE&&t!==pt.UPDATE||r.events.remove(i),t!==pt.ADD&&t!==pt.UPDATE||r.events.add(i,s)}};return e([O()],r.prototype,"_hasLoadedPBRTextures",void 0),e([O()],r.prototype,"_asyncModuleLoading",void 0),e([O()],r.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([O()],r.prototype,"view",void 0),e([O()],r.prototype,"i3slayer",void 0),e([O()],r.prototype,"_controller",void 0),e([O()],r.prototype,"_labeler",void 0),e([O()],r.prototype,"updating",void 0),e([O()],r.prototype,"suspended",void 0),e([O()],r.prototype,"holeFilling",void 0),e([O(st)],r.prototype,"updatingProgress",void 0),e([O({readOnly:!0,aliasOf:"_controller.updatingProgress"})],r.prototype,"updatingProgressValue",void 0),e([O({readOnly:!0})],r.prototype,"hasTexturesOrVertexColors",null),e([O({readOnly:!0})],r.prototype,"rendererTextureUsage",null),e([O()],r.prototype,"filter",void 0),e([O({readOnly:!0})],r.prototype,"elevationOffset",null),e([O({readOnly:!0})],r.prototype,"elevationInfo",null),e([O({type:Boolean})],r.prototype,"slicePlaneEnabled",void 0),e([O()],r.prototype,"supportedTextureEncodings",null),e([O()],r.prototype,"uncompressedTextureDownsamplingEnabled",null),e([O({type:[te]})],r.prototype,"_modifications",void 0),r=e([E("esri.views.3d.layers.I3SMeshView3D")],r),r};var pt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(pt||(pt={}));const bt=K(),yt=Y(),vt=Y(),It=tt(),Mt=[0,0,0,0],Ct=new t([0,0,0,0]),Ot=[0,0,0,0],Et=Y();function xt(e){if(u(e))return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function St(e){return"geometryData"in e}function wt(e){return c(e)&&M(e.data)}function jt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(c(t))for(const s of t)c(s)&&M(s.data)&&(i+=s.data.byteLength);return i}function Tt(e,t){return t.byteSize>gt?(ht.warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Dt(e){if(0===e.length)return null;const t=10*e.length,i=new Float64Array(t);return e.forAll(((e,t)=>{let s=e.serviceObb;u(s)&&(s=It,V(s.center,e.mbs),s.halfSize[0]=s.halfSize[1]=s.halfSize[2]=e.mbs[3]);const r=10*t;i[r+0]=s.center[0],i[r+1]=s.center[1],i[r+2]=s.center[2],i[r+3]=s.halfSize[0],i[r+4]=s.halfSize[1],i[r+5]=s.halfSize[2],i[r+6]=s.quaternion[0],i[r+7]=s.quaternion[1],i[r+8]=s.quaternion[2],i[r+9]=s.quaternion[3]})),i}const Rt={remove(){},pause(){},resume(){}};function At(e,t){e.forEach((e=>e.opacity=t))}var Nt;!function(e){e[e.Absolute=0]="Absolute",e[e.RelativeToGround=1]="RelativeToGround",e[e.OnTheGround=2]="OnTheGround"}(Nt||(Nt={}));const Ft=P(),Vt=K();export{Nt as ElevationMode,ft as I3SMeshView3D};