@arcgis/core 4.31.0-next.20240619 → 4.31.0-next.20240621

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 (189) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
  4. package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
  5. package/assets/esri/core/workers/chunks/{d7c0728bdd9a7fd1d701.js → 9d677af08238d9e09e72.js} +36 -25
  6. package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
  7. package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
  8. package/assets/esri/core/workers/chunks/cf1530abe2842f3d8eb0.js +1 -0
  9. package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
  10. package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
  11. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
  12. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
  13. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
  14. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
  15. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
  16. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
  17. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
  18. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
  19. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
  20. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
  21. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
  22. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
  23. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
  24. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
  25. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
  26. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
  27. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
  28. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
  29. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
  30. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
  31. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
  32. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
  33. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
  34. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
  35. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
  36. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
  37. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
  38. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
  39. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
  40. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
  41. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
  42. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
  43. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
  44. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
  45. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
  46. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
  47. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
  48. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
  49. package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
  50. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
  51. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
  52. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
  53. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
  54. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
  55. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
  56. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
  57. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
  58. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
  59. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
  60. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
  61. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
  62. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
  63. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
  64. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
  65. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
  66. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
  67. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
  68. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
  69. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
  70. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
  71. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
  72. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
  73. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
  74. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
  75. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
  76. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
  77. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
  78. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
  79. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
  80. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
  81. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
  82. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
  83. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
  84. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
  85. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
  86. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
  87. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
  88. package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
  89. package/chunks/CheckerBoard.glsl.js +9 -6
  90. package/chunks/ComponentShader.glsl.js +23 -23
  91. package/chunks/HUDMaterial.glsl.js +29 -33
  92. package/chunks/HighlightApply.glsl.js +150 -23
  93. package/chunks/HighlightDownsample.glsl.js +25 -12
  94. package/chunks/ImageMaterial.glsl.js +1 -2
  95. package/chunks/LineMarker.glsl.js +30 -30
  96. package/chunks/RibbonLine.glsl.js +42 -42
  97. package/chunks/ShadowHighlight.glsl.js +15 -6
  98. package/chunks/Terrain.glsl.js +6 -3
  99. package/interfaces.d.ts +50 -14
  100. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  101. package/layers/mixins/EditBusLayer.js +1 -1
  102. package/layers/mixins/FeatureLayerBase.js +1 -1
  103. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  104. package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
  105. package/layers/support/featureLayerUtils.js +1 -1
  106. package/package.json +1 -1
  107. package/portal/schemas/definitions.js +1 -1
  108. package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/views/2d/layers/support/ExportStrategy.js +1 -1
  111. package/views/3d/layers/I3SMeshView3D.js +1 -1
  112. package/views/3d/layers/SceneLayerView3D.js +1 -1
  113. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  114. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  115. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  116. package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
  117. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  118. package/views/3d/layers/i3s/Highlights.js +1 -1
  119. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  120. package/views/3d/support/HighlightOptions.js +1 -1
  121. package/views/3d/support/HighlightOptionsBase.js +5 -0
  122. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  123. package/views/3d/terrain/TerrainRenderer.js +1 -1
  124. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  125. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  126. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  127. package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
  128. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  129. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  130. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +18 -7
  131. package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +5 -0
  132. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  133. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  134. package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
  135. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  136. package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
  137. package/views/3d/webgl-engine/lib/Material.js +1 -1
  138. package/views/3d/webgl-engine/lib/Program.js +1 -1
  139. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  140. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  141. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  142. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  143. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  144. package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
  145. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  146. package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
  147. package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
  148. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  149. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  150. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  151. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  152. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  153. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  154. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  155. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  156. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  157. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  158. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  159. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  160. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  163. package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
  164. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  165. package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
  166. package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
  167. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  168. package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
  169. package/views/SceneView.js +1 -1
  170. package/views/SelectionManager.js +1 -1
  171. package/views/support/HighlightDefaults.js +1 -1
  172. package/views/webgl/BufferObject.js +1 -1
  173. package/views/webgl/RenderingContext.js +1 -1
  174. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  175. package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
  176. package/widgets/OrientedImageryViewer/utils.js +1 -1
  177. package/widgets/OrientedImageryViewer.js +1 -1
  178. package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
  179. package/widgets/PanoramicViewer/constants.js +1 -1
  180. package/widgets/PanoramicViewer/utils.js +1 -1
  181. package/widgets/Print.js +1 -1
  182. package/assets/esri/core/workers/chunks/24484bd0185ea0f79760.js +0 -1
  183. package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
  184. package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
  185. package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
  186. package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
  187. package/chunks/HighlightBlur.glsl.js +0 -25
  188. package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +0 -5
  189. package/views/3d/webgl-engine/shaders/HighlightBlur.glsl.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as i,is3DGeometryOutput as s,ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import n from"../lib/GLMaterial.js";import{Material as u}from"../lib/Material.js";import{isPathGeometry as h}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as c,intersectAabbInvDir as d}from"../lib/RayIntersections.js";import{RenderSlot as l}from"../lib/RenderSlot.js";import{VertexAttribute as p}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as f,PathTechniqueConfiguration as b,PathTechnique as S,PathPassParameters as v}from"./PathTechnique.js";class g extends u{constructor(e){super(e,new w),this.supportsEdges=!0,this.produces=new Map([[l.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&!this.parameters.transparent],[l.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&this.parameters.transparent]]),this._vertexAttributeLocations=f,this._configuration=new b,this._vertexBufferLayout=g.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e===a.Color&&(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.WindingOrder:o.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=null!=t.ssao),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==a.Shadow&&e!==a.ShadowExcludeHighlight&&e!==a.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(r,i,s,a,o,n){const u=r;if(!h(u))return;const l=u.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:s}=this.parameters.vvSize,a=l.sizeAttributeValue;p[0]*=e(t[0]+a*r[0],i[0],s[0]),p[1]*=e(t[2]+a*r[2],i[2],s[2])}const m=new c(!1,s.options.normalRequired),f=Math.max(p[0],p[1]),b=r.boundingInfo;if(null==b)return void O(l,p,a,o,m,n);const S=t(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),v=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],g=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),_=[g/v[0],g/v[1],g/v[2]];d(S,a,_,s.tolerance)&&O(l,p,a,o,m,n)}createBufferWriter(){return new m(this._vertexBufferLayout)}createGLMaterial(e){return new _(e)}static getVertexBufferLayout(){const e=r().vec3f(p.POSITION).vec4f(p.PROFILERIGHT).vec4f(p.PROFILEUP).vec4f(p.PROFILEVERTEXANDNORMAL).vec4f(p.FEATUREVALUE);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(p.OBJECTANDLAYERIDCOLOR),e}}class _ extends n{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output===a.Color&&(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(S,e)}}function O(e,t,r,i,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,s,a)}class w extends v{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{g as PathMaterial,w as PathMaterialParameters};
5
+ import has from"../../../../core/has.js";import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isShadowRelatedOutput as i,is3DGeometryOutput as s,ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as o}from"../core/shaderLibrary/shading/Normals.glsl.js";import n from"../lib/GLMaterial.js";import{Material as h}from"../lib/Material.js";import{isPathGeometry as u}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as c,intersectAabbInvDir as d}from"../lib/RayIntersections.js";import{RenderSlot as l}from"../lib/RenderSlot.js";import{VertexAttribute as p}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{PathTechniqueConfiguration as f,vertexAttributeLocations as b,PathTechnique as S,PathPassParameters as v}from"./PathTechnique.js";class g extends h{constructor(e){super(e,new A),this._vertexBufferLayout=_(),this._configuration=new f,this._vertexAttributeLocations=b,this.supportsEdges=!0,this.produces=new Map([[l.OPAQUE_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&!this.parameters.transparent],[l.TRANSPARENT_MATERIAL,e=>(this.parameters.castShadows&&i(e)||s(e))&&this.parameters.transparent]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e===a.Color&&(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?o.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?o.WindingOrder:o.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=null!=t.ssao),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==a.Shadow&&e!==a.ShadowExcludeHighlight&&e!==a.ShadowHighlight||this.parameters.castShadows}get visible(){return this.parameters.opacity>0}intersect(r,i,s,a,o,n){const h=r;if(!u(h))return;const l=h.path,p=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:s}=this.parameters.vvSize,a=l.sizeAttributeValue;p[0]*=e(t[0]+a*r[0],i[0],s[0]),p[1]*=e(t[2]+a*r[2],i[2],s[2])}const m=new c(!1,s.options.normalRequired),f=Math.max(p[0],p[1]),b=r.boundingInfo;if(null==b)return void w(l,p,a,o,m,n);const S=t(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),v=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],g=Math.sqrt(v[0]*v[0]+v[1]*v[1]+v[2]*v[2]),_=[g/v[0],g/v[1],g/v[2]];d(S,a,_,s.tolerance)&&w(l,p,a,o,m,n)}createBufferWriter(){return new m(this._vertexBufferLayout)}createGLMaterial(e){return new O(e)}}function _(){const e=r().vec3f(p.POSITION).vec4f(p.PROFILERIGHT).vec4f(p.PROFILEUP).vec4f(p.PROFILEVERTEXANDNORMAL).vec4f(p.FEATUREVALUE);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(p.OBJECTANDLAYERIDCOLOR),e}class O extends n{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output===a.Color&&(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(S,e)}}function w(e,t,r,i,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,s,a)}class A extends v{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{g as PathMaterial,A as PathMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as t,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{isOIDorHighlight as i,isColor as a,isDepth as o,ShaderOutput as n}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as c}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as u}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as f}from"../lib/RenderSlot.js";import{assert as p}from"../lib/Util.js";import{VertexAttribute as h}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{Style as d}from"./PatternStyle.js";import{TriangleMaterial as g}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{writeDefaultAttributes as b,writeBufferVec4 as A}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocationsOID as O,vertexAttributeLocations as T,PatternTechniqueConfiguration as y,PatternTechnique as P}from"../shaders/PatternTechnique.js";class v extends g{constructor(e){super(e,new C),this.supportsEdges=!0,this.produces=new Map([[f.OPAQUE_MATERIAL,e=>i(e)],[f.TRANSPARENT_MATERIAL,e=>a(e)],[f.TRANSPARENT_NO_SSAO_DEPTH,e=>o(e)&&this.parameters.writeLinearDepth],[f.DRAPED_MATERIAL,e=>this.parameters.draped&&e===n.Color||i(e)]]),this._vertexAttributeLocations=has("enable-feature:objectAndLayerId-rendering")?O:T,this._configuration=new y}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<u,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}createGLMaterial(e){return new E(e)}createBufferWriter(){const e=s().vec3f(h.POSITION).vec4f(h.UVMAPSPACE);return this.parameters.draped||e.mat3f(h.BOUNDINGRECT),this.parameters.vvColor?e.f32(h.COLORFEATUREATTRIBUTE):e.vec4u8(h.COLOR),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(h.OBJECTANDLAYERIDCOLOR),new S(e)}}class E extends l{_updateParameters(e){return this.ensureTechnique(P,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===n.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class S extends m{write(e,s,i,a,o){b(i,this.vertexBufferLayout,e,s,a,o);for(const n of this.vertexBufferLayout.fields.keys()){const s=i.attributes.get(n),c=s?.indices;if(s&&c)switch(n){case h.UVMAPSPACE:{p(4===s.size);const e=a.getField(n,r);e&&A(s,e,o);break}case h.BOUNDINGRECT:{p(9===s.size);const r=a.getField(n,t);r&&j(s,e,r,o);break}}}}}function j(e,t,r,s){const{data:i,indices:a}=e,o=t,n=r.typedBuffer,c=r.typedBufferStride,l=a.length;s*=c;for(let u=0;u<l;++u){const e=9*a[u],t=i[e],r=i[e+1],l=i[e+2];n[s]=o[0]*t+o[4]*r+o[8]*l+o[12],n[s+1]=o[1]*t+o[5]*r+o[9]*l+o[13],n[s+2]=o[2]*t+o[6]*r+o[10]*l+o[14];for(let a=3;a<9;++a)n[s+a]=i[e+a];s+=c}}class C extends _{constructor(){super(...arguments),this.color=e(1,1,1,1),this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=c.None,this.hasOccludees=!1,this.style=d.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{C as Parameters,v as PatternMaterial};
5
+ import has from"../../../../core/has.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewMat3f as t,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{isOIDorHighlight as i,isColor as a,isDepth as o,ShaderOutput as n}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as c}from"../lib/basicInterfaces.js";import l from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as u}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as f}from"../lib/RenderSlot.js";import{assert as p}from"../lib/Util.js";import{VertexAttribute as h}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{Style as d}from"./PatternStyle.js";import{TriangleMaterial as g}from"./TriangleMaterial.js";import{VisualVariablePassParameters as _}from"./VisualVariablePassParameters.js";import{writeDefaultAttributes as b,writeBufferVec4 as A}from"./internal/bufferWriterUtils.js";import{PatternTechniqueConfiguration as O,vertexAttributeLocationsOID as T,vertexAttributeLocations as y,PatternTechnique as P}from"../shaders/PatternTechnique.js";class v extends g{constructor(e){super(e,new C),this._configuration=new O,this._vertexAttributeLocations=has("enable-feature:objectAndLayerId-rendering")?T:y,this.supportsEdges=!0,this.produces=new Map([[f.OPAQUE_MATERIAL,e=>i(e)],[f.TRANSPARENT_MATERIAL,e=>a(e)],[f.TRANSPARENT_NO_SSAO_DEPTH,e=>o(e)&&this.parameters.writeLinearDepth],[f.DRAPED_MATERIAL,e=>this.parameters.draped&&e===n.Color||i(e)]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<u,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}createGLMaterial(e){return new E(e)}createBufferWriter(){const e=s().vec3f(h.POSITION).vec4f(h.UVMAPSPACE);return this.parameters.draped||e.mat3f(h.BOUNDINGRECT),this.parameters.vvColor?e.f32(h.COLORFEATUREATTRIBUTE):e.vec4u8(h.COLOR),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(h.OBJECTANDLAYERIDCOLOR),new S(e)}}class E extends l{_updateParameters(e){return this.ensureTechnique(P,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===n.Color&&this._updateOccludeeState(e),this._updateParameters(e)}}class S extends m{write(e,s,i,a,o){b(i,this.vertexBufferLayout,e,s,a,o);for(const n of this.vertexBufferLayout.fields.keys()){const s=i.attributes.get(n),c=s?.indices;if(s&&c)switch(n){case h.UVMAPSPACE:{p(4===s.size);const e=a.getField(n,r);e&&A(s,e,o);break}case h.BOUNDINGRECT:{p(9===s.size);const r=a.getField(n,t);r&&j(s,e,r,o);break}}}}}function j(e,t,r,s){const{data:i,indices:a}=e,o=t,n=r.typedBuffer,c=r.typedBufferStride,l=a.length;s*=c;for(let u=0;u<l;++u){const e=9*a[u],t=i[e],r=i[e+1],l=i[e+2];n[s]=o[0]*t+o[4]*r+o[8]*l+o[12],n[s+1]=o[1]*t+o[5]*r+o[9]*l+o[13],n[s+2]=o[2]*t+o[6]*r+o[10]*l+o[14];for(let a=3;a<9;++a)n[s+a]=i[e+a];s+=c}}class C extends _{constructor(){super(...arguments),this.color=e(1,1,1,1),this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=c.None,this.hasOccludees=!1,this.style=d.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{C as Parameters,v as PatternMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,m as n,j as o,g as l,c,l as u,p as h,h as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isDepth as v,isColorHighlightOIDOrDepth as P,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import N from"../lib/GLMaterial.js";import{Material as C,RenderOccludedFlag as y}from"../lib/Material.js";import{RenderSlot as j}from"../lib/RenderSlot.js";import{isTranslationMatrix as D}from"../lib/Util.js";import{VertexAttribute as U}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as w}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as B}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as J}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as M,CapType as G}from"../shaders/RibbonLineTechniqueConfiguration.js";var H;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(H||(H={}));class z extends C{constructor(e){super(e,new V),this._configuration=new M,this.produces=new Map([[j.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||e===b.Color&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.OPAQUE_NO_SSAO_DEPTH,e=>v(e)],[j.OCCLUDER_MATERIAL,e=>P(e)&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.TRANSPARENT_OCCLUDER_MATERIAL,e=>P(e)&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.TRANSPARENT_MATERIAL,e=>e===b.Color&&this.parameters.writeDepth&&this.parameters.renderOccluded!==y.OccludeAndTransparentStencil],[j.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>e===b.Color&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==y.OccludeAndTransparentStencil],[j.DRAPED_MATERIAL,e=>L(e)]]),this._vertexAttributeLocations=x}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===j.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&q(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===y.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(U.POSITION).data,l=e.attributes.get(U.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(U.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!D(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(U.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(U.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(U.SIZE)&&(v*=g.get(U.SIZE).data[0]);const P=m.camera,L=ee;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ue[0],L[0]-N,L[1]+N,0),i(ue[1],L[0]+N,L[1]+N,0),i(ue[2],L[0]+N,L[1]-N,0),i(ue[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ue[e],he[e]))return;O(P.eye,he[0],he[1],pe),O(P.eye,he[1],he[2],me),O(P.eye,he[2],he[3],fe),O(P.eye,he[3],he[0],de);let C=Number.MAX_VALUE,y=0;const j=Y(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<j;e+=3){X[0]=b[e]+p[12],X[1]=b[e+1]+p[13],X[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(Q[0]=b[t]+p[12],Q[1]=b[t+1]+p[13],Q[2]=b[t+2]+p[14],I(pe,X)<0&&I(pe,Q)<0||I(me,X)<0&&I(me,Q)<0||I(fe,X)<0&&I(fe,Q)<0||I(de,X)<0&&I(de,Q)<0)continue;if(P.projectToRenderScreen(X,te),P.projectToRenderScreen(Q,re),te[2]<0&&re[2]>0){a(K,X,Q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(K,S(e[d.NEAR]));o(K,K,t),l(X,X,K),P.projectToRenderScreen(X,te)}else if(te[2]>0&&re[2]<0){a(K,Q,X);const e=P.frustum,t=-I(e[d.NEAR],Q)/n(K,S(e[d.NEAR]));o(K,K,t),l(Q,Q,K),P.projectToRenderScreen(Q,re)}else if(te[2]<0&&re[2]<0)continue;te[2]=0,re[2]=0;const r=_(E(te,re,ae),L);r<C&&(C=r,c(se,X),c(ie,Q),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(se,ie,ae),E(F,w,ne),$)){a($,$,F);const t=u($);o($,$,1/t),e=t/h(F,w)}R(e,$,y,!1)}}get _layout(){const e=g().vec3f(U.POSITION).vec3f(U.PREVPOSITION).vec3f(U.NEXTPOSITION).f32(U.SUBDIVISIONFACTOR).vec2f(U.UV0);return this.parameters.vvSize?e.f32(U.SIZEFEATUREATTRIBUTE):e.f32(U.SIZE),this.parameters.vvColor?e.f32(U.COLORFEATUREATTRIBUTE):e.vec4f(U.COLOR),this.parameters.vvOpacity&&e.f32(U.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(U.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new Z(this._layout,this.parameters)}createGLMaterial(e){return new k(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class k extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===b.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(J,e)}}class V extends F{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=G.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class Z{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=B+r}}_isClosed(e){return Y(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(U.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=oe,o=le,l=ce,u=r.attributes.get(U.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(U.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(U.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(U.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(U.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(U.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(U.COLOR)&&(_=r.attributes.get(U.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(U.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(U.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,H.LEFT_CAP_START,0,0),y(o,o,l,1,H.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,F=j?f:f-1;for(let h=D;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,H.LEFT_JOIN_END,h,L),y(n,o,l,0,H.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,H.LEFT_JOIN_END,h,L),y(n,o,l,t,H.RIGHT_JOIN_END,h,L)}y(n,o,l,1,H.LEFT_JOIN_START,h,L),y(n,o,l,1,H.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,H.LEFT_JOIN_END,D,L),y(n,o,l,0,H.RIGHT_JOIN_END,D,L)):(L=N(n,o,F),y(n,o,o,0,H.LEFT_CAP_END,F,L),y(n,o,o,0,H.RIGHT_CAP_END,F,L)),W(S,P+b,S,P,b);v=W(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=W(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function W(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function Y(e,t){if(!e.isClosed)return!1;return t.get(U.POSITION).indices.length>2}function q(e){return e.anchor===w.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const X=m(),Q=m(),K=m(),$=m(),ee=m(),te=r(),re=r(),se=m(),ie=m(),ae=T(),ne=T(),oe=m(),le=m(),ce=m(),ue=[r(),r(),r(),r()],he=[m(),m(),m(),m()],pe=R(),me=R(),fe=R(),de=R();export{V as Parameters,z as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{s as i,f as a,m as n,j as o,g as l,c,l as u,p as h,h as p}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as T,distance2 as _,fromPoints as E,closestLineSegmentPoint as A}from"../../../../geometry/support/lineSegment.js";import{create as R,fromPoints as O,signedDistance as I,getNormal as S}from"../../../../geometry/support/plane.js";import{newLayout as g}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as b,isDepth as v,isColorHighlightOIDOrDepth as P,is2DGeometryOutput as L}from"../core/shaderLibrary/ShaderOutput.js";import N from"../lib/GLMaterial.js";import{Material as C,RenderOccludedFlag as y}from"../lib/Material.js";import{RenderSlot as j}from"../lib/RenderSlot.js";import{isTranslationMatrix as D}from"../lib/Util.js";import{VertexAttribute as U}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as F}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as w}from"../shaders/LineMarkerTechniqueConfiguration.js";import{r as B}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as J}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as M,CapType as G}from"../shaders/RibbonLineTechniqueConfiguration.js";var H;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(H||(H={}));class z extends C{constructor(e){super(e,new V),this._configuration=new M,this._vertexAttributeLocations=x,this.produces=new Map([[j.OPAQUE_MATERIAL,e=>e===b.Highlight||e===b.ObjectAndLayerIdColor||e===b.Color&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.OPAQUE_NO_SSAO_DEPTH,e=>v(e)],[j.OCCLUDER_MATERIAL,e=>P(e)&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.TRANSPARENT_OCCLUDER_MATERIAL,e=>P(e)&&this.parameters.renderOccluded===y.OccludeAndTransparentStencil],[j.TRANSPARENT_MATERIAL,e=>e===b.Color&&this.parameters.writeDepth&&this.parameters.renderOccluded!==y.OccludeAndTransparentStencil],[j.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>e===b.Color&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==y.OccludeAndTransparentStencil],[j.DRAPED_MATERIAL,e=>L(e)]])}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===j.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==b.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&q(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===y.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.attributes.get(U.POSITION).data,l=e.attributes.get(U.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.attributes.get(U.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let d=0;d<o.length-5;d+=3){const e=o[d],r=o[d+1],s=u-e,i=h-r,a=o[d+3]-e,n=o[d+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,T=c*c+p*p;T<m&&(m=T,f=d/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,T,R){if(!m.options.selectionMode||!r.visible)return;if(!D(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const g=r.attributes,b=g.get(U.POSITION).data;let v=this.parameters.width;if(this.parameters.vvSize){const e=g.get(U.SIZEFEATUREATTRIBUTE).data[0];v*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else g.has(U.SIZE)&&(v*=g.get(U.SIZE).data[0]);const P=m.camera,L=ee;s(L,m.point);const N=v*P.pixelRatio/2+4*P.pixelRatio;i(ue[0],L[0]-N,L[1]+N,0),i(ue[1],L[0]+N,L[1]+N,0),i(ue[2],L[0]+N,L[1]-N,0),i(ue[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(ue[e],he[e]))return;O(P.eye,he[0],he[1],pe),O(P.eye,he[1],he[2],me),O(P.eye,he[2],he[3],fe),O(P.eye,he[3],he[0],de);let C=Number.MAX_VALUE,y=0;const j=Y(this.parameters,g)?b.length-2:b.length-5;for(let e=0;e<j;e+=3){X[0]=b[e]+p[12],X[1]=b[e+1]+p[13],X[2]=b[e+2]+p[14];const t=(e+3)%b.length;if(Q[0]=b[t]+p[12],Q[1]=b[t+1]+p[13],Q[2]=b[t+2]+p[14],I(pe,X)<0&&I(pe,Q)<0||I(me,X)<0&&I(me,Q)<0||I(fe,X)<0&&I(fe,Q)<0||I(de,X)<0&&I(de,Q)<0)continue;if(P.projectToRenderScreen(X,te),P.projectToRenderScreen(Q,re),te[2]<0&&re[2]>0){a(K,X,Q);const e=P.frustum,t=-I(e[d.NEAR],X)/n(K,S(e[d.NEAR]));o(K,K,t),l(X,X,K),P.projectToRenderScreen(X,te)}else if(te[2]>0&&re[2]<0){a(K,Q,X);const e=P.frustum,t=-I(e[d.NEAR],Q)/n(K,S(e[d.NEAR]));o(K,K,t),l(Q,Q,K),P.projectToRenderScreen(Q,re)}else if(te[2]<0&&re[2]<0)continue;te[2]=0,re[2]=0;const r=_(E(te,re,ae),L);r<C&&(C=r,c(se,X),c(ie,Q),y=e/3)}const F=m.rayBegin,w=m.rayEnd;if(C<N*N){let e=Number.MAX_VALUE;if(A(E(se,ie,ae),E(F,w,ne),$)){a($,$,F);const t=u($);o($,$,1/t),e=t/h(F,w)}R(e,$,y,!1)}}get _layout(){const e=g().vec3f(U.POSITION).vec3f(U.PREVPOSITION).vec3f(U.NEXTPOSITION).f32(U.SUBDIVISIONFACTOR).vec2f(U.UV0);return this.parameters.vvSize?e.f32(U.SIZEFEATUREATTRIBUTE):e.f32(U.SIZE),this.parameters.vvColor?e.f32(U.COLORFEATUREATTRIBUTE):e.vec4f(U.COLOR),this.parameters.vvOpacity&&e.f32(U.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(U.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new Z(this._layout,this.parameters)}createGLMaterial(e){return new k(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class k extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===b.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(J,e)}}class V extends F{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=G.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class Z{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t,this.numJoinSubdivisions=0;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=B+r}}_isClosed(e){return Y(this._parameters,e.attributes)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.attributes.get(U.POSITION).indices.length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=oe,o=le,l=ce,u=r.attributes.get(U.POSITION),m=u.indices,f=u.data.length/3,d=r.attributes.get(U.DISTANCETOSTART)?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const T=r.attributes.get(U.SIZEFEATUREATTRIBUTE)?.data[0]??r.attributes.get(U.SIZE)?.data[0]??1;let _=[1,1,1,1],E=0;const A=this.vertexBufferLayout.fields.has(U.COLORFEATUREATTRIBUTE);A?E=r.attributes.get(U.COLORFEATUREATTRIBUTE).data[0]:r.attributes.has(U.COLOR)&&(_=r.attributes.get(U.COLOR).data);const R=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null,O=this.vertexBufferLayout.fields.has(U.OPACITYFEATUREATTRIBUTE),I=O?r.attributes.get(U.OPACITYFEATUREATTRIBUTE).data[0]:0,S=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,b=this.vertexBufferLayout.stride/4;let v=a*b;const P=v;let L=0;const N=d?(e,t,r)=>L=d[r]:(e,t,r)=>L+=h(e,t),C=has("enable-feature:objectAndLayerId-rendering"),y=(e,t,r,s,i,a,n)=>{if(S[v++]=t[0],S[v++]=t[1],S[v++]=t[2],S[v++]=e[0],S[v++]=e[1],S[v++]=e[2],S[v++]=r[0],S[v++]=r[1],S[v++]=r[2],S[v++]=s,S[v++]=n,S[v++]=i,S[v++]=T,A)S[v++]=E;else{const e=Math.min(4*a,_.length-4);S[v++]=_[e],S[v++]=_[e+1],S[v++]=_[e+2],S[v++]=_[e+3]}O&&(S[v++]=I),C&&(null!=R&&(g[4*v]=R[0],g[4*v+1]=R[1],g[4*v+2]=R[2],g[4*v+3]=R[3]),v++)};v+=b,i(o,u.data[0],u.data[1],u.data[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.data.length-3;i(n,u.data[t],u.data[t+1],u.data[t+2]),e&&p(n,n,e)}else i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),y(o,o,l,1,H.LEFT_CAP_START,0,0),y(o,o,l,1,H.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,F=j?f:f-1;for(let h=D;h<F;h++){const t=(h+1)%f*3;i(l,u.data[t],u.data[t+1],u.data[t+2]),e&&p(l,l,e),N(n,o,h),y(n,o,l,0,H.LEFT_JOIN_END,h,L),y(n,o,l,0,H.RIGHT_JOIN_END,h,L);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);y(n,o,l,t,H.LEFT_JOIN_END,h,L),y(n,o,l,t,H.RIGHT_JOIN_END,h,L)}y(n,o,l,1,H.LEFT_JOIN_START,h,L),y(n,o,l,1,H.RIGHT_JOIN_START,h,L),c(n,o),c(o,l)}j?(i(l,u.data[3],u.data[4],u.data[5]),e&&p(l,l,e),L=N(n,o,F),y(n,o,l,0,H.LEFT_JOIN_END,D,L),y(n,o,l,0,H.RIGHT_JOIN_END,D,L)):(L=N(n,o,F),y(n,o,o,0,H.LEFT_CAP_END,F,L),y(n,o,o,0,H.RIGHT_CAP_END,F,L)),W(S,P+b,S,P,b);v=W(S,v-b,S,v,b),this._parameters.wireframe&&this._addWireframeVertices(s,P,v,b)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=W(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function W(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function Y(e,t){if(!e.isClosed)return!1;return t.get(U.POSITION).indices.length>2}function q(e){return e.anchor===w.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const X=m(),Q=m(),K=m(),$=m(),ee=m(),te=r(),re=r(),se=m(),ie=m(),ae=T(),ne=T(),oe=m(),le=m(),ce=m(),ue=[r(),r(),r(),r()],he=[m(),m(),m(),m()],pe=R(),me=R(),fe=R(),de=R();export{V as Parameters,z as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,j as r,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as h,isColorOrOID as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as p}from"../lib/basicInterfaces.js";import f from"../lib/GLMaterial.js";import{Material as m,MaterialParameters as d}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{assert as g}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as T,writePosition as _}from"./internal/bufferWriterUtils.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as F,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";class w extends m{constructor(e){super(e,new x),this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>e===h.Highlight||u(e)&&!this._isTransparent],[S.TRANSPARENT_MATERIAL,e=>u(e)&&this._isTransparent&&this.parameters.writeDepth],[S.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>u(e)&&this._isTransparent&&!this.parameters.writeDepth]]),this._configuration=new A,this._vertexAttributeLocations=F}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,h){if(this.parameters.screenSizeEnabled){const s=e.attributes.get(E.OFFSET),u={applyToVertex:(e,n,o,c)=>{const l=t(O,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),h=t(y,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(l)),i(h,h,l),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,O);return o(e,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(t))}};b(e,a,c,l,u,h)}else b(e,a,c,l,void 0,h)}createGLMaterial(e){return new v(e)}createBufferWriter(){return new z(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class v extends f{beginSlot(e){return this.ensureTechnique(j,e)}}class x extends d{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=p.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class z{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(E.POSITION).indices.length}write(e,t,r,i,s){if(T(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.attributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.attributes.get(E.OFFSET);g(3===e.size);const a=i.getField(E.OFFSET,c);if(!a)throw new Error("unable to acquire view for "+E.OFFSET);_(e,t,a,s)}}}}const O=s(),y=s();export{w as ShadedColorMaterial,x as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,j as r,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as h,isColorOrOID as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as p}from"../lib/basicInterfaces.js";import f from"../lib/GLMaterial.js";import{Material as m,MaterialParameters as d}from"../lib/Material.js";import{intersectTriangleGeometry as b}from"../lib/RayIntersections.js";import{RenderSlot as S}from"../lib/RenderSlot.js";import{assert as g}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as T,writePosition as _}from"./internal/bufferWriterUtils.js";import{ShadedColorMaterialTechniqueConfiguration as A,vertexAttributeLocations as F,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";class w extends m{constructor(e){super(e,new x),this._configuration=new A,this._vertexAttributeLocations=F,this.supportsEdges=!0,this.produces=new Map([[S.OPAQUE_MATERIAL,e=>e===h.Highlight||u(e)&&!this._isTransparent],[S.TRANSPARENT_MATERIAL,e=>u(e)&&this._isTransparent&&this.parameters.writeDepth],[S.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>u(e)&&this._isTransparent&&!this.parameters.writeDepth]])}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,h){if(this.parameters.screenSizeEnabled){const s=e.attributes.get(E.OFFSET),u={applyToVertex:(e,n,o,c)=>{const l=t(O,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),h=t(y,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(l)),i(h,h,l),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,O);return o(e,this.parameters.screenSizeScale*a.camera.computeScreenPixelSizeAt(t))}};b(e,a,c,l,u,h)}else b(e,a,c,l,void 0,h)}createGLMaterial(e){return new v(e)}createBufferWriter(){return new z(this.parameters.screenSizeEnabled)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class v extends f{beginSlot(e){return this.ensureTechnique(j,e)}}class x extends d{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=p.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class z{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.attributes.get(E.POSITION).indices.length}write(e,t,r,i,s){if(T(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.attributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.attributes.get(E.OFFSET);g(3===e.size);const a=i.getField(E.OFFSET,c);if(!a)throw new Error("unable to acquire view for "+E.OFFSET);_(e,t,a,s)}}}}const O=s(),y=s();export{w as ShadedColorMaterial,x as ShadedColorMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as h,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as m}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as g}from"../../effects/RenderPlugin.js";import{GLMaterials as p}from"../../lib/GLMaterials.js";import{DirtyState as y}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as _}from"../../lib/RenderSlot.js";import{assert as b}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as w,mergeAdjacentRanges as O}from"./BufferRange.js";import{Instance as C}from"./Instance.js";import{PerBufferData as A,hasVao as E}from"./PerBufferData.js";import{PerOriginData as B}from"./PerOriginData.js";let H=class extends g{constructor(e){super(e),this._dataByOrigin=new Map,this._hasHighlights=!1,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==m.Highlight&&t!==m.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e,t){this._glMaterials=new p(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,d(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.usedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter;if(null==t)return;const r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,s=this._dataByOrigin.get(e.localOrigin.id),o=s?.findBuffer(e.id);if(null==o)return;const a=o.instances.get(e.id);if(i.updateType&(y.GEOMETRY|y.TRANSFORMATION)){const i=P(t.elementCount(a.geometry.geometry)*r),s=t.vertexBufferLayout.createView(i.buffer);this._writeGeometry(e,s,0),o.vao.vertexBuffers.geometry.setSubData(i,a.from*r,0,a.numElements*r)}i.updateType&(y.HIGHLIGHT|y.OCCLUDEE|y.VISIBILITY)&&(o.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new D(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new D(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_addAndRemoveGeometries(e,r){if(null==this._bufferWriter||null==this._vaoCache)return;const{_bufferWriter:i,_dataByOrigin:s}=this,o=i.vertexBufferLayout.stride/4,a=this._computeDeltas(e,r);a.forEach(((e,r)=>{const n=e.get(null),l=null!=n?n.changes:[];a.delete(r,null);let u=s.get(r);if(e.forEach(((e,n)=>{if(a.delete(r,n),null==n)return void b(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(u.buffers,n),void(0===u.buffers.length&&0===l.length&&s.delete(r));const h=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),d=e.changes.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),m=Math.min((h+f-d)*o,G),g=m>c;m>j&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(u.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==u&&(u=new B(n.origin),s.set(r,u)),u.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)u.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{if(e.drawCommandsDirty){e.hasHiddenInstances=e.hasHighlights=e.hasOccludees=!1;for(const t of e.instances.values())if(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees)break;e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)}this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(G/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new C(r,0,0);b(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,u=P(l),h=i.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,h,c);const s=c;c+=i.elementCount(t.geometry.geometry),e.updateInstance(r,s,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*o),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;for(const a of t.changes){const t=a.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const i=M.back();if(i){if(i.to===r.from){i.to=r.to;continue}if(i.from===r.to){i.from=r.from;continue}}const s=M.pushNew();s.from=r.from,s.to=r.to}O(M);const r=this._bufferWriter.vertexBufferLayout.stride/4,i=M.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,s=P(i);s.fill(0,0,i);const o=e.vao.vertexBuffers.geometry;M.forAll((e=>o.setSubData(s,e.from*r,0,e.numElements*r))),e.holes.pushArray(M.data,M.length),M.forAll(((e,t)=>M.data[t]=null)),M.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!E(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),n=Math.min((o+a)*s,G),l=4*n;if(e.vao.byteSize<V(G-j)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);O(e.holes);const u=new Array;for(const r of t){const t=i.elementCount(r.geometry),s=S(e.holes,t);u.push(s)}const h=e.vao.vertexBuffers.geometry;let c=0,f=0,d=0;const m=P(n),g=i.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const o=u[r];if(null==o)return;if(!(d===o)){const e=d-f;e>0&&h.setSubData(m,f*s,0,e*s),f=o,c=0}const a=i.elementCount(t.geometry);this._writeGeometry(t,g,c),c+=a,d=o+a;const n=new C(t,o,o+a);b(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&h.setSubData(m,f*s,0,p*s),r(t,((e,t)=>null==u[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(x,e.transformation),x[12]-=e.localOrigin.vec3[0],x[13]-=e.localOrigin.vec3[1],x[14]-=e.localOrigin.vec3[2],h(R,x),c(R,R),this._bufferWriter.write(x,R,e.geometry,t,r))}updateAnimation(e){return this.material.update(e)}prepareTechnique(e){if(!this.material.shouldRender(e))return null;const{output:t,bindParameters:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const s=t===m.Highlight||t===m.ShadowHighlight;if(s&&!this._hasHighlights)return null;const o=t===m.ShadowExcludeHighlight,a=!(s||o);for(const n of this._dataByOrigin.values())for(const i of n.buffers){if(s&&!i.hasHighlights)continue;const n=(s?i.drawCommandsHighlight:o&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null,l=a&&i.drawCommandsOccludees||null;if(n?.length||l?.length){const i=this._glMaterials.load(e.rctx,r.slot,t),s=null!=i?i.beginSlot(r):null;if(null!=s)return s}}return null}renderNode(e,t){const{output:r,bindParameters:i}=e,s=r===m.Highlight||r===m.ShadowHighlight,o=r===m.ShadowExcludeHighlight,a=!(s||o),n=i.slot===_.OCCLUDER_MATERIAL,l=i.slot===_.TRANSPARENT_OCCLUDER_MATERIAL,u=e.rctx;u.runAppleAmdDriverHelper(),u.bindTechnique(t,i,this.material.parameters);for(const h of this._dataByOrigin.values())for(const e of h.buffers){if(s&&!e.hasHighlights)continue;const r=(s?e.drawCommandsHighlight:o&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,c=a&&e.drawCommandsOccludees||null;if(r?.length||c?.length){t.program.bindDraw(new v(h.origin),i,this.material.parameters),t.ensureAttributeLocations(e.vao),u.bindVAO(e.vao),r?.length&&(u.setPipelineState(t.getPipeline(!1,n,l)),r.forAll((e=>u.drawArrays(t.primitiveType,e.first,e.count)))),c?.length&&(u.setPipelineState(t.getPipeline(!0,n,l)),c.forAll((e=>u.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){}};e([n({constructOnly:!0})],H.prototype,"material",void 0),H=e([l("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],H);class D{constructor(e){this.origin=e,this.changes=new Array}}function S(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const x=f(),R=f(),M=new a({allocator:e=>e||new w,deallocator:null}),j=65536,L=4*j,I=1024,T=16777216,G=T/4;let W=new Float32Array(j);function P(e){return W.length<e&&(W=new Float32Array(e)),W}function V(e){const t=4*e;return t<=I?I:t<L?i(t):Math.max(Math.min(Math.ceil(1.5*t/L)*L,T),t)}export{H as MergedRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as s}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import a from"../../../../../core/PooledArray.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{copy as u,invert as h,transpose as c}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as d}from"../../../support/buffer/glUtil.js";import{ShaderOutput as m}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as g}from"../../effects/RenderPlugin.js";import{GLMaterials as p}from"../../lib/GLMaterials.js";import{DirtyState as y}from"../../lib/ModelDirtyTypes.js";import{RenderSlot as _}from"../../lib/RenderSlot.js";import{assert as b}from"../../lib/Util.js";import{DrawParameters as v}from"../DrawParameters.js";import{BufferRange as w,mergeAdjacentRanges as O}from"./BufferRange.js";import{Instance as C}from"./Instance.js";import{PerBufferData as A,hasVao as E}from"./PerBufferData.js";import{PerOriginData as B}from"./PerOriginData.js";let H=class extends g{constructor(e){super(e),this._dataByOrigin=new Map,this._hasHighlights=!1,this.drapedPriority=0,this._produces=new Map,this._hasOccludees=!1}destroy(){this._glMaterials=s(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=null}initialize(){this.material.produces.forEach(((e,t)=>{this._produces.set(t,(t=>!(0===this._dataByOrigin.size||!(t!==m.Highlight&&t!==m.ShadowHighlight||this._hasHighlights))&&e(t)))}))}initializeRenderContext(e,t){this._glMaterials=new p(this.material,t??e.materials),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=e.renderContext.rctx.getVaoCache(this.material.vertexAttributeLocations,d(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get produces(){return this._produces}get hasOccludees(){return this._hasOccludees}get isDecoration(){return this.material.parameters.isDecoration}queryRenderOccludedState(e){return this.material.queryRenderOccludedState(e)}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.usedMemory),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((({geometry:t})=>e(t)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter;if(null==t)return;const r=t.vertexBufferLayout.stride/4;for(const i of e){const e=i.renderGeometry,s=this._dataByOrigin.get(e.localOrigin.id),o=s?.findBuffer(e.id);if(null==o)return;const a=o.instances.get(e.id);if(i.updateType&(y.GEOMETRY|y.TRANSFORMATION)){const i=P(t.elementCount(a.geometry.geometry)*r),s=t.vertexBufferLayout.createView(i.buffer);this._writeGeometry(e,s,0),o.vao.vertexBuffers.geometry.setSubData(i,a.from*r,0,a.numElements*r)}i.updateType&(y.HIGHLIGHT|y.OCCLUDEE|y.VISIBILITY)&&(o.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const i of e){const e=i.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new D(e.vec3),r.set(e.id,null,t)),t.changes.push(i)}for(const i of t){const e=i.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),s=t?.findBuffer(i.id);if(null==s)continue;let o=r.get(e.id,s);null==o&&(o=new D(e.vec3),r.set(e.id,s,o)),o.changes.push(i)}return r}_addAndRemoveGeometries(e,r){if(null==this._bufferWriter||null==this._vaoCache)return;const{_bufferWriter:i,_dataByOrigin:s}=this,o=i.vertexBufferLayout.stride/4,a=this._computeDeltas(e,r);a.forEach(((e,r)=>{const n=e.get(null),l=null!=n?n.changes:[];a.delete(r,null);let u=s.get(r);if(e.forEach(((e,n)=>{if(a.delete(r,n),null==n)return void b(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(u.buffers,n),void(0===u.buffers.length&&0===l.length&&s.delete(r));const h=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),d=e.changes.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),m=Math.min((h+f-d)*o,G),g=m>c;m>j&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(u.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==u&&(u=new B(n.origin),s.set(r,u)),u.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)u.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{if(e.drawCommandsDirty){e.hasHiddenInstances=e.hasHighlights=e.hasOccludees=!1;for(const t of e.instances.values())if(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees)break;e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)}this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const i=this._bufferWriter,s=i.vertexBufferLayout.stride,o=s/4,a=Math.floor(G/o);let n=e.numElements;for(;t.length>0;){const r=t.pop(),s=i.elementCount(r.geometry);if(n+s>a&&n>0){t.push(r);break}n+=s;const o=new C(r,0,0);b(null==e.instances.get(r.id)),e.addInstance(r.id,o)}const l=n*o,u=P(l),h=i.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,h,c);const s=c;c+=i.elementCount(t.geometry.geometry),e.updateInstance(r,s,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*o),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/s),e.updateDrawCommands(s),e}_applyRemoves(e,t){if(0===t.changes.length||null==this._bufferWriter)return;for(const a of t.changes){const t=a.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const i=M.back();if(i){if(i.to===r.from){i.to=r.to;continue}if(i.from===r.to){i.from=r.from;continue}}const s=M.pushNew();s.from=r.from,s.to=r.to}O(M);const r=this._bufferWriter.vertexBufferLayout.stride/4,i=M.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,s=P(i);s.fill(0,0,i);const o=e.vao.vertexBuffers.geometry;M.forAll((e=>o.setSubData(s,e.from*r,0,e.numElements*r))),e.holes.pushArray(M.data,M.length),M.forAll(((e,t)=>M.data[t]=null)),M.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null==this._bufferWriter)return;if(!E(e))return void this._applyAndRebuild(e,t,null);const i=this._bufferWriter,s=i.vertexBufferLayout.stride/4,o=e.numElements,a=t.reduce(((e,t)=>e+i.elementCount(t.geometry)),0),n=Math.min((o+a)*s,G),l=4*n;if(e.vao.byteSize<V(G-j)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);O(e.holes);const u=new Array;for(const r of t){const t=i.elementCount(r.geometry),s=S(e.holes,t);u.push(s)}const h=e.vao.vertexBuffers.geometry;let c=0,f=0,d=0;const m=P(n),g=i.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const o=u[r];if(null==o)return;if(!(d===o)){const e=d-f;e>0&&h.setSubData(m,f*s,0,e*s),f=o,c=0}const a=i.elementCount(t.geometry);this._writeGeometry(t,g,c),c+=a,d=o+a;const n=new C(t,o,o+a);b(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&h.setSubData(m,f*s,0,p*s),r(t,((e,t)=>null==u[t]))}_writeGeometry(e,t,r){null!=this._bufferWriter&&(u(x,e.transformation),x[12]-=e.localOrigin.vec3[0],x[13]-=e.localOrigin.vec3[1],x[14]-=e.localOrigin.vec3[2],h(R,x),c(R,R),this._bufferWriter.write(x,R,e.geometry,t,r))}updateAnimation(e){return this.material.update(e)}prepareTechnique(e){if(!this.material.shouldRender(e))return null;const{output:t,bindParameters:r}=e,i=this.material.produces.get(r.slot);if(!i?.(t))return null;const s=t===m.Highlight||t===m.ShadowHighlight;if(s&&!this._hasHighlights)return null;const o=t===m.ShadowExcludeHighlight,a=!(s||o);for(const n of this._dataByOrigin.values())for(const i of n.buffers){if(s&&!i.hasHighlights)continue;const n=(s?i.drawCommandsHighlight:o&&i.needsMultipleCommands()?i.drawCommandsShadowHighlightRest:i.drawCommandsDefault)||null,l=a&&i.drawCommandsOccludees||null;if(n?.length||l?.length){const i=this._glMaterials.load(e.rctx,r.slot,t),s=null!=i?i.beginSlot(r):null;if(null!=s)return s}}return null}renderNode(e,t){const{output:r,bindParameters:i}=e,s=r===m.Highlight||r===m.ShadowHighlight,o=r===m.ShadowExcludeHighlight,a=!(s||o),n=i.slot===_.OCCLUDER_MATERIAL,l=i.slot===_.TRANSPARENT_OCCLUDER_MATERIAL,u=e.rctx;u.runAppleAmdDriverHelper(),u.bindTechnique(t,i,this.material.parameters);for(const h of this._dataByOrigin.values())for(const e of h.buffers){if(s&&!e.hasHighlights)continue;const r=(s?e.drawCommandsHighlight:o&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,c=a&&e.drawCommandsOccludees||null;if(r?.length||c?.length){t.program.bindDraw(new v(h.origin),i,this.material.parameters),t.ensureAttributeLocations(e.vao),u.bindVAO(e.vao),r?.length&&(u.setPipelineState(t.getPipeline(!1,n,l)),r.forAll((e=>u.drawArrays(t.primitiveType,e.first,e.count)))),c?.length&&(u.setPipelineState(t.getPipeline(!0,n,l)),c.forAll((e=>u.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){}};e([n({constructOnly:!0})],H.prototype,"material",void 0),H=e([l("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],H);class D{constructor(e){this.origin=e,this.changes=new Array}}function S(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const i=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),i}const x=f(),R=f(),M=new a({allocator:e=>e||new w,deallocator:null}),j=65536,L=4*j,I=1024,T=16777216,G=T/4;let W=new Float32Array(j);function P(e){return W.length<e&&(W=new Float32Array(e)),W}function V(e){const t=4*e;return t<=I?I:t<L?i(t):Math.max(Math.min(Math.ceil(1.5*t/L)*L,T),t)}export{H as MergedRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/CheckerBoard.glsl.js";
5
+ import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";export{b as build}from"../../../../chunks/CheckerBoard.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{ViewingMode as r}from"../../../ViewingMode.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as i}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"../lib/DefaultVertexAttributeLocations.js";import{oitBlending as n,oitDrawBuffers as s}from"../lib/OrderIndependentTransparency.js";import{Program as a}from"../lib/Program.js";import{TransparencyPassType as l}from"../lib/TransparencyPassType.js";import{H as u}from"../../../../chunks/HUDMaterial.glsl.js";import{BlendFactor as p,CompareFunction as c,PrimitiveType as d}from"../../../webgl/enums.js";import{simpleBlendingParams as m,defaultDepthWriteParams as f,makePipelineState as h,defaultColorWriteParams as g}from"../../../webgl/renderState.js";class b extends t{initializeConfiguration(e,i){i.spherical=e.viewingMode===r.Global}initializeProgram(r){return new a(r.rctx,b.shader.get().build(this.configuration),o)}initializePipeline(){const r=this.configuration.transparencyPassType,i=this.configuration,t=r===l.NONE,o=r===l.FrontFace,a=this.configuration.hasPolygonOffset?j:null,u=i.draped?null:(t||o)&&i.output!==e.Highlight&&(i.depthEnabled||i.occlusionPass)?f:null;return h({blending:i.output===e.Color||i.output===e.Highlight?t?T:n(r):null,depthTest:i.draped?null:{func:c.LEQUAL},depthWrite:u,drawBuffers:s(r),colorWrite:g,polygonOffset:a})}get primitiveType(){return this.configuration.occlusionPass?d.POINTS:d.TRIANGLES}}b.shader=new i(u,(()=>import("./HUDMaterial.glsl.js")));const j={factor:0,units:-4},T=m(p.ONE,p.ONE_MINUS_SRC_ALPHA);export{b as HUDMaterialTechnique};
5
+ import{ViewingMode as r}from"../../../ViewingMode.js";import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as i}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as t}from"../core/shaderTechnique/ShaderTechnique.js";import{Default3D as o}from"../lib/DefaultVertexAttributeLocations.js";import{oitBlending as n,oitDrawBuffers as s}from"../lib/OrderIndependentTransparency.js";import{Program as a}from"../lib/Program.js";import{TransparencyPassType as l}from"../lib/TransparencyPassType.js";import{H as u}from"../../../../chunks/HUDMaterial.glsl.js";import{BlendFactor as p,CompareFunction as c,PrimitiveType as d}from"../../../webgl/enums.js";import{simpleBlendingParams as m,defaultDepthWriteParams as f,makePipelineState as h,defaultColorWriteParams as g}from"../../../webgl/renderState.js";class b extends t{initializeConfiguration(e,i){i.spherical=e.viewingMode===r.Global}initializeProgram(r){return new a(r.rctx,b.shader.get().build(this.configuration),o)}initializePipeline(){const r=this.configuration.transparencyPassType,i=this.configuration,t=r===l.NONE,o=r===l.FrontFace,a=this.configuration.hasPolygonOffset?j:null,u=i.draped?null:(t||o)&&i.output!==e.Highlight&&(i.depthEnabled||i.occlusionPass)?f:null;return h({blending:i.output===e.Color?t?T:n(r):null,depthTest:i.draped?null:{func:c.LEQUAL},depthWrite:u,drawBuffers:s(r),colorWrite:g,polygonOffset:a})}get primitiveType(){return this.configuration.occlusionPass?d.POINTS:d.TRIANGLES}}b.shader=new i(u,(()=>import("./HUDMaterial.glsl.js")));const j={factor:0,units:-4},T=m(p.ONE,p.ONE_MINUS_SRC_ALPHA);export{b as HUDMaterialTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../chunks/vec42.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/VertexAttribute.js";import"../../../../chunks/HighlightDownsample.glsl.js";export{b as build}from"../../../../chunks/HighlightApply.glsl.js";
5
+ import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/Integer2PassUniform.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../../../../chunks/HighlightDownsample.glsl.js";export{b as build}from"../../../../chunks/HighlightApply.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../support/engineContent/marker.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";import"./LineMarkerTechniqueConfiguration.js";export{b as build}from"../../../../chunks/LineMarker.glsl.js";
5
+ import"../../support/engineContent/marker.js";import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";import"./LineMarkerTechniqueConfiguration.js";export{b as build}from"../../../../chunks/LineMarker.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";import"./LineMarkerTechniqueConfiguration.js";import"./RibbonLineTechniqueConfiguration.js";export{b as build,r as ribbonlineNumRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
5
+ import"../core/shaderLibrary/ShaderOutput.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/LineStipple.glsl.js";import"../core/shaderLibrary/shading/MarkerSizing.glsl.js";import"../core/shaderLibrary/shading/MultipassTerrainTest.glsl.js";import"../core/shaderLibrary/shading/PiUtils.glsl.js";import"../core/shaderLibrary/util/AlphaCutoff.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../lib/TransparencyPassType.js";import"../lib/VertexAttribute.js";import"./LineMarkerTechniqueConfiguration.js";import"./RibbonLineTechniqueConfiguration.js";export{b as build,r as ribbonlineNumRoundJoinSubdivisions}from"../../../../chunks/RibbonLine.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/NormalFromDepth.glsl.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/ShadowMap.js";export{b as build}from"../../../../chunks/ShadowHighlight.glsl.js";
5
+ import"../../../../core/libs/gl-matrix-2/math/mat4.js";import"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import"../../../../chunks/vec32.js";import"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import"../core/shaderLibrary/NormalFromDepth.glsl.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import"../core/shaderModules/Float3PassUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/Matrix4PassUniform.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../lib/ShadowMap.js";export{b as build}from"../../../../chunks/ShadowHighlight.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import{on as g,watch as m,initial as y,syncAndInitial as f,whenOnce as w,sync as v}from"../core/reactiveUtils.js";import{setFrameDuration as _}from"../core/scheduling.js";import{createScreenPoint as b,createScreenPointArray as M}from"../core/screenUtils.js";import{initialize as S}from"../core/workers/workers.js";import{property as V}from"../core/accessorSupport/decorators/property.js";import{cast as R}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as j}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as C,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as T}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as x}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as E}from"../core/support/OwningCollection.js";import L from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as H,project as P}from"../geometry/projection.js";import{projectBoundingRect as A}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as I}from"../geometry/projection/projectPointToVector.js";import{create as G,toExtent as D}from"../geometry/support/aaBoundingRect.js";import{B as F,c as U}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as W}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as k}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as q,isTiledLayer as z,isVoxelLayer as B,isIntegratedMeshLayer as N}from"../layers/support/layerUtils.js";import{AnalysesCollection as Q}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Y}from"./BreakpointsOwner.js";import{DOMContainer as Z}from"./DOMContainer.js";import $ from"./GroundView.js";import{PopupView as J}from"./PopupView.js";import K from"./View.js";import X from"./ViewAnimation.js";import{ViewingMode as ee,stringFromViewingMode as te,viewingModeFromString as ie}from"./ViewingMode.js";import{layerView3DImporter as re}from"./3d/layerViewModuleImportUtils.js";import se from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as ne}from"./3d/constraints/Constraints.js";import ae from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as oe}from"./3d/environment/SceneViewEnvironmentManager.js";import le from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as pe}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as he}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as de}from"./3d/layers/support/FeatureTileTree3D.js";import ce from"./3d/state/ViewState.js";import{ViewStateManager as ue}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as ge}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as me}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as ye}from"./3d/support/debugFlags.js";import fe from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as we}from"./3d/support/ElevationProvider.js";import ve from"./3d/support/HighlightOptions.js";import{toMap as _e,hitTest as be}from"./3d/support/hitTest.js";import{popupHitTest as Me}from"./3d/support/popupHitTest.js";import{PropertiesPool as Se}from"./3d/support/PropertiesPool.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Re}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as je}from"./3d/support/ResourceController.js";import Ce from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Oe}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as Te}from"./3d/support/TextureCollection.js";import{PointsOfInterest as xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ee from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Le,getTiledLayerInfo as He,checkIfTileInfoSupportedForView as Pe}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{Decorations as Ie}from"./3d/webgl-engine/lib/basicInterfaces.js";import{defaultTolerance as Ge}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as De}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{occludeesSupported as Fe}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as Ue,createScreenPointFromSupportedEvent as We}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ke}from"./support/spatialReferenceSupport.js";import{check as qe}from"./support/WebGLRequirements.js";import ze from"./ui/DefaultUI.js";import Be from"./ui/3d/DefaultUI3D.js";import Ne from"../webscene/Environment.js";import Qe from"../geometry/Extent.js";import Ye from"../geometry/SpatialReference.js";import Ze from"../geometry/Point.js";let $e=class extends(Y(J(Z(K)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Se({slicePlane:F},this),this._resourceController=je(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new pe({view:this}),this.labeler=new he({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Q,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new ne,this.environment=new ae,this.environmentManager=new oe,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new se({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ce,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Be,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new ve,S();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([g((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),m((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new le({view:this}),this.stateManager=new ue({view:this})}initialize(){this.groundView=new $({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(g((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),y),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>_(e>0?1e3/Math.ceil(e):0)),y),this.updatingHandles.add((()=>this.map?.ground),e,f),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),f),this.addHandles(m((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),v))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof Qe?this.spatialReference&&(t=Je(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===ee.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Je(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||Ye.WGS84,i=Je(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||Ye.WGS84;let t;const i=i=>{const r=Je(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new Qe({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof ae?e:e instanceof Ne?this.environment?.cloneWithWebsceneEnvironment(e)??ae.fromWebsceneEnvironment(e):C(ae,e):new ae}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){fe.isValidProfile(e)&&(fe.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||fe.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");U(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?k(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainScale(){return this.stateManager?.terrainScale}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?L.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Le(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return te(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?te(this.defaultsFromMap.viewingMode):ke(t,ee.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ce(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=Ue(e)?We(this,e):e;return _e(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?we(this.elevationProvider,e):null)??0;return I(e,Ke,this.renderSpatialReference,t),this.state.camera.projectToScreen(Ke,Xe),b(Xe[0],Xe[1])}pixelSizeAt(e){return this.ready?e?(I(e,Ke,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(Ke)):0:(p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ue(e)?We(this,e):e;return be(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Me(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),n=await this._completeSettings(e);n.format="png";return[s,t(r[1],n,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return re.importLayerView(e)}hasLayerViewModule(e){return re.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=qe(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?ie(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,ee.Local),s=this._validateSpatialReferenceForViewingMode(e,t,ee.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,ee.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,ee.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ke(e,i)&&(null==t||(!!q(t)||(!z(t)||null!=He(t,e,i))&&(!B(t)||i!==ee.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(q(t)&&(r||s)){return!s||i===ee.Local||null===Pe(t.tileInfo,t.fullExtent,e,ee.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:Ye.WebMercator,viewingMode:i}]:[{spatialReference:r?Ye.WGS84:Ye.WebMercator,viewingMode:i}]}return z(t)||B(t)||!r&&!s?z(t)&&r&&i!==ee.Global?[{spatialReference:e,viewingMode:i},{spatialReference:Ye.WGS84,viewingMode:ee.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?Ye.WGS84:Ye.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${te(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&Fe(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await w((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new Ee({view:this})),this._set("elevationProvider",new me({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new xe({view:this})),this._set("featureTiles",new de({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?P(D(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>ye.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&ye.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||ye.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),f),this.updatingHandles.add((()=>this.clippingArea),e,f),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,f)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=W(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Re.create(this.state.viewingMode,i)),t||this.addHandles(m((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!A(e,this.basemapTerrain.spatialReference,et,t)||(this.renderCoordsHelper.extent=et)}),v),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(m((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),v),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t===Ie.OFF}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new ge(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ae({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),y),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ge/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Oe({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await w((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ie(this.viewingMode);e===ee.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(g((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?T(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new Te(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(De);for(const e of this.map.allLayers.items)N(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(De);for(const e of this.map.allLayers.items)N(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function Je(e,t){return null!=e&&H(e.spatialReference,t)?P(e,t):null}$e.type="3d",e([V()],$e.prototype,"_userClippingArea",void 0),e([V()],$e.prototype,"_resourceController",void 0),e([V()],$e.prototype,"_stage",void 0),e([V({readOnly:!0})],$e.prototype,"deconflictor",void 0),e([V({readOnly:!0})],$e.prototype,"labeler",void 0),e([V(E(Q,"analyses"))],$e.prototype,"analyses",void 0),e([V({type:X,readOnly:!0})],$e.prototype,"animation",null),e([V({readOnly:!0})],$e.prototype,"basemapTerrain",void 0),e([V({readOnly:!0})],$e.prototype,"elevationProvider",void 0),e([V()],$e.prototype,"camera",null),e([V({type:t})],$e.prototype,"contentCamera",null),e([V({readOnly:!0})],$e.prototype,"canvas",void 0),e([V({type:Ze})],$e.prototype,"center",null),e([V({type:Qe})],$e.prototype,"clippingArea",null),e([V({type:ne})],$e.prototype,"constraints",void 0),e([V({type:Qe,readOnly:!0})],$e.prototype,"renderDataExtent",null),e([V({readOnly:!0})],$e.prototype,"tileInfo",null),e([V({type:Qe,readOnly:!0})],$e.prototype,"dataExtent",null),e([V({type:Qe,readOnly:!0})],$e.prototype,"_groundAndLayersExtent",null),e([V({type:ae})],$e.prototype,"environment",void 0),e([R("environment")],$e.prototype,"castEnvironment",null),e([V({readOnly:!0})],$e.prototype,"environmentManager",void 0),e([V({type:Qe})],$e.prototype,"extent",null),e([V()],$e.prototype,"floors",void 0),e([V()],$e.prototype,"screenCenter",null),e([V()],$e.prototype,"frustum",null),e([V({type:Number,readOnly:!0})],$e.prototype,"fullOpacity",void 0),e([V({readOnly:!0})],$e.prototype,"graphicsView",void 0),e([V({readOnly:!0})],$e.prototype,"analysisViewManager",void 0),e([V()],$e.prototype,"groundView",void 0),e([V({type:Boolean})],$e.prototype,"initialExtentRequired",null),e([V()],$e.prototype,"_defaultsFromMapSettings",null),e([V()],$e.prototype,"interacting",null),e([V()],$e.prototype,"stationary",null),e([V()],$e.prototype,"navigating",null),e([V()],$e.prototype,"map",void 0),e([V()],$e.prototype,"padding",null),e([V({type:xe,readOnly:!0})],$e.prototype,"pointsOfInterest",void 0),e([V({type:de,readOnly:!0})],$e.prototype,"featureTiles",void 0),e([V()],$e.prototype,"_featureTreeDebugger",void 0),e([V({type:Boolean})],$e.prototype,"screenSizePerspectiveEnabled",void 0),e([V({constructOnly:!0})],$e.prototype,"deactivatedWebGLExtensions",void 0),e([V({constructOnly:!0})],$e.prototype,"debugWebGLExtensions",void 0),e([V({constructOnly:!0})],$e.prototype,"renderCanvas",void 0),e([V({constructOnly:!0})],$e.prototype,"state",void 0),e([V({readOnly:!0})],$e.prototype,"inputManager",void 0),e([V({readOnly:!0})],$e.prototype,"stateManager",void 0),e([V({type:["low","medium","high"]})],$e.prototype,"qualityProfile",null),e([V({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,fe.apply(this.qualityProfile,e)),e}})],$e.prototype,"qualitySettings",void 0),e([V()],$e.prototype,"slicePlane",null),e([V({readOnly:!0})],$e.prototype,"typeSpecificPreconditionsReady",null),e([V({readOnly:!0})],$e.prototype,"renderCoordsHelper",void 0),e([V({readOnly:!0})],$e.prototype,"sceneIntersectionHelper",void 0),e([V({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],$e.prototype,"resolution",null),e([V({type:Number})],$e.prototype,"scale",null),e([V()],$e.prototype,"heightModelInfo",null),e([V()],$e.prototype,"spatialReference",void 0),e([V({type:Boolean,constructOnly:!0})],$e.prototype,"alphaCompositingEnabled",void 0),e([V({constructOnly:!0})],$e.prototype,"preserveDrawingBufferEnabled",void 0),e([V({type:Boolean})],$e.prototype,"supersampleScreenshotsEnabled",void 0),e([V({readOnly:!0})],$e.prototype,"type",void 0),e([V(),R((e=>e instanceof ze?e:O(Be,e)))],$e.prototype,"ui",void 0),e([V({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],$e.prototype,"updating",null),e([V()],$e.prototype,"_updatingObjects",null),e([V()],$e.prototype,"_updatingObjectsWithProgress",null),e([V({type:Number,readOnly:!0,dependsOn:["updating"]})],$e.prototype,"updatingProgress",void 0),e([V({type:["global","local"]})],$e.prototype,"viewingMode",null),e([V({type:i})],$e.prototype,"viewpoint",null),e([V({type:Number})],$e.prototype,"zoom",null),e([V({type:ve})],$e.prototype,"highlightOptions",void 0),e([V({readOnly:!0})],$e.prototype,"quality",null),e([V({readOnly:!0})],$e.prototype,"resolutionScale",null),e([V()],$e.prototype,"textures",void 0),$e=e([j("esri.views.SceneView")],$e);const Ke=x(),Xe=M(),et=G(),tt=$e;export{tt as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{makeHandle as o,handlesGroup as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{destroyMaybe as h,maybeProperty as d}from"../core/maybe.js";import{ObservableChangesType as c}from"../core/ObservableChangesType.js";import{throwIfAborted as u}from"../core/promiseUtils.js";import g from"../core/ReactiveMap.js";import{on as m,watch as y,initial as f,syncAndInitial as w,whenOnce as v,sync as _}from"../core/reactiveUtils.js";import{setFrameDuration as b}from"../core/scheduling.js";import{createScreenPoint as M,createScreenPointArray as S}from"../core/screenUtils.js";import{initialize as V}from"../core/workers/workers.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as C}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as O,ensureClass as T}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as x}from"../core/accessorSupport/overrideDefaultsFrom.js";import{create as E}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{owningCollectionProperty as L}from"../core/support/OwningCollection.js";import H from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as P,project as A}from"../geometry/projection.js";import{projectBoundingRect as I}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as G}from"../geometry/projection/projectPointToVector.js";import{create as D,toExtent as F}from"../geometry/support/aaBoundingRect.js";import{B as U,c as W}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as k}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as q}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as z,isTiledLayer as B,isVoxelLayer as N,isIntegratedMeshLayer as Q}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as $}from"./DOMContainer.js";import J from"./GroundView.js";import{PopupView as K}from"./PopupView.js";import X from"./View.js";import ee from"./ViewAnimation.js";import{ViewingMode as te,stringFromViewingMode as ie,viewingModeFromString as re}from"./ViewingMode.js";import{layerView3DImporter as se}from"./3d/layerViewModuleImportUtils.js";import ne from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as ae}from"./3d/constraints/Constraints.js";import oe from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as le}from"./3d/environment/SceneViewEnvironmentManager.js";import pe from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as he}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as de}from"./3d/layers/graphics/Labeler.js";import{FeatureTileTree3D as ce}from"./3d/layers/support/FeatureTileTree3D.js";import ue from"./3d/state/ViewState.js";import{ViewStateManager as ge}from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as me}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ye}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as fe}from"./3d/support/debugFlags.js";import we from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as ve}from"./3d/support/ElevationProvider.js";import _e from"./3d/support/HighlightOptions.js";import{toMap as be,hitTest as Me}from"./3d/support/hitTest.js";import{popupHitTest as Se}from"./3d/support/popupHitTest.js";import{PropertiesPool as Ve}from"./3d/support/PropertiesPool.js";import Re from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as je}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ce}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Te}from"./3d/support/SharedSymbolResources.js";import{TextureCollection as xe}from"./3d/support/TextureCollection.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as He,getTiledLayerInfo as Pe,checkIfTileInfoSupportedForView as Ae}from"./3d/terrain/terrainUtils.js";import{Stage as Ie}from"./3d/webgl-engine/Stage.js";import{Decorations as Ge}from"./3d/webgl-engine/lib/basicInterfaces.js";import{defaultTolerance as De}from"./3d/webgl-engine/lib/Intersector.js";import{terrainId as Fe}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{defaultHighlightName as Ue}from"./support/HighlightDefaults.js";import{occludeesSupported as We}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as ke,createScreenPointFromSupportedEvent as qe}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ze}from"./support/spatialReferenceSupport.js";import{check as Be}from"./support/WebGLRequirements.js";import Ne from"./ui/DefaultUI.js";import Qe from"./ui/3d/DefaultUI3D.js";import Ye from"../webscene/Environment.js";import Ze from"../geometry/Extent.js";import $e from"../geometry/SpatialReference.js";import Je from"../geometry/Point.js";let Ke=class extends(Z(K($(X)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Ve({slicePlane:U},this),this._resourceController=Ce(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new he({view:this}),this.labeler=new de({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new ae,this.environment=new oe,this.environmentManager=new le,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ne({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new ue,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Qe,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new _e,this.highlights=new g,this.highlightOrder=new r([Ue]),V();const t=(e=null)=>{null!=e&&e.type===c.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.addHandles([m((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),y((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new pe({view:this}),this.stateManager=new ge({view:this})}initialize(){this.groundView=new J({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.addHandles(m((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),f),this.updatingHandles.add((()=>this.qualitySettings.frameRate??0),(e=>b(e>0?1e3/Math.ceil(e):0)),f),this.updatingHandles.add((()=>this.map?.ground),e,w),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),w),this.addHandles(y((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),_))}destroy(){this.destroyed||(this.updatingHandles.removeAll(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=h(this.sharedSymbolResources),this._set("labeler",h(this.labeler)),this._set("deconflictor",h(this.deconflictor)),this._resourceController=h(this._resourceController),this._set("stateManager",h(this.stateManager)),this._set("inputManager",h(this.inputManager)),this.state.destroy(),this._propertiesPool.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",h(this.environmentManager)),this._set("environment",h(this.environment)),this.groundView=h(this.groundView),this._exitBasemapTerrain(),this._stage?.destroy(),this.highlights.clear(),this.highlightOrder.destroy())}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||d(e,"clippingArea");return!this._userClippingArea&&!d(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof Ze?this.spatialReference&&(t=Xe(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===te.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Xe(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||$e.WGS84,i=Xe(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||$e.WGS84;let t;const i=i=>{const r=Xe(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new Ze({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}castEnvironment(e){return e?e instanceof oe?e:e instanceof Ye?this.environment?.cloneWithWebsceneEnvironment(e)??oe.fromWebsceneEnvironment(e):O(oe,e):new oe}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(null==this.state||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){we.isValidProfile(e)&&(we.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||we.getDefaultProfile()}set slicePlane(e){if(null!=this._stage&&this._stage.renderer.setParameters({slicePlane:e}),null==e)return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");W(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){return null!=this.spatialReference?q(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainScale(){return this.stateManager?.terrainScale}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?H.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||He(r))return;++i,e+=r.updatingProgress}}else++i}));for(const s of this._updatingObjects)if(null!=s&&s.updating){const t=.1;i+=t,e+=.5*t}for(const s of this._updatingObjectsWithProgress)null!=s&&s.updating&&(++i,e+=s.updatingProgress);const r=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||r||this._createGraphicsViewController||this.inputManager?.updating||this.map?.allLayers?.some((e=>!e.isFulfilled()))||this.textures?.updating),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ie(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ie(this.defaultsFromMap.viewingMode):ze(t,te.Global)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Oe(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ke(e)?qe(this,e):e;return be(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=(null==e.z?ve(this.elevationProvider,e):null)??0;return G(e,et,this.renderSpatialReference,t),this.state.camera.projectToScreen(et,tt),M(tt[0],tt[1])}pixelSizeAt(e){return this.ready?e?(G(e,et,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(et)):0:(p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e,(()=>this.pixelSizeAt(e))):1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ke(e)?qe(this,e):e;return Me(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Se(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),{encodeData:r}=await import("./support/screenshotUtils.js");return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await import("./support/screenshotUtils.js"),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);await this.whenReady();const r=await this._stage.renderView.takeScreenshotWithOID(i),s=t(r[0],i,this._pixelFormat()),n=await this._completeSettings(e);n.format="png";return[s,t(r[1],n,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(null==this._stage.renderView.objectAndLayerIdRenderHelper)throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView.objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return se.importLayerView(e)}hasLayerViewModule(e){return se.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=Be(this.type);const t=has("safari");if(t&&t<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:t})),null!=e)throw p.getLogger(this).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return null!=e?re(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode;if(null!=i)return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,te.Local),s=this._validateSpatialReferenceForViewingMode(e,t,te.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,te.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,te.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ze(e,i)&&(null==t||(!!z(t)||(!B(t)||null!=Pe(t,e,i))&&(!N(t)||i!==te.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(z(t)&&(r||s)){return!s||i===te.Local||null===Ae(t.tileInfo,t.fullExtent,e,te.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:$e.WebMercator,viewingMode:i}]:[{spatialReference:r?$e.WGS84:$e.WebMercator,viewingMode:i}]}return B(t)||N(t)||!r&&!s?B(t)&&r&&i!==te.Global?[{spatialReference:e,viewingMode:i},{spatialReference:$e.WGS84,viewingMode:te.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?$e.WGS84:$e.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ie(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(r.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):o()}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&We(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),o((()=>{r=!0,null!=i&&(i.remove(),i=null)}))}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await v((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ye({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new ce({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.cameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=null!=this.basemapTerrain.extent&&null!=this.basemapTerrain.spatialReference?A(F(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;null!=this.clippingArea?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.addHandles([this.updatingHandles.add((()=>fe.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||fe.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),w),this.updatingHandles.add((()=>this.clippingArea),e,w),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,w)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.exit(),this.removeHandles("render-coords-helper"),this.removeHandles("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=k(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",je.create(this.state.viewingMode,i)),t||this.addHandles(y((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!I(e,this.basemapTerrain.spatialReference,it,t)||(this.renderCoordsHelper.extent=it)}),_),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles("render-coords-helper"),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&e.type===c.MOVE||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.addHandles(y((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),_),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d");return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t===Ge.OFF}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new me(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new Ie({view:this,options:e,container:i}),this._stage.renderer.setParameters({slicePlane:this.slicePlane}),this.addHandles([this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(e=>this._stage.renderer.setParameters({highQualityTransparency:e})),f),this.on("pointer-move",(()=>this._stage?.renderer.resetAnimation())),a(this._stage.renderView.canvas,"webglcontextlost",(e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage)}))],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(De/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage=h(this._stage),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Te({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.removeHandles("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;u(e),await v((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.removeHandles("graphics-view"),null!=this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=re(this.viewingMode);e===te.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.addHandles(m((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded();const t=this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties:null,i=t?.environment;i&&(this._overrideDefaultEnvironmentOnly?x(this.environment,i):this.environment=this.environment.cloneWithWebsceneEnvironment(i)),this.timeExtent=t?.timeExtent,this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect(),this._set("textures",new xe(this._stage,this.resourceController.scheduler));const r=this._resolveWhenReady;this._resolveWhenReady=[],r.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this.removeHandles("graphics-view"),this._set("textures",h(this.textures)),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(Fe);for(const e of this.map.allLayers.items)Q(e.type)&&e.opacity<1&&this._defaultHitTestOptions.exclude.add(e.uid)}}};function Xe(e,t){return null!=e&&P(e.spatialReference,t)?A(e,t):null}Ke.type="3d",e([R()],Ke.prototype,"_userClippingArea",void 0),e([R()],Ke.prototype,"_resourceController",void 0),e([R()],Ke.prototype,"_stage",void 0),e([R({readOnly:!0})],Ke.prototype,"deconflictor",void 0),e([R({readOnly:!0})],Ke.prototype,"labeler",void 0),e([R(L(Y,"analyses"))],Ke.prototype,"analyses",void 0),e([R({type:ee,readOnly:!0})],Ke.prototype,"animation",null),e([R({readOnly:!0})],Ke.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],Ke.prototype,"elevationProvider",void 0),e([R()],Ke.prototype,"camera",null),e([R({type:t})],Ke.prototype,"contentCamera",null),e([R({readOnly:!0})],Ke.prototype,"canvas",void 0),e([R({type:Je})],Ke.prototype,"center",null),e([R({type:Ze})],Ke.prototype,"clippingArea",null),e([R({type:ae})],Ke.prototype,"constraints",void 0),e([R({type:Ze,readOnly:!0})],Ke.prototype,"renderDataExtent",null),e([R({readOnly:!0})],Ke.prototype,"tileInfo",null),e([R({type:Ze,readOnly:!0})],Ke.prototype,"dataExtent",null),e([R({type:Ze,readOnly:!0})],Ke.prototype,"_groundAndLayersExtent",null),e([R({type:oe})],Ke.prototype,"environment",void 0),e([j("environment")],Ke.prototype,"castEnvironment",null),e([R({readOnly:!0})],Ke.prototype,"environmentManager",void 0),e([R({type:Ze})],Ke.prototype,"extent",null),e([R()],Ke.prototype,"floors",void 0),e([R()],Ke.prototype,"screenCenter",null),e([R()],Ke.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],Ke.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],Ke.prototype,"graphicsView",void 0),e([R({readOnly:!0})],Ke.prototype,"analysisViewManager",void 0),e([R()],Ke.prototype,"groundView",void 0),e([R({type:Boolean})],Ke.prototype,"initialExtentRequired",null),e([R()],Ke.prototype,"_defaultsFromMapSettings",null),e([R()],Ke.prototype,"interacting",null),e([R()],Ke.prototype,"stationary",null),e([R()],Ke.prototype,"navigating",null),e([R()],Ke.prototype,"map",void 0),e([R()],Ke.prototype,"padding",null),e([R({type:Ee,readOnly:!0})],Ke.prototype,"pointsOfInterest",void 0),e([R({type:ce,readOnly:!0})],Ke.prototype,"featureTiles",void 0),e([R()],Ke.prototype,"_featureTreeDebugger",void 0),e([R({type:Boolean})],Ke.prototype,"screenSizePerspectiveEnabled",void 0),e([R({constructOnly:!0})],Ke.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],Ke.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],Ke.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],Ke.prototype,"state",void 0),e([R({readOnly:!0})],Ke.prototype,"inputManager",void 0),e([R({readOnly:!0})],Ke.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],Ke.prototype,"qualityProfile",null),e([R({type:Re,get(){let e=this._get("qualitySettings");return e||(e=new Re,we.apply(this.qualityProfile,e)),e}})],Ke.prototype,"qualitySettings",void 0),e([R()],Ke.prototype,"slicePlane",null),e([R({readOnly:!0})],Ke.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],Ke.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],Ke.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],Ke.prototype,"resolution",null),e([R({type:Number})],Ke.prototype,"scale",null),e([R()],Ke.prototype,"heightModelInfo",null),e([R()],Ke.prototype,"spatialReference",void 0),e([R({type:Boolean,constructOnly:!0})],Ke.prototype,"alphaCompositingEnabled",void 0),e([R({constructOnly:!0})],Ke.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],Ke.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],Ke.prototype,"type",void 0),e([R(),j((e=>e instanceof Ne?e:T(Qe,e)))],Ke.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.updating","toolViewManager.updating","analysisViewManager.updating","state.updating","textures.updating"]})],Ke.prototype,"updating",null),e([R()],Ke.prototype,"_updatingObjects",null),e([R()],Ke.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0,dependsOn:["updating"]})],Ke.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],Ke.prototype,"viewingMode",null),e([R({type:i})],Ke.prototype,"viewpoint",null),e([R({type:Number})],Ke.prototype,"zoom",null),e([R({type:_e})],Ke.prototype,"highlightOptions",void 0),e([R({readOnly:!0})],Ke.prototype,"quality",null),e([R({readOnly:!0})],Ke.prototype,"resolutionScale",null),e([R()],Ke.prototype,"textures",void 0),Ke=e([C("esri.views.SceneView")],Ke);const et=E(),tt=S(),it=D(),rt=Ke;export{rt 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.31/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as f,isSubtypeSublayer as g}from"../layers/support/layerUtils.js";import _ from"../rest/support/Query.js";import{isSelectableLayer as m}from"./support/selectionUtils.js";let y=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new o;this.view.when().then((()=>{this.view.map&&(this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(m(t)&&!f(t)||g(t))&&e.add(t)})),this.sources=e)}))}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=g(i)?i.parent:i;if(null==r||!S(r))return null;if("layer"===s)return M(r,n,t);if(v(r))return null;const l=await o.whenLayerView(r);return M(l,n,t)}));return(await Promise.all(n)).filter((e=>null!==e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=u(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=g(n)?n.parent:n;if(null!=r&&S(r)){if(v(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),void 0!==e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,"selection"))}))}}}_refreshListeners(){this._layerEditHandles.drain(l);for(const e of this.sources){const t=g(e)?e.parent:e;if(null!=t&&m(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!j(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([d({readOnly:!0,nonNullable:!0})],y.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"hasSelection",null),e([d()],y.prototype,"showHighlight",void 0),e([d()],y.prototype,"sources",null),y=e([p("esri.views.SelectionManager")],y);const v=e=>g(e)?!0===e.parent?.isTable:e.isTable,w=e=>void 0!==e.layer,S=e=>void 0!==e?.when,j=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},M=async(e,t,s={})=>{let o;if(w(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new _({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new _({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},b=y;export{b as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{referenceSetter as o}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as r}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeGroupLayer as f,isSubtypeSublayer as g}from"../layers/support/layerUtils.js";import _ from"../rest/support/Query.js";import{isSelectableLayer as m}from"./support/selectionUtils.js";let y=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new i,this._trashCan=[],this._layerEditHandles=new i,this._vizTaskId=0,this.showHighlight=!0}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]);const e=new i;this.view.when().then((()=>{this.view.map&&(this.view.map.allLayers.flatten((e=>"sublayers"in e&&e.sublayers?e.sublayers:null)).forEach((t=>{(m(t)&&!f(t)||g(t))&&e.add(t)})),this.sources=e)}))}destroy(){this._layerEditHandles.drain(r)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){o(e,this._sources)}async getSelectedFeatures(e,t={},s="layerView"){const{view:i,selections:o}=this,n=(void 0!==e?o.filter((t=>e.includes(t.layer))):o).filter((e=>e.selection.length>0)).map((async e=>{const{layer:o,selection:n}=e,l=g(o)?o.parent:o;if(null==l||!S(l))return null;if("layer"===s)return M(l,n,t);if(v(l))return null;const r=await i.whenLayerView(l).catch((()=>null));return r?M(r,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let i=!1;const o=e.current.concat(e.added);for(const t of o){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==o){const t=l(s,e,(()=>[]));t.includes(o)||(t.push(o),i=!0)}}for(const t of e.removed){const e=t.sourceLayer,o=t.getObjectId();if(this.sources.includes(e)&&(m(e)||g(e))&&null!==o){const t=s.get(e),n=t?.indexOf(o);void 0!==n&&n>=0&&(t?.splice(n,1),i=!0)}}if(i){const{_selectionMap:e,_trashCan:i}=this,o=[];for(const[n,l]of s){const s=e.get(n);void 0!==s&&i.push(s),e.set(n,{selection:l}),o.push({layer:n,selection:l,...t(void 0!==s?s.selection:[],l)})}this._onSelectionChange(o)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),i=void 0!==s?[...s.selection]:[];for(const o of t)i.includes(o)||i.push(o);this._setSelection(e,i)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const i=[];for(const o of s.selection)t.includes(o)||i.push(o);this._setSelection(e,i)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const i=new Set(s.selection),o=new Set(t),n=u(i,o);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,i]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...i.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:i}=this,o=this._vizTaskId;for(const n of e){const e=s.get(n),l=g(n)?n.parent:n;if(null!=l&&S(l)){if(v(l))continue;t.whenLayerView(l).then((t=>{e?.highlightHandle?.remove(),null!=e&&i&&o===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,"selection"))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(r);for(const e of this.sources){const t=g(e)?e.parent:e;if(null!=t&&m(t)){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const i=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,i)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const i=this._selectionMap.get(e);if(void 0===i||!j(i,{selection:s})){void 0!==i&&this._trashCan.push(i),this._selectionMap.set(e,{selection:[...s]});const o={layer:e,selection:[...s],...t(void 0!==i?i.selection:[],s)};this._onSelectionChange([o])}}};e([d({readOnly:!0,nonNullable:!0})],y.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],y.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],y.prototype,"hasSelection",null),e([d()],y.prototype,"showHighlight",void 0),e([d()],y.prototype,"sources",null),y=e([p("esri.views.SelectionManager")],y);const v=e=>g(e)?!0===e.parent?.isTable:e.isTable,w=e=>void 0!==e.layer,S=e=>void 0!==e?.when,j=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],i=[...t.selection];if(s.length!==i.length)return!1;s.sort(),i.sort();for(let e=0;e<s.length;e++)if(s[e]!==i[e])return!1}return!0},M=async(e,t,s={})=>{let i;if(w(e)){const o=e;i=void 0===o?null:await o.queryFeatures(new _({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const o=e;i=void 0===o?null:await o.queryFeatures(new _({...s,objectIds:t})).then((e=>({data:e,layer:o})))}return i},b=y;export{b 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.31/esri/copyright.txt for details.
4
4
  */
5
- import o from"../../Color.js";const r=new o([0,255,255]),e=1,n=.25,t=new o([0,0,0]),m=.4,p=.2;export{r as defaultColor,n as defaultFillOpacity,e as defaultHaloOpacity,t as defaultShadowColor,p as defaultShadowDifference,m as defaultShadowOpacity};
5
+ import o from"../../Color.js";const e=new o([0,255,255]),r=1,t=.25,n=new o([0,0,0]),f=.4,l=.2,m=.25,p="default";export{e as defaultColor,t as defaultFillOpacity,r as defaultHaloOpacity,p as defaultHighlightName,m as defaultOccludedFactor,n as defaultShadowColor,l as defaultShadowDifference,f as defaultShadowOpacity};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
4
  */
5
- import{isArrayLike as t}from"../../core/arrayUtils.js";import"../../core/has.js";import e from"../../core/Logger.js";import{isUint16Array as i,isUint32Array as s}from"../../core/typedArrayUtil.js";import{checkWebGLError as r}from"./checkWebGLError.js";import{BufferType as n,Usage as _,ResourceType as a,DataType as u}from"./enums.js";const f=()=>e.getLogger("esri.views.webgl.BufferObject"),h=null;class c{static createIndex(t,e,i){return new c(t,n.ELEMENT_ARRAY_BUFFER,e,i)}static createVertex(t,e,i){return new c(t,n.ARRAY_BUFFER,e,i)}static createUniform(t,e,i){return new c(t,n.UNIFORM_BUFFER,e,i)}static createPixelPack(t,e=_.STREAM_READ,i){const s=new c(t,n.PIXEL_PACK_BUFFER,e);return i&&s.setSize(i),s}static createPixelUnpack(t,e=_.STREAM_DRAW,i){return new c(t,n.PIXEL_UNPACK_BUFFER,e,i)}static createTransformFeedback(t,e=_.STATIC_DRAW,i){const s=new c(t,n.TRANSFORM_FEEDBACK_BUFFER,e);return s.setSize(i),s}constructor(t,e,i,s){this._context=t,this.bufferType=e,this.usage=i,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(a.BufferObject,this),this._glName=this._context.gl.createBuffer(),r(this._context.gl),s&&this.setData(s)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get usedMemory(){return this.bufferType===n.ELEMENT_ARRAY_BUFFER?this._indexType===u.UNSIGNED_INT?4*this._size:2*this._size:this._size}get _isVAOAware(){return this.bufferType===n.ELEMENT_ARRAY_BUFFER||this.bufferType===n.ARRAY_BUFFER}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(a.BufferObject,this),this._context=null}else this._glName&&f().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(this.bufferType===n.ELEMENT_ARRAY_BUFFER&&null!=e)switch(this._indexType=e,e){case u.UNSIGNED_SHORT:t*=2;break;case u.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;this.bufferType===n.ELEMENT_ARRAY_BUFFER&&(i(t)&&(e/=2,this._indexType=u.UNSIGNED_SHORT),s(t)&&(e/=4,this._indexType=u.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const i=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const s=this._context.gl;null!=e?s.bufferData(this.bufferType,e,this.usage):s.bufferData(this.bufferType,t,this.usage),r(s),this._isVAOAware&&this._context.bindVAO(i)}setSubData(t,e,i,s){if(!t)return;const n=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:_}=this._context;_.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,i,s-i),r(_),this._isVAOAware&&this._context.bindVAO(n)}getSubData(t,e=0,i,s){if(i<0||s<0)return;const r=o(t)?t.BYTES_PER_ELEMENT:1;if(r*((i??0)+(s??0))>t.byteLength)return;e+r*(s??0)>this.usedMemory&&f().warn("Potential problem getting subdata: requested data exceeds buffer size!");const _=this._context.gl;this.bufferType===n.TRANSFORM_FEEDBACK_BUFFER?(this._context.bindBuffer(this,n.TRANSFORM_FEEDBACK_BUFFER),_.getBufferSubData(n.TRANSFORM_FEEDBACK_BUFFER,e,t,i,s),this._context.unbindBuffer(n.TRANSFORM_FEEDBACK_BUFFER)):(this._context.bindBuffer(this,n.COPY_READ_BUFFER),_.getBufferSubData(n.COPY_READ_BUFFER,e,t,i,s),this._context.unbindBuffer(n.COPY_READ_BUFFER))}async getSubDataAsync(t,e=0,i,s){await this._context.clientWaitAsync(),this.getSubData(t,e,i,s)}}function o(e){return t(e)}export{c as BufferObject,h as tracer};
5
+ import{isArrayLike as t}from"../../core/arrayUtils.js";import"../../core/has.js";import e from"../../core/Logger.js";import{isUint8Array as i,isUint16Array as s,isUint32Array as r}from"../../core/typedArrayUtil.js";import{checkWebGLError as n}from"./checkWebGLError.js";import{BufferType as _,Usage as a,ResourceType as u,DataType as f}from"./enums.js";const h=()=>e.getLogger("esri.views.webgl.BufferObject"),c=null;class E{static createIndex(t,e,i){return new E(t,_.ELEMENT_ARRAY_BUFFER,e,i)}static createVertex(t,e,i){return new E(t,_.ARRAY_BUFFER,e,i)}static createUniform(t,e,i){return new E(t,_.UNIFORM_BUFFER,e,i)}static createPixelPack(t,e=a.STREAM_READ,i){const s=new E(t,_.PIXEL_PACK_BUFFER,e);return i&&s.setSize(i),s}static createPixelUnpack(t,e=a.STREAM_DRAW,i){return new E(t,_.PIXEL_UNPACK_BUFFER,e,i)}static createTransformFeedback(t,e=a.STATIC_DRAW,i){const s=new E(t,_.TRANSFORM_FEEDBACK_BUFFER,e);return s.setSize(i),s}constructor(t,e,i,s){this._context=t,this.bufferType=e,this.usage=i,this._glName=null,this._size=-1,this._indexType=void 0,t.instanceCounter.increment(u.BufferObject,this),this._glName=this._context.gl.createBuffer(),n(this._context.gl),s&&this.setData(s)}get glName(){return this._glName}get size(){return this._size}get indexType(){return this._indexType}get usedMemory(){if(this.bufferType===_.ELEMENT_ARRAY_BUFFER){if(this._indexType===f.UNSIGNED_INT)return 4*this._size;if(this._indexType===f.UNSIGNED_SHORT)return 2*this._size}return this._size}get _isVAOAware(){return this.bufferType===_.ELEMENT_ARRAY_BUFFER||this.bufferType===_.ARRAY_BUFFER}dispose(){if(this._context?.gl){if(this._glName){this._context.gl.deleteBuffer(this._glName),this._glName=null}this._context.instanceCounter.decrement(u.BufferObject,this),this._context=null}else this._glName&&h().warn("Leaked WebGL buffer object")}setSize(t,e=null){if(this.bufferType===_.ELEMENT_ARRAY_BUFFER&&null!=e)switch(this._indexType=e,e){case f.UNSIGNED_SHORT:t*=2;break;case f.UNSIGNED_INT:t*=4}this._setBufferData(t)}setData(t){if(!t)return;let e=t.byteLength;this.bufferType===_.ELEMENT_ARRAY_BUFFER&&(i(t)?this._indexType=f.UNSIGNED_BYTE:s(t)?(e/=2,this._indexType=f.UNSIGNED_SHORT):r(t)&&(e/=4,this._indexType=f.UNSIGNED_INT)),this._setBufferData(e,t)}_setBufferData(t,e=null){this._size=t;const i=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const s=this._context.gl;null!=e?s.bufferData(this.bufferType,e,this.usage):s.bufferData(this.bufferType,t,this.usage),n(s),this._isVAOAware&&this._context.bindVAO(i)}setSubData(t,e,i,s){if(!t)return;const r=this._context.getBoundVAO();this._isVAOAware&&this._context.bindVAO(null),this._context.bindBuffer(this);const{gl:_}=this._context;_.bufferSubData(this.bufferType,e*t.BYTES_PER_ELEMENT,t,i,s-i),n(_),this._isVAOAware&&this._context.bindVAO(r)}getSubData(t,e=0,i,s){if(i<0||s<0)return;const r=o(t)?t.BYTES_PER_ELEMENT:1;if(r*((i??0)+(s??0))>t.byteLength)return;e+r*(s??0)>this.usedMemory&&h().warn("Potential problem getting subdata: requested data exceeds buffer size!");const n=this._context.gl;this.bufferType===_.TRANSFORM_FEEDBACK_BUFFER?(this._context.bindBuffer(this,_.TRANSFORM_FEEDBACK_BUFFER),n.getBufferSubData(_.TRANSFORM_FEEDBACK_BUFFER,e,t,i,s),this._context.unbindBuffer(_.TRANSFORM_FEEDBACK_BUFFER)):(this._context.bindBuffer(this,_.COPY_READ_BUFFER),n.getBufferSubData(_.COPY_READ_BUFFER,e,t,i,s),this._context.unbindBuffer(_.COPY_READ_BUFFER))}async getSubDataAsync(t,e=0,i,s){await this._context.clientWaitAsync(),this.getSubData(t,e,i,s)}}function o(e){return t(e)}export{E as BufferObject,c as tracer};