@arcgis/core 5.1.0-next.46 → 5.1.0-next.48

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 (131) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{521a671182b0f79e3624.js → 193775b3b7de8f5dc578.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{c0ecb68387e342dddf58.js → 25509953f19fbc4949a1.js} +1 -1
  4. package/assets/esri/core/workers/chunks/2669a7195f1de21a9cf3.js +1 -0
  5. package/assets/esri/core/workers/chunks/36425d29aaa5852cb41d.js +1 -0
  6. package/assets/esri/core/workers/chunks/440a650ed0867a16f559.js +1 -0
  7. package/assets/esri/core/workers/chunks/{aa367ca7f8326fd67881.js → 4afddb66242438b38df0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/5344919fc6e8050450f1.js +1 -0
  9. package/assets/esri/core/workers/chunks/53c149bca42595b7dd1e.js +1 -0
  10. package/assets/esri/core/workers/chunks/{6afdaa6c4555c467dca7.js → 54420b66fd53d6e19ba5.js} +1 -1
  11. package/assets/esri/core/workers/chunks/797bf402489b3677a5f7.js +1 -0
  12. package/assets/esri/core/workers/chunks/{5c830cce32710d70dfa6.js → 7dba4121cdd20dbc4b20.js} +1 -1
  13. package/assets/esri/core/workers/chunks/947a715b608c8affd812.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ce0a6bc9df30af778ac9.js → 9f7b5749f3ceca8d5978.js} +12 -9
  15. package/assets/esri/core/workers/chunks/aa69cbaa38b49677ddff.js +1 -0
  16. package/assets/esri/core/workers/chunks/{beb53b372d356800f333.js → ab414a60808ea05a63e6.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b98dd9fc9a7e3ff6bd49.js +1 -0
  18. package/assets/esri/core/workers/chunks/cb8c17daec7055bf99cc.js +1 -0
  19. package/assets/esri/core/workers/chunks/cd491c37ba1ac381178c.js +1 -0
  20. package/assets/esri/core/workers/chunks/{a9f35127c3f5bf42036b.js → de359f89e03da18999fc.js} +1 -1
  21. package/chunks/Fog.glsl.js +3 -3
  22. package/chunks/GlowComposition.glsl.js +5 -3
  23. package/chunks/OITBlend.glsl.js +2 -1
  24. package/config.js +1 -1
  25. package/core/has.js +1 -1
  26. package/core/workers/Connection.js +1 -1
  27. package/core/workers/WorkerHandle.js +1 -1
  28. package/core/workers/workers.js +1 -1
  29. package/geometry/support/curves/bezierCurveUtils.js +1 -1
  30. package/kernel.js +1 -1
  31. package/layers/Layer.d.ts +2 -1
  32. package/layers/Lyr3DWorkerHandle.js +1 -1
  33. package/layers/ParquetLayer.d.ts +23 -1
  34. package/layers/graphics/data/QueryEngineResult.js +1 -1
  35. package/layers/support/LayerContingentValuesCache.js +1 -1
  36. package/layers/support/RasterJobHandler.js +1 -1
  37. package/layers/support/arcgisLayers.js +1 -1
  38. package/layers/support/layerUtils.js +1 -1
  39. package/package.json +1 -1
  40. package/smartMapping/statistics/support/statsWorker.js +1 -1
  41. package/support/revision.js +1 -1
  42. package/time/TimeExtent.d.ts +34 -0
  43. package/time/TimeInterval.d.ts +15 -0
  44. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  45. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  46. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  47. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  48. package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
  49. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  50. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  51. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  52. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  53. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  54. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  55. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  56. package/views/3d/layers/FlowSubView3D.js +1 -1
  57. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  58. package/views/3d/layers/I3SMeshView3D.js +1 -1
  59. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  60. package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
  61. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  62. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  64. package/views/3d/layers/i3s/Highlights.js +1 -1
  65. package/views/3d/layers/i3s/Intersector.js +1 -1
  66. package/views/3d/layers/support/patternUtils.js +1 -1
  67. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  68. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  69. package/views/3d/support/gaussianSplatting/GaussianSplatFadeTexture.js +1 -1
  70. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  71. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  72. package/views/3d/terrain/TerrainRenderer.js +1 -1
  73. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  74. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  75. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialGlobalParameters.js +2 -0
  76. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
  77. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  78. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  79. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  80. package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
  81. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  82. package/views/3d/webgl-engine/effects/fog/FogTechniqueConfiguration.js +1 -1
  83. package/views/3d/webgl-engine/effects/glow/GlowBlurTechniqueConfiguration.js +1 -1
  84. package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
  85. package/views/3d/webgl-engine/effects/glow/GlowCompositionTechniqueConfiguration.js +1 -1
  86. package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
  87. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  88. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  89. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  90. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  91. package/views/3d/webgl-engine/lib/Material.js +1 -1
  92. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  93. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  94. package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
  95. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  98. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  99. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  100. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/PolygonOffset.js +2 -0
  102. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  103. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  104. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +1 -1
  106. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  107. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  108. package/views/3d/webgl-engine/shaders/Dithering.glsl.js +4 -0
  109. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  110. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +11 -10
  111. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  112. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  113. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  114. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  115. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
  116. package/views/SceneView.d.ts +2 -1
  117. package/views/SceneView.js +1 -1
  118. package/views/support/LayerViewManager.js +1 -1
  119. package/views/types.d.ts +33 -2
  120. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  121. package/assets/esri/core/workers/chunks/0601c316da0256a60538.js +0 -1
  122. package/assets/esri/core/workers/chunks/13d55e3c9aea04116eaa.js +0 -1
  123. package/assets/esri/core/workers/chunks/54c1d31e1efab765ee7a.js +0 -1
  124. package/assets/esri/core/workers/chunks/5b515b5741733bcb4645.js +0 -1
  125. package/assets/esri/core/workers/chunks/7f07f490c6fcc794c8d9.js +0 -1
  126. package/assets/esri/core/workers/chunks/abcb39ad1e2d54710766.js +0 -1
  127. package/assets/esri/core/workers/chunks/c2aa3b1344b42a904234.js +0 -1
  128. package/assets/esri/core/workers/chunks/cf5e4cf9b1aa37eeb6b0.js +0 -1
  129. package/assets/esri/core/workers/chunks/e63046a9567d84228644.js +0 -1
  130. package/assets/esri/core/workers/chunks/f4ec2dcdc4bbf7dbcc94.js +0 -1
  131. package/assets/esri/core/workers/chunks/fce8d4ff920baf8856e6.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as y,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as C,isDepth as x,isColorHighlightOLIDOrDepth as L,is2DGeometryOutput as M}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as W}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as I}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||C(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>L(t)&&8===this.parameters.renderOccluded],[12,t=>L(t)&&8===this.parameters.renderOccluded],[4,t=>C(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>C(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>M(t)]]),this._configuration=new J(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,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.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&C(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=I||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>I}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:j}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const x=it;a(x,s.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-L,x[1]+L,0),n(ut[1],x[0]+L,x[1]+L,0),n(ut[2],x[0]+L,x[1]-L,0),n(ut[3],x[0]-L,x[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;y(_.eye,ft[0],ft[1],dt),y(_.eye,ft[1],ft[2],gt),y(_.eye,ft[2],ft[3],bt),y(_.eye,ft[3],ft[0],_t);let M=Number.MAX_VALUE,O=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<M&&(M=a,m(at,Z),m(nt,$),O=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,j,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,j)}g(t,et,O)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(W,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,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.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const j=o.fields.has("colorFeatureAttribute");if(j){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const y=i.get("timeStamps")?.data,E=y&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),x=S(s.buffer),L=new Uint8Array(s.buffer),M=o.stride/4;let V=a*M;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=C.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=O(),W=(t,e,i,s,a,n,o,l)=>{C[V++]=e[0],C[V++]=e[1],C[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,C[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),j)C[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(V++,C[V++]=_?.[o]??b,T&&(C[V++]=A?.[o]??z),B){let t=4*V;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=M,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,y[0],y[1],y[2],y[3]),t&&f(pt,pt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),W(pt,pt,mt,ct,1,-4,0,0),W(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,y[4],y[5],y[6],y[7]);const I=J?0:1,Y=J?p:p-1;for(let u=I;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),W(ht,pt,mt,ct,0,-1,u,F),W(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ht,pt,mt,ct,e,-1,u,F),W(ht,pt,mt,ct,e,1,u,F)}if(W(ht,pt,mt,ct,1,-2,u,F),W(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,y[t],y[t+1],y[t+2],y[t+3])}}J?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),W(ht,pt,mt,ct,0,-1,I,F),W(ht,pt,mt,ct,0,1,I,F)):(F=N(ht,pt,Y),W(ht,pt,pt,ct,0,-5,Y,F),W(ht,pt,pt,ct,0,5,Y,F)),H(C,R+M,C,R,M);return V=H(C,V-M,C,V,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,M),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=j(),lt=j(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
2
+ import t from"../../../../core/Logger.js";import{clamp as e}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as h,add as p,copy as m,length as c,distance as u,transformMat4 as f}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as b,create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as S}from"../../../../geometry/support/float16.js";import{distance2 as v,fromPoints as P,closestLineSegmentPoint as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as y,signedDistance as E,getNormal as T,create as z}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as A,isColor as C,isDepth as x,isColorHighlightOLIDOrDepth as L,is2DGeometryOutput as M}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as O}from"../effects/geometry/olidUtils.js";import V from"../lib/GLMaterial.js";import{Material as R}from"../lib/Material.js";import{isTranslationMatrix as F}from"../lib/Util.js";import{isImagePattern as N}from"./lineStippleUtils.js";import{VisualVariablePassParameters as k}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as U}from"./internal/bufferWriterUtils.js";import{r as D}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as B,RibbonLineTechnique as W}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as J}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as I}from"../../../../webscene/support/AlphaCutoff.js";class Y extends R{constructor(t,e){super(t,X),this.produces=new Map([[2,t=>A(t)||C(t)&&8===this.parameters.renderOccluded],[3,t=>x(t)],[11,t=>L(t)&&8===this.parameters.renderOccluded],[12,t=>L(t)&&8===this.parameters.renderOccluded],[4,t=>C(t)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[9,t=>C(t)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[19,t=>M(t)]]),this._configuration=new J(e)}updateConfiguration(t){super.updateConfiguration(t);const e=19===t.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==t.output,r=i&&e&&this.parameters.isImagePattern();this._configuration.draped=e,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,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.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=t.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&C(t.output),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=I||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>I}setParameters(t,e){t.animation=this.parameters.animation,super.setParameters(t,e)}intersectDraped({attributes:t,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=t.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=t.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=e(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const h=s[0],p=s[1],m=(l/2+4)*i;let c=Number.MAX_VALUE,u=0;const f=t.get("position").data,d=K(this.parameters,t)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const t=f[g],i=f[g+1],r=(g+3)%f.length,s=h-t,a=p-i,n=f[r]-t,o=f[r+1]-i,l=e((n*s+o*a)/(n*n+o*o),0,1),m=n*l-s,d=o*l-a,b=m*m+d*d;b<c&&(c=b,u=g/3)}c<m*m&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:j}=s;if(!b.selectionMode||!i.visible||!_)return;if(!F(r))return void t.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const z=i.attributes,A=z.get("position").data;let C=this.parameters.width;if(this.parameters.vvSize){const t=z.get("sizeFeatureAttribute").data[0];Number.isNaN(t)||(C*=e(this.parameters.vvSize.offset[0]+t*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else z.has("size")&&(C*=z.get("size").data[0]);const x=it;a(x,s.point);const L=C*_.pixelRatio/2+4*_.pixelRatio;n(ut[0],x[0]-L,x[1]+L,0),n(ut[1],x[0]+L,x[1]+L,0),n(ut[2],x[0]+L,x[1]-L,0),n(ut[3],x[0]-L,x[1]-L,0);for(let t=0;t<4;t++)if(!_.unprojectFromRenderScreen(ut[t],ft[t]))return;y(_.eye,ft[0],ft[1],dt),y(_.eye,ft[1],ft[2],gt),y(_.eye,ft[2],ft[3],bt),y(_.eye,ft[3],ft[0],_t);let M=Number.MAX_VALUE,O=0;const V=K(this.parameters,z)?A.length-2:A.length-5;for(let t=0;t<V;t+=3){Z[0]=A[t]+r[12],Z[1]=A[t+1]+r[13],Z[2]=A[t+2]+r[14];const e=(t+3)%A.length;if($[0]=A[e]+r[12],$[1]=A[e+1]+r[13],$[2]=A[e+2]+r[14],E(dt,Z)<0&&E(dt,$)<0||E(gt,Z)<0&&E(gt,$)<0||E(bt,Z)<0&&E(bt,$)<0||E(_t,Z)<0&&E(_t,$)<0)continue;const i=_.projectToRenderScreen(Z,rt),s=_.projectToRenderScreen($,st);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(tt,Z,$);const t=_.frustum,e=-E(t[4],Z)/l(tt,T(t[4]));if(h(tt,tt,e),p(Z,Z,tt),!_.projectToRenderScreen(Z,i))continue}else if(i[2]>0&&s[2]<0){o(tt,$,Z);const t=_.frustum,e=-E(t[4],$)/l(tt,T(t[4]));if(h(tt,tt,e),p($,$,tt),!_.projectToRenderScreen($,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=v(P(i,s,ot),x);a<M&&(M=a,m(at,Z),m(nt,$),O=t/3)}if(M<L*L){let t=Number.MAX_VALUE;if(w(P(at,nt,ot),P(S,j,lt),et)){o(et,et,S);const e=c(et);h(et,et,1/e),t=e/u(S,j)}g(t,et,O)}}get hasEmissions(){return this.parameters.emissiveStrength>0}createBufferWriter(){return new G(B(this.parameters),this.parameters)}createGLMaterial(t){return new q(t)}validateParameters(t){"miter"!==t.join&&(t.miterLimit=0),null!=t.markerParameters&&(t.markerScale=t.markerParameters.width/t.width)}update(t){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(t.time)},!1),0!==t.dt)}}class q extends V{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(t){const{stipplePattern:e}=this._material.parameters;return this._stipplePattern!==e&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(e,this._stipplePattern)}),this._stipplePattern=e),this.getTechnique(W,t)}}class X extends k{constructor(){super(...arguments),this._width=0,this.color=b,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,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.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(t){this._width=t}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return N(this.stipplePattern)&&null!=this.stippleTexture}}class G{constructor(t,e){this.layout=t,this._parameters=e;const i=e.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=D+i}}_isClosed(t){return K(this._parameters,t)}allocate(t){return this.layout.createBuffer(t)}elementCount(t){const e=2,i=t.get("position").indices.length/2+1,r=this._isClosed(t);let s=r?2:2*e;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(t,e,i,r,s,a){const o=this.layout,l=i.get("position"),h=l.indices,p=l.data.length/3,c=i.get("distanceToStart")?.data;h&&h.length!==2*(p-1)&&console.warn("RibbonLineMaterial does not support indices");const d=o.fields.has("sizeFeatureAttribute");let b=1,_=null;if(d){const t=i.get("sizeFeatureAttribute");1===t.data.length?b=t.data[0]:_=t.data}else b=i.get("size")?.data[0]??1;let v=[1,1,1,1],P=0,w=null;const j=o.fields.has("colorFeatureAttribute");if(j){const t=i.get("colorFeatureAttribute");1===t.data.length?P=t.data[0]:w=t.data}else v=i.get("color")?.data??v;const y=i.get("timeStamps")?.data,E=y&&o.fields.has("timeStamps"),T=o.fields.has("opacityFeatureAttribute");let z=0,A=null;if(T){const t=i.get("opacityFeatureAttribute");1===t.data.length?z=t.data[0]:A=t.data}const C=new Float32Array(s.buffer),x=S(s.buffer),L=new Uint8Array(s.buffer),M=o.stride/4;let V=a*M;const R=V;let F=0;const N=c?(t,e,i)=>F=c[i]:(t,e,i)=>F+=u(t,e),k=C.BYTES_PER_ELEMENT/x.BYTES_PER_ELEMENT,D=4/k,B=O(),W=(t,e,i,s,a,n,o,l)=>{C[V++]=e[0],C[V++]=e[1],C[V++]=e[2],U(t,e,x,V*k),V+=D,U(i,e,x,V*k),V+=D,C[V++]=l;let h=V*k;if(x[h++]=a,x[h++]=n,V=Math.ceil(h/k),j)C[V]=w?.[o]??P;else{const t=Math.min(4*o,v.length-4),e=4*V;L[e]=255*v[t],L[e+1]=255*v[t+1],L[e+2]=255*v[t+2],L[e+3]=255*v[t+3]}if(V++,C[V++]=_?.[o]??b,T&&(C[V++]=A?.[o]??z),B){let t=4*V;r?(L[t++]=r[0],L[t++]=r[1],L[t++]=r[2],L[t++]=r[3]):(L[t++]=0,L[t++]=0,L[t++]=0,L[t++]=0),V=Math.ceil(.25*t)}E&&(h=V*k,x[h++]=s[0],x[h++]=s[1],x[h++]=s[2],x[h++]=s[3],V=Math.ceil(h/k))};V+=M,n(pt,l.data[0],l.data[1],l.data[2]),E&&g(ct,y[0],y[1],y[2],y[3]),t&&f(pt,pt,t);const J=this._isClosed(i);if(J){const e=l.data.length-3;n(ht,l.data[e],l.data[e+1],l.data[e+2]),t&&f(ht,ht,t)}else n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),W(pt,pt,mt,ct,1,-4,0,0),W(pt,pt,mt,ct,1,4,0,0),m(ht,pt),m(pt,mt),E&&g(ct,y[4],y[5],y[6],y[7]);const I=J?0:1,Y=J?p:p-1;for(let u=I;u<Y;u++){const e=(u+1)%p*3;n(mt,l.data[e],l.data[e+1],l.data[e+2]),t&&f(mt,mt,t),N(ht,pt,u),W(ht,pt,mt,ct,0,-1,u,F),W(ht,pt,mt,ct,0,1,u,F);const i=this.numJoinSubdivisions;for(let t=0;t<i;++t){const e=(t+1)/(i+1);W(ht,pt,mt,ct,e,-1,u,F),W(ht,pt,mt,ct,e,1,u,F)}if(W(ht,pt,mt,ct,1,-2,u,F),W(ht,pt,mt,ct,1,2,u,F),m(ht,pt),m(pt,mt),E){const t=(u+1)%p*4;g(ct,y[t],y[t+1],y[t+2],y[t+3])}}J?(n(mt,l.data[3],l.data[4],l.data[5]),t&&f(mt,mt,t),F=N(ht,pt,Y),W(ht,pt,mt,ct,0,-1,I,F),W(ht,pt,mt,ct,0,1,I,F)):(F=N(ht,pt,Y),W(ht,pt,pt,ct,0,-5,Y,F),W(ht,pt,pt,ct,0,5,Y,F)),H(C,R+M,C,R,M);return V=H(C,V-M,C,V,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,V,M),null}_addWireframeVertices(t,e,i,r){const s=new Float32Array(t.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(t.buffer,e*Float32Array.BYTES_PER_ELEMENT,i-e);let n=0;const o=t=>n=H(a,t,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function H(t,e,i,r,s){for(let a=0;a<s;a++)i[r++]=t[e++];return r}function K(t,e){if(!t.isClosed)return!1;return e.get("position").indices.length>2}function Q(t){return 1===t.anchor&&t.hideOnShortSegments&&"begin-end"===t.placement&&t.worldSpace}const Z=d(),$=d(),tt=d(),et=d(),it=d(),rt=i(),st=i(),at=d(),nt=d(),ot=j(),lt=j(),ht=d(),pt=d(),mt=d(),ct=_(),ut=[i(),i(),i(),i()],ft=[d(),d(),d(),d()],dt=z(),gt=z(),bt=z(),_t=z();export{X as Parameters,Y as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import e from"../lib/GLMaterial.js";import{DefaultBufferWriter as t}from"./DefaultBufferWriter.js";import{PositionUvLayout as s}from"./DefaultLayouts.js";import{TriangleMaterial as i}from"./TriangleMaterial.js";import{SlicePlaneMaterialPassParameters as a,SlicePlaneMaterialTechnique as o}from"../shaders/SlicePlaneMaterialTechnique.js";import{SlicePlaneMaterialTechniqueConfiguration as n}from"../shaders/SlicePlaneMaterialTechniqueConfiguration.js";class u extends i{constructor(e){super(e,l),this.visible=!0,this.transparent=!0,this.produces=new Map([[9,e=>r(e)]]),this._configuration=new n}createGLMaterial(r){return new c(r)}createBufferWriter(){return new t(s)}}class c extends e{constructor(r){super(r)}beginSlot(r){return this.getTechnique(o,r)}}class l extends a{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.polygonOffset=!1}}export{l as Parameters,u as SlicePlaneMaterial};
2
+ import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import r from"../lib/GLMaterial.js";import{DefaultBufferWriter as t}from"./DefaultBufferWriter.js";import{PositionUvLayout as s}from"./DefaultLayouts.js";import{TriangleMaterial as i}from"./TriangleMaterial.js";import{SlicePlaneMaterialPassParameters as a,SlicePlaneMaterialTechnique as n}from"../shaders/SlicePlaneMaterialTechnique.js";import{SlicePlaneMaterialTechniqueConfiguration as o}from"../shaders/SlicePlaneMaterialTechniqueConfiguration.js";class u extends i{constructor(r){super(r,l),this.visible=!0,this.transparent=!0,this.produces=new Map([[9,r=>e(r)]]),this._configuration=new o}createGLMaterial(e){return new c(e)}createBufferWriter(){return new t(s)}}class c extends r{beginSlot(e){return this.getTechnique(n,e)}}class l extends a{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.polygonOffset=0}}export{l as Parameters,u as SlicePlaneMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as s}from"../lib/RayIntersections.js";class n extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOffset=t.enableOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersect(t,e,s,n,i,o){return r(t,s,n,i,void 0,o)}intersectDraped(t,e,r,n){return s(r[0],r[1],t,n)}}class i extends e{constructor(){super(...arguments),this.polygonOffset=!1}}export{n as TriangleMaterial,i as TriangleMaterialParameters};
2
+ import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as r,intersectTriangleGeometry2D as s}from"../lib/RayIntersections.js";class n extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersect(t,e,s,n,i,o){return r(t,s,n,i,void 0,o)}intersectDraped(t,e,r,n){return s(r[0],r[1],t,n)}}class i extends e{constructor(){super(...arguments),this.polygonOffset=0}}export{n as TriangleMaterial,i as TriangleMaterialParameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"./DefaultTechniqueConfiguration.js";class r extends o{constructor(){super(...arguments),this.transparent=!1,this.enableOffset=!0,this.polygonOffset=!1}}t([e()],r.prototype,"transparent",void 0),t([e()],r.prototype,"enableOffset",void 0),t([e()],r.prototype,"polygonOffset",void 0);export{r as TriangleTechniqueConfiguration};
2
+ import{__decorate as t}from"tslib";import{parameter as o}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as e}from"./DefaultTechniqueConfiguration.js";class r extends e{constructor(){super(...arguments),this.polygonOffset=0,this.transparent=!1,this.enableOITOffset=!0}}t([o({count:4})],r.prototype,"polygonOffset",void 0),t([o()],r.prototype,"transparent",void 0),t([o()],r.prototype,"enableOITOffset",void 0);export{r as TriangleTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as l}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as a}from"../effects/geometry/olidUtils.js";import{oitPolygonOffset as c,depthWrite as p,depthTest as u,blending as m}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as f,stencilBaseAllZerosParams as d,stencilWriteMaskOn as h}from"../lib/StencilUtils.js";import{VisualVariablePassParameters as g}from"../materials/VisualVariablePassParameters.js";import{C as j}from"../../../../chunks/ColorMaterial.glsl.js";import{makePipelineState as b,defaultColorWrite as P,cullingParams as S}from"../../../webgl/renderState.js";class C extends g{constructor(){super(...arguments),this.color=t}}let T=class extends n{constructor(e,r){super(e,r,o(y(r))),this.shader=new l(j,()=>import("./ColorMaterial.glsl.js")),this.ignoreUnused=!0}_createPipeline(e,r){const{output:t,transparent:o,cullFace:i,draped:l,hasOccludees:n,polygonOffset:a}=e,g=!s(t);return b({blending:o?m(t):null,culling:S(i),depthTest:l?null:u(t),depthWrite:p(e),colorWrite:P,stencilWrite:n?h:null,stencilTest:n?r?f:d:null,polygonOffset:g?a?v:null:c(e)})}initializePipeline(e){return this._occludeePipelineState=this._createPipeline(e,!0),this._createPipeline(e,!1)}getPipeline(e,r){return r?this._occludeePipelineState:super.getPipeline(e)}};T=e([r("esri.views.3d.webgl-engine.shaders.ColorMaterialTechnique")],T);const v={factor:1,units:1};function y(e){const r=i().vec3f("position");return a()&&r.vec4u8("olidColor"),e.hasVVColor?r.f32("colorFeatureAttribute"):e.hasVertexColors&&r.vec4u8("color",{glNormalized:!0}),r.freeze()}export{C as ColorMaterialPassParameters,T as ColorMaterialTechnique,y as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{oitPolygonOffset as a,depthWrite as c,depthTest as p,blending as u}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as m,stencilBaseAllZerosParams as d,stencilWriteMaskOn as f}from"../lib/StencilUtils.js";import{VisualVariablePassParameters as h}from"../materials/VisualVariablePassParameters.js";import{C as g}from"../../../../chunks/ColorMaterial.glsl.js";import{makePipelineState as j,defaultColorWrite as b,cullingParams as P}from"../../../webgl/renderState.js";class C extends h{constructor(){super(...arguments),this.color=t}}let S=class extends l{constructor(e,r){super(e,r,o(T(r))),this.shader=new s(g,()=>import("./ColorMaterial.glsl.js")),this.ignoreUnused=!0}_createPipeline(e,r){const{output:t,transparent:o,cullFace:i,draped:s,hasOccludees:l}=e;return j({blending:o?u(t):null,culling:P(i),depthTest:s?null:p(t),depthWrite:c(e),colorWrite:b,stencilWrite:l?f:null,stencilTest:l?r?m:d:null,polygonOffset:a(e)})}initializePipeline(e){return this._occludeePipelineState=this._createPipeline(e,!0),this._createPipeline(e,!1)}getPipeline(e,r){return r?this._occludeePipelineState:super.getPipeline(e)}};function T(e){const r=i().vec3f("position");return n()&&r.vec4u8("olidColor"),e.hasVVColor?r.f32("colorFeatureAttribute"):e.hasVertexColors&&r.vec4u8("color",{glNormalized:!0}),r.freeze()}S=e([r("esri.views.3d.webgl-engine.shaders.ColorMaterialTechnique")],S);export{C as ColorMaterialPassParameters,S as ColorMaterialTechnique,T as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class s extends o{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.transparent=!1,this.enableOffset=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}e([t({count:4})],s.prototype,"alphaDiscardMode",void 0),e([t({count:3})],s.prototype,"doubleSidedMode",void 0),e([t({count:7})],s.prototype,"pbrMode",void 0),e([t({count:3})],s.prototype,"cullFace",void 0),e([t({count:3})],s.prototype,"normalType",void 0),e([t({count:3})],s.prototype,"customDepthTest",void 0),e([t({count:8})],s.prototype,"emissionSource",void 0),e([t()],s.prototype,"hasVertexColors",void 0),e([t()],s.prototype,"hasSymbolColors",void 0),e([t()],s.prototype,"hasVerticalOffset",void 0),e([t()],s.prototype,"hasColorTexture",void 0),e([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([t()],s.prototype,"hasOcclusionTexture",void 0),e([t()],s.prototype,"hasNormalTexture",void 0),e([t()],s.prototype,"hasScreenSizePerspective",void 0),e([t()],s.prototype,"hasVertexTangents",void 0),e([t()],s.prototype,"hasOccludees",void 0),e([t()],s.prototype,"instanced",void 0),e([t()],s.prototype,"instancedDoublePrecision",void 0),e([t()],s.prototype,"hasModelTransformation",void 0),e([t()],s.prototype,"offsetBackfaces",void 0),e([t()],s.prototype,"hasVVSize",void 0),e([t()],s.prototype,"hasVVColor",void 0),e([t()],s.prototype,"receiveShadows",void 0),e([t()],s.prototype,"receiveAmbientOcclusion",void 0),e([t()],s.prototype,"textureAlphaPremultiplied",void 0),e([t()],s.prototype,"instancedFeatureAttribute",void 0),e([t()],s.prototype,"instancedColor",void 0),e([t()],s.prototype,"writeDepth",void 0),e([t()],s.prototype,"transparent",void 0),e([t()],s.prototype,"enableOffset",void 0),e([t()],s.prototype,"terrainDepthTest",void 0),e([t()],s.prototype,"cullAboveTerrain",void 0),e([t()],s.prototype,"snowCover",void 0),e([t()],s.prototype,"hasColorTextureTransform",void 0),e([t()],s.prototype,"hasEmissionTextureTransform",void 0),e([t()],s.prototype,"hasNormalTextureTransform",void 0),e([t()],s.prototype,"hasOcclusionTextureTransform",void 0),e([t()],s.prototype,"hasMetallicRoughnessTextureTransform",void 0);export{s as DefaultMaterialTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";class s extends o{constructor(e){super(),this.spherical=e,this.alphaDiscardMode=1,this.doubleSidedMode=0,this.pbrMode=0,this.cullFace=0,this.normalType=0,this.customDepthTest=0,this.emissionSource=0,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.hasVerticalOffset=!1,this.hasColorTexture=!1,this.hasMetallicRoughnessTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasScreenSizePerspective=!1,this.hasVertexTangents=!1,this.hasOccludees=!1,this.instanced=!1,this.instancedDoublePrecision=!1,this.hasModelTransformation=!1,this.offsetBackfaces=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.receiveShadows=!1,this.receiveAmbientOcclusion=!1,this.textureAlphaPremultiplied=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.writeDepth=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.snowCover=!1,this.hasColorTextureTransform=!1,this.hasEmissionTextureTransform=!1,this.hasNormalTextureTransform=!1,this.hasOcclusionTextureTransform=!1,this.hasMetallicRoughnessTextureTransform=!1,this.useCustomDTRExponentForWater=!1,this.useFillLights=!0,this.draped=!1}get textureCoordinateType(){return this.hasTextures?1:0}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}get hasVVInstancing(){return this.instanced}get discardInvisibleFragments(){return this.transparent}}e([t({count:4})],s.prototype,"alphaDiscardMode",void 0),e([t({count:3})],s.prototype,"doubleSidedMode",void 0),e([t({count:7})],s.prototype,"pbrMode",void 0),e([t({count:3})],s.prototype,"cullFace",void 0),e([t({count:3})],s.prototype,"normalType",void 0),e([t({count:3})],s.prototype,"customDepthTest",void 0),e([t({count:8})],s.prototype,"emissionSource",void 0),e([t()],s.prototype,"hasVertexColors",void 0),e([t()],s.prototype,"hasSymbolColors",void 0),e([t()],s.prototype,"hasVerticalOffset",void 0),e([t()],s.prototype,"hasColorTexture",void 0),e([t()],s.prototype,"hasMetallicRoughnessTexture",void 0),e([t()],s.prototype,"hasOcclusionTexture",void 0),e([t()],s.prototype,"hasNormalTexture",void 0),e([t()],s.prototype,"hasScreenSizePerspective",void 0),e([t()],s.prototype,"hasVertexTangents",void 0),e([t()],s.prototype,"hasOccludees",void 0),e([t()],s.prototype,"instanced",void 0),e([t()],s.prototype,"instancedDoublePrecision",void 0),e([t()],s.prototype,"hasModelTransformation",void 0),e([t()],s.prototype,"offsetBackfaces",void 0),e([t()],s.prototype,"hasVVSize",void 0),e([t()],s.prototype,"hasVVColor",void 0),e([t()],s.prototype,"receiveShadows",void 0),e([t()],s.prototype,"receiveAmbientOcclusion",void 0),e([t()],s.prototype,"textureAlphaPremultiplied",void 0),e([t()],s.prototype,"instancedFeatureAttribute",void 0),e([t()],s.prototype,"instancedColor",void 0),e([t()],s.prototype,"writeDepth",void 0),e([t()],s.prototype,"terrainDepthTest",void 0),e([t()],s.prototype,"cullAboveTerrain",void 0),e([t()],s.prototype,"snowCover",void 0),e([t()],s.prototype,"hasColorTextureTransform",void 0),e([t()],s.prototype,"hasEmissionTextureTransform",void 0),e([t()],s.prototype,"hasNormalTextureTransform",void 0),e([t()],s.prototype,"hasOcclusionTextureTransform",void 0),e([t()],s.prototype,"hasMetallicRoughnessTextureTransform",void 0);export{s as DefaultMaterialTechniqueConfiguration};
@@ -0,0 +1,4 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{glsl as o}from"../core/shaderModules/glsl.js";function r(r,t){t.hasFloatOit?r.code.add(o`float ditherNoise() { return 0.0; }`):r.code.add(o`float ditherNoise() {
3
+ return (1.0 / 255.0) * (fract(52.9829189 * fract(dot(gl_FragCoord.xy + gl_FragCoord.z, vec2(0.06711056, 0.00583715)))) - 0.5);
4
+ }`)}export{r as Dithering};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{newLayout as o}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as a}from"../effects/geometry/olidUtils.js";import{blending as l}from"../lib/OrderIndependentTransparency.js";import{H as c}from"../../../../chunks/HUDMaterial.glsl.js";import{PrimitiveType as f}from"../../../webgl/enums.js";import{makePipelineState as u,defaultColorWrite as p,defaultDepthWrite as m}from"../../../webgl/renderState.js";let d=class extends n{constructor(e,r){super(e,r,t(g).concat(t(v(r)))),this.shader=new i(c,()=>import("./HUDMaterial.glsl.js")),this.ignoreUnused=!0,this.primitiveType=f.TRIANGLE_STRIP}initializePipeline(e){const{hasPolygonOffset:r,draped:t,output:o,depthTestEnabled:i}=e,n=s(o),a=i&&!t&&!n&&!(10===o);return u({blending:l(o,!0),depthTest:i&&!t?{func:515}:null,depthWrite:a?m:null,colorWrite:p,polygonOffset:r?h:null})}};d=e([r("esri.views.3d.webgl-engine.shaders.HUDMaterialTechnique")],d);const h={factor:0,units:-4},g=o().vec2u8("uv0",{glNormalized:!0});function v(e){let r=o().vec3f("position").vec3f("normal").f32("groundDistance");return e.hasVertexCenterOffset&&(r=r.vec3f("centerOffset")),e.hasVertexColor&&(r=r.vec4u8("color",{glNormalized:!0})),e.hasVertexSize&&(r=r.vec2f("size")),e.hasVertexRotation&&(r=r.f32("rotation")),(e.hasVVColor||e.hasVVSize)&&(r=r.vec4f("featureAttribute")),e.hasVertexUVi&&(r=r.vec4i16("uvi")),a()?r.vec4u8("olidColor"):r}export{d as HUDMaterialTechnique,g as baseLayout,v as getInstanceLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{newLayout as o}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as a}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as l}from"../effects/geometry/olidUtils.js";import{blending as n}from"../lib/OrderIndependentTransparency.js";import{hudPolygonOffset as f}from"../materials/PolygonOffset.js";import{H as c}from"../../../../chunks/HUDMaterial.glsl.js";import{PrimitiveType as p}from"../../../webgl/enums.js";import{makePipelineState as m,defaultColorWrite as u,defaultDepthWrite as d}from"../../../webgl/renderState.js";let h=class extends a{constructor(e,r){super(e,r,t(g).concat(t(v(r)))),this.shader=new i(c,()=>import("./HUDMaterial.glsl.js")),this.ignoreUnused=!0,this.primitiveType=p.TRIANGLE_STRIP}initializePipeline(e){const{hasPolygonOffset:r,draped:t,output:o,depthTestEnabled:i}=e,a=s(o),l=i&&!t&&!a&&!(10===o);return m({blending:n(o,!0),depthTest:i&&!t?{func:515}:null,depthWrite:l?d:null,colorWrite:u,polygonOffset:r?f:null})}};h=e([r("esri.views.3d.webgl-engine.shaders.HUDMaterialTechnique")],h);const g=o().vec2u8("uv0",{glNormalized:!0});function v(e){let r=o().vec3f("position").vec3f("normal").f32("groundDistance");return e.hasVertexCenterOffset&&(r=r.vec3f("centerOffset")),e.hasVertexColor&&(r=r.vec4u8("color",{glNormalized:!0})),e.hasVertexSize&&(r=r.vec2f("size")),e.hasVertexRotation&&(r=r.f32("rotation")),(e.hasVVColor||e.hasVVSize)&&(r=r.vec4f("featureAttribute")),e.hasVertexUVi&&(r=r.vec4i16("uvi")),l()?r.vec4u8("olidColor"):r}export{h as HUDMaterialTechnique,g as baseLayout,v as getInstanceLayout};
@@ -1,14 +1,15 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{isColor as o,isOITColor as r,isOITFrontFace as i}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as l}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as a}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as t}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{If as s,glsl as e}from"../core/shaderModules/glsl.js";import{alphaCutoff as n}from"./alphaCutoff.glsl.js";import{oitResolution as f}from"./oitResolution.glsl.js";function u(u,d){u.include(a,d),u.include(l,d);const{fragment:g,outputs:c}=u;g.include(t);const{output:m,hasEmission:C,discardInvisibleFragments:p,oitPremultipliedAlpha:h,snowCover:v,hasFloatOit:b}=d,y=11===m,O=r(m),$=i(m),E=o(m)&&!O;let j=0;(E||O)&&c.add("fragColor","vec4",j++),C&&c.add("fragEmission","vec4",j++),O&&c.add("fragAlpha","float",j++),g.include(n),g.include(f,d),g.code.add(b?"float ditherNoise() { return 0.0; }":"float ditherNoise() {\n return (1.0 / 255.0) *\n (fract(52.9829189 * fract(dot(gl_FragCoord.xy + gl_FragCoord.z, vec2(0.06711056, 0.00583715)))) - 0.5);\n }\n "),g.code.add(e`
3
- void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${s(v,", float snow")}) {
4
- ${s(y,"finalColor.a = 1.0;")}
5
- ${s(p,"if (finalColor.a < alphaCutoff) { discard; }")}
2
+ import{isColor as o,isOITColor as r,isOITFrontFace as i}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as l}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as a}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as s}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{If as t,glsl as e}from"../core/shaderModules/glsl.js";import{alphaCutoff as n}from"./alphaCutoff.glsl.js";import{Dithering as f}from"./Dithering.glsl.js";import{oitResolution as u}from"./oitResolution.glsl.js";function m(m,g){m.include(a,g),m.include(l,g);const{fragment:c,outputs:d}=m;c.include(s);const{output:p,hasEmission:C,discardInvisibleFragments:h,oitPremultipliedAlpha:v,snowCover:b}=g,$=11===p,j=r(p),y=i(p),E=o(p)&&!j;let O=0;(E||j)&&d.add("fragColor","vec4",O++),C&&d.add("fragEmission","vec4",O++),j&&d.add("fragAlpha","float",O++),c.include(n),c.include(u,g),c.include(f,g),c.code.add(e`
3
+ void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${t(b,", float snow")}) {
4
+ ${t($,"finalColor.a = 1.0;")}
5
+ ${t(h,"if (finalColor.a < alphaCutoff) { discard; }")}
6
+ ${t(j||C,"float noise = ditherNoise();")}
6
7
 
7
- ${s(O,`${s(h,"fragColor = finalColor;","fragColor = premultiplyAlpha(finalColor);")}\n float noise = ditherNoise();\n fragColor = vec4(fragColor.rgb * oitOutputScale + noise, fragColor.a);\n fragAlpha = finalColor.a * oitOutputScale + noise;`)}
8
- ${s($&&h&&p,"finalColor.rgb /= finalColor.a;")}
9
- ${s(E,"fragColor = finalColor;")}
10
- ${s(C,`fragEmission = ${s(v,"mix(finalColor.a * getEmissions(emissiveSymbolColor), vec4(0.0), snow);","finalColor.a * getEmissions(emissiveSymbolColor);")}\n fragEmission = vec4(fragEmission.rgb * oitOutputScale, fragEmission.a);`)}
8
+ ${t(j,`${t(v,"fragColor = finalColor;","fragColor = premultiplyAlpha(finalColor);")}\n fragColor = vec4(fragColor.rgb * oitOutputScale + noise, fragColor.a);\n fragAlpha = finalColor.a * oitOutputScale + noise;`)}
9
+ ${t(y&&v&&h,"finalColor.rgb /= finalColor.a;")}
10
+ ${t(E,"fragColor = finalColor;")}
11
+ ${t(C,`fragEmission = ${t(b,"mix(finalColor.a * getEmissions(emissiveSymbolColor), vec4(0.0), snow);","finalColor.a * getEmissions(emissiveSymbolColor);")}\n fragEmission = vec4(fragEmission.rgb * oitOutputScale + noise, fragEmission.a);`)}
11
12
  calculateOcclusionAndOutputHighlight();
12
- ${s(y,"outputObjectAndLayerIdColor();")}
13
+ ${t($,"outputObjectAndLayerIdColor();")}
13
14
  }
14
- `)}export{u as outputColorHighlightOLID};
15
+ `)}export{m as outputColorHighlightOLID};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as r}from"../../support/buffer/glUtil.js";import{isOITColor as i}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as o}from"../core/shaderTechnique/ShaderTechnique.js";import{oitPolygonOffset as n,depthWrite as l,depthTest as p,blending as a}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as c,stencilBaseAllZerosParams as u,stencilWriteMaskOn as d}from"../lib/StencilUtils.js";import{P as m}from"../../../../chunks/Pattern.glsl.js";import{getLayout as h}from"./PatternLayouts.js";import{makePipelineState as f,defaultColorWrite as g,cullingParams as P}from"../../../webgl/renderState.js";let j=class extends o{constructor(e,t){super(e,t,r(h(t))),this.shader=new s(m,()=>import("./Pattern.glsl.js")),this.ignoreUnused=!0}_setPipelineState(e,t){const{output:r,cullFace:s,draped:o,hasOccludees:m,polygonOffset:h}=e,j=!i(r);return f({blending:a(r),culling:P(s),depthTest:o?null:p(r),depthWrite:l(e),colorWrite:g,stencilWrite:m?d:null,stencilTest:m?t?c:u:null,polygonOffset:j?h?S:null:n(e)})}initializePipeline(e){return this._occludeePipelineState=this._setPipelineState(e,!0),this._setPipelineState(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};j=e([t("esri.views.3d.webgl-engine.shaders.PatternTechnique")],j);const S={factor:1,units:1};export{j as PatternTechnique};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as r}from"../../support/buffer/glUtil.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{oitPolygonOffset as n,depthWrite as l,depthTest as o,blending as p}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as a,stencilBaseAllZerosParams as c,stencilWriteMaskOn as u}from"../lib/StencilUtils.js";import{P as d}from"../../../../chunks/Pattern.glsl.js";import{getLayout as m}from"./PatternLayouts.js";import{makePipelineState as h,defaultColorWrite as f,cullingParams as P}from"../../../webgl/renderState.js";let g=class extends s{constructor(e,t){super(e,t,r(m(t))),this.shader=new i(d,()=>import("./Pattern.glsl.js")),this.ignoreUnused=!0}_setPipelineState(e,t){const{output:r,cullFace:i,draped:s,hasOccludees:d}=e;return h({blending:p(r),culling:P(i),depthTest:s?null:o(r),depthWrite:l(e),colorWrite:f,stencilWrite:d?u:null,stencilTest:d?t?a:c:null,polygonOffset:n(e)})}initializePipeline(e){return this._occludeePipelineState=this._setPipelineState(e,!0),this._setPipelineState(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};g=e([t("esri.views.3d.webgl-engine.shaders.PatternTechnique")],g);export{g as PatternTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as l}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as s}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as o}from"../effects/geometry/olidUtils.js";import{OITPolygonOffset as c,depthWrite as u,depthTest as p,blending as a}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as d,stencilBaseAllZerosParams as f,stencilWriteMaskOn as h,stencilToolTransparentOccluderParams as m,depthCompareAlways as g,stencilToolMaskOccluderParams as b,stencilWriteMaskOff as P,depthCompareLess as T}from"../lib/StencilUtils.js";import{R as W}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as j}from"../../../webgl/enums.js";import{makePipelineState as y,defaultColorWrite as O,unpremultipliedAlphaToPremultipliedAlpha as S}from"../../../webgl/renderState.js";let v=class extends n{constructor(e,t){super(e,t,i(w(t))),this.shader=new s(W,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.wireframe?j.LINES:j.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r,hasPolygonOffset:s}=e,n=!l(i);return y({blending:a(i),depthTest:p(i),depthWrite:u(e),colorWrite:O,stencilWrite:r?h:null,stencilTest:r?t?d:f:null,polygonOffset:n?s?_:null:c})}initializePipeline(e){if(e.occluder){const t=e.hasPolygonOffset?_:null,{hasOccludees:i}=e;this._occluderPipelineTransparent=y({blending:S,polygonOffset:t,depthTest:g,depthWrite:null,colorWrite:O,stencilWrite:null,stencilTest:i?m:null}),this._occluderPipelineOpaque=y({blending:S,polygonOffset:t,depthTest:i?g:T,depthWrite:null,colorWrite:O,stencilWrite:i?P:null,stencilTest:i?b:null}),this._occluderPipelineMaskWrite=y({blending:null,polygonOffset:t,depthTest:T,depthWrite:null,colorWrite:null,stencilWrite:i?h:null,stencilTest:i?d:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 12:return this._occluderPipelineTransparent??super.getPipeline(e);case 11:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};v=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],v);const _={factor:0,units:-4};function w(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),o()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}export{v as RibbonLineTechnique,w as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShader as l}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{oitPolygonOffset as o,depthWrite as c,depthTest as u,blending as p}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as a,stencilBaseAllZerosParams as d,stencilWriteMaskOn as f,stencilToolTransparentOccluderParams as h,depthCompareAlways as m,stencilToolMaskOccluderParams as b,stencilWriteMaskOff as g,depthCompareLess as P}from"../lib/StencilUtils.js";import{R as T}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{makePipelineState as j,defaultColorWrite as v,unpremultipliedAlphaToPremultipliedAlpha as S}from"../../../webgl/renderState.js";let _=class extends s{constructor(e,t){super(e,t,i(y(t))),this.shader=new l(T,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.wireframe?W.LINES:W.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r}=e;return j({blending:p(i),depthTest:u(i),depthWrite:c(e),colorWrite:v,stencilWrite:r?f:null,stencilTest:r?t?a:d:null,polygonOffset:o(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:t}=e;this._occluderPipelineTransparent=j({blending:S,polygonOffset:o(e),depthTest:m,depthWrite:null,colorWrite:v,stencilWrite:null,stencilTest:t?h:null}),this._occluderPipelineOpaque=j({blending:S,polygonOffset:o(e),depthTest:t?m:P,depthWrite:null,colorWrite:v,stencilWrite:t?g:null,stencilTest:t?b:null}),this._occluderPipelineMaskWrite=j({blending:null,polygonOffset:o(e),depthTest:P,depthWrite:null,colorWrite:null,stencilWrite:t?f:null,stencilTest:t?a:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 12:return this._occluderPipelineTransparent??super.getPipeline(e);case 11:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};function y(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),n()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}_=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],_);export{_ as RibbonLineTechnique,y as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{parameter as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(t){super(),this.spherical=t,this.capType=0,this.emissionSource=0,this.animation=2,this.hasPolygonOffset=!1,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}t([e({count:3})],i.prototype,"capType",void 0),t([e({count:8})],i.prototype,"emissionSource",void 0),t([e({count:4})],i.prototype,"animation",void 0),t([e()],i.prototype,"hasPolygonOffset",void 0),t([e()],i.prototype,"writeDepth",void 0),t([e()],i.prototype,"draped",void 0),t([e()],i.prototype,"stippleEnabled",void 0),t([e()],i.prototype,"stippleOffColorEnabled",void 0),t([e()],i.prototype,"stipplePreferContinuous",void 0),t([e()],i.prototype,"roundJoins",void 0),t([e()],i.prototype,"applyMarkerOffset",void 0),t([e()],i.prototype,"hasVVSize",void 0),t([e()],i.prototype,"hasVVColor",void 0),t([e()],i.prototype,"hasVVOpacity",void 0),t([e()],i.prototype,"falloffEnabled",void 0),t([e()],i.prototype,"innerColorEnabled",void 0),t([e()],i.prototype,"hasOccludees",void 0),t([e()],i.prototype,"occluder",void 0),t([e()],i.prototype,"terrainDepthTest",void 0),t([e()],i.prototype,"cullAboveTerrain",void 0),t([e()],i.prototype,"wireframe",void 0),t([e()],i.prototype,"discardInvisibleFragments",void 0),t([e()],i.prototype,"hasScreenSizePerspective",void 0),t([e()],i.prototype,"worldSizedImagePattern",void 0);export{i as RibbonLineTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as o}from"../materials/TriangleTechniqueConfiguration.js";class i extends o{constructor(e){super(),this.spherical=e,this.capType=0,this.emissionSource=0,this.animation=2,this.writeDepth=!1,this.draped=!1,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVVOpacity=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.hasOccludees=!1,this.occluder=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.wireframe=!1,this.discardInvisibleFragments=!1,this.hasScreenSizePerspective=!1,this.worldSizedImagePattern=!1,this.textureCoordinateType=0,this.hasVVInstancing=!1,this.hasSliceTranslatedView=!0,this.overlayEnabled=!1,this.snowCover=!1}get hasAnimation(){return 0!==this.animation}}e([t({count:3})],i.prototype,"capType",void 0),e([t({count:8})],i.prototype,"emissionSource",void 0),e([t({count:4})],i.prototype,"animation",void 0),e([t()],i.prototype,"writeDepth",void 0),e([t()],i.prototype,"draped",void 0),e([t()],i.prototype,"stippleEnabled",void 0),e([t()],i.prototype,"stippleOffColorEnabled",void 0),e([t()],i.prototype,"stipplePreferContinuous",void 0),e([t()],i.prototype,"roundJoins",void 0),e([t()],i.prototype,"applyMarkerOffset",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVVOpacity",void 0),e([t()],i.prototype,"falloffEnabled",void 0),e([t()],i.prototype,"innerColorEnabled",void 0),e([t()],i.prototype,"hasOccludees",void 0),e([t()],i.prototype,"occluder",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"wireframe",void 0),e([t()],i.prototype,"discardInvisibleFragments",void 0),e([t()],i.prototype,"hasScreenSizePerspective",void 0),e([t()],i.prototype,"worldSizedImagePattern",void 0);export{i as RibbonLineTechniqueConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{isOITColor as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPolygonOffset as a,depthWrite as l,blending as d}from"../lib/OrderIndependentTransparency.js";import{S as p}from"../../../../chunks/ShadedColorMaterial.glsl.js";import{makePipelineState as c,defaultColorWrite as u,cullingParams as f}from"../../../webgl/renderState.js";let m=class extends n{constructor(e,r){super(e,r,o(h(r))),this.shader=new i(p,()=>import("./ShadedColorMaterial.glsl.js"))}initializePipeline(e){const{output:r,transparent:o,cullFace:t,shadingEnabled:i}=e,n=!s(r),p=2===r;return c({blending:o?d(r):null,culling:f(t),depthTest:{func:p?513:i?515:513},depthWrite:l(e),colorWrite:u,polygonOffset:n?null:a})}};function h(e){const r=t().vec3f("position").vec3f("normal");return e.screenSizeEnabled&&r.vec3f("offset"),r}m=e([r("esri.views.3d.webgl-engine.shaders.ShadedColorMaterialTechnique")],m);export{m as ShadedColorMaterialTechnique,h as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as r}from"../../../../core/accessorSupport/decorators.js";import{glLayout as o}from"../../support/buffer/glUtil.js";import{newLayout as t}from"../../support/buffer/InterleavedLayout.js";import{isOITFrontFace as s}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShader as i}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as n}from"../core/shaderTechnique/ShaderTechnique.js";import{oitPolygonOffset as a,depthWrite as l,blending as d}from"../lib/OrderIndependentTransparency.js";import{S as p}from"../../../../chunks/ShadedColorMaterial.glsl.js";import{makePipelineState as c,defaultColorWrite as u,cullingParams as f}from"../../../webgl/renderState.js";let m=class extends n{constructor(e,r){super(e,r,o(h(r))),this.shader=new i(p,()=>import("./ShadedColorMaterial.glsl.js"))}initializePipeline(e){const{output:r,transparent:o,cullFace:t,shadingEnabled:i}=e,n=s(r);return c({blending:o?d(r):null,culling:f(t),depthTest:{func:n?513:i?515:513},depthWrite:l(e),colorWrite:u,polygonOffset:a(e)})}};function h(e){const r=t().vec3f("position").vec3f("normal");return e.screenSizeEnabled&&r.vec3f("offset"),r}m=e([r("esri.views.3d.webgl-engine.shaders.ShadedColorMaterialTechnique")],m);export{m as ShadedColorMaterialTechnique,h as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as r}from"../materials/DefaultTechniqueConfiguration.js";class i extends r{constructor(){super(...arguments),this.cullFace=0,this.transparent=!1,this.writeDepth=!0,this.screenSizeEnabled=!0,this.shadingEnabled=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.textureCoordinateType=0,this.emissionSource=0,this.olidColorInstanced=!1,this.draped=!1,this.overlayEnabled=!1,this.snowCover=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:3})],i.prototype,"cullFace",void 0),e([t()],i.prototype,"transparent",void 0),e([t()],i.prototype,"writeDepth",void 0),e([t()],i.prototype,"screenSizeEnabled",void 0),e([t()],i.prototype,"shadingEnabled",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0);export{i as ShadedColorMaterialTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TriangleTechniqueConfiguration as i}from"../materials/TriangleTechniqueConfiguration.js";class r extends i{constructor(){super(...arguments),this.cullFace=0,this.writeDepth=!0,this.screenSizeEnabled=!0,this.shadingEnabled=!0,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.textureCoordinateType=0,this.emissionSource=0,this.olidColorInstanced=!1,this.draped=!1,this.overlayEnabled=!1,this.snowCover=!1}get discardInvisibleFragments(){return this.transparent}}e([t({count:3})],r.prototype,"cullFace",void 0),e([t()],r.prototype,"writeDepth",void 0),e([t()],r.prototype,"screenSizeEnabled",void 0),e([t()],r.prototype,"shadingEnabled",void 0),e([t()],r.prototype,"terrainDepthTest",void 0),e([t()],r.prototype,"cullAboveTerrain",void 0);export{r as ShadedColorMaterialTechniqueConfiguration};
@@ -1378,7 +1378,8 @@ export default class SceneView extends SceneViewSuperclass {
1378
1378
  *
1379
1379
  * The [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) hit test [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewMediaHit) contains all media elements if the hit is made on intersecting elements.
1380
1380
  * The [RouteLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/RouteLayer/) hit test [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewRouteHit) contains all route elements if the hit is made on intersecting elements.
1381
- *
1381
+ * The [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/) hit test [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewLayerHit) returns the intersected layer,
1382
+ * hit location, and hit distance.
1382
1383
  * The [VoxelLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VoxelLayer/) hit test [result](https://developers.arcgis.com/javascript/latest/references/core/views/types/#SceneViewGraphicHit) contains information about the intersecting voxel if a hit is made.
1383
1384
  *
1384
1385
  * If no options are specified, graphics that are behind the ground surface will not be returned unless the ground surface is
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Camera.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}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ignoreAbortErrors as d,throwIfDestroyed as u,throwIfAborted as c,createAbortError as g}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{on as y,watch as f,initial as w,sync as v,whenOnce as _,syncAndInitial as b}from"../core/reactiveUtils.js";import{setFrameDuration as M,cleanupScheduling as S}from"../core/scheduling.js";import{createScreenPoint as V,createScreenPointArray as j}from"../core/screenUtils.js";import{cleanupWhereClauseCache as C}from"../core/sql.js";import{getMetersPerUnitForSR as T}from"../core/units.js";import{property as R,cast as x,subclass as A}from"../core/accessorSupport/decorators.js";import{ensureType as E,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as L}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as H}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as I}from"../core/accessorSupport/trackingUtils.js";import{create as F}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as P}from"../core/libs/rbush/PooledRBush.js";import{initialize as D}from"../core/workers/workers.js";import U from"../geometry/Extent.js";import G from"../geometry/HeightModelInfo.js";import z from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import k from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as B}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as N}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Q}from"../geometry/projection/projectPointToVector.js";import{toExtent as Z,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as $}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as J}from"../geometry/support/scaleUtils.js";import{makeDehydratedPoint as K}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as X,isTiledLayer as ee,isVoxelLayer as te,isIntegratedMeshLayer as ie}from"../layers/support/layerUtils.js";import{TilemapCache as re}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as se}from"../portal/portalDefault.js";import{WebSceneTag as ne}from"../support/tagSymbols.js";import{BreakpointsOwner as ae}from"./BreakpointsOwner.js";import{DOMContainer as oe}from"./DOMContainer.js";import{PopupView as le}from"./PopupView.js";import pe from"./View.js";import he from"./ViewAnimation.js";import{stringFromViewingMode as de,viewingModeFromString as ue}from"./ViewingMode.js";import{GroundView3D as ce}from"./3d/GroundView3D.js";import{layerView3DImporter as ge}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as me}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as ye}from"./3d/camera/intersectionUtils.js";import fe from"./3d/constraints/Constraints.js";import we from"./3d/environment/Environment.js";import{EnvironmentManager as ve}from"./3d/environment/EnvironmentManager.js";import _e from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as be}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Me}from"./3d/layers/graphics/Labeler.js";import Se from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as Ve}from"./3d/layers/support/StageLayerElevationProvider.js";import{ScreenSizePerspective as je}from"./3d/state/ScreenSizePerspective.js";import Ce from"./3d/state/ViewState.js";import{ViewStateManager as Te,cleanupViewStateManager as Re}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as xe}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ae}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Ee}from"./3d/state/utils/navigationUtils.js";import Oe from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as Le}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as He}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Ie}from"./3d/support/ElevationProvider.js";import{toMap as Fe,hitTest as Pe}from"./3d/support/hitTest.js";import{popupHitTest as De}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as Ue,getQualityProfileSettings as Ge}from"./3d/support/QualityProfile.js";import ze from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as We}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as qe}from"./3d/support/ResourceController.js";import ke from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Be}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Ne}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Qe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ze from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ye,getTiledLayerInfo as $e,checkIfTileInfoSupportedForView as Je}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Ke}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as Xe}from"./3d/terrain/TileRenderer.js";import{Stage as et}from"./3d/webgl-engine/Stage.js";import{olidEnabled as tt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as it}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as rt}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as st}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as nt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as at}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import ot from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as lt}from"./support/drapedUtils.js";import{occludeesSupported as pt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as ht,createScreenPointFromSupportedEvent as dt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ut}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as ct,destroyTextureCompressionWorker as gt}from"./support/TextureCompressionHelper.js";import mt from"./ui/DefaultUI.js";import yt from"./ui/3d/DefaultUI3D.js";import ft from"../webscene/Environment.js";import{clearVNodeCache as wt}from"../widgets/support/vnodeCache.js";var vt;const _t=Symbol(),bt=Symbol();let Mt=class extends(ae(le(oe(pe)))){static{vt=this}constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=qe(this),this.deconflictor=new be({view:this}),this.attribution3D=new Oe({view:this}),this.labeler=new Me({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.basemapTerrain=null,this.elevationProvider=new Le({view:this}),this._canvas=null,this.constraints=new fe,this._environment=new we,this.environmentManager=new ve,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ot({importAnalysisViewModule:e=>me(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new m,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Ce({view:this}),this.slice=new Ne,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new yt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,D();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([y(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),f(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new _e({view:this}),this.stateManager=new Te({view:this}),this.screenSizePerspective=new je({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=ct(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ce({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},w),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},w),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>M(e>0?1e3/Math.ceil(e):0),w),this.addHandles([f(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),v),f(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),v)])}destroy(){this.destroyed||(gt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.basemapTerrain?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}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 canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=E(z,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof U?this.spatialReference&&(t=St(t,this.spatialReference),null==t)?(l.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):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:St(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||k.WGS84,i=St(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||k.WGS84;let t;const i=i=>{const r=St(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new U({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(e)),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 o=this._get("_groundAndLayersExtent");return t.equals(o)?o:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof we?e:e instanceof ft?this.environment?.cloneWithWebsceneEnvironment(e)??we.fromWebsceneEnvironment(e):E(we,e):new we}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 layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return vt._layerToLayerview}static{this._layerToLayerview=pe._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}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&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&ne in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){const t=Ge(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new ze(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ue()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?H(()=>J(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?G.deriveUnitFromSR(e,this.spatialReference):null}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn("alphaCompositingEnabled cannot be changed after the view has become ready"),this._set("alphaCompositingEnabled",e)}get updating(){if(this.destroying||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||Ye(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._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),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 de(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?de(this.defaultsFromMap.viewingMode):ut(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.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 visibleArea(){return this.stateManager?.visibleArea}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 ke(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 l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ht(e)?dt(this,e):e;return Fe(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=Tt,t.x=e.x,t.y=e.y,t.z=Ie(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Q(t,Vt,this.renderSpatialReference),this.state.camera.projectToScreen(Vt,jt),V(jt[0],jt[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Q(e,Vt,i);const r=this.state.camera.computeScreenPixelSizeAt(Vt);return t&&i!==t?r*T(i)/T(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ht(e)?dt(this,e):e;return Pe(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return De(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return d(this.goTo({zoomFactor:2}))}async zoomOut(){if(this.canZoomOut)return d(this.goTo({zoomFactor:.5}))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":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))[0];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))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(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()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!tt())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return ge.importLayerView(e)}hasLayerViewModule(e){return ge.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ue(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,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ut(e,i)&&(null==t||(!!X(t)||(!ee(t)||null!=$e(t,e,i))&&(!te(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(X(t)&&(r||s)){return!s||2===i||null===Je(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:k.WebMercator,viewingMode:i}]:[{spatialReference:r?k.WGS84:k.WebMercator,viewingMode:i}]}return ee(t)||te(t)||!r&&!s?ee(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:k.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?k.WGS84:k.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${de(i)} viewing mode.`):e.isGeographic&&l.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 l.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)})}maskOccludee(e){if(!e)return l.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&&pt(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?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await _(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?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):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Rt[e]();if(t&&(u(this),c(i.signal),await t(i.signal)),this.destroyed)throw g();return c(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new Ze({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Qe({view:this})),this.addHandles([this.updatingHandles.add(()=>He.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&He.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},b),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Z(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},b),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=p(this._featureTiles)},v)],_t),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(bt),this.removeHandles(_t),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=$(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",We.create(this.state.viewingMode,i)),t||this.addHandles(f(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!N(e,this.groundView.spatialReference,Ct,t)||(this.renderCoordsHelper.extent=Ct)},v),bt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(rt/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(bt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(f(()=>[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",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),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 Ae(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new et({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([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(rt/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Be({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>_(()=>this.groundView?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){1===ue(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(y(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(f(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?L(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(nt);for(const t of this.allLayerViews)ie(t.layer)&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(nt);for(const t of this.allLayerViews)ie(t.layer)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){wt(),I(),C(),at(),Re(),ye(),Ve(),B(),lt(),se(),Xe(),st(),xe(),Ee(),P(),S(),it(),Ke(),Se.cleanupI3SLodHandling(),re.cleanupTilemapCache(),Ce.cleanupViewstate(),Ze.cleanupTerrainSurface()}};function St(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],Mt.prototype,"_userClippingArea",void 0),e([R()],Mt.prototype,"_resourceController",void 0),e([R()],Mt.prototype,"stage",null),e([R({readOnly:!0})],Mt.prototype,"deconflictor",void 0),e([R({readOnly:!0})],Mt.prototype,"labeler",void 0),e([R({type:he,readOnly:!0})],Mt.prototype,"animation",null),e([R({readOnly:!0})],Mt.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],Mt.prototype,"overlayManager",null),e([R({readOnly:!0})],Mt.prototype,"elevationProvider",void 0),e([R()],Mt.prototype,"camera",null),e([R({type:t})],Mt.prototype,"contentCamera",null),e([R({readOnly:!0})],Mt.prototype,"canvas",null),e([R({type:z,useTypeForAutocast:!1})],Mt.prototype,"center",null),e([R({type:U})],Mt.prototype,"clippingArea",null),e([R({type:fe,nonNullable:!0})],Mt.prototype,"constraints",void 0),e([R({type:U,readOnly:!0})],Mt.prototype,"renderDataExtent",null),e([R({readOnly:!0})],Mt.prototype,"tileInfo",null),e([R({type:U,readOnly:!0})],Mt.prototype,"dataExtent",null),e([R({type:U,readOnly:!0})],Mt.prototype,"_groundAndLayersExtent",null),e([R({type:we})],Mt.prototype,"environment",null),e([x("environment")],Mt.prototype,"castEnvironment",null),e([R({readOnly:!0})],Mt.prototype,"environmentManager",void 0),e([R({type:U})],Mt.prototype,"extent",null),e([R({type:r})],Mt.prototype,"floors",void 0),e([R()],Mt.prototype,"screenCenter",null),e([R()],Mt.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],Mt.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],Mt.prototype,"graphicsView",void 0),e([R()],Mt.prototype,"analysisViewManager",void 0),e([R()],Mt.prototype,"groundView",void 0),e([R({readOnly:!0})],Mt.prototype,"layerviewCollections",null),e([R({type:Boolean})],Mt.prototype,"initialExtentRequired",null),e([R()],Mt.prototype,"defaultsFromMapSettings",null),e([R()],Mt.prototype,"interacting",null),e([R()],Mt.prototype,"stationary",null),e([R()],Mt.prototype,"navigating",null),e([R()],Mt.prototype,"map",void 0),e([R()],Mt.prototype,"padding",null),e([R({type:Qe,readOnly:!0})],Mt.prototype,"pointsOfInterest",void 0),e([R()],Mt.prototype,"_featureTiles",void 0),e([R()],Mt.prototype,"featureTiles",null),e([R()],Mt.prototype,"_featureTreeDebugger",void 0),e([R({constructOnly:!0})],Mt.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],Mt.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],Mt.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],Mt.prototype,"state",void 0),e([R()],Mt.prototype,"screenSizePerspective",void 0),e([R({readOnly:!0})],Mt.prototype,"inputManager",void 0),e([R({readOnly:!0})],Mt.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],Mt.prototype,"qualityProfile",null),e([R({type:ze,get(){let e=this._get("qualitySettings");if(!e){const t=Ge(this.qualityProfile);e=new ze(t)}return e}})],Mt.prototype,"qualitySettings",void 0),e([R()],Mt.prototype,"slice",void 0),e([R({readOnly:!0})],Mt.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],Mt.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],Mt.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,readOnly:!0})],Mt.prototype,"resolution",null),e([R({type:Number})],Mt.prototype,"scale",null),e([R({readOnly:!0,type:Number})],Mt.prototype,"terrainLevel",null),e([R()],Mt.prototype,"heightModelInfo",null),e([R({type:k})],Mt.prototype,"spatialReference",void 0),e([R({type:Boolean,value:!1})],Mt.prototype,"alphaCompositingEnabled",null),e([R({constructOnly:!0})],Mt.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],Mt.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],Mt.prototype,"type",void 0),e([R(),x(e=>e instanceof mt?e:O(yt,e))],Mt.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0})],Mt.prototype,"updating",null),e([R()],Mt.prototype,"_updatingObjects",null),e([R()],Mt.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0})],Mt.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],Mt.prototype,"viewingMode",null),e([R({type:i})],Mt.prototype,"viewpoint",null),e([R({readOnly:!0})],Mt.prototype,"visibleArea",null),e([R({type:Number})],Mt.prototype,"zoom",null),e([R({readOnly:!0})],Mt.prototype,"quality",null),e([R({readOnly:!0})],Mt.prototype,"resolutionScale",null),e([R()],Mt.prototype,"focusAreasView",void 0),e([R()],Mt.prototype,"_defaultToMapOptions",null),e([R()],Mt.prototype,"_defaultHitTestOptions",null),Mt=vt=e([A("esri.views.SceneView")],Mt);const Vt=F(),jt=j(),Ct=Y(),Tt=K(0,0,0,k.WebMercator),Rt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},xt=Mt;export{xt as default};
2
+ import{__decorate as e}from"tslib";import t from"../Camera.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}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{destroyMaybe as p,maybeProperty as h}from"../core/maybe.js";import{ignoreAbortErrors as d,throwIfDestroyed as u,throwIfAborted as c,createAbortError as g}from"../core/promiseUtils.js";import m from"../core/ReactiveSet.js";import{on as y,watch as f,initial as w,sync as v,whenOnce as _,syncAndInitial as b}from"../core/reactiveUtils.js";import{setFrameDuration as M,cleanupScheduling as S}from"../core/scheduling.js";import{createScreenPoint as V,createScreenPointArray as j}from"../core/screenUtils.js";import{cleanupWhereClauseCache as C}from"../core/sql.js";import{getMetersPerUnitForSR as T}from"../core/units.js";import{property as R,cast as x,subclass as A}from"../core/accessorSupport/decorators.js";import{ensureType as E,ensureClass as O}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as L}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as H}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as I}from"../core/accessorSupport/trackingUtils.js";import{create as F}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as P}from"../core/libs/rbush/PooledRBush.js";import{initialize as D}from"../core/workers/workers.js";import U from"../geometry/Extent.js";import G from"../geometry/HeightModelInfo.js";import z from"../geometry/Point.js";import{project as W,canProjectWithoutEngine as q}from"../geometry/projectionUtils.js";import k from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as B}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as N}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Q}from"../geometry/projection/projectPointToVector.js";import{toExtent as Z,create as Y}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as $}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as J}from"../geometry/support/scaleUtils.js";import{makeDehydratedPoint as K}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as X,isTiledLayer as ee,isVoxelLayer as te,isIntegratedMeshLayer as ie,isGaussianSplatLayer as re}from"../layers/support/layerUtils.js";import{TilemapCache as se}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as ne}from"../portal/portalDefault.js";import{WebSceneTag as ae}from"../support/tagSymbols.js";import{BreakpointsOwner as oe}from"./BreakpointsOwner.js";import{DOMContainer as le}from"./DOMContainer.js";import{PopupView as pe}from"./PopupView.js";import he from"./View.js";import de from"./ViewAnimation.js";import{stringFromViewingMode as ue,viewingModeFromString as ce}from"./ViewingMode.js";import{GroundView3D as ge}from"./3d/GroundView3D.js";import{layerView3DImporter as me}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ye}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as fe}from"./3d/camera/intersectionUtils.js";import we from"./3d/constraints/Constraints.js";import ve from"./3d/environment/Environment.js";import{EnvironmentManager as _e}from"./3d/environment/EnvironmentManager.js";import be from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as Me}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Se}from"./3d/layers/graphics/Labeler.js";import Ve from"./3d/layers/i3s/I3SLodHandling.js";import{cleanupStageLayerElevationProvider as je}from"./3d/layers/support/StageLayerElevationProvider.js";import{ScreenSizePerspective as Ce}from"./3d/state/ScreenSizePerspective.js";import Te from"./3d/state/ViewState.js";import{ViewStateManager as Re,cleanupViewStateManager as xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ae}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ee}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Oe}from"./3d/state/utils/navigationUtils.js";import Le from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as He}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ie}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Fe}from"./3d/support/ElevationProvider.js";import{toMap as Pe,hitTest as De}from"./3d/support/hitTest.js";import{popupHitTest as Ue}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as Ge,getQualityProfileSettings as ze}from"./3d/support/QualityProfile.js";import We from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as qe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as ke}from"./3d/support/ResourceController.js";import Be from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Ne}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Qe}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Ze}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Ye from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as $e,getTiledLayerInfo as Je,checkIfTileInfoSupportedForView as Ke}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as Xe}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as et}from"./3d/terrain/TileRenderer.js";import{Stage as tt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as it}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as rt}from"./3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js";import{defaultTolerance as st}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as nt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as at}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as ot}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import lt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as pt}from"./support/drapedUtils.js";import{occludeesSupported as ht}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as dt,createScreenPointFromSupportedEvent as ut}from"./support/screenUtils.js";import{isSpatialReferenceSupported as ct}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as gt,destroyTextureCompressionWorker as mt}from"./support/TextureCompressionHelper.js";import yt from"./ui/DefaultUI.js";import ft from"./ui/3d/DefaultUI3D.js";import wt from"../webscene/Environment.js";import{clearVNodeCache as vt}from"../widgets/support/vnodeCache.js";var _t;const bt=Symbol(),Mt=Symbol();let St=class extends(oe(pe(le(he)))){static{_t=this}constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=ke(this),this.deconflictor=new Me({view:this}),this.attribution3D=new Le({view:this}),this.labeler=new Se({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.basemapTerrain=null,this.elevationProvider=new He({view:this}),this._canvas=null,this.constraints=new we,this._environment=new ve,this.environmentManager=new _e,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new lt({importAnalysisViewModule:e=>ye(e),view:this}),this.groundView=null,this.map=null,this._featureTileTreeClients=new m,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Te({view:this}),this.slice=new Qe,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new ft,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,D();const t=(e=null)=>{null!=e&&4===e.type||(this._updatingChanged(),this.map?.allLayers.forEach(async e=>{try{await e.when()}catch(t){}this._updatingChanged()}))};this.addHandles([y(()=>this.map?.allLayers,"after-changes",e=>t(e),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),f(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new be({view:this}),this.stateManager=new Re({view:this}),this.screenSizePerspective=new Ce({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=gt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ge({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},w),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},w),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>M(e>0?1e3/Math.ceil(e):0),w),this.addHandles([f(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),v),f(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),v)])}destroy(){this.destroyed||(mt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._set("analysisViewManager",p(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=p(this.sharedSymbolResources),this._set("labeler",p(this.labeler)),this._set("deconflictor",p(this.deconflictor)),this._resourceController=p(this._resourceController),this._set("stateManager",p(this.stateManager)),this._set("inputManager",p(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",p(this.environmentManager)),this._set("environment",p(this.environment)),this.groundView=p(this.groundView),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.basemapTerrain?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}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 canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=E(z,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||h(e,"clippingArea");return!this._userClippingArea&&!h(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof U?this.spatialReference&&(t=Vt(t,this.spatialReference),null==t)?(l.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):(l.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?l.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Vt(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||k.WGS84,i=Vt(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||k.WGS84;let t;const i=i=>{const r=Vt(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new U({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(e)),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 o=this._get("_groundAndLayersExtent");return t.equals(o)?o:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof ve?e:e instanceof wt?this.environment?.cloneWithWebsceneEnvironment(e)??ve.fromWebsceneEnvironment(e):E(ve,e):new ve}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 layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return _t._layerToLayerview}static{this._layerToLayerview=he._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}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&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&ae in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){const t=ze(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new We(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Ge()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?H(()=>J(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?G.deriveUnitFromSR(e,this.spatialReference):null}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn("alphaCompositingEnabled cannot be changed after the view has become ready"),this._set("alphaCompositingEnabled",e)}get updating(){if(this.destroying||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||$e(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._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),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 ue(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ue(this.defaultsFromMap.viewingMode):ct(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?l.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 visibleArea(){return this.stateManager?.visibleArea}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 Be(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 l.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=dt(e)?ut(this,e):e;return Pe(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=Rt,t.x=e.x,t.y=e.y,t.z=Fe(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Q(t,jt,this.renderSpatialReference),this.state.camera.projectToScreen(jt,Ct),V(Ct[0],Ct[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Q(e,jt,i);const r=this.state.camera.computeScreenPixelSizeAt(jt);return t&&i!==t?r*T(i)/T(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=dt(e)?ut(this,e):e;return De(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return Ue(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return d(this.goTo({zoomFactor:2}))}async zoomOut(){if(this.canZoomOut)return d(this.goTo({zoomFactor:.5}))}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":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))[0];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))[0];return(await import("./support/screenshotUtils.js")).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(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()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!it())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await import("./support/screenshotUtils.js"),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return me.importLayerView(e)}hasLayerViewModule(e){return me.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.scene?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ce(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,2),s=this._validateSpatialReferenceForViewingMode(e,t,1);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,2)}:{constraints:this._makeSpatialReferenceConstraints(e,t,1)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!ct(e,i)&&(null==t||(!!X(t)||(!ee(t)||null!=Je(t,e,i))&&(!te(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:r,isWGS84:s}=e;if(X(t)&&(r||s)){return!s||2===i||null===Ke(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:k.WebMercator,viewingMode:i}]:[{spatialReference:r?k.WGS84:k.WebMercator,viewingMode:i}]}return ee(t)||te(t)||!r&&!s?ee(t)&&r&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:k.WGS84,viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?k.WGS84:k.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ue(i)} viewing mode.`):e.isGeographic&&l.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 l.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)})}maskOccludee(e){if(!e)return l.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&&ht(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?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await _(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?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):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),o(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await xt[e]();if(t&&(u(this),c(i.signal),await t(i.signal)),this.destroyed)throw g();return c(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new Ye({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ze({view:this})),this.addHandles([this.updatingHandles.add(()=>Ie.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ie.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=p(this._featureTreeDebugger))},b),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?W(Z(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},b),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=p(this._featureTiles)},v)],bt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(Mt),this.removeHandles(bt),this._featureTiles=p(this.featureTiles),this._set("pointsOfInterest",p(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=$(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",qe.create(this.state.viewingMode,i)),t||this.addHandles(f(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!N(e,this.groundView.spatialReference,Tt,t)||(this.renderCoordsHelper.extent=Tt)},v),Mt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(st/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(Mt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(f(()=>[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",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),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 Ee(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new tt({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([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(st/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=p(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Ne({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>_(()=>this.groundView?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=p(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){1===ce(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(y(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(f(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?L(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(e=>e(this))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(at);for(const t of this.allLayerViews)(ie(t.layer)||re(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(at);for(const t of this.allLayerViews)ie(t.layer)&&t.layer.opacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){vt(),I(),C(),ot(),xe(),fe(),je(),B(),pt(),ne(),et(),nt(),Ae(),Oe(),P(),S(),rt(),Xe(),Ve.cleanupI3SLodHandling(),se.cleanupTilemapCache(),Te.cleanupViewstate(),Ye.cleanupTerrainSurface()}};function Vt(e,t){return null!=e&&q(e.spatialReference,t)?W(e,t):null}e([R()],St.prototype,"_userClippingArea",void 0),e([R()],St.prototype,"_resourceController",void 0),e([R()],St.prototype,"stage",null),e([R({readOnly:!0})],St.prototype,"deconflictor",void 0),e([R({readOnly:!0})],St.prototype,"labeler",void 0),e([R({type:de,readOnly:!0})],St.prototype,"animation",null),e([R({readOnly:!0})],St.prototype,"basemapTerrain",void 0),e([R({readOnly:!0})],St.prototype,"overlayManager",null),e([R({readOnly:!0})],St.prototype,"elevationProvider",void 0),e([R()],St.prototype,"camera",null),e([R({type:t})],St.prototype,"contentCamera",null),e([R({readOnly:!0})],St.prototype,"canvas",null),e([R({type:z,useTypeForAutocast:!1})],St.prototype,"center",null),e([R({type:U})],St.prototype,"clippingArea",null),e([R({type:we,nonNullable:!0})],St.prototype,"constraints",void 0),e([R({type:U,readOnly:!0})],St.prototype,"renderDataExtent",null),e([R({readOnly:!0})],St.prototype,"tileInfo",null),e([R({type:U,readOnly:!0})],St.prototype,"dataExtent",null),e([R({type:U,readOnly:!0})],St.prototype,"_groundAndLayersExtent",null),e([R({type:ve})],St.prototype,"environment",null),e([x("environment")],St.prototype,"castEnvironment",null),e([R({readOnly:!0})],St.prototype,"environmentManager",void 0),e([R({type:U})],St.prototype,"extent",null),e([R({type:r})],St.prototype,"floors",void 0),e([R()],St.prototype,"screenCenter",null),e([R()],St.prototype,"frustum",null),e([R({type:Number,readOnly:!0})],St.prototype,"fullOpacity",void 0),e([R({readOnly:!0})],St.prototype,"graphicsView",void 0),e([R()],St.prototype,"analysisViewManager",void 0),e([R()],St.prototype,"groundView",void 0),e([R({readOnly:!0})],St.prototype,"layerviewCollections",null),e([R({type:Boolean})],St.prototype,"initialExtentRequired",null),e([R()],St.prototype,"defaultsFromMapSettings",null),e([R()],St.prototype,"interacting",null),e([R()],St.prototype,"stationary",null),e([R()],St.prototype,"navigating",null),e([R()],St.prototype,"map",void 0),e([R()],St.prototype,"padding",null),e([R({type:Ze,readOnly:!0})],St.prototype,"pointsOfInterest",void 0),e([R()],St.prototype,"_featureTiles",void 0),e([R()],St.prototype,"featureTiles",null),e([R()],St.prototype,"_featureTreeDebugger",void 0),e([R({constructOnly:!0})],St.prototype,"deactivatedWebGLExtensions",void 0),e([R({constructOnly:!0})],St.prototype,"debugWebGLExtensions",void 0),e([R({constructOnly:!0})],St.prototype,"renderCanvas",void 0),e([R({constructOnly:!0})],St.prototype,"state",void 0),e([R()],St.prototype,"screenSizePerspective",void 0),e([R({readOnly:!0})],St.prototype,"inputManager",void 0),e([R({readOnly:!0})],St.prototype,"stateManager",void 0),e([R({type:["low","medium","high"]})],St.prototype,"qualityProfile",null),e([R({type:We,get(){let e=this._get("qualitySettings");if(!e){const t=ze(this.qualityProfile);e=new We(t)}return e}})],St.prototype,"qualitySettings",void 0),e([R()],St.prototype,"slice",void 0),e([R({readOnly:!0})],St.prototype,"typeSpecificPreconditionsReady",null),e([R({readOnly:!0})],St.prototype,"renderCoordsHelper",void 0),e([R({readOnly:!0})],St.prototype,"sceneIntersectionHelper",void 0),e([R({type:Number,readOnly:!0})],St.prototype,"resolution",null),e([R({type:Number})],St.prototype,"scale",null),e([R({readOnly:!0,type:Number})],St.prototype,"terrainLevel",null),e([R()],St.prototype,"heightModelInfo",null),e([R({type:k})],St.prototype,"spatialReference",void 0),e([R({type:Boolean,value:!1})],St.prototype,"alphaCompositingEnabled",null),e([R({constructOnly:!0})],St.prototype,"preserveDrawingBufferEnabled",void 0),e([R({type:Boolean})],St.prototype,"supersampleScreenshotsEnabled",void 0),e([R({readOnly:!0})],St.prototype,"type",void 0),e([R(),x(e=>e instanceof yt?e:O(ft,e))],St.prototype,"ui",void 0),e([R({type:Boolean,readOnly:!0})],St.prototype,"updating",null),e([R()],St.prototype,"_updatingObjects",null),e([R()],St.prototype,"_updatingObjectsWithProgress",null),e([R({type:Number,readOnly:!0})],St.prototype,"updatingProgress",void 0),e([R({type:["global","local"]})],St.prototype,"viewingMode",null),e([R({type:i})],St.prototype,"viewpoint",null),e([R({readOnly:!0})],St.prototype,"visibleArea",null),e([R({type:Number})],St.prototype,"zoom",null),e([R({readOnly:!0})],St.prototype,"quality",null),e([R({readOnly:!0})],St.prototype,"resolutionScale",null),e([R()],St.prototype,"focusAreasView",void 0),e([R()],St.prototype,"_defaultToMapOptions",null),e([R()],St.prototype,"_defaultHitTestOptions",null),St=_t=e([A("esri.views.SceneView")],St);const jt=F(),Ct=j(),Tt=Y(),Rt=K(0,0,0,k.WebMercator),xt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},At=St;export{At as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as y}from"../../core/reactiveUtils.js";import{schedule as h}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function m(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(h(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),y)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&m(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c()],g.prototype,"supportsGround",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};
2
+ import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import i from"../../core/Error.js";import t from"../../core/Logger.js";import{someMap as s}from"../../core/MapUtils.js";import{createAbortError as o,isAbortError as a}from"../../core/promiseUtils.js";import{on as n,watch as l,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as y}from"../../core/scheduling.js";import{property as c,subclass as p}from"../../core/accessorSupport/decorators.js";import{get as d}from"../../core/accessorSupport/get.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{destroyMap as f}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as u}from"./LayerLayerViewInfo.js";function m(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let g=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new w,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=Promise.withResolvers(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(y(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const o of e)if(o){if(!1===this.layerViewFilter?.(o))continue;r.add(o);const e=this._layerLayerViewInfoMap.get(o);e&&t?e.start():e||this._recyclingInfoMap.has(o)||i.push(o),"layers"in o&&o.layers&&s(o.layers)}};for(const a of this._rootCollectionNames)s(d(this,a));const o=new Array,n=e=>{const r=e.tryRecycle(i);r?(this._recyclingInfoMap.set(e.layer,e),this._watchUpdatingTracking.consumePromise(r),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{a(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):o.push(e)};for(const a of this._layerLayerViewInfoMap.values())r.has(a.layer)||(this._layerLayerViewInfoMap.delete(a.layer),n(a));for(const a of this._recyclingInfoMap.values())r.has(a.layer)||(this._recyclingInfoMap.delete(a.layer),n(a));for(const a of i)this._createLayerView(a);this._refreshCollections(),o.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([n(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),l(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),h)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),f(this._recyclingInfoMap),f(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(o()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),f(this._layerLayerViewInfoMap),f(this._recyclingInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,t))}isRecyclingLayerViewForLayer(e){return this._recyclingInfoMap.has(e)}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(d(this,e),d(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())d(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void r?.removeAll();let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const{layerView:o}=e;o.layer=s,o.parent=i,r.at(t)!==o&&r.splice(t,0,o),"layers"in s&&m(o)&&this._populateLayerViewsOwners(s.layers,o.layerViews,o),++t}t<r.length&&r.splice(t)}_createLayerView(e){e.load().catch(()=>{}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new u(e,this.view,this.layerViewImporter);this._watchUpdatingTracking.consumePromise(r.promise),r.promise?.then(()=>this._refreshCollections(),r=>{r&&(a(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],g.prototype,"_workPromise",void 0),e([c({readOnly:!0})],g.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],g.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],g.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],g.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],g.prototype,"layerViewFilter",void 0),e([c()],g.prototype,"layerViewImporter",void 0),e([c()],g.prototype,"supportsGround",void 0),e([c({readOnly:!0})],g.prototype,"updating",null),e([c({readOnly:!0})],g.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],g.prototype,"view",void 0),g=e([p("esri.views.support.LayerViewManager")],g);const _=g;export{_ as default};