@arcgis/core 5.1.0-next.16 → 5.1.0-next.18

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 (32) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{da5deed75e1a170a49b3.js → fd125618f513bc2f5206.js} +13 -13
  3. package/chunks/HUDMaterial.glsl.js +41 -64
  4. package/chunks/MeasurementArrow.glsl.js +7 -8
  5. package/chunks/RealisticTree.glsl.js +3 -3
  6. package/chunks/RibbonLine.glsl.js +29 -35
  7. package/chunks/Terrain.glsl.js +24 -24
  8. package/config.js +1 -1
  9. package/kernel.js +1 -1
  10. package/package.json +1 -1
  11. package/support/revision.js +1 -1
  12. package/symbols/Symbol3DLayer.d.ts +12 -18
  13. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  14. package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
  15. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  16. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  17. package/views/3d/webgl-engine/materials/renderers/BufferCache.js +2 -0
  18. package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
  19. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  20. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  21. package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
  22. package/views/3d/webgl-engine/materials/renderers/TextureBufferCache.js +2 -0
  23. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  24. package/views/3d/webgl-engine/materials/renderers/VboCache.js +2 -0
  25. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  26. package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
  27. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +7 -7
  28. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  29. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  30. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  31. package/views/3d/webgl-engine/shaders/alphaCutoff.glsl.js +2 -0
  32. package/views/webgl/VertexArrayObject.js +1 -1
@@ -132,7 +132,7 @@ smoothstep(0.0, 0.1, dot(shadingNormal, groundNormal)));
132
132
  return snow * snowCover;
133
133
  }`),e.code.add(n.H`vec3 applySnowToMRR(vec3 mrr, float snow) {
134
134
  return mix(mrr, vec3(0.0, 1.0, 0.04), snow);
135
- }`))}},11964(e,t,r){r.d(t,{Cr:()=>u,LV:()=>c,_I:()=>d,vt:()=>l});var i=r(34727),n=r(4341),o=r(35522),s=r(51850),a=r(32114);function l(e){return e?{origin:(0,s.o8)(e.origin),vector:(0,s.o8)(e.vector)}:{origin:(0,s.vt)(),vector:(0,s.vt)()}}function c(e,t){const r=h.get();return r.origin=e,r.vector=t,r}function u(e,t,r=l()){return(0,o.C)(r.origin,e),(0,o.Re)(r.vector,t,e),r}function d(e,t,r){return function(e,t,r,n,s){const{vector:l,origin:c}=e,u=(0,o.Re)(a.rq.get(),t,c),d=(0,o.Om)(l,u)/(0,o.m3)(l);return(0,o.hs)(s,l,(0,i.qE)(d,0,1)),(0,o.WQ)(s,s,e.origin)}(e,t,0,0,r)}(0,s.vt)(),(0,s.vt)();const h=new n.I(()=>l())},12791(e,t,r){r.d(t,{x:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",0,(r,i)=>r.bindTexture(e,t(i)))}}},13840(e,t,r){r.d(t,{r:()=>i});class i{constructor(e,t){this._module=e,this._load=t}get(){return this._module}async reload(){return this._module=await this._load(),this._module}}},14113(e,t,r){r.d(t,{N5:()=>a});var i=r(49186),n=(r(44208),r(53966));const o=()=>n.A.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class s{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class a extends s{constructor(){super(...arguments),this.vertex=new d,this.fragment=new d,this.attributes=new h,this.varyings=new m,this.outputs=new p}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),i=this.varyings.generateSource(e),n="vertex"===e?this.vertex:this.fragment,o=n.uniforms.generateSource(),s=n.code.generateSource(),a=n.main.generateSource(t),l=this.debugName?`// ${this.debugName}\n`:"",c="vertex"===e?v:g,u=n.constants.generateSource(),d=this.outputs.generateSource(e);return`#version 300 es\n${l}\n${c}\n${u.join("\n")}\n${o.join("\n")}\n${r.join("\n")}\n${i.join("\n")}\n${d.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return t=>{for(let n=0;n<i;++n)r[n](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n)=>{for(let o=0;o<i;++o)r[o](e,t,n)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n,o)=>{for(let s=0;s<i;++s)r[s](e,o,t,n)}}}class l{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(e){if(null!=e){if(this._entries.has(e.name)&&!this._entries.get(e.name).equals(e))throw new i.A("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else o().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class c{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(e){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(e)throw new i.A("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class u{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class d extends s{constructor(){super(...arguments),this.uniforms=new l(this),this.main=new c(this),this.code=new u(this),this.constants=new f(this)}get builder(){return this}}class h{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class m{constructor(){this._entries=new Map}add(e,t,r){this._entries.has(e)?o().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:r?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,i)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${i};`)),t}}class p{constructor(){this._entries=new Map}add(e,t,r=0){const i=this._entries.get(r);i?.name!==e||i?.type!==t?this._entries.set(r,{name:e,type:t}):o().warn(`Fragment shader output location ${r} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:p.DEFAULT_NAME,type:p.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class f{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let i="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":i=f._numberToFloatStr(r);break;case"int":i=f._numberToIntStr(r);break;case"uint":i=f._numberToUintStr(r);break;case"bool":i=r.toString();break;case"vec2":i=`vec2(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])})`;break;case"vec3":i=`vec3(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])}, ${f._numberToFloatStr(r[2])})`;break;case"vec4":i=`vec4(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])}, ${f._numberToFloatStr(r[2])}, ${f._numberToFloatStr(r[3])})`;break;case"ivec2":i=`ivec2(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])})`;break;case"ivec3":i=`ivec3(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])}, ${f._numberToIntStr(r[2])})`;break;case"ivec4":i=`ivec4(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])}, ${f._numberToIntStr(r[2])}, ${f._numberToIntStr(r[3])})`;break;case"uvec2":i=`uvec2(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])})`;break;case"uvec3":i=`uvec3(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])}, ${f._numberToUintStr(r[2])})`;break;case"uvec4":i=`uvec4(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])}, ${f._numberToUintStr(r[2])}, ${f._numberToUintStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":i=`${t}(${Array.prototype.map.call(r,e=>f._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${i};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToUintStr(e){return`${e.toFixed(0)}u`}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const g="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",v="precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n "},14314(e,t,r){r.d(t,{I:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",0,(i,n)=>i.setUniform4fv(e,t(n),r))}}},14527(e,t,r){r.d(t,{n:()=>vt});var i=r(31821),n=r(12791),o=r(5482),s=r(34727),a=r(97768),l=r(36708),c=r(78659),u=r(91429),d=r(37585),h=r(69540);let m=class extends h.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"columns",void 0),m=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],m);const p=m;var f=r(69052),g=r(25482),v=r(56507),_=r(86738),x=r(43937),y=r(36005);let w=class extends((0,h.OU)(g.o)){constructor(...e){super(...e),this.position=new _.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new p}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){const n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){const n=e.clone();n.x=(0,v.GB)(e.x||0),n.y=(0,v.GB)(e.y||0),n.z=e.hasZ?(0,v.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){const r=new _.A;return r.read(e,t),r.x=(0,v.GB)(r.x||0),r.y=(0,v.GB)(r.y||0),r.z=r.hasZ?(0,v.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:_.A,json:{write:{isRequired:!0}}})],w.prototype,"position",void 0),(0,o.Cg)([(0,x.K)("position")],w.prototype,"writePosition",null),(0,o.Cg)([(0,y.w)("position")],w.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>f.ie.normalize((0,v.GB)(e)))],w.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e),-180,180))],w.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e,55),1,170))],w.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:p,nonNullable:!0,json:{read:!1,write:!1}})],w.prototype,"layout",void 0),w=(0,o.Cg)([(0,u.$K)("esri.Camera")],w);var b=r(9093),M=r(35522),T=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),A=r(27993),E=r(73941),R=(r(19419),r(71351)),I=r(69622),O=r(53966),F=r(90629),P=r(58083),D=r(48163),N=r(78955),H=r(91829),L=r(82919),B=r(44280);const z=(0,T.vt)(),U=(0,T.vt)();var G;let V=G=class extends I.A{constructor(e){super(e),this._ray=(0,R.vt)(),this._viewport=(0,H.fA)(0,0,1,1),this._padding=(0,H.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,D.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,b.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,b.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,b.vt)(),this._frustumDirty=!0,this._frustum=(0,L.vt)(),this._fullViewport=(0,H.vt)(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,T.vt)(),this._up=(0,T.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin)}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,M.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,P.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const e=(0,N.hs)((0,H.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,N.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;const e=(0,N.hs)((0,H.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,N.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,N.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,N.C)(this._padding,e),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&((0,P.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,P.B8)((0,b.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,b.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,M.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,P.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,P.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){const{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,s=-i/2+this.column*o,a=s+o,l=-r/2+this.row*n,c=l+n,u=(0,P.$h)((0,b.vt)(),s*(1+2*this._padding[3]/e),a*(1+2*this._padding[1]/e),l*(1+2*this._padding[2]/t),c*(1+2*this._padding[0]/t),this.near,this.far),d=this._get("projectionMatrix");return d&&(0,P.aI)(d,u)?d:u}copyFrom(e){(0,M.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,N.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,N.C)(this._padding,e.padding),this.notifyChange("_padding"),(0,d.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;const t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,P.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||((0,L.C)(this._frustum,e.frustum),this._frustumDirty=!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,P.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),(0,N.C)(this._fullViewport,e.fullViewport),this.pixelRatio=e.pixelRatio,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new G).copyFrom(this)}equals(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&(0,N.t2)(this._viewport,e.viewport)&&(0,N.t2)(this._padding,e.padding)&&(0,d.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}almostEquals(e){const t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,N.hG)(e.screenPadding,this.screenPadding)>=t||(0,N.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,M.jb)(k,e.eye,e.center),(0,M.jb)($,this.eye,this.center);const r=(0,M.Om)(k,$),i=(0,M.uE)(k),n=(0,M.uE)($),o=5e-4;return r*r>=(1-1e-10)*i*n&&(0,M.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDist(e){return e*this.perRenderPixelRatio}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,B.gr)(this.viewForward,(0,M.Re)(k,e,this.eye)))}computeScreenPixelSizeAtDist(e){return e*this.perScreenPixelRatio}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){const t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==j&&(0,M.C)(j,e),j[3]=1,(0,N.Z0)(j,j,this.projectionMatrix);const r=Math.abs(j[3]);(0,M.hs)(j,j,1/r);const i=this.fullViewport;t[0]=(0,s.Cc)(0,i[0]+i[2],.5+.5*j[0]),t[1]=(0,s.Cc)(0,i[1]+i[3],.5+.5*j[1]),t[2]=.5*(j[2]+1),t[3]=r}unapplyProjection(e,t){const r=this.fullViewport;j[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],j[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],j[2]=(2*e[2]-1)*e[3],j[3]=e[3],null!=this.inverseProjectionMatrix&&((0,N.Z0)(j,j,this.inverseProjectionMatrix),t[0]=j[0],t[1]=j[1],t[2]=j[2])}projectToScreen(e,t){return this.projectToRenderScreen(e,Z),this.renderToScreen(Z,t),t}projectToRenderScreen(e,t){if(j[0]=e[0],j[1]=e[1],j[2]=e[2],j[3]=1,(0,N.Z0)(j,j,this.viewProjectionMatrix),0===j[3])return null;const r=j;(0,M.hs)(r,r,1/Math.abs(j[3]));const i=this.fullViewport,n=(0,s.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,s.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,Z),t)}unprojectFromRenderScreen(e,t){if((0,P.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,P.B8)(W,W))return null;const r=this.fullViewport;return j[0]=2*(e[0]-r[0])/r[2]-1,j[1]=2*(e[1]-r[1])/r[3]-1,j[2]=2*e[2]-1,j[3]=1,(0,N.Z0)(j,j,W),0===j[3]?null:(t[0]=j[0]/j[3],t[1]=j[1]/j[3],t[2]=j[2]/j[3],t)}constrainWindowSize(e,t,r,i){const n=e*this.pixelRatio,o=t*this.pixelRatio,s=Math.max(n-r/2,0),a=Math.max(this.fullHeight-o-i/2,0),l=-Math.min(n-r/2,0),c=-Math.min(this.fullHeight-o-i/2,0),u=r-l- -Math.min(this.fullWidth-n-r/2,0),d=i-c- -Math.min(o-i/2,0);return[Math.round(s),Math.round(a),Math.round(u),Math.round(d)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){const r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){const r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){const{center:r,eye:i,distance:n,fovY:o}=this,a=Math.abs(Math.PI/2-function(e,t,r){e.worldUpAtPosition(t,z),(0,M.Re)(U,r,t);const i=(0,M.Bw)(U);return 0===i?0:(0,s.XM)((0,M.Om)(U,z)/i)}(t,r,i));return e.frustumCoverage(a,n,o)}_computeUpGlobal(){(0,M.Re)(k,this.center,this.eye);const e=(0,M.Bw)(this.center);e<1?(0,M.t2)(this._up,T.Cb)&&((0,M.C)(this._up,T.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,M.Om)(k,this.center))>.9999*(0,M.Bw)(k)*e||((0,M.$A)($,k,this.center),(0,M.$A)($,$,k),(0,M.S8)($,$),(0,M.t2)(this._up,$)||((0,M.C)(this._up,$),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,M.oW)(k,this.eye,this.center),Math.abs(k[2])<=.9999&&((0,M.hs)(k,k,k[2]),(0,M.hZ)(k,-k[0],-k[1],1-k[2]),(0,M.S8)(k,k),(0,M.t2)(this._up,k)||((0,M.C)(this._up,k),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r=""){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,M.t2)(e,t)||((0,M.C)(t,e),this._markViewDirty(),r.length&&this.notifyChange(r)):O.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&((0,L.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&((0,P.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"relativeElevation",void 0),V=G=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],V);const j=(0,H.vt)(),W=(0,b.vt)(),k=(0,T.vt)(),$=(0,T.vt)(),Z=(0,F.r_)();r(49718),r(6867),r(16396),(0,T.vt)(),(0,T.vt)(),(0,T.vt)();var q=r(5443),Y=r(39829),X=r(95108);function K(e,t,r,i){const n=function(e,t){const r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=0===r?1:0;return(e,t,s)=>{if(t[r]<i&&s[r]<i)return 1===n?0:1;if(t[r]>i&&s[r]>i)return 1===n?1:0;const a=(s[o]-t[o])/(s[r]-t[r]),l=t[o]+a*(i-t[r]);return e[r]=i,e[o]=l,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(Q,t[0],t[0])&&J(e,t[0]);for(let r=0;r<t.length;r++){const i=t[r===t.length-1?0:r+1];switch(n(Q,t[r],i)){case 1:J(e,i);break;case 3:J(e,(0,D.o8)(Q));break;case 2:J(e,(0,D.o8)(Q)),J(e,i)}}}}function J(e,t){0!==e.length&&(0,d.aI)(e.at(-1),t)||e.push(t)}const Q=(0,D.vt)();var ee=r(11964),te=r(27921);const re=(0,T.vt)(),ie=(0,T.vt)();function ne(){return{direction:(0,T.vt)(),up:(0,T.vt)()}}function oe(e,t,r,i,n){let o=(0,M.S8)(re,e),a=(0,M.Om)(o,i);const l=a>0;a=Math.abs(a),a>.99&&(a=Math.abs((0,M.Om)(t,i)),a<.99?((0,M.C)(o,t),l&&(0,M.hs)(o,o,-1)):o=null);let c=0;if(o){(0,M.hs)(ie,i,(0,M.Om)(i,o)),(0,M.Re)(o,o,ie);const e=(0,M.Om)(o,n)/((0,M.Bw)(o)*(0,M.Bw)(n));(0,M.$A)(ie,o,n),c=((0,M.Om)(ie,i)>0?1:-1)*(0,s.KJ)((0,s.XM)(e))}const u=(0,s.KJ)((0,s.XM)(-(0,M.Om)(i,e)/(0,M.Bw)(e)));return r?(r.heading=c,r.tilt=u,r):{heading:c,tilt:u}}function se(e,t,r,i){(0,M.Re)(ae,r,t),(0,te.T7)(i,(0,ee.LV)(t,ae),e)||e===r||(0,M.C)(e,r)}const ae=(0,T.vt)(),le=(0,T.fA)(0,1,0),ce=(0,T.fA)(0,0,1),ue=(0,b.vt)(),de=(0,T.vt)(),he=(0,T.vt)();function me(e,t,r,i=ne()){const{direction:n,up:o}=i;return(0,P.N9)(ue,-(0,s.kU)(t)),(0,P.eL)(ue,ue,(0,s.kU)(r)),(0,M.Z0)(n,ce,ue),(0,M.hs)(n,n,-1),(0,M.Z0)(o,le,ue),i}function pe(e,t,r,i,n){const o=t.lines[11].direction,s=(n-r.getAltitude(i))/o[2];(0,M.Ln)(e,i,o,s)}const fe=(0,T.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return oe(t,r,i,ce,le)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n=me(0,r,i),o=(0,T.vt)();return(0,M.hs)(o,n.direction,-t),(0,M.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,s.kU)(e)},headingTiltToDirectionUp:me,lookAtTiltToEyeTilt:function(e){return(0,s.KJ)(e)},toArea:function(e,t){const r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,s=e.state.camera.eye,a=[],l=r.planes[5];for(let e=0;e<4;e++){const t=r.lines[e];i.intersectInfiniteManifold((0,R.LV)(t.origin,t.direction),n,fe)||pe(fe,r,i,t.endpoint,n),se(fe,s,fe,l),a.push((0,D.fA)(fe[0],fe[1]))}return function(e,t,r){const i=e.map(e=>((0,M.hZ)(fe,e[0],e[1],0),t.fromRenderCoords(fe,fe,r),[fe[0],fe[1]]));return i.length<=2?new Y.A({spatialReference:r}):(i.push(i[0].slice()),(0,X.$3)(i)||i.reverse(),new Y.A({rings:[i],spatialReference:r}))}(function(e,t){const r=[],i=[];return K(r,e,t,0),K(i,r,t,1),K(r,i,t,2),K(i,r,t,3),i}(a,i.extent),i,o)},toExtent:function(e,t,r,i,n){const o=e.renderSpatialReference,s=e.spatialReference??t.spatialReference;return(0,C.g)(t,de,o),(0,C.g)(t,he,o),de[0]-=r/2,he[0]+=r/2,de[1]-=i/2,he[1]+=i/2,(0,A.F)(de,o,de,s),(0,A.F)(he,o,he,s),n?(n.xmin=de[0],n.ymin=de[1],n.xmax=he[0],n.ymax=he[1],n.spatialReference=s):n=new q.A(de[0],de[1],he[0],he[1],s),n}},Symbol.toStringTag,{value:"Module"}));var ge=r(34304),ve=r(17136),_e=r(94008),xe=r(28735);class ye{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,L.vt)(),this._points=(0,L.Qy)(),this.lines=new Array(12),this._origin=(0,T.vt)(),this._direction=(0,T.vt)(),this._boundingSphere=new _e.iy,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,T.vt)(),endpoint:null}}update(e){(0,L.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,M.C)(this._origin,e.eye),(0,M.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(e){for(let t=0;t<this._points.length;t++)(0,M.C)(this._points[t],e[t]);(0,L.DV)(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(e){return(0,L.m7)(this.frustum,e)}intersectsRay(e){return(0,L.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,L.ST)(this.frustum,e,t)}intersectsPoint(e){return(0,L.bU)(this.frustum,e)}_updateLines(){const e=this._points;for(let t=0;t<4;t++){const r=t+4;we(this.lines[t],e[t],e[r]),we(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),we(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){const{origin:e}=this,t=Me;(0,M.S8)(t,this.direction);const r=be;(0,M.jb)(r,this.points[4],e);const i=.5*(0,M.Om)(r,r)/(0,M.Om)(t,r),n=this._boundingSphere,o=(0,M.Ln)(Te,e,t,i);n.center=o,n.radius=i}static{this.planePointIndices=L.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function we(e,t,r){e.origin=t,e.endpoint=r,(0,M.oW)(e.direction,t,r)}const be=(0,T.vt)(),Me=(0,T.vt)(),Te=(0,T.vt)();r(86211);const Se=(0,T.fA)(5802e-9,13558e-9,331e-7),Ce=(0,T.fA)(65e-8*3,5643e-9,255e-9);(0,T.fA)(Se[0]+Ce[0],Se[1]+Ce[1],Se[2]+Ce[2]);class Ae{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ae(0,0)}static{this.Infinite=new Ae}}(0,T.vt)(),(0,T.vt)(),new _e.iy,(0,R.vt)(),new q.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Ee=r(32728);const Re=(0,T.fA)(0,0,1),Ie=(0,M.S8)((0,T.vt)(),(0,T.fA)(1,1,1)),Oe=(0,b.vt)(),Fe=(0,T.vt)(),Pe=(0,T.vt)();function De(e,t,r,i=ne()){(0,M.$A)(Fe,e,Re),0===(0,M.Om)(Fe,Fe)&&(0,M.$A)(Fe,e,Ie),(0,P.$0)(Oe,-(0,s.kU)(t),e),(0,P.e$)(Oe,Oe,-(0,s.kU)(r),Fe);const{up:n,direction:o}=i;return(0,M.$A)(n,Fe,e),(0,M.S8)(n,n),(0,M.Z0)(n,n,Oe),(0,M.S8)(o,e),(0,M.ze)(o,o),(0,M.Z0)(o,o,Oe),i}function Ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function He(e,t){const r=De(t,e.heading,e.tilt);return e.up=r.up,e}function Le(e,t){const r=[],i=[],n=(0,ge.FD)();for(let o=0;o<e.length;o++){const s=e[o],a=o===e.length-1?e[0]:e[o+1],l=(0,ee.Cr)(s,a,ke),c=(0,te.vE)(t,l.origin,l.vector,0,je);switch(c){case 2:r.push(s);break;case 3:i.push(s);break;case 0:case 1:{const[e,o,a]=0===c?[1,r,i]:[-1,i,r],l=(0,te.Qj)(t),u=(0,M.Ln)((0,T.vt)(),je,l,e*n),d=(0,M.Ln)((0,T.vt)(),je,l,e*-n);o.push(s),o.push(u),a.push(d)}}}const o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const Be={minCurvature:(0,s.kU)(5),maxCurvature:(0,s.kU)(50),minSamples:1,maxSamples:6},ze=(0,T.fA)(1,0,0),Ue=(0,T.fA)(0,1,0),Ge=(0,T.vt)(),Ve=(0,T.vt)(),je=(0,T.vt)(),We=new _e.iy,ke=(0,ee.vt)(),$e=(0,H.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){const n=Fe,o=Pe;return(0,M.S8)(n,e),(0,M.$A)(Pe,n,Re),0===(0,M.Om)(Pe,Pe)&&(0,M.$A)(Pe,n,Ie),(0,M.$A)(o,Pe,n),oe(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n={eye:(0,T.vt)(),up:null,tilt:i,heading:r},o=Fe;o[0]=e[0],o[1]=e[2],o[2]=-e[1];const a=t,l=(0,s.kU)(r),c=(0,s.kU)(i),u=Math.sin(l),d=Math.cos(l),h=Math.sin(c),m=Math.cos(c),p=(0,M.Bw)(o);let f;if(Math.abs(c)<1e-8)f=a+p;else{const e=p/h,t=(0,s.YN)(a/e),r=Math.PI-c-t;f=e*Math.sin(r)}const g=m*a,v=a*a*(h*h),_=d*d*v,x=f-g,y=x*x,w=_*(_+y-o[1]*o[1]);if(w<0)return(0,M.hs)(n.eye,o,f/p),n.tilt=0,He(n,e);const b=Math.sqrt(w),S=o[1]*x,C=_+y;let A;if(A=d>0?-b+S:b+S,Math.abs(C)<1e-8)return p<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=a):(0,M.hs)(n.eye,o,f/p),n.tilt=0,Ne(n.eye),He(n,e);n.eye[1]=A/C;const E=u*u*v,R=h*a,I=d*R*n.eye[1],O=n.eye[1]*n.eye[1],F=1-O,P=Math.sqrt(F),D=_*O+E-2*I*P*x+F*y;return Math.abs(D)<1e-8?((0,M.hs)(n.eye,o,f/p),n.tilt=0,Ne(n.eye),He(n,e)):(n.eye[0]=(F*(f*o[0]-g*o[0])-R*P*(o[0]*n.eye[1]*d+o[2]*u))/D,n.eye[2]=(F*(f*o[2]-g*o[2])-R*P*(o[2]*n.eye[1]*d-o[0]*u))/D,(0,M.hs)(n.eye,n.eye,f),Ne(n.eye),He(n,e))},eyeTiltToLookAtTilt:function(e,t,r){const i=(0,s.kU)(e),n=(0,M.Bw)(t);return(0,s.YN)(r/(n/Math.sin(i)))+i},headingTiltToDirectionUp:De,lookAtTiltToEyeTilt:function(e,t,r){const i=(0,M.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,s.YN)(r/(n/Math.sin(e)));return(0,s.KJ)(e-o)},toArea:function(e,t){const{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new ye(r);i.near=2,n.update(i);const o=r.getAltitude(t),a=e.spatialReference,l=r.referenceEllipsoid.radius,c=i.eye,u=1+(0,M.Io)(c,t)/(l+o),d=Math.sqrt(u*u-1),{minCurvature:h,maxCurvature:m,minSamples:p,maxSamples:f}=Be,g=function(e){const{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return We.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(We,t)}(e),v=(0,s.qE)((d-h)/(m-h),0,1),_=Math.round((0,s.Cc)(p,f,v)),x=i.aboveGround,y=n.planes[5],w=[],b=(0,te.O_)(T.uY,ze,(0,te.vt)()),S=(0,te.O_)(T.uY,Ue,(0,te.vt)());(0,N.hZ)($e,0,0,0,0);const C=e=>{};for(let e=0;e<4;e++){const t=1===e&&!x||3===e&&x?1-g:0,i=1===e&&x||3===e&&!x?g:1,a=n.lines[e],l=n.lines[3===e?0:e+1];for(let n=0;n<_;n++){const u=n/_,d=0===n?0:(0,s.Cc)(t,i,1===e?1-(1-u)**2:3===e?u**2:u),h=(0,M.Cc)(Ve,a.origin,l.origin,d),m=(0,Ee.nu)(a.direction,l.direction,d,Ge);r.intersectManifoldClosestSilhouette((0,R.LV)(h,m),o,je),se(je,c,je,y),w.push((0,T.o8)(je)),0!==w.length&&C((0,M.lo)(w.at(-1),je));const p=((0,te.Tj)(b,je)?1:0)|((0,te.Tj)(S,je)?2:0);$e[p]=1}}w.length>2&&(0,M.lo)(w[0],w.at(-1));const A=function(e,t,r){const i=2*(0,ge.FD)();return e.map(e=>{const n=[];let o=!1;for(const s of e)t.fromRenderCoords(s,je,r),Math.abs(s[0])<i&&Math.abs(s[1])<i?(n.push([null,je[1]]),n.push([null,je[1]]),o=!0):n.push([je[0],je[1]]);if(o)for(let e=0;e<n.length;e++){const t=n[e];if(null!=t[0])continue;const r=n[e+1],i=n.at(0===e?-1:e-1);t[0]=i[0],e++;const o=n.at(e===n.length-1?0:e+1);r[0]=o[0]}return n.push(n[0]),(0,X.$3)(n)||n.reverse(),n})}((0,N.m3)($e)>1?function(e,t){const r=[];for(const i of e)r.push(...Le(i,t));return r}(Le(w,b),S):[w],r,a);return new Y.A({rings:A,spatialReference:a})},toExtent:function(e,t,r,i,n){let o,a,l,c;const u=t.latitude,d=(0,E.tO)(e.spatialReference).radius,h=t.longitude,m=function(e,t,r){const i=t/r,n=(0,s.kU)(e),o=Math.sin(i/2),a=Math.cos(n),l=2*(0,s.YN)(Math.sqrt(o*o/(a*a)));return(0,s.KJ)(l)}(u,r,d)/2;o=h-m,a=h+m;const p=(0,s.kU)(u),g=(1+Math.sin(p))/(1-Math.sin(p)),v=(g+1)*Math.tan(i/d/2),_=v*v;function x(e){const t=Math.PI/2;return(e=f.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(l=1.5*Math.PI-2*Math.atan(.5*(v+Math.sqrt(4*g+_))),c=l+i/d,l=x(l),c=x(c),c<l){const e=c;c=l,l=e}if(l=Math.max((0,s.KJ)(l),-90),c=Math.min((0,s.KJ)(c),90),a=ve.Y_.monotonic(o,a),a-o>180){const e=(a-o-180)/2;o+=e,a-=e}const y=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=l,n.xmax=a,n.ymax=c,n.spatialReference=y):n=new q.A(o,l,a,c,y),e.spatialReference&&e.spatialReference.isWebMercator&&(0,xe.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const Ze="composite-color",qe=["final-color",Ze,"opaque-color","transparent-color"],Ye={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_DEPTH:"cutfill-depth",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian-splat",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserline-color",MAGNIFIER:"magnifier-color",OCCLUDED:"occluded-color",OPAQUE_ENVIRONMENT:"opaque-environment-color",OPAQUE_TERRAIN:"opaque-terrain-color",SSAO:"ssao",TRANSPARENT_ENVIRONMENT:"transparent-environment-color",VIEWSHED:"viewshed-color"};Array.from(Object.values(Ye)).concat(qe),(0,T.vt)();var Xe=r(49186),Ke=r(10107),Je=r(64108);let Qe=class extends I.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=Ze,this.requireGeometryDepth=!1,this._dirty=!0}initialize(){this.addHandles([(0,l.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},l.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Xe.A("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return t.fbo?.initializeAndBind(),t}bindRenderTarget(){return this._frameBuffer?.fbo?.initializeAndBind(),this._frameBuffer}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}};(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],Qe.prototype,"view",void 0),(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],Qe.prototype,"consumes",void 0),(0,o.Cg)([(0,Ke.MZ)()],Qe.prototype,"produces",void 0),(0,o.Cg)([(0,Ke.MZ)({readOnly:!0})],Qe.prototype,"techniques",null),Qe=(0,o.Cg)([(0,Je.$)("esri.views.3d.webgl.RenderNode")],Qe);var et=r(15581),tt=r(13840),rt=r(42958),it=r(95774),nt=r(90644);let ot=class extends rt.w{constructor(){super(...arguments),this.shader=new tt.r(it.S,()=>r.e(1285).then(r.bind(r,91285)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};ot=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],ot);var st=r(65786);class at extends st.Y{constructor(){super(...arguments),this.projScale=1}}class lt extends at{constructor(){super(...arguments),this.intensity=1}}class ct extends st.Y{}class ut extends ct{constructor(){super(...arguments),this.blurSize=(0,D.vt)()}}let dt=class extends rt.w{constructor(){super(...arguments),this.shader=new tt.r(et.S,()=>r.e(6122).then(r.bind(r,86122)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};dt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],dt);var ht=r(63907),mt=r(76284),pt=r(67171);let ft=class extends Qe{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=Ye.SSAO,this.isEnabled=()=>!1,this._enableTime=(0,c.l5)(0),this._passParameters=new lt,this._drawParameters=new ut}initialize(){const e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),e=>e.charCodeAt(0)),t=new pt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new mt.A(this.renderingContext,t,e),this.techniques.precompile(dt),this.techniques.precompile(ot),this.addHandles((0,l.wB)(()=>this.isEnabled(),()=>this._enableTime=(0,c.l5)(0)))}destroy(){this._passParameters.noiseTexture=(0,a.WD)(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(ht.nI);if(!r||!i)return;const n=this.techniques.get(dt),o=this.techniques.get(ot);if(!n.compiled||!o.compiled)return this._enableTime=(0,c.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,c.l5)(performance.now()));const a=this.renderingContext,l=this.view.qualitySettings.fadeDuration,u=this.bindParameters,h=u.camera,m=h.relativeElevation,p=(0,s.qE)((5e5-m)/2e5,0,1),f=l>0?Math.min(l,performance.now()-this._enableTime)/l:1,g=f*p;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/h.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*gt/(0,et.g)(h)**6*g;const v=h.fullViewport[2],_=h.fullViewport[3],x=this.fboCache.acquire(v,_,"ssao input",2);a.bindFramebuffer(x.fbo),a.setViewport(0,0,v,_),a.bindTechnique(n,u,this._passParameters,this._drawParameters),a.screen.draw();const y=Math.round(v/2),w=Math.round(_/2),b=this.fboCache.acquire(y,w,"ssao blur",0);a.bindFramebuffer(b.fbo),this._drawParameters.colorTexture=x.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,0,2/_),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),x.release();const M=this.fboCache.acquire(y,w,Ye.SSAO,0);return a.bindFramebuffer(M.fbo),a.setViewport(0,0,v,_),a.setClearColor(1,1,1,0),a.clear(16384),this._drawParameters.colorTexture=b.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,2/v,0),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),a.setViewport4fv(h.fullViewport),b.release(),f<1&&this.requestRender(2),M}};(0,o.Cg)([(0,u.MZ)()],ft.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],ft.prototype,"produces",void 0),(0,o.Cg)([(0,u.MZ)({constructOnly:!0})],ft.prototype,"isEnabled",void 0),ft=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],ft);const gt=.5;function vt(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
135
+ }`))}},11964(e,t,r){r.d(t,{Cr:()=>u,LV:()=>c,_I:()=>d,vt:()=>l});var i=r(34727),n=r(4341),o=r(35522),s=r(51850),a=r(32114);function l(e){return e?{origin:(0,s.o8)(e.origin),vector:(0,s.o8)(e.vector)}:{origin:(0,s.vt)(),vector:(0,s.vt)()}}function c(e,t){const r=h.get();return r.origin=e,r.vector=t,r}function u(e,t,r=l()){return(0,o.C)(r.origin,e),(0,o.Re)(r.vector,t,e),r}function d(e,t,r){return function(e,t,r,n,s){const{vector:l,origin:c}=e,u=(0,o.Re)(a.rq.get(),t,c),d=(0,o.Om)(l,u)/(0,o.m3)(l);return(0,o.hs)(s,l,(0,i.qE)(d,0,1)),(0,o.WQ)(s,s,e.origin)}(e,t,0,0,r)}(0,s.vt)(),(0,s.vt)();const h=new n.I(()=>l())},12791(e,t,r){r.d(t,{x:()=>n});var i=r(74333);class n extends i.n{constructor(e,t){super(e,"sampler2D",0,(r,i)=>r.bindTexture(e,t(i)))}}},13840(e,t,r){r.d(t,{r:()=>i});class i{constructor(e,t){this._module=e,this._load=t}get(){return this._module}async reload(){return this._module=await this._load(),this._module}}},14113(e,t,r){r.d(t,{N5:()=>a});var i=r(49186),n=(r(44208),r(53966));const o=()=>n.A.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class s{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class a extends s{constructor(){super(...arguments),this.vertex=new d,this.fragment=new d,this.attributes=new h,this.varyings=new m,this.outputs=new p}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),i=this.varyings.generateSource(e),n="vertex"===e?this.vertex:this.fragment,o=n.uniforms.generateSource(),s=n.code.generateSource(),a=n.main.generateSource(t),l=this.debugName?`// ${this.debugName}\n`:"",c="vertex"===e?v:g,u=n.constants.generateSource(),d=this.outputs.generateSource(e);return`#version 300 es\n${l}\n${c}\n${u.join("\n")}\n${o.join("\n")}\n${r.join("\n")}\n${i.join("\n")}\n${d.join("\n")}\n${s.join("\n")}\n${a.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return t=>{for(let n=0;n<i;++n)r[n](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n)=>{for(let o=0;o<i;++o)r[o](e,t,n)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),i=r.length;return(t,n,o)=>{for(let s=0;s<i;++s)r[s](e,o,t,n)}}}class l{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(e){if(null!=e){if(this._entries.has(e.name)&&!this._entries.get(e.name).equals(e))throw new i.A("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${e.name} for different uniform type`);this._entries.set(e.name,e)}else o().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class c{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(e){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(e)throw new i.A("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class u{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class d extends s{constructor(){super(...arguments),this.uniforms=new l(this),this.main=new c(this),this.code=new u(this),this.constants=new f(this)}get builder(){return this}}class h{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class m{constructor(){this._entries=new Map}add(e,t,r){this._entries.has(e)?o().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:r?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,i)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${i};`)),t}}class p{constructor(){this._entries=new Map}add(e,t,r=0){const i=this._entries.get(r);i?.name!==e||i?.type!==t?this._entries.set(r,{name:e,type:t}):o().warn(`Fragment shader output location ${r} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:p.DEFAULT_NAME,type:p.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class f{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let i="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":i=f._numberToFloatStr(r);break;case"int":i=f._numberToIntStr(r);break;case"uint":i=f._numberToUintStr(r);break;case"bool":i=r.toString();break;case"vec2":i=`vec2(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])})`;break;case"vec3":i=`vec3(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])}, ${f._numberToFloatStr(r[2])})`;break;case"vec4":i=`vec4(${f._numberToFloatStr(r[0])}, ${f._numberToFloatStr(r[1])}, ${f._numberToFloatStr(r[2])}, ${f._numberToFloatStr(r[3])})`;break;case"ivec2":i=`ivec2(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])})`;break;case"ivec3":i=`ivec3(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])}, ${f._numberToIntStr(r[2])})`;break;case"ivec4":i=`ivec4(${f._numberToIntStr(r[0])}, ${f._numberToIntStr(r[1])}, ${f._numberToIntStr(r[2])}, ${f._numberToIntStr(r[3])})`;break;case"uvec2":i=`uvec2(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])})`;break;case"uvec3":i=`uvec3(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])}, ${f._numberToUintStr(r[2])})`;break;case"uvec4":i=`uvec4(${f._numberToUintStr(r[0])}, ${f._numberToUintStr(r[1])}, ${f._numberToUintStr(r[2])}, ${f._numberToUintStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":i=`${t}(${Array.prototype.map.call(r,e=>f._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${i};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToUintStr(e){return`${e.toFixed(0)}u`}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const g="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",v="precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n "},14314(e,t,r){r.d(t,{I:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec4",0,(i,n)=>i.setUniform4fv(e,t(n),r))}}},14527(e,t,r){r.d(t,{n:()=>vt});var i=r(31821),n=r(12791),o=r(5482),s=r(34727),a=r(97768),l=r(36708),c=r(78659),u=r(91429),d=r(37585),h=r(69540);let m=class extends h.Pw{constructor(e){super(e),this.row=0,this.column=0,this.rows=1,this.columns=1}equals(e){return null!=e&&this.row===e.row&&this.rows===e.rows&&this.column===e.column&&this.columns===e.columns}};(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"rows",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{read:!1,write:!1}})],m.prototype,"columns",void 0),m=(0,o.Cg)([(0,u.$K)("esri.CameraLayout")],m);const p=m;var f=r(69052),g=r(25482),v=r(56507),_=r(86738),x=r(43937),y=r(36005);let w=class extends((0,h.OU)(g.o)){constructor(...e){super(...e),this.position=new _.A([0,0,0]),this.heading=0,this.tilt=0,this.fov=55,this.layout=new p}normalizeCtorArgs(e,t,r,i){if(e&&"object"==typeof e&&("x"in e||Array.isArray(e))){const n={position:e};return null!=t&&(n.heading=t),null!=r&&(n.tilt=r),null!=i&&(n.fov=i),n}return e}writePosition(e,t,r,i){const n=e.clone();n.x=(0,v.GB)(e.x||0),n.y=(0,v.GB)(e.y||0),n.z=e.hasZ?(0,v.GB)(e.z||0):e.z,t[r]=n.write({},i)}readPosition(e,t){const r=new _.A;return r.read(e,t),r.x=(0,v.GB)(r.x||0),r.y=(0,v.GB)(r.y||0),r.z=r.hasZ?(0,v.GB)(r.z||0):r.z,r}equals(e){return null!=e&&this.tilt===e.tilt&&this.heading===e.heading&&this.fov===e.fov&&this.position.equals(e.position)&&this.layout.equals(e.layout)}};(0,o.Cg)([(0,u.MZ)({type:_.A,json:{write:{isRequired:!0}}})],w.prototype,"position",void 0),(0,o.Cg)([(0,x.K)("position")],w.prototype,"writePosition",null),(0,o.Cg)([(0,y.w)("position")],w.prototype,"readPosition",null),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>f.ie.normalize((0,v.GB)(e)))],w.prototype,"heading",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{write:{isRequired:!0}}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e),-180,180))],w.prototype,"tilt",void 0),(0,o.Cg)([(0,u.MZ)({type:Number,nonNullable:!0,json:{default:55,write:!0}}),(0,u.wg)(e=>(0,s.qE)((0,v.GB)(e,55),1,170))],w.prototype,"fov",void 0),(0,o.Cg)([(0,u.MZ)({type:p,nonNullable:!0,json:{read:!1,write:!1}})],w.prototype,"layout",void 0),w=(0,o.Cg)([(0,u.$K)("esri.Camera")],w);var b=r(9093),M=r(35522),T=r(51850),S=r(16930),C=(r(48353),r(9762),r(65806)),A=r(27993),E=r(73941),R=(r(19419),r(71351)),I=r(69622),O=r(53966),F=r(90629),P=r(58083),D=r(48163),N=r(78955),H=r(91829),L=r(82919),B=r(44280);const z=(0,T.vt)(),U=(0,T.vt)();var G;let V=G=class extends I.A{constructor(e){super(e),this._ray=(0,R.vt)(),this._viewport=(0,H.fA)(0,0,1,1),this._padding=(0,H.fA)(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=(0,D.fA)(1,1e3),this._viewDirty=!0,this._viewMatrix=(0,b.vt)(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=(0,b.vt)(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=(0,b.vt)(),this._frustumDirty=!0,this._frustum=(0,L.vt)(),this._fullViewport=(0,H.vt)(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=(0,T.vt)(),this._up=(0,T.vt)(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(e){this._pixelRatio=e>0?e:1}get rows(){return this._rows}set rows(e){this._rows=Math.max(1,e)}get columns(){return this._columns}set columns(e){this._columns=Math.max(1,e)}get eye(){return this._ray.origin}set eye(e){this._compareAndSetView(e,this._ray.origin)}get center(){return this._center}set center(e){this._compareAndSetView(e,this._center,"_center")}get ray(){return(0,M.Re)(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(e){this._compareAndSetView(e,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(e){(0,P.C)(this._viewMatrix,e),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),(0,M.hZ)((0,T.vt)(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(e){this._nearFar[0]!==e&&(this._nearFar[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(e){this._nearFar[1]!==e&&(this._nearFar[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(e){this.x=e[0],this.y=e[1],this.width=e[2],this.height=e[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const e=(0,N.hs)((0,H.vt)(),this._viewport,1/this.pixelRatio),t=this._get("screenViewport");return t&&(0,N.aI)(e,t)?t:e}get screenPadding(){if(1===this.pixelRatio)return this._padding;const e=(0,N.hs)((0,H.vt)(),this._padding,1/this.pixelRatio),t=this._get("screenPadding");return t&&(0,N.aI)(e,t)?t:e}get x(){return this._viewport[0]}set x(e){e+=this._padding[3],this._viewport[0]!==e&&(this._viewport[0]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(e){e+=this._padding[2],this._viewport[1]!==e&&(this._viewport[1]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(e){this._viewport[2]!==e&&(this._viewport[2]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(e){this._viewport[3]!==e&&(this._viewport[3]=e,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(e){this.width=e-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(e){this.height=e-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(e){(0,N.t2)(this._padding,e)||(this._viewport[0]+=e[3]-this._padding[3],this._viewport[1]+=e[2]-this._padding[2],this._viewport[2]-=e[1]+e[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=e[0]+e[2]-(this._padding[0]+this._padding[2]),(0,N.C)(this._padding,e),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&((0,P.lw)(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return(0,P.B8)((0,b.vt)(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||(0,b.vt)()}get fov(){return this._fov}set fov(e){this._fov=e,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(t*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovX(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/t)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return e=this._fov,t=this.width,r=this.height,2*Math.atan(r*Math.tan(.5*e)/Math.sqrt(t*t+r*r));var e,t,r}set fovY(e){this._fov=function(e,t,r){return 2*Math.atan(Math.sqrt(t*t+r*r)*Math.tan(.5*e)/r)}(e,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return(0,M.Io)(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&((0,P.B8)(this._viewInverseTransposeMatrix,this.viewMatrix),(0,P.mg)(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(e){const{near:t,far:r}=this;return 2*t*r/(r+t-e*(r-t))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const e=this.width,t=this.height,r=this.near*Math.tan(this.fovY/2)*2,i=r*this._aspect,n=r/this.rows,o=i/this.columns,s=-i/2+this.column*o,a=s+o,l=-r/2+this.row*n,c=l+n,u=(0,P.$h)((0,b.vt)(),s*(1+2*this._padding[3]/e),a*(1+2*this._padding[1]/e),l*(1+2*this._padding[2]/t),c*(1+2*this._padding[0]/t),this.near,this.far),d=this._get("projectionMatrix");return d&&(0,P.aI)(d,u)?d:u}copyFrom(e){(0,M.C)(this._ray.origin,e.eye),this.center=e.center,this.up=e.up,(0,N.C)(this._viewport,e.viewport),this.notifyChange("_viewport"),(0,N.C)(this._padding,e.padding),this.notifyChange("_padding"),(0,d.C)(this._nearFar,e.nearFar),this.notifyChange("_nearFar"),this._fov=e.fov,this.row=e.row,this.column=e.column,this.rows=e.rows,this.columns=e.columns,this.relativeElevation=e.relativeElevation;const t=e;return this._viewDirty=t._viewDirty,this._viewDirty||((0,P.C)(this._viewMatrix,e.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=t._frustumDirty,this._frustumDirty||((0,L.C)(this._frustum,e.frustum),this._frustumDirty=!1),t._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:((0,P.C)(this._viewInverseTransposeMatrix,e.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),(0,N.C)(this._fullViewport,e.fullViewport),this.pixelRatio=e.pixelRatio,this}copyViewFrom(e){this.eye=e.eye,this.center=e.center,this.up=e.up,this.fov=e.fov}clone(){return(new G).copyFrom(this)}equals(e){return(0,M.t2)(this.eye,e.eye)&&(0,M.t2)(this.center,e.center)&&(0,M.t2)(this.up,e.up)&&(0,N.t2)(this._viewport,e.viewport)&&(0,N.t2)(this._padding,e.padding)&&(0,d.t2)(this.nearFar,e.nearFar)&&this._fov===e.fov&&this.pixelRatio===e.pixelRatio&&this.relativeElevation===e.relativeElevation&&this.row===e.row&&this.column===e.column&&this.rows===e.rows&&this.columns===e.columns}almostEquals(e){const t=Math.max(1,1/this.pixelRatio,1/e.pixelRatio);if(Math.abs(e.fov-this._fov)>=.001||(0,N.hG)(e.screenPadding,this.screenPadding)>=t||(0,N.hG)(this.screenViewport,e.screenViewport)>=t||this.row!==e.row||this.column!==e.column||this.rows!==e.rows||this.columns!==e.columns)return!1;(0,M.jb)(k,e.eye,e.center),(0,M.jb)(Z,this.eye,this.center);const r=(0,M.Om)(k,Z),i=(0,M.uE)(k),n=(0,M.uE)(Z),o=5e-4;return r*r>=(1-1e-10)*i*n&&(0,M.lo)(e.eye,this.eye)<Math.max(i,n)*o*o}computeRenderPixelSizeAt(e){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(e))}computeRenderPixelSizeAtDist(e){return e*this.perRenderPixelRatio}computeScreenPixelSizeAt(e){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(e))}_viewDirectionDistance(e){return Math.abs((0,B.gr)(this.viewForward,(0,M.Re)(k,e,this.eye)))}computeScreenPixelSizeAtDist(e){return e*this.perScreenPixelRatio}computeDistanceFromRadius(e,t){return e/Math.tan(Math.min(this.fovX,this.fovY)/(2*(t||1)))}getScreenCenter(e=(0,F.gs)()){return e[0]=(this.padding[3]+this.width/2)/this.pixelRatio,e[1]=(this.padding[0]+this.height/2)/this.pixelRatio,e}getRenderCenter(e,t=.5,r=.5){return e[0]=this.padding[3]+this.width*t,e[1]=this.padding[2]+this.height*r,e[2]=.5,e}setGLViewport(e){const t=this.viewport,r=this.padding;e.setViewport(t[0]-r[3],t[1]-r[2],t[2]+r[1]+r[3],t[3]+r[0]+r[2])}applyProjection(e,t){e!==j&&(0,M.C)(j,e),j[3]=1,(0,N.Z0)(j,j,this.projectionMatrix);const r=Math.abs(j[3]);(0,M.hs)(j,j,1/r);const i=this.fullViewport;t[0]=(0,s.Cc)(0,i[0]+i[2],.5+.5*j[0]),t[1]=(0,s.Cc)(0,i[1]+i[3],.5+.5*j[1]),t[2]=.5*(j[2]+1),t[3]=r}unapplyProjection(e,t){const r=this.fullViewport;j[0]=(e[0]/(r[0]+r[2])*2-1)*e[3],j[1]=(e[1]/(r[1]+r[3])*2-1)*e[3],j[2]=(2*e[2]-1)*e[3],j[3]=e[3],null!=this.inverseProjectionMatrix&&((0,N.Z0)(j,j,this.inverseProjectionMatrix),t[0]=j[0],t[1]=j[1],t[2]=j[2])}projectToScreen(e,t){return this.projectToRenderScreen(e,$),this.renderToScreen($,t),t}projectToRenderScreen(e,t){if(j[0]=e[0],j[1]=e[1],j[2]=e[2],j[3]=1,(0,N.Z0)(j,j,this.viewProjectionMatrix),0===j[3])return null;const r=j;(0,M.hs)(r,r,1/Math.abs(j[3]));const i=this.fullViewport,n=(0,s.Cc)(0,i[0]+i[2],.5+.5*r[0]),o=(0,s.Cc)(0,i[1]+i[3],.5+.5*r[1]);return"x"in t?(t.x=n,t.y=o):(t[0]=n,t[1]=o,t.length>2&&(t[2]=.5*(r[2]+1))),t}unprojectFromScreen(e,t){return this.unprojectFromRenderScreen(this.screenToRender(e,$),t)}unprojectFromRenderScreen(e,t){if((0,P.lw)(W,this.projectionMatrix,this.viewMatrix),!(0,P.B8)(W,W))return null;const r=this.fullViewport;return j[0]=2*(e[0]-r[0])/r[2]-1,j[1]=2*(e[1]-r[1])/r[3]-1,j[2]=2*e[2]-1,j[3]=1,(0,N.Z0)(j,j,W),0===j[3]?null:(t[0]=j[0]/j[3],t[1]=j[1]/j[3],t[2]=j[2]/j[3],t)}constrainWindowSize(e,t,r,i){const n=e*this.pixelRatio,o=t*this.pixelRatio,s=Math.max(n-r/2,0),a=Math.max(this.fullHeight-o-i/2,0),l=-Math.min(n-r/2,0),c=-Math.min(this.fullHeight-o-i/2,0),u=r-l- -Math.min(this.fullWidth-n-r/2,0),d=i-c- -Math.min(o-i/2,0);return[Math.round(s),Math.round(a),Math.round(u),Math.round(d)]}computeUp(e){1===e?this._computeUpGlobal():this._computeUpLocal()}screenToRender(e,t){const r=e[0]*this.pixelRatio,i=this.fullHeight-e[1]*this.pixelRatio;return t[0]=r,t[1]=i,t}renderToScreen(e,t){const r=e[0]/this.pixelRatio,i=(this.fullHeight-e[1])/this.pixelRatio;t[0]=r,t[1]=i}sphereFrustumCoverage(e,t){const{center:r,eye:i,distance:n,fovY:o}=this,a=Math.abs(Math.PI/2-function(e,t,r){e.worldUpAtPosition(t,z),(0,M.Re)(U,r,t);const i=(0,M.Bw)(U);return 0===i?0:(0,s.XM)((0,M.Om)(U,z)/i)}(t,r,i));return e.frustumCoverage(a,n,o)}_computeUpGlobal(){(0,M.Re)(k,this.center,this.eye);const e=(0,M.Bw)(this.center);e<1?(0,M.t2)(this._up,T.Cb)&&((0,M.C)(this._up,T.Cb),this._markViewDirty(),this.notifyChange("_up")):Math.abs((0,M.Om)(k,this.center))>.9999*(0,M.Bw)(k)*e||((0,M.$A)(Z,k,this.center),(0,M.$A)(Z,Z,k),(0,M.S8)(Z,Z),(0,M.t2)(this._up,Z)||((0,M.C)(this._up,Z),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){(0,M.oW)(k,this.eye,this.center),Math.abs(k[2])<=.9999&&((0,M.hs)(k,k,k[2]),(0,M.hZ)(k,-k[0],-k[1],1-k[2]),(0,M.S8)(k,k),(0,M.t2)(this._up,k)||((0,M.C)(this._up,k),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(e,t,r=""){"number"==typeof e[0]&&isFinite(e[0])&&"number"==typeof e[1]&&isFinite(e[1])&&"number"==typeof e[2]&&isFinite(e[2])?(0,M.t2)(e,t)||((0,M.C)(t,e),this._markViewDirty(),r.length&&this.notifyChange(r)):O.A.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&((0,L.ui)(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&((0,P.t5)(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewport",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_padding",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_fov",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_nearFar",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewDirty",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_viewMatrix",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_pixelRatio",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"pixelRatio",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"row",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"column",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_rows",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"rows",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_columns",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"columns",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"eye",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"center",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_center",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"up",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"_up",void 0),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewForward",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewUp",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"viewRight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"nearFar",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"near",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"far",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"screenViewport",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"screenPadding",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"x",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"y",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"width",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"height",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fullWidth",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fullHeight",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"_aspect",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"padding",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"projectionMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"inverseProjectionMatrix",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fov",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fovX",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"fovY",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"viewInverseTransposeMatrix",null),(0,o.Cg)([(0,u.MZ)({readOnly:!0})],V.prototype,"_projectionMatrixInternal",null),(0,o.Cg)([(0,u.MZ)()],V.prototype,"relativeElevation",void 0),V=G=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl.RenderCamera")],V);const j=(0,H.vt)(),W=(0,b.vt)(),k=(0,T.vt)(),Z=(0,T.vt)(),$=(0,F.r_)();r(49718),r(6867),r(16396),(0,T.vt)(),(0,T.vt)(),(0,T.vt)();var q=r(5443),Y=r(39829),X=r(95108);function K(e,t,r,i){const n=function(e,t){const r=0===t||2===t?0:1,i=e[t],n=0===t||1===t?1:-1,o=0===r?1:0;return(e,t,s)=>{if(t[r]<i&&s[r]<i)return 1===n?0:1;if(t[r]>i&&s[r]>i)return 1===n?1:0;const a=(s[o]-t[o])/(s[r]-t[r]),l=t[o]+a*(i-t[r]);return e[r]=i,e[o]=l,(t[r]<i?1:-1)*n>0?2:3}}(r,i);if(e.length=0,t.length){1===n(Q,t[0],t[0])&&J(e,t[0]);for(let r=0;r<t.length;r++){const i=t[r===t.length-1?0:r+1];switch(n(Q,t[r],i)){case 1:J(e,i);break;case 3:J(e,(0,D.o8)(Q));break;case 2:J(e,(0,D.o8)(Q)),J(e,i)}}}}function J(e,t){0!==e.length&&(0,d.aI)(e.at(-1),t)||e.push(t)}const Q=(0,D.vt)();var ee=r(11964),te=r(27921);const re=(0,T.vt)(),ie=(0,T.vt)();function ne(){return{direction:(0,T.vt)(),up:(0,T.vt)()}}function oe(e,t,r,i,n){let o=(0,M.S8)(re,e),a=(0,M.Om)(o,i);const l=a>0;a=Math.abs(a),a>.99&&(a=Math.abs((0,M.Om)(t,i)),a<.99?((0,M.C)(o,t),l&&(0,M.hs)(o,o,-1)):o=null);let c=0;if(o){(0,M.hs)(ie,i,(0,M.Om)(i,o)),(0,M.Re)(o,o,ie);const e=(0,M.Om)(o,n)/((0,M.Bw)(o)*(0,M.Bw)(n));(0,M.$A)(ie,o,n),c=((0,M.Om)(ie,i)>0?1:-1)*(0,s.KJ)((0,s.XM)(e))}const u=(0,s.KJ)((0,s.XM)(-(0,M.Om)(i,e)/(0,M.Bw)(e)));return r?(r.heading=c,r.tilt=u,r):{heading:c,tilt:u}}function se(e,t,r,i){(0,M.Re)(ae,r,t),(0,te.T7)(i,(0,ee.LV)(t,ae),e)||e===r||(0,M.C)(e,r)}const ae=(0,T.vt)(),le=(0,T.fA)(0,1,0),ce=(0,T.fA)(0,0,1),ue=(0,b.vt)(),de=(0,T.vt)(),he=(0,T.vt)();function me(e,t,r,i=ne()){const{direction:n,up:o}=i;return(0,P.N9)(ue,-(0,s.kU)(t)),(0,P.eL)(ue,ue,(0,s.kU)(r)),(0,M.Z0)(n,ce,ue),(0,M.hs)(n,n,-1),(0,M.Z0)(o,le,ue),i}function pe(e,t,r,i,n){const o=t.lines[11].direction,s=(n-r.getAltitude(i))/o[2];(0,M.Ln)(e,i,o,s)}const fe=(0,T.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){return oe(t,r,i,ce,le)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n=me(0,r,i),o=(0,T.vt)();return(0,M.hs)(o,n.direction,-t),(0,M.WQ)(o,o,e),{up:n.up,eye:o,heading:r,tilt:i}},eyeTiltToLookAtTilt:function(e){return(0,s.kU)(e)},headingTiltToDirectionUp:me,lookAtTiltToEyeTilt:function(e){return(0,s.KJ)(e)},toArea:function(e,t){const r=e.frustum,{renderCoordsHelper:i}=e,n=i.getAltitude(t),o=e.spatialReference,s=e.state.camera.eye,a=[],l=r.planes[5];for(let e=0;e<4;e++){const t=r.lines[e];i.intersectInfiniteManifold((0,R.LV)(t.origin,t.direction),n,fe)||pe(fe,r,i,t.endpoint,n),se(fe,s,fe,l),a.push((0,D.fA)(fe[0],fe[1]))}return function(e,t,r){const i=e.map(e=>((0,M.hZ)(fe,e[0],e[1],0),t.fromRenderCoords(fe,fe,r),[fe[0],fe[1]]));return i.length<=2?new Y.A({spatialReference:r}):(i.push(i[0].slice()),(0,X.$3)(i)||i.reverse(),new Y.A({rings:[i],spatialReference:r}))}(function(e,t){const r=[],i=[];return K(r,e,t,0),K(i,r,t,1),K(r,i,t,2),K(i,r,t,3),i}(a,i.extent),i,o)},toExtent:function(e,t,r,i,n){const o=e.renderSpatialReference,s=e.spatialReference??t.spatialReference;return(0,C.g)(t,de,o),(0,C.g)(t,he,o),de[0]-=r/2,he[0]+=r/2,de[1]-=i/2,he[1]+=i/2,(0,A.F)(de,o,de,s),(0,A.F)(he,o,he,s),n?(n.xmin=de[0],n.ymin=de[1],n.xmax=he[0],n.ymax=he[1],n.spatialReference=s):n=new q.A(de[0],de[1],he[0],he[1],s),n}},Symbol.toStringTag,{value:"Module"}));var ge=r(34304),ve=r(17136),_e=r(94008),xe=r(28735);class ye{get planes(){return this.frustum}get points(){return this._points}get mutablePoints(){return this._points}get direction(){return this._direction}get origin(){return this._origin}get boundingSphere(){return this._boundingSphereDirty&&this._updateBoundingSphere(),this._boundingSphere}constructor(e){this.renderCoordsHelper=e,this.frustum=(0,L.vt)(),this._points=(0,L.Qy)(),this.lines=new Array(12),this._origin=(0,T.vt)(),this._direction=(0,T.vt)(),this._boundingSphere=new _e.iy,this._altitude=null,this._boundingSphereDirty=!0;for(let e=0;e<12;e++)this.lines[e]={origin:null,direction:(0,T.vt)(),endpoint:null}}update(e){(0,L.ui)(e.viewMatrix,e.projectionMatrix,this.frustum,this._points),(0,M.C)(this._origin,e.eye),(0,M.C)(this._direction,e.viewForward),this._altitude=this.renderCoordsHelper.getAltitude(this._origin),this._updateLines(),this._boundingSphereDirty=!0}updatePoints(e){for(let t=0;t<this._points.length;t++)(0,M.C)(this._points[t],e[t]);(0,L.DV)(this.frustum,this._points),this._updateLines()}get altitude(){return this._altitude}intersectsSphere(e){return(0,L.m7)(this.frustum,e)}intersectsRay(e){return(0,L.pw)(this.frustum,e)}intersectsLineSegment(e,t){return(0,L.ST)(this.frustum,e,t)}intersectsPoint(e){return(0,L.bU)(this.frustum,e)}_updateLines(){const e=this._points;for(let t=0;t<4;t++){const r=t+4;we(this.lines[t],e[t],e[r]),we(this.lines[t+4],e[t],3===t?e[0]:e[t+1]),we(this.lines[t+8],e[r],3===t?e[4]:e[r+1])}}_updateBoundingSphere(){const{origin:e}=this,t=Me;(0,M.S8)(t,this.direction);const r=be;(0,M.jb)(r,this.points[4],e);const i=.5*(0,M.Om)(r,r)/(0,M.Om)(t,r),n=this._boundingSphere,o=(0,M.Ln)(Te,e,t,i);n.center=o,n.radius=i}static{this.planePointIndices=L.c8}static{this.nearFarLineIndices=[[0,4],[1,5],[2,6],[3,7]]}}function we(e,t,r){e.origin=t,e.endpoint=r,(0,M.oW)(e.direction,t,r)}const be=(0,T.vt)(),Me=(0,T.vt)(),Te=(0,T.vt)();r(86211);const Se=(0,T.fA)(5802e-9,13558e-9,331e-7),Ce=(0,T.fA)(65e-8*3,5643e-9,255e-9);(0,T.fA)(Se[0]+Ce[0],Se[1]+Ce[1],Se[2]+Ce[2]);class Ae{constructor(e=1/0,t=-1/0){this.near=e,this.far=t}set(e,t){this.near=e,this.far=t}union(e){return null!=e&&(this.near=Math.min(this.near,e.near),this.far=Math.max(this.far,e.far)),this}within(e){return this.near<=e&&e<=this.far}equals(e){return this.near===e.near&&this.far===e.far}static{this.Zero=new Ae(0,0)}static{this.Infinite=new Ae}}(0,T.vt)(),(0,T.vt)(),new _e.iy,(0,R.vt)(),new q.A({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0});var Ee=r(32728);const Re=(0,T.fA)(0,0,1),Ie=(0,M.S8)((0,T.vt)(),(0,T.fA)(1,1,1)),Oe=(0,b.vt)(),Fe=(0,T.vt)(),Pe=(0,T.vt)();function De(e,t,r,i=ne()){(0,M.$A)(Fe,e,Re),0===(0,M.Om)(Fe,Fe)&&(0,M.$A)(Fe,e,Ie),(0,P.$0)(Oe,-(0,s.kU)(t),e),(0,P.e$)(Oe,Oe,-(0,s.kU)(r),Fe);const{up:n,direction:o}=i;return(0,M.$A)(n,Fe,e),(0,M.S8)(n,n),(0,M.Z0)(n,n,Oe),(0,M.S8)(o,e),(0,M.ze)(o,o),(0,M.Z0)(o,o,Oe),i}function Ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function He(e,t){const r=De(t,e.heading,e.tilt);return e.up=r.up,e}function Le(e,t){const r=[],i=[],n=(0,ge.FD)();for(let o=0;o<e.length;o++){const s=e[o],a=o===e.length-1?e[0]:e[o+1],l=(0,ee.Cr)(s,a,ke),c=(0,te.vE)(t,l.origin,l.vector,0,je);switch(c){case 2:r.push(s);break;case 3:i.push(s);break;case 0:case 1:{const[e,o,a]=0===c?[1,r,i]:[-1,i,r],l=(0,te.Qj)(t),u=(0,M.Ln)((0,T.vt)(),je,l,e*n),d=(0,M.Ln)((0,T.vt)(),je,l,e*-n);o.push(s),o.push(u),a.push(d)}}}const o=[];return r.length&&o.push(r),i.length&&o.push(i),o}const Be={minCurvature:(0,s.kU)(5),maxCurvature:(0,s.kU)(50),minSamples:1,maxSamples:6},ze=(0,T.fA)(1,0,0),Ue=(0,T.fA)(0,1,0),Ge=(0,T.vt)(),Ve=(0,T.vt)(),je=(0,T.vt)(),We=new _e.iy,ke=(0,ee.vt)(),Ze=(0,H.vt)();Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:function(e,t,r,i){const n=Fe,o=Pe;return(0,M.S8)(n,e),(0,M.$A)(Pe,n,Re),0===(0,M.Om)(Pe,Pe)&&(0,M.$A)(Pe,n,Ie),(0,M.$A)(o,Pe,n),oe(t,r,i,n,o)},eyeForCenterWithHeadingTilt:function(e,t,r,i){const n={eye:(0,T.vt)(),up:null,tilt:i,heading:r},o=Fe;o[0]=e[0],o[1]=e[2],o[2]=-e[1];const a=t,l=(0,s.kU)(r),c=(0,s.kU)(i),u=Math.sin(l),d=Math.cos(l),h=Math.sin(c),m=Math.cos(c),p=(0,M.Bw)(o);let f;if(Math.abs(c)<1e-8)f=a+p;else{const e=p/h,t=(0,s.YN)(a/e),r=Math.PI-c-t;f=e*Math.sin(r)}const g=m*a,v=a*a*(h*h),_=d*d*v,x=f-g,y=x*x,w=_*(_+y-o[1]*o[1]);if(w<0)return(0,M.hs)(n.eye,o,f/p),n.tilt=0,He(n,e);const b=Math.sqrt(w),S=o[1]*x,C=_+y;let A;if(A=d>0?-b+S:b+S,Math.abs(C)<1e-8)return p<1e-8?(n.eye[0]=0,n.eye[1]=0,n.eye[2]=a):(0,M.hs)(n.eye,o,f/p),n.tilt=0,Ne(n.eye),He(n,e);n.eye[1]=A/C;const E=u*u*v,R=h*a,I=d*R*n.eye[1],O=n.eye[1]*n.eye[1],F=1-O,P=Math.sqrt(F),D=_*O+E-2*I*P*x+F*y;return Math.abs(D)<1e-8?((0,M.hs)(n.eye,o,f/p),n.tilt=0,Ne(n.eye),He(n,e)):(n.eye[0]=(F*(f*o[0]-g*o[0])-R*P*(o[0]*n.eye[1]*d+o[2]*u))/D,n.eye[2]=(F*(f*o[2]-g*o[2])-R*P*(o[2]*n.eye[1]*d-o[0]*u))/D,(0,M.hs)(n.eye,n.eye,f),Ne(n.eye),He(n,e))},eyeTiltToLookAtTilt:function(e,t,r){const i=(0,s.kU)(e),n=(0,M.Bw)(t);return(0,s.YN)(r/(n/Math.sin(i)))+i},headingTiltToDirectionUp:De,lookAtTiltToEyeTilt:function(e,t,r){const i=(0,M.Bw)(t),n=Math.sqrt(r*r+i*i-2*r*i*Math.cos(Math.PI-e)),o=(0,s.YN)(r/(n/Math.sin(e)));return(0,s.KJ)(e-o)},toArea:function(e,t){const{renderCoordsHelper:r}=e,i=e.state.camera.clone(),n=new ye(r);i.near=2,n.update(i);const o=r.getAltitude(t),a=e.spatialReference,l=r.referenceEllipsoid.radius,c=i.eye,u=1+(0,M.Io)(c,t)/(l+o),d=Math.sqrt(u*u-1),{minCurvature:h,maxCurvature:m,minSamples:p,maxSamples:f}=Be,g=function(e){const{renderCoordsHelper:t,state:r}=e,i=Math.abs(t.getAltitude(r.camera.center));return We.radius=t.referenceEllipsoid.radius+i,r.camera.sphereFrustumCoverage(We,t)}(e),v=(0,s.qE)((d-h)/(m-h),0,1),_=Math.round((0,s.Cc)(p,f,v)),x=i.aboveGround,y=n.planes[5],w=[],b=(0,te.O_)(T.uY,ze,(0,te.vt)()),S=(0,te.O_)(T.uY,Ue,(0,te.vt)());(0,N.hZ)(Ze,0,0,0,0);const C=e=>{};for(let e=0;e<4;e++){const t=1===e&&!x||3===e&&x?1-g:0,i=1===e&&x||3===e&&!x?g:1,a=n.lines[e],l=n.lines[3===e?0:e+1];for(let n=0;n<_;n++){const u=n/_,d=0===n?0:(0,s.Cc)(t,i,1===e?1-(1-u)**2:3===e?u**2:u),h=(0,M.Cc)(Ve,a.origin,l.origin,d),m=(0,Ee.nu)(a.direction,l.direction,d,Ge);r.intersectManifoldClosestSilhouette((0,R.LV)(h,m),o,je),se(je,c,je,y),w.push((0,T.o8)(je)),0!==w.length&&C((0,M.lo)(w.at(-1),je));const p=((0,te.Tj)(b,je)?1:0)|((0,te.Tj)(S,je)?2:0);Ze[p]=1}}w.length>2&&(0,M.lo)(w[0],w.at(-1));const A=function(e,t,r){const i=2*(0,ge.FD)();return e.map(e=>{const n=[];let o=!1;for(const s of e)t.fromRenderCoords(s,je,r),Math.abs(s[0])<i&&Math.abs(s[1])<i?(n.push([null,je[1]]),n.push([null,je[1]]),o=!0):n.push([je[0],je[1]]);if(o)for(let e=0;e<n.length;e++){const t=n[e];if(null!=t[0])continue;const r=n[e+1],i=n.at(0===e?-1:e-1);t[0]=i[0],e++;const o=n.at(e===n.length-1?0:e+1);r[0]=o[0]}return n.push(n[0]),(0,X.$3)(n)||n.reverse(),n})}((0,N.m3)(Ze)>1?function(e,t){const r=[];for(const i of e)r.push(...Le(i,t));return r}(Le(w,b),S):[w],r,a);return new Y.A({rings:A,spatialReference:a})},toExtent:function(e,t,r,i,n){let o,a,l,c;const u=t.latitude,d=(0,E.tO)(e.spatialReference).radius,h=t.longitude,m=function(e,t,r){const i=t/r,n=(0,s.kU)(e),o=Math.sin(i/2),a=Math.cos(n),l=2*(0,s.YN)(Math.sqrt(o*o/(a*a)));return(0,s.KJ)(l)}(u,r,d)/2;o=h-m,a=h+m;const p=(0,s.kU)(u),g=(1+Math.sin(p))/(1-Math.sin(p)),v=(g+1)*Math.tan(i/d/2),_=v*v;function x(e){const t=Math.PI/2;return(e=f.uC.normalize(e,-t))>t&&(e=Math.PI-e),e}if(l=1.5*Math.PI-2*Math.atan(.5*(v+Math.sqrt(4*g+_))),c=l+i/d,l=x(l),c=x(c),c<l){const e=c;c=l,l=e}if(l=Math.max((0,s.KJ)(l),-90),c=Math.min((0,s.KJ)(c),90),a=ve.Y_.monotonic(o,a),a-o>180){const e=(a-o-180)/2;o+=e,a-=e}const y=e.spatialReference&&e.spatialReference.isGeographic?e.spatialReference:S.A.WGS84;return n?(n.xmin=o,n.ymin=l,n.xmax=a,n.ymax=c,n.spatialReference=y):n=new q.A(o,l,a,c,y),e.spatialReference&&e.spatialReference.isWebMercator&&(0,xe.Gh)(n,!1,n),n}},Symbol.toStringTag,{value:"Module"}));const $e="composite-color",qe=["final-color",$e,"opaque-color","transparent-color"],Ye={ANTIALIASING:"aa-color",CUTFILL_COLOR:"cutfill-color",CUTFILL_DEPTH:"cutfill-depth",FOCUSAREA_COLOR:"focusarea-color",FOCUSAREA:"focusarea",GAUSSIAN_SPLAT:"gaussian-splat",HIGHLIGHT_COLOR:"highlight-color",LASERLINES:"laserline-color",MAGNIFIER:"magnifier-color",OCCLUDED:"occluded-color",OPAQUE_ENVIRONMENT:"opaque-environment-color",OPAQUE_TERRAIN:"opaque-terrain-color",SSAO:"ssao",TRANSPARENT_ENVIRONMENT:"transparent-environment-color",VIEWSHED:"viewshed-color"};Array.from(Object.values(Ye)).concat(qe),(0,T.vt)();var Xe=r(49186),Ke=r(10107),Je=r(64108);let Qe=class extends I.A{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces=$e,this.requireGeometryDepth=!1,this._dirty=!0}initialize(){this.addHandles([(0,l.wB)(()=>this.view.ready,e=>{e&&this.view.stage?.renderer.addRenderNode(this)},l.Vh)])}destroy(){this.view.stage?.renderer?.removeRenderNode(this)}precompile(){}render(){throw new Xe.A("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view.stage.renderView.renderingContext.gl}get techniques(){return this.view.stage.renderView.techniques}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,t=this.view.stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return t.fbo?.initializeAndBind(),t}bindRenderTarget(){return this._frameBuffer?.fbo?.initializeAndBind(),this._frameBuffer}requestRender(e){switch(e){case 2:this.view.state.fading=!0;case 1:this.view.stage?.renderView.requestRender(e);case 0:case void 0:this._dirty=!0}}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view.stage.renderer.fboCache}get bindParameters(){return this.renderContext.bind}get renderingContext(){return this.view.stage.renderView.renderingContext}get renderContext(){return this.view.stage?.renderer.renderContext}updateAnimation(e){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e){this._frameBuffer=e.find(({name:e})=>e===this.produces);try{return this.render(e)}finally{this._frameBuffer=null}}};(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],Qe.prototype,"view",void 0),(0,o.Cg)([(0,Ke.MZ)({constructOnly:!0})],Qe.prototype,"consumes",void 0),(0,o.Cg)([(0,Ke.MZ)()],Qe.prototype,"produces",void 0),(0,o.Cg)([(0,Ke.MZ)({readOnly:!0})],Qe.prototype,"techniques",null),Qe=(0,o.Cg)([(0,Je.$)("esri.views.3d.webgl.RenderNode")],Qe);var et=r(15581),tt=r(13840),rt=r(42958),it=r(95774),nt=r(90644);let ot=class extends rt.w{constructor(){super(...arguments),this.shader=new tt.r(it.S,()=>r.e(1285).then(r.bind(r,91285)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};ot=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOBlurTechnique")],ot);var st=r(65786);class at extends st.Y{constructor(){super(...arguments),this.projScale=1}}class lt extends at{constructor(){super(...arguments),this.intensity=1}}class ct extends st.Y{}class ut extends ct{constructor(){super(...arguments),this.blurSize=(0,D.vt)()}}let dt=class extends rt.w{constructor(){super(...arguments),this.shader=new tt.r(et.S,()=>r.e(6122).then(r.bind(r,86122)))}initializePipeline(){return(0,nt.Ey)({colorWrite:nt.kn})}};dt=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAOTechnique")],dt);var ht=r(63907),mt=r(76284),pt=r(67171);let ft=class extends Qe{constructor(e){super(e),this.consumes={required:["normals"]},this.produces=Ye.SSAO,this.isEnabled=()=>!1,this._enableTime=(0,c.l5)(0),this._passParameters=new lt,this._drawParameters=new ut}initialize(){const e=Uint8Array.from(atob("eXKEvZaUc66cjIKElE1jlJ6MjJ6Ufkl+jn2fcXp5jBx7c6KEflSGiXuXeW6OWs+tfqZ2Yot2Y7Zzfo2BhniEj3xoiXuXj4eGZpqEaHKDWjSMe7palFlzc3BziYOGlFVzg6Zzg7CUY5JrjFF7eYJ4jIKEcyyEonSXe7qUfqZ7j3xofqZ2c4R5lFZ5Y0WUbppoe1l2cIh2ezyUho+BcHN2cG6DbpqJhqp2e1GcezhrdldzjFGUcyxjc3aRjDyEc1h7Sl17c6aMjH92pb6Mjpd4dnqBjMOEhqZleIOBYzB7gYx+fnqGjJuEkWlwnCx7fGl+c4hjfGyRe5qMlNOMfnqGhIWHc6OMi4GDc6aMfqZuc6aMzqJzlKZ+lJ6Me3qRfoFue0WUhoR5UraEa6qMkXiPjMOMlJOGe7JrUqKMjK6MeYRzdod+Sl17boiPc6qEeYBlcIh2c1WEe7GDiWCDa0WMjEmMdod+Y0WcdntzhmN8WjyMjKJjiXtzgYxYaGd+a89zlEV7e2GJfnd+lF1rcK5zc4p5cHuBhL6EcXp5eYB7fnh8iX6HjIKEeaxuiYOGc66RfG2Ja5hzjlGMjEmMe9OEgXuPfHyGhPeEdl6JY02McGuMfnqGhFiMa3WJfnx2l4hwcG1uhmN8c0WMc39og1GBbrCEjE2EZY+JcIh2cIuGhIWHe0mEhIVrc09+gY5+eYBlnCyMhGCDl3drfmmMgX15aGd+gYx+fnuRfnhzY1SMsluJfnd+hm98WtNrcIuGh4SEj0qPdkqOjFF7jNNjdnqBgaqUjMt7boeBhnZ4jDR7c5pze4GGjEFrhLqMjHyMc0mUhKZze4WEa117kWlwbpqJjHZ2eX2Bc09zeId+e0V7WlF7jHJ2l72BfId8l3eBgXyBe897jGl7c66cgW+Xc76EjKNbgaSEjGx4fId8jFFjgZB8cG6DhlFziZhrcIh2fH6HgUqBgXiPY8dahGFzjEmMhEFre2dxhoBzc5SGfleGe6alc7aUeYBlhKqUdlp+cH5za4OEczxza0Gcc4J2jHZ5iXuXjH2Jh5yRjH2JcFx+hImBjH+MpddCl3dreZeJjIt8ZW18bm1zjoSEeIOBlF9oh3N7hlqBY4+UeYFwhLJjeYFwaGd+gUqBYxiEYot2fqZ2ondzhL6EYyiEY02Ea0VjgZB8doaGjHxoc66cjEGEiXuXiXWMiZhreHx8frGMe75rY02Ec5pzfnhzlEp4a3VzjM+EhFFza3mUY7Zza1V5e2iMfGyRcziEhDyEkXZ2Y4OBnCx7g5t2eyBjgV6EhEFrcIh2dod+c4Z+nJ5zjm15jEmUeYxijJp7nL6clIpjhoR5WrZraGd+fnuRa6pzlIiMg6ZzfHx5foh+eX1ufnB5eX1ufnB5aJt7UqKMjIh+e3aBfm5lbYSBhGFze6J4c39oc0mUc4Z+e0V7fKFVe0WEdoaGY02Ec4Z+Y02EZYWBfH6HgU1+gY5+hIWUgW+XjJ57ebWRhFVScHuBfJ6PhBx7WqJzlM+Ujpd4gHZziX6HjHmEgZN+lJt5boiPe2GJgX+GjIGJgHZzeaxufnB5hF2JtdN7jJ57hp57hK6ElFVzg6ZzbmiEbndzhIWHe3uJfoFue3qRhJd2j3xoc65zlE1jc3p8lE1jhniEgXJ7e657vZaUc3qBh52BhIF4aHKDa9drgY5+c52GWqZzbpqJe8tjnM+UhIeMfo2BfGl+hG1zSmmMjKJjZVaGgX15c1lze0mEp4OHa3mUhIWHhDyclJ6MeYOJkXiPc0VzhFiMlKaEboSJa5Jze41re3qRhn+HZYWBe0mEc4p5fnORbox5lEp4hGFjhGGEjJuEc1WEhLZjeHeGa7KlfHx2hLaMeX1ugY5+hIWHhKGPjMN7c1WEho1zhoBzZYx7fnhzlJt5exyUhFFziXtzfmmMa6qMYyiEiXxweV12kZSMeWqXSl17fnhzxmmMrVGEe1mcc4p5eHeGjK6MgY5+doaGa6pzlGV7g1qBh4KHkXiPeW6OaKqafqZ2eXZ5e1V7jGd7boSJc3BzhJd2e0mcYot2h1RoY8dahK6EQmWEWjx7e1l2lL6UgXyBdnR4eU9zc0VreX1umqaBhld7fo2Bc6KEc5Z+hDyEcIeBWtNrfHyGe5qMhMuMe5qMhEGEbVVupcNzg3aHhIF4boeBe0mEdlptc39ofFl5Y8uUlJOGiYt2UmGEcyxjjGx4jFF7a657ZYWBnElzhp57iXtrgZN+tfOEhIOBjE2HgU1+e8tjjKNbiWCDhE15gUqBgYN7fnqGc66ce9d7iYSBj0qPcG6DnGGcT3eGa6qMZY+JlIiMl4hwc3aRdnqBlGV7eHJ2hLZjfnuRhDyEeX6MSk17g6Z+c6aUjHmEhIF4gXyBc76EZW18fGl+fkl+jCxrhoVwhDyUhIqGlL2DlI6EhJd2tdN7eYORhEGMa2Faa6pzc3Bzc4R5lIRznM+UY9eMhDycc5Z+c4p5c4iGY117pb6MgXuPrbJafnx2eYOJeXZ5e657hDyEcziElKZjfoB5eHeGj4WRhGGEe6KGeX1utTStc76EhFGJnCyMa5hzfH6HnNeceYB7hmN8gYuMhIVrczSMgYF8h3N7c5pza5hzjJqEYIRdgYuMlL2DeYRzhGGEeX1uhLaEc4iGeZ1zdl6JhrVteX6Me2iMfm5lWqJzSpqEa6pzdnmchHx2c6OMhNdrhoR5g3aHczxzeW52gV6Ejm15frGMc0Vzc4Z+l3drfniJe+9rWq5rlF1rhGGEhoVwe9OEfoh+e7pac09+c3qBY0lrhDycdnp2lJ6MiYOGhGCDc3aRlL2DlJt5doaGdnp2gYF8gWeOjF2Uc4R5c5Z+jEmMe7KEc4mEeYJ4dmyBe0mcgXiPbqJ7eYB7fmGGiYSJjICGlF1reZ2PnElzbpqJfH6Hc39oe4WEc5eJhK6EhqyJc3qBgZB8c09+hEmEaHKDhFGJc5SGiXWMUpaEa89zc6OMnCyMiXtrho+Be5qMc7KEjJ57dmN+hKGPjICGbmiEe7prdod+hGCDdnmchBx7eX6MkXZ2hGGEa657hm98jFFjY5JreYOJgY2EjHZ2a295Y3FajJ6Mc1J+YzB7e4WBjF2Uc4R5eV12gYxzg1qBeId+c9OUc5pzjFFjgY5+hFiMlIaPhoR5lIpjjIKBlNdSe7KEeX2BfrGMhIqGc65zjE2UhK6EklZ+QmWEeziMWqZza3VzdnR4foh+gYF8n3iJiZhrnKp7gYF8eId+lJ6Me1lrcIuGjKJjhmN8c66MjFF7a6prjJ6UnJ5zezyUfruRWlF7nI5zfHyGe657h4SEe8tjhBx7jFFjc09+c39ojICMeZeJeXt+YzRzjHZ2c0WEcIeBeXZ5onSXkVR+gYJ+eYFwdldzgYF7eX2BjJ6UiXuXlE1jh4SEe1mchLJjc4Z+hqZ7eXZ5bm1zlL6Ue5p7iWeGhKqUY5pzjKJjcIeBe8t7gXyBYIRdlEp4a3mGnK6EfmmMZpqEfFl5gYxzjKZuhGFjhoKGhHx2fnx2eXuMe3aBiWeGvbKMe6KGa5hzYzB7gZOBlGV7hmN8hqZlYot2Y117a6pzc6KEfId8foB5rctrfneJfJ6PcHN2hFiMc5pzjH92c0VzgY2EcElzdmCBlFVzg1GBc65zY4OBboeBcHiBeYJ4ewxzfHx5lIRzlEmEnLKEbk1zfJ6PhmN8eYBljBiEnMOEiXxwezyUcIeBe76EdsKEeX2BdnR4jGWUrXWMjGd7fkl+j4WRlEGMa5Jzho+BhDyEfnqMeXt+g3aHlE1jczClhNN7ZW18eHx8hGFjZW18iXWMjKJjhH57gYuMcIuGWjyMe4ZtjJuExmmMj4WRdntzi4GDhFFzYIRdnGGcjJp7Y0F7e4WEkbCGiX57fnSHa657a6prhBCMe3Z+SmmMjH92eHJ2hK6EY1FzexhrvbKMnI5za4OEfnd+eXuMhImBe897hLaMjN+EfG+BeIOBhF1+eZeJi4GDkXZ2eXKEgZ6Ejpd4c2GHa1V5e5KUfqZuhCx7jKp7lLZrg11+hHx2hFWUoot2nI5zgbh5mo9zvZaUe3qRbqKMfqZ2kbCGhFiM"),e=>e.charCodeAt(0)),t=new pt.R(32);t.wrapMode=33071,t.pixelFormat=6407,t.wrapMode=10497,t.hasMipmap=!0,this._passParameters.noiseTexture=new mt.A(this.renderingContext,t,e),this.techniques.precompile(dt),this.techniques.precompile(ot),this.addHandles((0,l.wB)(()=>this.isEnabled(),()=>this._enableTime=(0,c.l5)(0)))}destroy(){this._passParameters.noiseTexture=(0,a.WD)(this._passParameters.noiseTexture)}render(e){const t=e.find(({name:e})=>"normals"===e),r=t?.getTexture(),i=t?.getTexture(ht.nI);if(!r||!i)return;const n=this.techniques.get(dt),o=this.techniques.get(ot);if(!n.compiled||!o.compiled)return this._enableTime=(0,c.l5)(performance.now()),void this.requestRender(1);0===this._enableTime&&(this._enableTime=(0,c.l5)(performance.now()));const a=this.renderingContext,l=this.view.qualitySettings.fadeDuration,u=this.bindParameters,h=u.camera,m=h.relativeElevation,p=(0,s.qE)((5e5-m)/2e5,0,1),f=l>0?Math.min(l,performance.now()-this._enableTime)/l:1,g=f*p;this._passParameters.normalTexture=r,this._passParameters.depthTexture=i,this._passParameters.projScale=1/h.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*gt/(0,et.g)(h)**6*g;const v=h.fullViewport[2],_=h.fullViewport[3],x=this.fboCache.acquire(v,_,"ssao input",2);a.bindFramebuffer(x.fbo),a.setViewport(0,0,v,_),a.bindTechnique(n,u,this._passParameters,this._drawParameters),a.screen.draw();const y=Math.round(v/2),w=Math.round(_/2),b=this.fboCache.acquire(y,w,"ssao blur",0);a.bindFramebuffer(b.fbo),this._drawParameters.colorTexture=x.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,0,2/_),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),x.release();const M=this.fboCache.acquire(y,w,Ye.SSAO,0);return a.bindFramebuffer(M.fbo),a.setViewport(0,0,v,_),a.setClearColor(1,1,1,0),a.clear(16384),this._drawParameters.colorTexture=b.getTexture(),(0,d.hZ)(this._drawParameters.blurSize,2/v,0),a.bindTechnique(o,u,this._passParameters,this._drawParameters),a.setViewport(0,0,y,w),a.screen.draw(),a.setViewport4fv(h.fullViewport),b.release(),f<1&&this.requestRender(2),M}};(0,o.Cg)([(0,u.MZ)()],ft.prototype,"consumes",void 0),(0,o.Cg)([(0,u.MZ)()],ft.prototype,"produces",void 0),(0,o.Cg)([(0,u.MZ)({constructOnly:!0})],ft.prototype,"isEnabled",void 0),ft=(0,o.Cg)([(0,u.$K)("esri.views.3d.webgl-engine.effects.ssao.SSAO")],ft);const gt=.5;function vt(e,t){t.receiveAmbientOcclusion?(e.uniforms.add(new n.x("ssaoTex",e=>e.ssao?.getTexture())),e.constants.add("blurSizePixelsInverse","float",.5),e.code.add(i.H`float evaluateAmbientOcclusionInverse() {
136
136
  vec2 ssaoTextureSizeInverse = 1.0 / vec2(textureSize(ssaoTex, 0));
137
137
  return texture(ssaoTex, gl_FragCoord.xy * blurSizePixelsInverse * ssaoTextureSizeInverse).r;
138
138
  }
@@ -288,7 +288,7 @@ return color;
288
288
  vec3 hiD = hiA + hiB;
289
289
  vec3 loD = loA + loB;
290
290
  return dpDummy * hiD + loD;
291
- }`)}},27950(e,t,r){r.d(t,{N:()=>o});var i=r(63365),n=r(31821);function o(e){e.include(i.a),e.code.add(n.H`
291
+ }`)}},26934(e,t,r){r.d(t,{Q:()=>n});var i=r(49788);function n(e){e.constants.add("alphaCutoff","float",i.Q)}},27950(e,t,r){r.d(t,{N:()=>o});var i=r(63365),n=r(31821);function o(e){e.include(i.a),e.code.add(n.H`
292
292
  vec3 mixExternalColor(vec3 internalColor, vec3 textureColor, vec3 externalColor, int mode) {
293
293
  // workaround for artifacts in macOS using Intel Iris Pro
294
294
  // see: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/10475
@@ -328,7 +328,7 @@ return dpDummy * hiD + loD;
328
328
  // multiply or tint (or something invalid)
329
329
  return allMixed;
330
330
  }
331
- `)}},27993(e,t,r){r.d(t,{F:()=>a});var i=r(91218),n=r(16930),o=r(9762),s=r(65806);function a(e,t,r,n){return!(null==t||null==n||e.length<2)&&((0,i.canProjectWithoutEngine)(t,n)?(0,o.projectBuffer)(e,t,0,r,n,0,1):(l.x=e[0],l.y=e[1],l.z=e[2],l.spatialReference=t,(0,s.g)(l,r,n)))}const l={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:n.A.WGS84,type:"point"}},28421(e,t,r){r.d(t,{J:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",2,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},28491(e,t,r){r.d(t,{D:()=>V,b:()=>G});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),l=r(72722),c=r(43519),u=r(73955),d=r(71955),h=r(53466),m=r(92700),p=r(72824),f=r(54154),g=r(9169),v=r(77695),_=r(14527),x=r(28747),y=r(98619),w=r(62602),b=r(22393),M=r(59469),T=r(32482),S=r(96598),C=r(51406),A=r(986),E=r(58614),R=r(27950),I=r(20693),O=r(33079),F=r(71988),P=r(20304),D=r(31821),N=r(63761),H=r(10906),L=r(19245),B=r(51255),z=r(14113),U=r(49788);function G(e){const t=new z.N5,{attributes:r,vertex:G,fragment:V,varyings:j}=t,{output:W,normalType:k,offsetBackfaces:$,spherical:Z,snowCover:q,pbrMode:Y,textureAlphaPremultiplied:X,instancedDoublePrecision:K,hasVertexColors:J,hasVertexTangents:Q,hasColorTexture:ee,hasNormalTexture:te,hasNormalTextureTransform:re,hasColorTextureTransform:ie}=e;if((0,I.NB)(G,e),r.add("position","vec3"),j.add("vpos","vec3",{invariant:!0}),t.include(A.A,e),t.include(l.B,e),t.include(f.Ge,e),t.include(C.q2,e),!(0,n._o)(W))return t.include(g.E,e),t;t.include(C.Sx,e),t.include(C.MU,e),t.include(C.O1,e),t.include(C.QM,e),(0,I.yu)(G,e),t.include(u.Y,e),t.include(s.d);const ne=0===k||1===k;return ne&&$&&t.include(i.M),t.include(v.J,e),t.include(p.Mh,e),t.include(a.v,e),j.add("vPositionLocal","vec3"),t.include(h.U,e),t.include(d.K,e),t.include(m.c,e),G.uniforms.add(new F.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),j.add("vcolorExt","vec4"),t.include(S.Z,e),G.include(c.WD),G.include(c.oF),t.include(K?T.G:T.Bz,e),G.main.add(D.H`
331
+ `)}},27993(e,t,r){r.d(t,{F:()=>a});var i=r(91218),n=r(16930),o=r(9762),s=r(65806);function a(e,t,r,n){return!(null==t||null==n||e.length<2)&&((0,i.canProjectWithoutEngine)(t,n)?(0,o.projectBuffer)(e,t,0,r,n,0,1):(l.x=e[0],l.y=e[1],l.z=e[2],l.spatialReference=t,(0,s.g)(l,r,n)))}const l={x:0,y:0,z:0,hasZ:!0,hasM:!1,spatialReference:n.A.WGS84,type:"point"}},28421(e,t,r){r.d(t,{J:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"float",2,(i,n,o)=>i.setUniform1f(e,t(n,o),r))}}},28491(e,t,r){r.d(t,{D:()=>V,b:()=>G});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),l=r(72722),c=r(43519),u=r(73955),d=r(71955),h=r(53466),m=r(92700),p=r(72824),f=r(54154),g=r(9169),v=r(77695),_=r(14527),x=r(28747),y=r(98619),w=r(62602),b=r(22393),M=r(59469),T=r(32482),S=r(96598),C=r(51406),A=r(986),E=r(58614),R=r(27950),I=r(20693),O=r(33079),F=r(71988),P=r(20304),D=r(31821),N=r(63761),H=r(10906),L=r(19245),B=r(51255),z=r(14113),U=r(49788);function G(e){const t=new z.N5,{attributes:r,vertex:G,fragment:V,varyings:j}=t,{output:W,normalType:k,offsetBackfaces:Z,spherical:$,snowCover:q,pbrMode:Y,textureAlphaPremultiplied:X,instancedDoublePrecision:K,hasVertexColors:J,hasVertexTangents:Q,hasColorTexture:ee,hasNormalTexture:te,hasNormalTextureTransform:re,hasColorTextureTransform:ie}=e;if((0,I.NB)(G,e),r.add("position","vec3"),j.add("vpos","vec3",{invariant:!0}),t.include(A.A,e),t.include(l.B,e),t.include(f.Ge,e),t.include(C.q2,e),!(0,n._o)(W))return t.include(g.E,e),t;t.include(C.Sx,e),t.include(C.MU,e),t.include(C.O1,e),t.include(C.QM,e),(0,I.yu)(G,e),t.include(u.Y,e),t.include(s.d);const ne=0===k||1===k;return ne&&Z&&t.include(i.M),t.include(v.J,e),t.include(p.Mh,e),t.include(a.v,e),j.add("vPositionLocal","vec3"),t.include(h.U,e),t.include(d.K,e),t.include(m.c,e),G.uniforms.add(new F.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),j.add("vcolorExt","vec4"),t.include(S.Z,e),G.include(c.WD),G.include(c.oF),t.include(K?T.G:T.Bz,e),G.main.add(D.H`
332
332
  forwardVertexColor();
333
333
 
334
334
  MaskedColor maskedColor =
@@ -344,7 +344,7 @@ return dpDummy * hiD + loD;
344
344
  vpos = addVerticalOffset(vpos, localOrigin);
345
345
  ${(0,D.If)(Q,"vTangent = dpTransformVertexTangent(tangent);")}
346
346
  gl_Position = transformPosition(proj, view, vpos);
347
- ${(0,D.If)(ne&&$,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
347
+ ${(0,D.If)(ne&&Z,"gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);")}
348
348
 
349
349
  forwardViewPosDepth((view * vec4(vpos, 1.0)).xyz);
350
350
  forwardTextureCoordinates();
@@ -381,7 +381,7 @@ return dpDummy * hiD + loD;
381
381
  float opacity_ = layerOpacity * mixExternalOpacity(${(0,D.If)(J,"vColor.a * ")} opacity, texColor.a, vcolorExt.a, opacityMixMode);
382
382
 
383
383
  ${te?`mat3 tangentSpace = computeTangentSpace(${Q?"normal":"normal, vpos, vuv0"});\n vec3 shadingNormal = computeTextureNormal(tangentSpace, ${re?"normalUV":"vuv0"});`:"vec3 shadingNormal = normal;"}
384
- vec3 normalGround = ${Z?"normalize(posWorld);":"vec3(0.0, 0.0, 1.0);"}
384
+ vec3 normalGround = ${$?"normalize(posWorld);":"vec3(0.0, 0.0, 1.0);"}
385
385
 
386
386
  ${(0,D.If)(q,D.H`
387
387
  float snow = getSnow(normal, normalGround);
@@ -664,12 +664,12 @@ vec4 masked2 = maskedColorSelectOrOne(color2);
664
664
  return MaskedColor(masked1 * masked2, bvec4(ivec4(color1.mask) & ivec4(color2.mask)));
665
665
  }`)}function a(e){e.include(n),e.code.add(i.H`MaskedColor createMaskedFromNaNColor(vec4 color) {
666
666
  return MaskedColor(color, isnan(color));
667
- }`)}},43609(e,t,r){r.d(t,{a:()=>o,f:()=>s,n:()=>n});var i=r(34275);function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=2,n=r){const o=t.length/2;let s=0,a=0;if(!(0,i.iu)(t)||(0,i.dk)(t)){for(let i=0;i<o;++i)e[s]=t[a],e[s+1]=t[a+1],s+=r,a+=n;return}const l=(0,i.a3)(t);if((0,i.JI)(t))for(let i=0;i<o;++i)e[s]=Math.max(t[a]/l,-1),e[s+1]=Math.max(t[a+1]/l,-1),s+=r,a+=n;else for(let i=0;i<o;++i)e[s]=t[a]/l,e[s+1]=t[a+1]/l,s+=r,a+=n}function s(e,t,r,i){const n=e.typedBuffer,o=e.typedBufferStride,s=i?.count??e.count;let a=(i?.dstIndex??0)*o;for(let e=0;e<s;++e)n[a]=t,n[a+1]=r,a+=o}Object.freeze(Object.defineProperty({__proto__:null,fill:s,normalizeIntegerBuffer:o,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},46140(e,t,r){r.d(t,{A:()=>n});var i=r(49186);class n{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new n(this.major,this.minor,this._context)}static parse(e,t=""){const[r,o]=e.split("."),s=/^\s*\d+\s*$/;if(!r?.match||!s.test(r))throw new i.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!o?.match||!s.test(o))throw new i.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),l=parseInt(o,10);return new n(a,l,t)}}},46154(e,t,r){r.d(t,{fetch:()=>Mr});var i=r(40876),n=r(61473),o=r(34727),s=r(77690),a=r(29242),l=r(58083),c=r(9093),u=r(48163),d=r(35522),h=r(51850),m=r(70328),p=r(34275);function f(e,t=!1){return e<=p.y9?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var g=r(13030),v=r(73354),_=r(65686),x=r(43609),y=r(21015),w=r(84498),b=r(51530),M=r(88340);function T(e){if(null==e)return null;const t=null!=e.offset?e.offset:M.uY,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:M.Un,n=(0,a.fA)(1,0,0,0,1,0,t[0],t[1],1),o=(0,a.fA)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),l=(0,a.fA)(i[0],0,0,0,i[1],0,0,0,1),c=(0,a.vt)();return(0,s.lw)(c,o,l),(0,s.lw)(c,n,c),c}class S{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new S,this.numberOfVertices=0}}var A=r(11254),E=r(60999),R=r(49186),I=r(53966),O=r(69397),F=r(81139),P=r(74887),D=r(46140),N=r(97146);async function H(e,t){return(await(0,A.A)(e,{responseType:"image",...t})).data}var L=r(46610),B=r(20498);function z(e){if(e.length<p.y9)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return(0,p.LW)(e)?(0,B.pX)().from(e):(0,p.jq)(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var U=r(15142),G=r(620);class V{get center(){return(0,h.fA)(this._data[0],this._data[1],this._data[2])}get radius(){return this._data[3]}get bbMin(){return(0,h.fA)(this._data[4],this._data[5],this._data[6])}get bbMax(){return(0,h.fA)(this._data[7],this._data[8],this._data[9])}constructor(e,t,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.position=r,this._data=[.1,0,0,0,0,0,0,0,0,0],this._children=void 0,(0,G.vA)(e.length>=1),(0,G.vA)(3===r.size||4===r.size);const{data:i,size:n,indices:o}=r;(0,G.vA)(o.length%this._numIndexPerPrimitive===0),(0,G.vA)(o.length>=e.length*this._numIndexPerPrimitive);const s=e.length;let a=n*o[this._numIndexPerPrimitive*e[0]];j.clear(),j.push(a);const l=(0,h.fA)(i[a],i[a+1],i[a+2]),c=(0,h.o8)(l);for(let t=0;t<s;++t){const r=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){a=n*o[r+e],j.push(a);let t=i[a];l[0]=Math.min(t,l[0]),c[0]=Math.max(t,c[0]),t=i[a+1],l[1]=Math.min(t,l[1]),c[1]=Math.max(t,c[1]),t=i[a+2],l[2]=Math.min(t,l[2]),c[2]=Math.max(t,c[2])}}for(let e=0;e<3;++e)this._data[4+e]=l[e],this._data[7+e]=c[e];const u=(0,d.Cc)((0,h.vt)(),this.bbMin,this.bbMax,.5);let m=.5*Math.max(Math.max(c[0]-l[0],c[1]-l[1]),c[2]-l[2]),p=m*m;for(let e=0;e<j.length;++e){a=j.at(e);const t=i[a]-u[0],r=i[a+1]-u[1],n=i[a+2]-u[2],o=t*t+r*r+n*n;if(o<=p)continue;const s=Math.sqrt(o),l=.5*(s-m);m+=l,p=m*m;const c=l/s;u[0]+=t*c,u[1]+=r*c,u[2]+=n*c}this._data[3]=m;for(let e=0;e<3;++e)this._data[0+e]=u[e];j.clear()}getChildren(){if(this._children||(0,d.hG)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,d.Cc)((0,h.vt)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o,indices:s}=this.position;for(let a=0;a<t;++a){let t=0;const l=this._numIndexPerPrimitive*this.primitiveIndices[a];let c=o*s[l],u=n[c],d=n[c+1],h=n[c+2];for(let e=1;e<this._numIndexPerPrimitive;++e){c=o*s[l+e];const t=n[c],r=n[c+1],i=n[c+2];t<u&&(u=t),r<d&&(d=r),i<h&&(h=i)}u<e[0]&&(t|=1),d<e[1]&&(t|=2),h<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const l=new Array(8);for(let e=0;e<8;++e)l[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];l[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array;for(let e=0;e<8;++e)void 0!==l[e]&&this._children.push(new V(l[e],this._numIndexPerPrimitive,this.position));return this._children}static prune(){j.prune()}}const j=new U.A({deallocator:null});var W=r(24326);class k{constructor(e){this.id=(0,W.c)(),this._attributes=new Map;for(const[t,r]of e)this._attributes.set(t,{...r,indices:(0,N.Dg)(r.indices)})}get attributes(){return this._attributes}}var $=r(4341),Z=r(11964);function q(e,t,r){return(0,d.Re)(Y,t,e),(0,d.Re)(X,r,e),.5*(0,d.Bw)((0,d.$A)(Y,Y,X))}r(32114),new $.I(Z.vt),new $.I(()=>{return e?{p0:(0,h.o8)(e.p0),p1:(0,h.o8)(e.p1),p2:(0,h.o8)(e.p2)}:{p0:(0,h.vt)(),p1:(0,h.vt)(),p2:(0,h.vt)()};var e});const Y=(0,h.vt)(),X=(0,h.vt)(),K=(0,h.vt)(),J=(0,h.vt)(),Q=(0,h.vt)(),ee=(0,h.vt)();class te{constructor(){this.uid=(0,W.c)()}}class re extends te{constructor(e){super(),this.highlightName=e,this.channel=0}}var ie=r(94656);class ne extends k{constructor(e,t,r=null,i=0,n=null,o=-1,s){super(t),this.material=e,this.mapPositions=r,this.type=i,this.olidColor=n,this.edgeIndicesLength=o,this.baseGeometry=s,this._highlights=null,this._highlightOptionsCounts=null,this.visible=!0,this._boundingInfo=null;const a=this.positionAttribute;null!=a&&this.edgeIndicesLength<0&&(this.edgeIndicesLength=a.indices.length)}instantiate(e={}){const t=new ne(e.material||this.material,[],this.mapPositions,this.type,this.olidColor,this.edgeIndicesLength,this.baseGeometry);return this._attributes.forEach((e,r)=>{e.exclusive=!1,t._attributes.set(r,e)}),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:z(t.data)},this._attributes.set(e,t)),t}setAttributeData(e,t){const r=this._attributes.get(e);r?this._attributes.set(e,{...r,exclusive:!0,data:t}):(0,ie.en)()&&console.warn(`Setting undefined attribute ${e} data`)}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const e=this._attributes.values().next().value?.indices;return e?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(e){return!!(0===this.type?this._computeAttachmentOriginTriangles(e):2===this.type?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(null!=this._transformation&&(0,d.Z0)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){return function(e,t){if(!e)return!1;const{size:r,data:i,indices:n}=e;(0,d.hZ)(t,0,0,0),(0,d.hZ)(ee,0,0,0);let o=0,s=0;for(let e=0;e<n.length-2;e+=3){const a=n[e]*r,l=n[e+1]*r,c=n[e+2]*r;(0,d.hZ)(K,i[a],i[a+1],i[a+2]),(0,d.hZ)(J,i[l],i[l+1],i[l+2]),(0,d.hZ)(Q,i[c],i[c+1],i[c+2]);const u=q(K,J,Q);u?((0,d.WQ)(K,K,J),(0,d.WQ)(K,K,Q),(0,d.hs)(K,K,1/3*u),(0,d.WQ)(t,t,K),o+=u):((0,d.WQ)(ee,ee,K),(0,d.WQ)(ee,ee,J),(0,d.WQ)(ee,ee,Q),s+=3)}return!(0===s&&0===o||(0!==o?((0,d.hs)(t,t,1/o),0):0===s||((0,d.hs)(t,ee,1/s),0)))}(this.positionAttribute,e)}_computeAttachmentOriginLines(e){const t=this.positionAttribute;return function(e,t,r){if(!e)return!1;(0,d.hZ)(r,0,0,0),(0,d.hZ)(ee,0,0,0);let i=0,n=0;const{size:o,data:s,indices:a}=e,l=a.length-1,c=l+(t?2:0);for(let e=0;e<c;e+=2){const t=e<l?e+1:0,c=a[e<l?e:l]*o,u=a[t]*o;K[0]=s[c],K[1]=s[c+1],K[2]=s[c+2],J[0]=s[u],J[1]=s[u+1],J[2]=s[u+2],(0,d.hs)(K,(0,d.WQ)(K,K,J),.5);const h=(0,d.xg)(K,J);h>0?((0,d.WQ)(r,r,(0,d.hs)(K,K,h)),i+=h):0===i&&((0,d.WQ)(ee,ee,K),n++)}return 0!==i?((0,d.hs)(r,r,1/i),!0):0!==n&&((0,d.hs)(r,ee,1/n),!0)}(t,function(e,t){return!(!("isClosed"in e)||!e.isClosed)&&t.indices.length>2}(this.material.parameters,t),e)}_computeAttachmentOriginPoints(e){return function(e,t){if(!e)return!1;const{size:r,data:i,indices:n}=e;(0,d.hZ)(t,0,0,0);let o=-1,s=0;for(let e=0;e<n.length;e++){const a=n[e]*r;o!==a&&(t[0]+=i[a],t[1]+=i[a+1],t[2]+=i[a+2],s++),o=a}return s>1&&(0,d.hs)(t,t,1/s),s>0}(this.positionAttribute,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.positionAttribute;if(!e||0===e.indices.length)return null;const t=0===this.type?3:1;(0,G.vA)(e.indices.length%t===0,"Indexing error: "+e.indices.length+" not divisible by "+t);const r=(0,N.tM)(e.indices.length/t);return new V(r,t,e)}get transformation(){return this._transformation??c.zK}set transformation(e){this._transformation=e&&e!==c.zK?(0,c.o8)(e):null}get highlights(){return this._highlights||oe}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(e){this._highlightOptionsCounts?.forEach((t,r)=>e(r))}allocateIdAndHighlight(e){const t=new re(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);const{highlightName:t}=e,r=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,r),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){const{highlightName:t}=e,r=this._highlightOptionsCounts?.get(t)??0;r<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,r-1)}}}const oe=new Set;var se=r(65529),ae=r(97768),le=r(84952),ce=r(38969),ue=r(95117),de=r(2741);let he;var me=r(63907),pe=r(76284),fe=r(42293);let ge=null,ve=null;async function _e(){return null==ve&&(he??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,de.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),ve=he,ge=await ve),ve}function xe(e,t,r,i,n){const o=(0,fe.MW)(t?me.CQ.COMPRESSED_RGBA8_ETC2_EAC:me.CQ.COMPRESSED_RGB8_ETC2),s=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*s)}function ye(e){return e.getNumImages()>=1&&!e.isUASTC()}function we(e){return e.getFaces()>=1&&e.isETC1S()}function be(e,t,r,i,n,o,s,a){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[u,d]=l?i?[1,me.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,me.CQ.COMPRESSED_RGB8_ETC2]:c?i?[3,me.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,me.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<h;e++)m.push(new Uint8Array(s(e,u))),a(e,u,m[e]);return t.internalFormat=d,t.hasMipmap=m.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new pe.A(e,t,{type:"compressed",levels:m})}const Me=()=>I.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function Te(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const Se=Te("DXT1"),Ce=Te("DXT3"),Ae=Te("DXT5");function Ee(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function Re(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const s=Math.min(Math.sqrt(r/o),i/n);return[Ee(Math.round(e*s),i),Ee(Math.round(t*s),i)]}(e,t);return e.width===r&&e.height===i?e:Ie(e,r,i)}function Ie(e,t,r){if(e instanceof ImageData)return Ie(function(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");if(null==r)throw new R.A("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);const i=document.createElement("canvas");return i.width=t,i.height=r,i.getContext("2d").drawImage(e,0,0,i.width,i.height),i}var Oe=r(67171);class Fe{constructor(e,t){this._data=e,this.id=(0,W.c)(),this.events=new se.bk,this._parameters={...De,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!((0,le.w8)(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,ce.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,le.DB)(e.src)||(0,le.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new Oe.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||function(e,t){if(null==e)return 0;if((0,p.mw)(e)||(0,p.mg)(e))return"image/ktx2"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.KTX2File(new Uint8Array(e)),i=we(r)?xe(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):"image/x.basis"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.BasisFile(new Uint8Array(e)),i=ye(r)?xe(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Pe(e):t,n=t.pixelFormat??6408,o=(0,fe.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const t=this._data;return null==t?(this._texture=new pe.A(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):(0,p.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,p.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,p.mw)(t)||(0,p.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,p.mw)(t)||(0,p.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,p.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,p.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return Me().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Me().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case Se:n=8,o=me.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ce:n=16,o=me.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ae:n=16,o=me.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Me().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let s=1,a=r[4],l=r[3];(3&a||3&l)&&(Me().warn("Rounding up compressed texture size to nearest multiple of 4."),a=a+3&-4,l=l+3&-4);const c=a,u=l;let d,h;131072&r[2]&&!1!==t&&(s=Math.max(1,r[7]));let m=e.byteOffset+r[1]+4;const p=[];for(let t=0;t<s;++t)h=(a+3>>2)*(l+3>>2)*n,d=new Uint8Array(e.buffer,m,h),p.push(d),m+=h,a=Math.max(1,a>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:p},internalFormat:o,width:c,height:u}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:s,height:a}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=s,t.height=a,new pe.A(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.KTX2File(new Uint8Array(r));if(!we(i))return null;i.startTranscoding();const n=be(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.BasisFile(new Uint8Array(r));if(!ye(i))return null;i.startTranscoding();const n=be(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,G.vA)(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new pe.A(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await H(t,{signal:r});return(0,P.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,ue.y)(t,t.src,!1,r);return(0,P.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((i,n)=>{const o=()=>{t.removeEventListener("loadeddata",s),t.removeEventListener("error",a),(0,ae.xt)(l)},s=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(o(),i(this._loadFromImage(e,t)))},a=e=>{o(),n(e||new R.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",s),t.addEventListener("error",a);const l=(0,P.u7)(r,()=>a((0,P.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=Re(r,e.parameters));const i=Pe(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._texture=new pe.A(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,ae.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function Pe(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const De={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};var Ne=r(49255);class He{constructor(e){this._material=e.material,this._techniques=e.techniques,this._output=e.output}dispose(){}get _stippleTextures(){return this._techniques.context?.stippleTextures}get _markerTextures(){return this._techniques.context?.markerTextures}getTechnique(e,t){return this._techniques.get(e,this._material.getConfiguration(this._output,t))}ensureResources(e){return 2}}var Le=r(65786);class Be extends He{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this.updateTexture(e.textureId),this._acquire(e.normalTextureId,e=>this._textureNormal=e),this._acquire(e.emissiveTextureId,e=>this._textureEmissive=e),this._acquire(e.occlusionTextureId,e=>this._textureOcclusion=e),this._acquire(e.metallicRoughnessTextureId,e=>this._textureMetallicRoughness=e)}dispose(){super.dispose(),this._texture=(0,ae.Gz)(this._texture),this._textureNormal=(0,ae.Gz)(this._textureNormal),this._textureEmissive=(0,ae.Gz)(this._textureEmissive),this._textureOcclusion=(0,ae.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,ae.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}get textureBindParameters(){return new Ue(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,ae.Gz)(this._texture),this._acquire(e,e=>this._texture=e))}_acquire(e,t){if(null==e)return void t(null);const r=this._textures.acquire(e);if((0,P.$X)(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return(0,ae.Gz)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(r)}}class ze extends Le.Y{constructor(e=null){super(),this.textureEmissive=e}}class Ue extends ze{constructor(e,t,r,i,n,o,s){super(r),this.texture=e,this.textureNormal=t,this.textureOcclusion=i,this.textureMetallicRoughness=n,this.scale=o,this.normalTextureTransformMatrix=s}}var Ge=r(5482),Ve=r(68317),je=r(51976);class We extends Ve.Hz{constructor(){super(...arguments),this.oitPass=0,this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1}}(0,Ge.Cg)([(0,je.W)({count:3})],We.prototype,"oitPass",void 0),(0,Ge.Cg)([(0,je.W)()],We.prototype,"hasHighlightMixTexture",void 0);var ke=r(19245);class $e{constructor(e,t){this.id=(0,W.c)(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,(0,ke.MB)(this._parameters,e),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,ke.MB)(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bind.decorations)&&0!==(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(e,t,r=new We){return r.output=e,r.hasEmission=t.hasEmission&&(0,Ne._o)(e),r.oitPass=t.oitPass,r.hasHighlightMixTexture=8===e&&null!=t.highlightMixTexture,r}}Le.Y;class Ze{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const qe=(0,m.vt)();function Ye(e,t,r,i,n,o){if(!e.visible)return;const s=(0,d.jb)(lt,i,r),a=(e,t,r)=>o(e,r,t),{tolerance:l}=t,c=new Ze(l,!1,t.options.normalRequired);if(e.boundingInfo)(0,G.vA)(0===e.type),Ke(e.boundingInfo,r,s,l,n,c,a);else{const t=e.positionAttribute,i=t.indices;!function(e,t,r,i,n,o,s,a,l,c){const u=t,h=ct,m=Math.abs(u[0]),p=Math.abs(u[1]),f=Math.abs(u[2]),g=m>=p?m>=f?0:2:p>=f?1:2,v=g,_=u[v]<0?2:1,x=(g+_)%3,y=(g+(3-_))%3,w=u[x]/u[v],b=u[y]/u[v],M=1/u[v],T=Qe,S=et,C=tt,{normalRequired:A}=l;for(let t=r;t<i;++t){const r=3*t,i=s*n[r];(0,d.hZ)(h[0],o[i+0],o[i+1],o[i+2]);const l=s*n[r+1];(0,d.hZ)(h[1],o[l+0],o[l+1],o[l+2]);const u=s*n[r+2];(0,d.hZ)(h[2],o[u+0],o[u+1],o[u+2]),a&&((0,d.C)(h[0],a.applyToVertex(h[0][0],h[0][1],h[0][2],t)),(0,d.C)(h[1],a.applyToVertex(h[1][0],h[1][1],h[1][2],t)),(0,d.C)(h[2],a.applyToVertex(h[2][0],h[2][1],h[2][2],t))),(0,d.jb)(T,h[0],e),(0,d.jb)(S,h[1],e),(0,d.jb)(C,h[2],e);const m=T[x]-w*T[v],p=T[y]-b*T[v],f=S[x]-w*S[v],g=S[y]-b*S[v],_=C[x]-w*C[v],E=C[y]-b*C[v],R=_*g-E*f,I=m*E-p*_,O=f*p-g*m;if((R<0||I<0||O<0)&&(R>0||I>0||O>0))continue;const F=R+I+O;if(0===F)continue;const P=R*(M*T[v])+I*(M*S[v])+O*(M*C[v]);if(P*Math.sign(F)<0)continue;const D=P/F;D>=0&&c(D,t,A?it(h):null)}}(r,s,0,i.length/3,i,t.data,t.stride,n,c,a)}}const Xe=(0,h.vt)();function Ke(e,t,r,i,n,o,s){if(null==e)return;const a=function(e,t){return(0,d.hZ)(t,1/e[0],1/e[1],1/e[2])}(r,Xe);if((0,m.Ne)(qe,e.bbMin),(0,m.vI)(qe,e.bbMax),null!=n&&n.applyToAabb(qe),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let s=Math.min(n,o),a=Math.max(n,o);const l=(e[1]-i-t[1])*r[1],c=(e[4]+i-t[1])*r[1];if(a=Math.min(a,Math.max(l,c)),a<0)return!1;if(s=Math.max(s,Math.min(l,c)),s>a)return!1;const u=(e[2]-i-t[2])*r[2],d=(e[5]+i-t[2])*r[2];return a=Math.min(a,Math.max(u,d)),!(a<0)&&(s=Math.max(s,Math.min(u,d)),!(s>a)&&s<1/0)}(e,t,r,i)}(qe,t,a,i)){const{primitiveIndices:a,position:l}=e,c=a?a.length:l.indices.length/3;if(c>st){const a=e.getChildren();if(void 0!==a){for(const e of a)Ke(e,t,r,i,n,o,s);return}}!function(e,t,r,i,n,o,s,a,l,c,u){const d=e[0],h=e[1],m=e[2],p=t[0],f=t[1],g=t[2],{normalRequired:v}=c;for(let e=0;e<i;++e){const t=a[e],r=3*t,i=s*n[r];let c=o[i],_=o[i+1],x=o[i+2];const y=s*n[r+1];let w=o[y],b=o[y+1],M=o[y+2];const T=s*n[r+2];let S=o[T],C=o[T+1],A=o[T+2];null!=l&&([c,_,x]=l.applyToVertex(c,_,x,e),[w,b,M]=l.applyToVertex(w,b,M,e),[S,C,A]=l.applyToVertex(S,C,A,e));const E=w-c,R=b-_,I=M-x,O=S-c,F=C-_,P=A-x,D=f*P-F*g,N=g*O-P*p,H=p*F-O*f,L=E*D+R*N+I*H;if(Math.abs(L)<=at)continue;const B=d-c,z=h-_,U=m-x,G=B*D+z*N+U*H;if(L>0){if(G<0||G>L)continue}else if(G>0||G<L)continue;const V=z*I-R*U,j=U*E-I*B,W=B*R-E*z,k=p*V+f*j+g*W;if(L>0){if(k<0||G+k>L)continue}else if(k>0||G+k<L)continue;const $=(O*V+F*j+P*W)/L;$>=0&&u($,t,v?rt(E,R,I,O,F,P,Je):null)}}(t,r,0,c,l.indices,l.data,l.stride,a,n,o,s)}}const Je=(0,h.vt)();const Qe=(0,h.vt)(),et=(0,h.vt)(),tt=(0,h.vt)();function rt(e,t,r,i,n,o,s){return(0,d.hZ)(nt,e,t,r),(0,d.hZ)(ot,i,n,o),(0,d.$A)(s,nt,ot),(0,d.S8)(s,s),s}function it(e){return(0,d.jb)(nt,e[1],e[0]),(0,d.jb)(ot,e[2],e[0]),(0,d.$A)(Je,nt,ot),(0,d.S8)(Je,Je),Je}const nt=(0,h.vt)(),ot=(0,h.vt)(),st=1e3,at=1e-7,lt=(0,h.vt)(),ct=[(0,h.vt)(),(0,h.vt)(),(0,h.vt)()];var ut=r(16396);function dt(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length;r*=s;for(let e=0;e<a;++e){const t=2*n[e];o[r]=i[t],o[r+1]=i[t+1],r+=s}}function ht(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,l=o.length;if(r*=a,1===i)for(let e=0;e<l;++e){const t=3*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}else for(let e=0;e<l;++e){const t=3*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}}function mt(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,l=o.length;if(r*=a,1===i)for(let e=0;e<l;++e){const t=4*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}else for(let e=0;e<l;++e){const t=4*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}}function pt(e,t,r,i,n=1){const o=t.typedBuffer,s=t.typedBufferStride;if(i*=s,1===n)for(let t=0;t<r;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s;else for(let t=0;t<r;++t)for(let t=0;t<n;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s}function ft(e,t,r,i,n,o){switch(e){case"position":{(0,G.vA)(3===t.size);const i=n.getField(e,g.xs);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ht(e,r,i,n);const{data:o,indices:s}=e,a=r.typedBuffer,c=r.typedBufferStride,u=s.length,d=t[0],h=t[1],m=t[2],p=t[4],f=t[5],g=t[6],v=t[8],_=t[9],x=t[10],y=t[12],w=t[13],b=t[14];i*=c;let M=0,T=0,S=0;const C=(0,l.tZ)(t)?e=>{M=o[e]+y,T=o[e+1]+w,S=o[e+2]+b}:e=>{const t=o[e],r=o[e+1],i=o[e+2];M=d*t+p*r+v*i+y,T=h*t+f*r+_*i+w,S=m*t+g*r+x*i+b};if(1===n)for(let e=0;e<u;++e)C(3*s[e]),a[i]=M,a[i+1]=T,a[i+2]=S,i+=c;else for(let e=0;e<u;++e){C(3*s[e]);for(let e=0;e<n;++e)a[i]=M,a[i+1]=T,a[i+2]=S,i+=c}}(t,r,i,o);break}case"normal":{(0,G.vA)(3===t.size);const r=n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ht(e,r,i,n);const{data:o,indices:s}=e,a=t,c=r.typedBuffer,u=r.typedBufferStride,d=s.length,h=a[0],m=a[1],p=a[2],f=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,l.ut)(a),b=1e-6,M=1-b;i*=u;let T=0,S=0,C=0;const A=(0,l.tZ)(a)?e=>{T=o[e],S=o[e+1],C=o[e+2]}:e=>{const t=o[e],r=o[e+1],i=o[e+2];T=h*t+f*r+_*i,S=m*t+g*r+x*i,C=p*t+v*r+y*i};if(1===n)if(w)for(let e=0;e<d;++e){A(3*s[e]);const t=T*T+S*S+C*C;if(t<M&&t>b){const e=1/Math.sqrt(t);c[i]=T*e,c[i+1]=S*e,c[i+2]=C*e}else c[i]=T,c[i+1]=S,c[i+2]=C;i+=u}else for(let e=0;e<d;++e)A(3*s[e]),c[i]=T,c[i+1]=S,c[i+2]=C,i+=u;else for(let e=0;e<d;++e){if(A(3*s[e]),w){const e=T*T+S*S+C*C;if(e<M&&e>b){const t=1/Math.sqrt(e);T*=t,S*=t,C*=t}}for(let e=0;e<n;++e)c[i]=T,c[i+1]=S,c[i+2]=C,i+=u}}(t,i,r,o);break}case"normalCompressed":case"profileRight":case"profileUp":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"uv0":{(0,G.vA)(2===t.size);const r=n.getField(e,g.ZD)??n.getField(e,g.gH);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"uvi":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"color":case"symbolColor":{const r=n.getField(e,g.XP);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(3===t.size||4===t.size),function(e,t,r,i,n=1){const{data:o,indices:s}=e,a=r.typedBuffer,l=r.typedBufferStride,c=s.length;if(i*=l,t===o.length&&4===t){a[i]=o[0],a[i+1]=o[1],a[i+2]=o[2],a[i+3]=o[3];const e=new Uint32Array(r.typedBuffer.buffer,r.start),t=l/4,s=e[i/=4];i+=t;const u=c*n;for(let r=1;r<u;++r)e[i]=s,i+=t;return}if(1!==n)if(4!==t)for(let e=0;e<c;++e){const t=3*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=l}else for(let e=0;e<c;++e){const t=4*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=l}else{if(4===t){for(let e=0;e<c;++e){const t=4*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=l}return}for(let e=0;e<c;++e){const t=3*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=l}}}(t,t.size,r,o);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const r=n.getField(e,g.Y$)??n.getField(e,g.Y$);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(1===t.size),function(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length,l=i[0];r*=s;for(let e=0;e<a;++e)o[r]=l,r+=s}(t,r,o);break}case"tangent":{(0,G.vA)(4===t.size);const i=n.getField(e,g.Eq);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void mt(e,r,i,n);const{data:o,indices:s}=e,a=t,c=r.typedBuffer,u=r.typedBufferStride,d=s.length,h=a[0],m=a[1],p=a[2],f=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,l.ut)(a),b=1e-6,M=1-b;if(i*=u,1===n)for(let e=0;e<d;++e){const t=4*s[e],r=o[t],n=o[t+1],a=o[t+2],l=o[t+3];let d=h*r+f*n+_*a,T=m*r+g*n+x*a,S=p*r+v*n+y*a;if(w){const e=d*d+T*T+S*S;if(e<M&&e>b){const t=1/Math.sqrt(e);d*=t,T*=t,S*=t}}c[i]=d,c[i+1]=T,c[i+2]=S,c[i+3]=l,i+=u}else for(let e=0;e<d;++e){const t=4*s[e],r=o[t],a=o[t+1],l=o[t+2],d=o[t+3];let T=h*r+f*a+_*l,S=m*r+g*a+x*l,C=p*r+v*a+y*l;if(w){const e=T*T+S*S+C*C;if(e<M&&e>b){const t=1/Math.sqrt(e);T*=t,S*=t,C*=t}}for(let e=0;e<n;++e)c[i]=T,c[i+1]=S,c[i+2]=C,c[i+3]=d,i+=u}}(t,r,i,o);break}case"profileVertexAndNormal":{(0,G.vA)(4===t.size);const r=n.getField(e,g.jz)??n.getField(e,g.Eq);(0,G.vA)(!!r,`No buffer view for ${e}`),mt(t,r,o);break}case"profileAuxData":{(0,G.vA)(3===t.size);const r=n.getField(e,g.EC)??n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),ht(t,r,o);break}}}(0,h.vt)();class gt{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return function(e,t,r,i,n,o,s){let a={numItems:0,numVerticesPerItem:0};for(const l of r.fields.keys()){const r=e.get(l),c=r?.indices;if(r&&c)"position"===l&&(a={numItems:1,numVerticesPerItem:c.length}),ft(l,r,i,n,o,s);else if("olidColor"===l&&null!=t){const r=e.get("position")?.indices;if(r){const e=r.length;pt(t,o.getField(l,g.XP),e,s)}}}return a}(r,i,this.layout,e,t,n,o)}}var vt=r(91429),_t=r(91829),xt=r(4431),yt=r(1843),wt=r(72824),bt=r(13840),Mt=r(42958),Tt=r(16943),St=r(90644);const Ct=(0,St.p3)(1,0,1,771);function At(e,t=!1){switch(e){case 0:return t?St.RC:St.T8;case 1:return Ct;case 2:case 3:return null}}function Et(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?St.Uy:null;case 1:case 3:return null}}function Rt(e,t=513){return{func:0===e||2===e?t:515}}const It={factor:-1,units:-2};function Ot({oitPass:e,enableOffset:t}){return t&&1===e?It:null}function Ft(e,t){const r={buffers:1===e?[me.r6,me.yI]:[me.r6]};return t&&r.buffers.push(me.r6+r.buffers.length),r.buffers.length>1?r:null}const Pt={mask:255},Dt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Nt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Ht=r(4576);(0,r(44208).A)("esri-tests-disable-gpu-memory-measurements");var Lt=r(69622),Bt=r(32728);class zt{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",g.Eq),this.color=e.getField("instanceColor",g.XP),this.olidColor=e.getField("instanceOlidColor",g.XP),this.state=e.getField("state",g.SL),this.lodLevel=e.getField("lodLevel",g.SL)}}let Ut=class extends Lt.A{constructor(e,t){super(e),this.events=new se.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return Vt(Gt.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=Zt,this._buffer=this._layout.createBuffer(this._capacity),this._view=new zt(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=jt,i=Wt;t.localTransform.getMat(e,kt),t.globalTransform.getMat(e,$t);const n=(0,l.lw)($t,$t,kt);(0,d.hZ)(r,n[12],n[13],n[14]),t.modelOrigin.setVec(e,r),(0,s.z0)(i,n),t.model.setMat(e,i);const o=(0,Bt.wp)(jt,n);o.sort(),t.modelScaleFactors.set(e,0,o[1]),t.modelScaleFactors.set(e,1,o[2]),(0,s.B8)(i,i),(0,s.mg)(i,i),t.modelNormal.setMat(e,i),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,Wt),r.modelOrigin.getVec(e,jt),t[0]=Wt[0],t[1]=Wt[1],t[2]=Wt[2],t[3]=0,t[4]=Wt[3],t[5]=Wt[4],t[6]=Wt[5],t[7]=0,t[8]=Wt[6],t[9]=Wt[7],t[10]=Wt[8],t[11]=0,t[12]=jt[0],t[13]=jt[1],t[14]=jt[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=Math.max(jt[0],jt[1],jt[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(jt[0],jt[1],jt[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max(Zt,Math.floor(this._capacity*Ht.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new zt(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,Ge.Cg)([(0,vt.MZ)({constructOnly:!0})],Ut.prototype,"shaderTransformation",void 0),(0,Ge.Cg)([(0,vt.MZ)()],Ut.prototype,"_size",void 0),(0,Ge.Cg)([(0,vt.MZ)({readOnly:!0})],Ut.prototype,"size",null),Ut=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],Ut);const Gt=(0,yt.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function Vt(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,Tt.E)()&&e.vec4u8("instanceOlidColor"),e}const jt=(0,h.vt)(),Wt=(0,a.vt)(),kt=(0,c.vt)(),$t=(0,c.vt)(),Zt=64,qt=(0,yt.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var Yt=r(74810),Xt=r(28491),Kt=r(49788);class Jt extends wt.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=Yt.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=h.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,h.CN)(.2,.2,.2),this.diffuse=(0,h.CN)(.8,.8,.8),this.externalColor=(0,_t.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,h.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=Kt.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}wt.gy;let Qt=class extends Mt.w{constructor(e,t){let i=(0,xt.U)(rr(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat((0,xt.U)(function(e){return Vt(qt.clone(),e)}(t)))),super(e,t,i),this.shader=new bt.r(Xt.D,()=>r.e(5141).then(r.bind(r,5141)))}_makePipeline(e,t){const{oitPass:r,output:i,hasEmission:n,transparent:o,cullFace:s,customDepthTest:a,hasOccludees:l}=e;return(0,St.Ey)({blending:(0,Ne._o)(i)&&o?At(r):null,culling:tr(e)?(0,St.Xt)(s):null,depthTest:Rt(r,er(a)),depthWrite:Et(e),drawBuffers:(0,Mt.L)(i,Ft(r,n)),colorWrite:St.kn,stencilWrite:l?Pt:null,stencilTest:l?t?Nt:Dt:null,polygonOffset:Ot(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};function er(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function tr(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function rr(e){const t=(0,yt.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,Tt.E)()&&t.vec4u8("olidColor"),t}Qt=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],Qt);class ir extends We{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.occlusionPass=!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}}(0,Ge.Cg)([(0,je.W)({count:4})],ir.prototype,"alphaDiscardMode",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"doubleSidedMode",void 0),(0,Ge.Cg)([(0,je.W)({count:7})],ir.prototype,"pbrMode",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"cullFace",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"normalType",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"customDepthTest",void 0),(0,Ge.Cg)([(0,je.W)({count:8})],ir.prototype,"emissionSource",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVertexColors",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasSymbolColors",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVerticalOffset",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasColorTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasMetallicRoughnessTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOcclusionTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasNormalTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasScreenSizePerspective",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVertexTangents",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOccludees",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instanced",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedDoublePrecision",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasModelTransformation",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"offsetBackfaces",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVVSize",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVVColor",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"receiveShadows",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"receiveAmbientOcclusion",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"textureAlphaPremultiplied",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedFeatureAttribute",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedColor",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"writeDepth",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"transparent",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"enableOffset",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"terrainDepthTest",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"cullAboveTerrain",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"snowCover",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasColorTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasEmissionTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasNormalTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOcclusionTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasMetallicRoughnessTextureTransform",void 0);var nr=r(57323);let or=class extends Qt{constructor(){super(...arguments),this.shader=new bt.r(nr.R,()=>r.e(2314).then(r.bind(r,39933)))}};or=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],or);class sr extends $e{constructor(e,t){super(e,lr),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&!this.transparent],[4,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=rr(this.parameters),this._configuration=new ir(t.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=Kt.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,d.t2)(this.parameters.emissiveBaseColor,h.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,t){const{parameters:r,_configuration:i}=this,{treeRendering:n,doubleSided:o,doubleSidedType:s}=r;return super.getConfiguration(e,t,this._configuration),i.hasNormalTexture=r.hasNormalTexture,i.hasColorTexture=r.hasColorTexture,i.hasMetallicRoughnessTexture=r.hasMetallicRoughnessTexture,i.hasOcclusionTexture=r.hasOcclusionTexture,i.hasVertexTangents=!n&&r.hasVertexTangents,i.instanced=r.instanced,i.instancedDoublePrecision=r.instancedDoublePrecision,i.hasVVColor=!!r.vvColor,i.hasVVSize=!!r.vvSize,i.hasVerticalOffset=null!=r.verticalOffset,i.hasScreenSizePerspective=null!=r.screenSizePerspective,i.hasSlicePlane=r.hasSlicePlane,i.alphaDiscardMode=r.textureAlphaMode,i.normalType=n?0:r.normalType,i.transparent=this.transparent,i.writeDepth=r.writeDepth,i.customDepthTest=r.customDepthTest??0,i.hasOccludees=t.hasOccludees,i.cullFace=r.hasSlicePlane?0:r.cullFace,i.cullAboveTerrain=t.cullAboveTerrain,i.hasModelTransformation=!n&&null!=r.modelTransformation,i.hasVertexColors=r.hasVertexColors,i.hasSymbolColors=r.hasSymbolColors,i.doubleSidedMode=n?2:o&&"normal"===s?1:o&&"winding-order"===s?2:0,i.instancedFeatureAttribute=r.instancedFeatureAttribute,i.instancedColor=r.instancedColor,(0,Ne._o)(e)?(i.terrainDepthTest=t.terrainDepthTest,i.receiveShadows=r.receiveShadows,i.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(i.terrainDepthTest=!1,i.receiveShadows=i.receiveAmbientOcclusion=!1),i.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,i.pbrMode=r.usePBR?r.isSchematic?2:1:0,i.emissionSource=r.emissionSource,i.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),i.enableOffset=t.enableOffset,i.snowCover=t.snowCover>0,i.hasColorTextureTransform=!!r.colorTextureTransformMatrix,i.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,i.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,i.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,i.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,i}intersect(e,t,r,i,n,o){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,d.hZ)(pr,t[12],t[13],t[14]);let o=null;switch(r.viewingMode){case 1:o=(0,d.S8)(hr,pr);break;case 2:o=(0,d.C)(hr,dr)}const s=(0,d.Re)(fr,pr,e.eye),a=(0,d.Bw)(s),l=(0,d.hs)(s,s,1/a);let c=null;this.parameters.screenSizePerspective&&(c=(0,d.Om)(o,l));const u=(0,ke.kE)(e,a,this.parameters.verticalOffset,c??0,this.parameters.screenSizePerspective,null);(0,d.hs)(o,o,u),(0,d.ei)(mr,o,r.transform.inverseRotation),i=(0,d.Re)(cr,i,mr),n=(0,d.Re)(ur,n,mr)}Ye(e,r,i,n,(0,ut.ou)(r.verticalOffset),o)}createGLMaterial(e){return new ar(e)}createBufferWriter(){return new gt(this._layout)}get transparent(){return function(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:s,textureAlphaMode:a,colorMixMode:l}=e,c=i[3];return t||r<1&&"replace"!==l||c<1&&"ignore"!==l||n<1||(null!=o||null!=s)&&1!==a&&2!==a&&"replace"!==l}(this.parameters)}}class ar extends Be{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,d.hZ)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?or:Qt,e)}}class lr extends Jt{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const cr=(0,h.vt)(),ur=(0,h.vt)(),dr=(0,h.fA)(0,0,1),hr=(0,h.vt)(),mr=(0,h.vt)(),pr=(0,h.vt)(),fr=(0,h.vt)(),gr=()=>I.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class vr{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}function _r(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(gr().warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(gr().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(gr().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(gr().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else gr().warn("Indexed geometries must specify faces"),i=!1;break}default:gr().warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(gr().warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(gr().warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function xr(e){const t=(0,m.Ie)();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&((0,m.iT)(t,r.bbMin),(0,m.iT)(t,r.bbMax))}),t}function yr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function wr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const br=new D.A(1,2,"wosr");async function Mr(e,t){const a=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,n.EM)(e));if("wosr"===a.fileType){const e=await(t.cache?t.cache.loadWOSR(a.url,t):async function(e,t){const r=await async function(e,t){const r=await(0,E.Ke)((0,A.A)(e,t));if(r.ok)return r.value.data;(0,P.QP)(r.error),function(e){throw new R.A("",`Request for object resource failed: ${e}`)}(r.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const n=e[i],o=n.images[0].data;if(!o){gr().warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+o,a="/textureDefinitions/"+i,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==yr(l)},u=t?.disableTextures?Promise.resolve(null):H(s,t);r.push(u.then(e=>({refId:a,image:e,parameters:c,alphaChannelUsage:l})))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}(r.textureDefinitions??{},t);let n=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];n+=t?.image?t.image.width*t.image.height*4:0}return new vr(r,i,n+(0,O.Qh)(r))}(a.url,t)),{engineResources:r,referenceBoundingBox:i}=function(e,t){const r=new Array,i=new Array,n=new Array,o=new F.O,s=e.resource,a=D.A.parse(s.version||"1.0","wosr");br.validate(a);const l=s.model.name,c=s.model.geometries,u=s.materialDefinitions??{},d=e.textures;let m=0;const p=new Map;for(let e=0;e<c.length;e++){const s=c[e];if(!_r(s))continue;const a=wr(s),l=s.params.vertexAttributes,f=[],g=e=>{if("PerAttributeArray"===s.params.topology)return null;const t=s.params.faces;for(const r in t)if(r===e)return t[r].values;return null},v=l.position,_=v.values.length/v.valuesPerElement;for(const e in l){const t=l[e],r=t.values,i=g(e)??(0,N.tM)(_);f.push([e,new L.n(r,i,t.valuesPerElement,!0)])}const x=a.texture,y=d&&d[x];if(y&&!p.has(x)){const{image:e,parameters:t}=y,r=new Fe(e,t);i.push(r),p.set(x,r)}const w=p.get(x),b=w?w.id:void 0,M=a.material;let T=o.get(M,x);if(null==T){const e=u[M.slice(M.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=y?yr(y.alphaChannelUsage):void 0,i={ambient:(0,h.ci)(e.diffuse),diffuse:(0,h.ci)(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:b,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:y?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(i,t.materialParameters),T=new sr(i,t),o.set(M,x,T)}n.push(T);const S=new ne(T,f);m+=f.find(e=>"position"===e[0])?.[1]?.indices.length??0,r.push(S)}return{engineResources:[{name:l,stageResources:{textures:i,materials:n,geometries:r},pivotOffset:s.model.pivotOffset,numberOfVertices:m,lodThreshold:null}],referenceBoundingBox:xr(r)}}(e,t);return{lods:r,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let p;if(t.cache)p=await t.cache.loadGLTF(a.url,t,!!t.usePBR,!!t.useEmissive);else{const{loadGLTF:e}=await r.e(1698).then(r.bind(r,51698));p=await e(new y.R,a.url,t,t.usePBR,t.useEmissive)}const{engineResources:M,referenceBoundingBox:S}=function(e,t,r){const n=e.model,a=e.meta,p=n.meta?.ESRI_proxyEllipsoid,y=a.isEsriSymbolResource&&null!=p&&"EsriRealisticTreesStyle"===a.ESRI_webstyle;y&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r){const n=e.model.lods[r];for(const o of n.parts){const n=o.attributes.normal;if(null==n)return;const s=o.attributes.position,a=s.count,u=(0,h.vt)(),m=(0,h.vt)(),p=(0,h.vt)(),f=new Float32Array(4*a),v=new Float32Array(3*a),_=(0,l.B8)((0,c.vt)(),o.transform);let x=0,y=0;for(let l=0;l<a;l++){s.getVec(l,m),n.getVec(l,u),(0,d.Z0)(m,m,o.transform),(0,d.Re)(p,m,t.center),(0,d.Qr)(p,p,t.radius);const a=p[2],c=(0,d.Bw)(p),h=Math.min(.45+.55*c*c,1)**i.Tf;(0,d.Qr)(p,p,t.radius),null!==_&&(0,d.Z0)(p,p,_),(0,d.S8)(p,p),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,d.Cc)(p,p,u,a>-1?.2:Math.min(-4*a-3.8,1)),v[x]=p[0],v[x+1]=p[1],v[x+2]=p[2],x+=3,f[y]=h,f[y+1]=h,f[y+2]=h,f[y+3]=1,y+=4}o.attributes.normal=new g.xs(v.buffer),o.attributes.color=new g.Eq(f.buffer)}}}(e,p));const M=!!t.usePBR,S=a.isEsriSymbolResource?{usePBR:M,isSchematic:!1,treeRendering:y,mrrFactors:Yt.SY}:{usePBR:M,isSchematic:!1,treeRendering:!1,mrrFactors:Yt.mb},A={...t.materialParameters,treeRendering:y},E=new Array,R=new Map,I=new Map,O=n.lods.length,F=(0,m.Ie)();return n.lods.forEach((e,a)=>{const l=!0===t.skipHighLods&&(O>1&&0===a||O>3&&1===a)||!1===t.skipHighLods&&null!=r&&a!==r;if(l&&0!==a)return;const c=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const r=l?new sr({},t):function(e,t,r,n,o,s,a,l,c){const d=e.materials.get(t.material);if(null==d)return null;const{normal:h,color:m,texCoord0:p,tangent:f}=t.attributes,g=t.material+(h?"_normal":"")+(m?"_color":"")+(p?"_texCoord0":"")+(f?"_tangent":""),v=null!=t.attributes.texCoord0,_=null!=t.attributes.normal,x=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(d.alphaMode);if(!s.has(g)){if(v){const t=(t,r=!1,i=!1)=>{if(null!=t&&!a.has(t)){const n=e.textures.get(t);if(n){const e=n.data,o=r&&!(0,b.x3)(e)?l.compressionOptions:void 0;a.set(t,new Fe((0,b.x3)(e)?e.data:e,{...n.parameters,preMultiplyAlpha:!(0,b.x3)(e)&&i,encoding:(0,b.x3)(e)?e.encoding:void 0,compressionOptions:o}))}}},r=1!==x&&!c;t(d.colorTexture,r,1!==x),t(d.normalTexture),t(d.occlusionTexture,!0),t(d.emissiveTexture),t(d.metallicRoughnessTexture,!0)}const r=(0,i.xV)(d.color[0]),h=(0,i.xV)(d.color[1]),m=(0,i.xV)(d.color[2]),p=null!=d.colorTexture&&v?a.get(d.colorTexture):null,f=(0,Yt.Jr)(d),y=null!=d.normalTextureTransform?.scale?d.normalTextureTransform?.scale:u.Un;s.set(g,new sr({...n,customDepthTest:1,textureAlphaMode:x,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,h,m],ambient:[r,h,m],opacity:"OPAQUE"===d.alphaMode?1:d.opacity,doubleSided:d.doubleSided,doubleSidedType:"winding-order",cullFace:d.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:_?0:2,castShadows:!0,receiveShadows:d.receiveShadows,receiveAmbientOcclusion:d.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:d.colorMixMode,normalTextureId:null!=d.normalTexture&&v?a.get(d.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=d.occlusionTexture&&v?a.get(d.occlusionTexture).id:void 0,emissiveTextureId:null!=d.emissiveTexture&&v?a.get(d.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=d.metallicRoughnessTexture&&v?a.get(d.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[d.emissiveFactor[0],d.emissiveFactor[1],d.emissiveFactor[2]],emissiveStrengthKHR:null!=d.emissiveStrengthKHR?d.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=o.emissiveStrengthFromSymbol?o.emissiveStrengthFromSymbol:void 0,mrrFactors:f?Yt.Bt:[d.metallicFactor,d.roughnessFactor,n.mrrFactors[2]],isSchematic:f,colorTextureTransformMatrix:T(d.colorTextureTransform),normalTextureTransformMatrix:T(d.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:T(d.occlusionTextureTransform),emissiveTextureTransformMatrix:T(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:T(d.metallicRoughnessTextureTransform),...o},l))}const y=s.get(g);if(r.stageResources.materials.push(y),v){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(d.colorTexture),e(d.normalTexture),e(d.occlusionTexture),e(d.emissiveTexture),e(d.metallicRoughnessTexture)}return y}(n,e,c,S,A,R,I,t,y),{geometry:d,vertexCount:h}=function(e,t){const r=e.attributes.position.count,i=(0,w.x)(e.indices||r,e.primitiveType),n=f(3*r),{typedBuffer:a,typedBufferStride:l}=e.attributes.position;(0,v.t)(n,a,e.transform,3,l);const c=[["position",new L.n(n,i,3,!0)]];if(null!=e.attributes.normal){const t=f(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,s.Ge)(Tr,e.transform),(0,v.b)(t,n,Tr,3,a),(0,o.or)(Tr)&&(0,v.n)(t,t),c.push(["normal",new L.n(t,i,3,!0)])}if(null!=e.attributes.tangent){const t=f(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,s.z0)(Tr,e.transform),(0,_.t)(t,n,Tr,4,a),(0,o.or)(Tr)&&(0,v.n)(t,t,4),c.push(["tangent",new L.n(t,i,4,!0)])}if(null!=e.attributes.texCoord0){const t=f(2*r),{typedBuffer:n,typedBufferStride:o}=e.attributes.texCoord0;(0,x.a)(t,n,2,o),c.push(["uv0",new L.n(t,i,2,!0)])}const u=e.attributes.color;if(null!=u){const t=new Uint8Array(4*r);4===u.elementCount?u instanceof g.Eq?(0,_.b)(t,u,1,255):(u instanceof g.XP||u instanceof g.Uz)&&(0,_.b)(t,u,1/255,255):(t.fill(255),u instanceof g.xs?(0,v.f)(t,u.typedBuffer,1,255,4,u.typedBufferStride):(e.attributes.color instanceof g.eI||e.attributes.color instanceof g.nS)&&(0,v.f)(t,u.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new L.n(t,i,4,!0)])}return{geometry:new ne(t,c),vertexCount:r}}(e,r??new sr({},t)),p=d.boundingInfo;null!=p&&0===a&&((0,m.iT)(F,p.bbMin),(0,m.iT)(F,p.bbMax)),null!=r&&(c.stageResources.geometries.push(d),c.numberOfVertices+=h)}),l||E.push(c)}),{engineResources:E,referenceBoundingBox:F}}(p,t,a.specifiedLodIndex);return{lods:M,referenceBoundingBox:S,isEsriSymbolResource:p.meta.isEsriSymbolResource,isWosr:!1}}const Tr=(0,a.vt)()},46686(e,t,r){r.d(t,{o:()=>n});var i=r(31821);function n(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(i.H`
667
+ }`)}},43609(e,t,r){r.d(t,{a:()=>o,f:()=>s,n:()=>n});var i=r(34275);function n(e,t){o(e.typedBuffer,t.typedBuffer,e.typedBufferStride,t.typedBufferStride)}function o(e,t,r=2,n=r){const o=t.length/2;let s=0,a=0;if(!(0,i.iu)(t)||(0,i.dk)(t)){for(let i=0;i<o;++i)e[s]=t[a],e[s+1]=t[a+1],s+=r,a+=n;return}const l=(0,i.a3)(t);if((0,i.JI)(t))for(let i=0;i<o;++i)e[s]=Math.max(t[a]/l,-1),e[s+1]=Math.max(t[a+1]/l,-1),s+=r,a+=n;else for(let i=0;i<o;++i)e[s]=t[a]/l,e[s+1]=t[a+1]/l,s+=r,a+=n}function s(e,t,r,i){const n=e.typedBuffer,o=e.typedBufferStride,s=i?.count??e.count;let a=(i?.dstIndex??0)*o;for(let e=0;e<s;++e)n[a]=t,n[a+1]=r,a+=o}Object.freeze(Object.defineProperty({__proto__:null,fill:s,normalizeIntegerBuffer:o,normalizeIntegerBufferView:n},Symbol.toStringTag,{value:"Module"}))},46140(e,t,r){r.d(t,{A:()=>n});var i=r(49186);class n{constructor(e,t,r=""){this.major=e,this.minor=t,this._context=r}lessThan(e,t){return this.major<e||e===this.major&&this.minor<t}greaterEqual(e,t){return!this.lessThan(e,t)}toString(){return`${this.major}.${this.minor}`}validate(e){if(this.major!==e.major){const t=this._context&&this._context+":",r=this._context&&this._context+" ";throw new i.A(t+"unsupported-version",`Required major ${r}version is '${this.major}', but got '\${version.major}.\${version.minor}'`,{version:e})}}clone(){return new n(this.major,this.minor,this._context)}static parse(e,t=""){const[r,o]=e.split("."),s=/^\s*\d+\s*$/;if(!r?.match||!s.test(r))throw new i.A((t&&t+":")+"invalid-version","Expected major version to be a number, but got '${version}'",{version:e});if(!o?.match||!s.test(o))throw new i.A((t&&t+":")+"invalid-version","Expected minor version to be a number, but got '${version}'",{version:e});const a=parseInt(r,10),l=parseInt(o,10);return new n(a,l,t)}}},46154(e,t,r){r.d(t,{fetch:()=>Mr});var i=r(40876),n=r(61473),o=r(34727),s=r(77690),a=r(29242),l=r(58083),c=r(9093),u=r(48163),d=r(35522),h=r(51850),m=r(70328),p=r(34275);function f(e,t=!1){return e<=p.y9?t?new Array(e).fill(0):new Array(e):new Float32Array(e)}var g=r(13030),v=r(73354),_=r(65686),x=r(43609),y=r(21015),w=r(84498),b=r(51530),M=r(88340);function T(e){if(null==e)return null;const t=null!=e.offset?e.offset:M.uY,r=null!=e.rotation?e.rotation:0,i=null!=e.scale?e.scale:M.Un,n=(0,a.fA)(1,0,0,0,1,0,t[0],t[1],1),o=(0,a.fA)(Math.cos(r),-Math.sin(r),0,Math.sin(r),Math.cos(r),0,0,0,1),l=(0,a.fA)(i[0],0,0,0,i[1],0,0,0,1),c=(0,a.vt)();return(0,s.lw)(c,o,l),(0,s.lw)(c,n,c),c}class S{constructor(){this.geometries=new Array,this.materials=new Array,this.textures=new Array}}class C{constructor(e,t,r){this.name=e,this.lodThreshold=t,this.pivotOffset=r,this.stageResources=new S,this.numberOfVertices=0}}var A=r(11254),E=r(60999),R=r(49186),I=r(53966),O=r(69397),F=r(81139),P=r(74887),D=r(46140),N=r(97146);async function H(e,t){return(await(0,A.A)(e,{responseType:"image",...t})).data}var L=r(46610),B=r(20498);function z(e){if(e.length<p.y9)return Array.from(e);if(Array.isArray(e))return Float64Array.from(e);if(!("BYTES_PER_ELEMENT"in e))return Array.from(e);switch(e.BYTES_PER_ELEMENT){case 1:return Uint8Array.from(e);case 2:return(0,p.LW)(e)?(0,B.pX)().from(e):(0,p.jq)(e)?Uint16Array.from(e):Int16Array.from(e);case 4:return Float32Array.from(e);default:return Float64Array.from(e)}}var U=r(15142),G=r(620);class V{get center(){return(0,h.fA)(this._data[0],this._data[1],this._data[2])}get radius(){return this._data[3]}get bbMin(){return(0,h.fA)(this._data[4],this._data[5],this._data[6])}get bbMax(){return(0,h.fA)(this._data[7],this._data[8],this._data[9])}constructor(e,t,r){this.primitiveIndices=e,this._numIndexPerPrimitive=t,this.position=r,this._data=[.1,0,0,0,0,0,0,0,0,0],this._children=void 0,(0,G.vA)(e.length>=1),(0,G.vA)(3===r.size||4===r.size);const{data:i,size:n,indices:o}=r;(0,G.vA)(o.length%this._numIndexPerPrimitive===0),(0,G.vA)(o.length>=e.length*this._numIndexPerPrimitive);const s=e.length;let a=n*o[this._numIndexPerPrimitive*e[0]];j.clear(),j.push(a);const l=(0,h.fA)(i[a],i[a+1],i[a+2]),c=(0,h.o8)(l);for(let t=0;t<s;++t){const r=this._numIndexPerPrimitive*e[t];for(let e=0;e<this._numIndexPerPrimitive;++e){a=n*o[r+e],j.push(a);let t=i[a];l[0]=Math.min(t,l[0]),c[0]=Math.max(t,c[0]),t=i[a+1],l[1]=Math.min(t,l[1]),c[1]=Math.max(t,c[1]),t=i[a+2],l[2]=Math.min(t,l[2]),c[2]=Math.max(t,c[2])}}for(let e=0;e<3;++e)this._data[4+e]=l[e],this._data[7+e]=c[e];const u=(0,d.Cc)((0,h.vt)(),this.bbMin,this.bbMax,.5);let m=.5*Math.max(Math.max(c[0]-l[0],c[1]-l[1]),c[2]-l[2]),p=m*m;for(let e=0;e<j.length;++e){a=j.at(e);const t=i[a]-u[0],r=i[a+1]-u[1],n=i[a+2]-u[2],o=t*t+r*r+n*n;if(o<=p)continue;const s=Math.sqrt(o),l=.5*(s-m);m+=l,p=m*m;const c=l/s;u[0]+=t*c,u[1]+=r*c,u[2]+=n*c}this._data[3]=m;for(let e=0;e<3;++e)this._data[0+e]=u[e];j.clear()}getChildren(){if(this._children||(0,d.hG)(this.bbMin,this.bbMax)<=1)return this._children;const e=(0,d.Cc)((0,h.vt)(),this.bbMin,this.bbMax,.5),t=this.primitiveIndices.length,r=new Uint8Array(t),i=new Array(8);for(let e=0;e<8;++e)i[e]=0;const{data:n,size:o,indices:s}=this.position;for(let a=0;a<t;++a){let t=0;const l=this._numIndexPerPrimitive*this.primitiveIndices[a];let c=o*s[l],u=n[c],d=n[c+1],h=n[c+2];for(let e=1;e<this._numIndexPerPrimitive;++e){c=o*s[l+e];const t=n[c],r=n[c+1],i=n[c+2];t<u&&(u=t),r<d&&(d=r),i<h&&(h=i)}u<e[0]&&(t|=1),d<e[1]&&(t|=2),h<e[2]&&(t|=4),r[a]=t,++i[t]}let a=0;for(let e=0;e<8;++e)i[e]>0&&++a;if(a<2)return;const l=new Array(8);for(let e=0;e<8;++e)l[e]=i[e]>0?new Uint32Array(i[e]):void 0;for(let e=0;e<8;++e)i[e]=0;for(let e=0;e<t;++e){const t=r[e];l[t][i[t]++]=this.primitiveIndices[e]}this._children=new Array;for(let e=0;e<8;++e)void 0!==l[e]&&this._children.push(new V(l[e],this._numIndexPerPrimitive,this.position));return this._children}static prune(){j.prune()}}const j=new U.A({deallocator:null});var W=r(24326);class k{constructor(e){this.id=(0,W.c)(),this._attributes=new Map;for(const[t,r]of e)this._attributes.set(t,{...r,indices:(0,N.Dg)(r.indices)})}get attributes(){return this._attributes}}var Z=r(4341),$=r(11964);function q(e,t,r){return(0,d.Re)(Y,t,e),(0,d.Re)(X,r,e),.5*(0,d.Bw)((0,d.$A)(Y,Y,X))}r(32114),new Z.I($.vt),new Z.I(()=>{return e?{p0:(0,h.o8)(e.p0),p1:(0,h.o8)(e.p1),p2:(0,h.o8)(e.p2)}:{p0:(0,h.vt)(),p1:(0,h.vt)(),p2:(0,h.vt)()};var e});const Y=(0,h.vt)(),X=(0,h.vt)(),K=(0,h.vt)(),J=(0,h.vt)(),Q=(0,h.vt)(),ee=(0,h.vt)();class te{constructor(){this.uid=(0,W.c)()}}class re extends te{constructor(e){super(),this.highlightName=e,this.channel=0}}var ie=r(94656);class ne extends k{constructor(e,t,r=null,i=0,n=null,o=-1,s){super(t),this.material=e,this.mapPositions=r,this.type=i,this.olidColor=n,this.edgeIndicesLength=o,this.baseGeometry=s,this._highlights=null,this._highlightOptionsCounts=null,this.visible=!0,this._boundingInfo=null;const a=this.positionAttribute;null!=a&&this.edgeIndicesLength<0&&(this.edgeIndicesLength=a.indices.length)}instantiate(e={}){const t=new ne(e.material||this.material,[],this.mapPositions,this.type,this.olidColor,this.edgeIndicesLength,this.baseGeometry);return this._attributes.forEach((e,r)=>{e.exclusive=!1,t._attributes.set(r,e)}),t._boundingInfo=this._boundingInfo,t.transformation=e.transformation||this.transformation,t}getMutableAttribute(e){let t=this._attributes.get(e);return t&&!t.exclusive&&(t={...t,exclusive:!0,data:z(t.data)},this._attributes.set(e,t)),t}setAttributeData(e,t){const r=this._attributes.get(e);r?this._attributes.set(e,{...r,exclusive:!0,data:t}):(0,ie.en)()&&console.warn(`Setting undefined attribute ${e} data`)}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const e=this._attributes.values().next().value?.indices;return e?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(e){return!!(0===this.type?this._computeAttachmentOriginTriangles(e):2===this.type?this._computeAttachmentOriginLines(e):this._computeAttachmentOriginPoints(e))&&(null!=this._transformation&&(0,d.Z0)(e,e,this._transformation),!0)}_computeAttachmentOriginTriangles(e){return function(e,t){if(!e)return!1;const{size:r,data:i,indices:n}=e;(0,d.hZ)(t,0,0,0),(0,d.hZ)(ee,0,0,0);let o=0,s=0;for(let e=0;e<n.length-2;e+=3){const a=n[e]*r,l=n[e+1]*r,c=n[e+2]*r;(0,d.hZ)(K,i[a],i[a+1],i[a+2]),(0,d.hZ)(J,i[l],i[l+1],i[l+2]),(0,d.hZ)(Q,i[c],i[c+1],i[c+2]);const u=q(K,J,Q);u?((0,d.WQ)(K,K,J),(0,d.WQ)(K,K,Q),(0,d.hs)(K,K,1/3*u),(0,d.WQ)(t,t,K),o+=u):((0,d.WQ)(ee,ee,K),(0,d.WQ)(ee,ee,J),(0,d.WQ)(ee,ee,Q),s+=3)}return!(0===s&&0===o||(0!==o?((0,d.hs)(t,t,1/o),0):0===s||((0,d.hs)(t,ee,1/s),0)))}(this.positionAttribute,e)}_computeAttachmentOriginLines(e){const t=this.positionAttribute;return function(e,t,r){if(!e)return!1;(0,d.hZ)(r,0,0,0),(0,d.hZ)(ee,0,0,0);let i=0,n=0;const{size:o,data:s,indices:a}=e,l=a.length-1,c=l+(t?2:0);for(let e=0;e<c;e+=2){const t=e<l?e+1:0,c=a[e<l?e:l]*o,u=a[t]*o;K[0]=s[c],K[1]=s[c+1],K[2]=s[c+2],J[0]=s[u],J[1]=s[u+1],J[2]=s[u+2],(0,d.hs)(K,(0,d.WQ)(K,K,J),.5);const h=(0,d.xg)(K,J);h>0?((0,d.WQ)(r,r,(0,d.hs)(K,K,h)),i+=h):0===i&&((0,d.WQ)(ee,ee,K),n++)}return 0!==i?((0,d.hs)(r,r,1/i),!0):0!==n&&((0,d.hs)(r,ee,1/n),!0)}(t,function(e,t){return!(!("isClosed"in e)||!e.isClosed)&&t.indices.length>2}(this.material.parameters,t),e)}_computeAttachmentOriginPoints(e){return function(e,t){if(!e)return!1;const{size:r,data:i,indices:n}=e;(0,d.hZ)(t,0,0,0);let o=-1,s=0;for(let e=0;e<n.length;e++){const a=n[e]*r;o!==a&&(t[0]+=i[a],t[1]+=i[a+1],t[2]+=i[a+2],s++),o=a}return s>1&&(0,d.hs)(t,t,1/s),s>0}(this.positionAttribute,e)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const e=this.positionAttribute;if(!e||0===e.indices.length)return null;const t=0===this.type?3:1;(0,G.vA)(e.indices.length%t===0,"Indexing error: "+e.indices.length+" not divisible by "+t);const r=(0,N.tM)(e.indices.length/t);return new V(r,t,e)}get transformation(){return this._transformation??c.zK}set transformation(e){this._transformation=e&&e!==c.zK?(0,c.o8)(e):null}get highlights(){return this._highlights||oe}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(e){this._highlightOptionsCounts?.forEach((t,r)=>e(r))}allocateIdAndHighlight(e){const t=new re(e);return this.addHighlight(t)}addHighlight(e){this._ensureHighlights().add(e);const{highlightName:t}=e,r=(this._highlightOptionsCounts?.get(t)??0)+1;return this._ensureHighlightOptionsCounts().set(t,r),e}_ensureHighlights(){let e=this._highlights;return e||(e=new Set,this._highlights=e),e}_ensureHighlightOptionsCounts(){let e=this._highlightOptionsCounts;return e||(e=new Map,this._highlightOptionsCounts=e),e}removeHighlight(e){if(this._highlights?.delete(e)){const{highlightName:t}=e,r=this._highlightOptionsCounts?.get(t)??0;r<=1?this._highlightOptionsCounts?.delete(t):this._ensureHighlightOptionsCounts().set(t,r-1)}}}const oe=new Set;var se=r(65529),ae=r(97768),le=r(84952),ce=r(38969),ue=r(95117),de=r(2741);let he;var me=r(63907),pe=r(76284),fe=r(42293);let ge=null,ve=null;async function _e(){return null==ve&&(he??=(async()=>{const e=await r.e(9321).then(r.bind(r,49321)),t=await e.default({locateFile:e=>(0,de.s)(`esri/libs/basisu/${e}`)});return t.initializeBasis(),t})(),ve=he,ge=await ve),ve}function xe(e,t,r,i,n){const o=(0,fe.MW)(t?me.CQ.COMPRESSED_RGBA8_ETC2_EAC:me.CQ.COMPRESSED_RGB8_ETC2),s=n&&e>1?(4**e-1)/(3*4**(e-1)):1;return Math.ceil(r*i*o*s)}function ye(e){return e.getNumImages()>=1&&!e.isUASTC()}function we(e){return e.getFaces()>=1&&e.isETC1S()}function be(e,t,r,i,n,o,s,a){const{compressedTextureETC:l,compressedTextureS3TC:c}=e.capabilities,[u,d]=l?i?[1,me.CQ.COMPRESSED_RGBA8_ETC2_EAC]:[0,me.CQ.COMPRESSED_RGB8_ETC2]:c?i?[3,me.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT]:[2,me.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT]:[13,6408],h=t.hasMipmap?r:Math.min(1,r),m=[];for(let e=0;e<h;e++)m.push(new Uint8Array(s(e,u))),a(e,u,m[e]);return t.internalFormat=d,t.hasMipmap=m.length>1,t.samplingMode=t.hasMipmap?9987:9729,t.width=n,t.height=o,new pe.A(e,t,{type:"compressed",levels:m})}const Me=()=>I.A.getLogger("esri.views.3d.webgl-engine.lib.DDSUtil");function Te(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}const Se=Te("DXT1"),Ce=Te("DXT3"),Ae=Te("DXT5");function Ee(e,t){return t=16*Math.floor(t/16),Math.min(16*Math.round(e/16),t)}function Re(e,t){const[r,i]=function({width:e,height:t},{maxPreferredTexturePixels:r,maxTextureSize:i}){const n=Math.max(e,t),o=e*t;if(n<=i&&o<=r)return[e,t];const s=Math.min(Math.sqrt(r/o),i/n);return[Ee(Math.round(e*s),i),Ee(Math.round(t*s),i)]}(e,t);return e.width===r&&e.height===i?e:Ie(e,r,i)}function Ie(e,t,r){if(e instanceof ImageData)return Ie(function(e){const t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");if(null==r)throw new R.A("texture:context-failed","Failed to create 2d context from HTMLCanvasElement");return r.putImageData(e,0,0),t}(e),t,r);const i=document.createElement("canvas");return i.width=t,i.height=r,i.getContext("2d").drawImage(e,0,0,i.width,i.height),i}var Oe=r(67171);class Fe{constructor(e,t){this._data=e,this.id=(0,W.c)(),this.events=new se.bk,this._parameters={...De,...t},this._startPreload(e)}dispose(){this.unload(),this._data=this.update=void 0}_startPreload(e){e instanceof HTMLVideoElement?(this.update=t=>this._update(e,t),this._startPreloadVideoElement(e)):e instanceof HTMLImageElement&&this._startPreloadImageElement(e)}_startPreloadVideoElement(e){if(!((0,le.w8)(e.src)||"auto"===e.preload&&e.crossOrigin)&&(e.preload="auto",e.crossOrigin="anonymous",e.src=e.src,e.paused&&e.autoplay)){const t=[];(0,ce.i)(e,e=>t.push(e)).then(()=>{e.play()}).finally(()=>t.forEach(e=>e.remove()))}}_startPreloadImageElement(e){(0,le.DB)(e.src)||(0,le.w8)(e.src)||e.crossOrigin||(e.crossOrigin="anonymous",e.src=e.src)}_createDescriptor(e){const t=new Oe.R;return t.wrapMode=this._parameters.wrap??10497,t.flipped=!this._parameters.noUnpackFlip,t.samplingMode=this._parameters.mipmap?9987:9729,t.hasMipmap=!!this._parameters.mipmap,t.preMultiplyAlpha=!!this._parameters.preMultiplyAlpha,t.maxAnisotropy=this._parameters.maxAnisotropy??(this._parameters.mipmap?e.parameters.maxMaxAnisotropy:1),t.dataType=this._parameters.dataType??t.dataType,t.pixelFormat=this._parameters.pixelFormat??t.pixelFormat,t.internalFormat=this._parameters.internalFormat??t.internalFormat,t}get texture(){return this._texture??this._emptyTexture}get loaded(){return null!=this._texture}get usedMemory(){return this._texture?.usedMemory||function(e,t){if(null==e)return 0;if((0,p.mw)(e)||(0,p.mg)(e))return"image/ktx2"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.KTX2File(new Uint8Array(e)),i=we(r)?xe(r.getLevels(),r.getHasAlpha(),r.getWidth(),r.getHeight(),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):"image/x.basis"===t.encoding?function(e,t){if(null==ge)return e.byteLength;const r=new ge.BasisFile(new Uint8Array(e)),i=ye(r)?xe(r.getNumLevels(0),r.getHasAlpha(),r.getImageWidth(0,0),r.getImageHeight(0,0),t):0;return r.close(),r.delete(),i}(e,!!t.mipmap):e.byteLength;const{width:r,height:i}=e instanceof Image||e instanceof ImageData||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement?Pe(e):t,n=t.pixelFormat??6408,o=(0,fe.wH)(n);return(t.mipmap?4/3:1)*r*i*o||0}(this._data,this._parameters)}load(e){if(this._loadingPromise)return this._loadingPromise;if(this._texture)return this._texture;const t=this._data;return null==t?(this._texture=new pe.A(e,this._createDescriptor(e),null),this._texture):(this._emptyTexture=e.emptyTexture,this._parameters.reloadable||(this._data=void 0),"string"==typeof t?this._loadFromURL(e,t):t instanceof Image?this._loadFromImageElement(e,t):t instanceof HTMLVideoElement?this._loadFromVideoElement(e,t):t instanceof ImageData||t instanceof HTMLCanvasElement?this._loadFromImage(e,t):(0,p.mg)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,t):(0,p.mw)(t)&&"image/vnd-ms.dds"===this._parameters.encoding?this._loadFromDDSData(e,new Uint8Array(t)):((0,p.mw)(t)||(0,p.mg)(t))&&"image/ktx2"===this._parameters.encoding?this._loadFromKTX2(e,t):((0,p.mw)(t)||(0,p.mg)(t))&&"image/x.basis"===this._parameters.encoding?this._loadFromBasis(e,t):(0,p.mw)(t)?this._loadFromPixelData(e,new Uint8Array(t)):(0,p.iu)(t)?this._loadFromPixelData(e,t):null)}_update(e,t){return null==this._texture||e.readyState<HTMLMediaElement.HAVE_CURRENT_DATA||t===e.currentTime?t:(this._texture.setData(e),this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._parameters.updateCallback&&this._parameters.updateCallback(),e.currentTime)}_loadFromDDSData(e,t){return this._texture=function(e,t,r){const i=function(e,t){const r=new Int32Array(e.buffer,e.byteOffset,31);if(542327876!==r[0])return Me().error("Invalid magic number in DDS header"),null;if(!(4&r[20]))return Me().error("Unsupported format, must contain a FourCC code"),null;const i=r[21];let n,o;switch(i){case Se:n=8,o=me.CQ.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Ce:n=16,o=me.CQ.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ae:n=16,o=me.CQ.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return Me().error("Unsupported FourCC code:",function(e){return String.fromCharCode(255&e,e>>8&255,e>>16&255,e>>24&255)}(i)),null}let s=1,a=r[4],l=r[3];(3&a||3&l)&&(Me().warn("Rounding up compressed texture size to nearest multiple of 4."),a=a+3&-4,l=l+3&-4);const c=a,u=l;let d,h;131072&r[2]&&!1!==t&&(s=Math.max(1,r[7]));let m=e.byteOffset+r[1]+4;const p=[];for(let t=0;t<s;++t)h=(a+3>>2)*(l+3>>2)*n,d=new Uint8Array(e.buffer,m,h),p.push(d),m+=h,a=Math.max(1,a>>1),l=Math.max(1,l>>1);return{textureData:{type:"compressed",levels:p},internalFormat:o,width:c,height:u}}(r,t.hasMipmap??!1);if(null==i)throw new Error("DDS texture data is null");const{textureData:n,internalFormat:o,width:s,height:a}=i;return t.samplingMode=n.levels.length>1?9987:9729,t.hasMipmap=n.levels.length>1,t.internalFormat=o,t.width=s,t.height=a,new pe.A(e,t,n)}(e,this._createDescriptor(e),t),this._emptyTexture=null,this._texture}_loadFromKTX2(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.KTX2File(new Uint8Array(r));if(!we(i))return null;i.startTranscoding();const n=be(e,t,i.getLevels(),i.getHasAlpha(),i.getWidth(),i.getHeight(),(e,t)=>i.getImageTranscodedSizeInBytes(e,0,0,t),(e,t,r)=>i.transcodeImage(r,e,0,0,t,0,-1,-1));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromBasis(e,t){return this._loadAsync(()=>async function(e,t,r){null==ge&&(ge=await _e());const i=new ge.BasisFile(new Uint8Array(r));if(!ye(i))return null;i.startTranscoding();const n=be(e,t,i.getNumLevels(0),i.getHasAlpha(),i.getImageWidth(0,0),i.getImageHeight(0,0),(e,t)=>i.getImageTranscodedSizeInBytes(0,e,t),(e,t,r)=>i.transcodeImage(r,0,e,t,0,0));return i.close(),i.delete(),n}(e,this._createDescriptor(e),t).then(e=>(this._texture=e,e)))}_loadFromPixelData(e,t){(0,G.vA)(this._parameters.width>0&&this._parameters.height>0);const r=this._createDescriptor(e);return 6407!==r.pixelFormat&&6408!==r.pixelFormat||(r.compress=this._parameters.compressionOptions),r.width=this._parameters.width??0,r.height=this._parameters.height??0,this._texture=new pe.A(e,r,t),this._texture}_loadFromURL(e,t){return this._loadAsync(async r=>{const i=await H(t,{signal:r});return(0,P.Te)(r),this._loadFromImage(e,i)})}_loadFromImageElement(e,t){return t.complete?this._loadFromImage(e,t):this._loadAsync(async r=>{const i=await(0,ue.y)(t,t.src,!1,r);return(0,P.Te)(r),this._loadFromImage(e,i)})}_loadFromVideoElement(e,t){return t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?this._loadFromImage(e,t):this._loadFromVideoElementAsync(e,t)}_loadFromVideoElementAsync(e,t){return this._loadAsync(r=>new Promise((i,n)=>{const o=()=>{t.removeEventListener("loadeddata",s),t.removeEventListener("error",a),(0,ae.xt)(l)},s=()=>{t.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA&&(o(),i(this._loadFromImage(e,t)))},a=e=>{o(),n(e||new R.A("texture:load-error","Failed to load video"))};t.addEventListener("loadeddata",s),t.addEventListener("error",a);const l=(0,P.u7)(r,()=>a((0,P.NK)()))}))}_loadFromImage(e,t){let r=t;r instanceof HTMLVideoElement||(r=Re(r,e.parameters));const i=Pe(r);this._parameters.width=i.width,this._parameters.height=i.height;const n=this._createDescriptor(e);return n.width=i.width,n.height=i.height,n.compress=this._parameters.compressionOptions,this._texture=new pe.A(e,n,r),this._emptyTexture=null,this.events.emit("loaded"),this._texture}_loadAsync(e){const t=new AbortController;this._loadingController=t;const r=e(t.signal);this._loadingPromise=r;const i=()=>{this._loadingController===t&&(this._loadingController=null),this._loadingPromise===r&&(this._loadingPromise=null),this._emptyTexture=null};return r.then(i,i),r}unload(){if(this._texture=(0,ae.WD)(this._texture),this._emptyTexture=null,null!=this._loadingController){const e=this._loadingController;this._loadingController=null,this._loadingPromise=null,e.abort()}this.events.emit("unloaded")}get parameters(){return this._parameters}}function Pe(e){return e instanceof HTMLVideoElement?{width:e.videoWidth,height:e.videoHeight}:e}const De={wrap:{s:10497,t:10497},mipmap:!0,noUnpackFlip:!1,preMultiplyAlpha:!1};var Ne=r(49255);class He{constructor(e){this._material=e.material,this._techniques=e.techniques,this._output=e.output}dispose(){}get _stippleTextures(){return this._techniques.context?.stippleTextures}get _markerTextures(){return this._techniques.context?.markerTextures}getTechnique(e,t){return this._techniques.get(e,this._material.getConfiguration(this._output,t))}ensureResources(e){return 2}}var Le=r(65786);class Be extends He{constructor(e){super(e),this._numLoading=0,this._disposed=!1,this._textures=e.textures,this.updateTexture(e.textureId),this._acquire(e.normalTextureId,e=>this._textureNormal=e),this._acquire(e.emissiveTextureId,e=>this._textureEmissive=e),this._acquire(e.occlusionTextureId,e=>this._textureOcclusion=e),this._acquire(e.metallicRoughnessTextureId,e=>this._textureMetallicRoughness=e)}dispose(){super.dispose(),this._texture=(0,ae.Gz)(this._texture),this._textureNormal=(0,ae.Gz)(this._textureNormal),this._textureEmissive=(0,ae.Gz)(this._textureEmissive),this._textureOcclusion=(0,ae.Gz)(this._textureOcclusion),this._textureMetallicRoughness=(0,ae.Gz)(this._textureMetallicRoughness),this._disposed=!0}ensureResources(e){return 0===this._numLoading?2:1}get textureBindParameters(){return new Ue(this._texture?.texture??null,this._textureNormal?.texture??null,this._textureEmissive?.texture??null,this._textureOcclusion?.texture??null,this._textureMetallicRoughness?.texture??null)}updateTexture(e){null!=this._texture&&e===this._texture.id||(this._texture=(0,ae.Gz)(this._texture),this._acquire(e,e=>this._texture=e))}_acquire(e,t){if(null==e)return void t(null);const r=this._textures.acquire(e);if((0,P.$X)(r))return++this._numLoading,void r.then(e=>{if(this._disposed)return(0,ae.Gz)(e),void t(null);t(e)}).finally(()=>--this._numLoading);t(r)}}class ze extends Le.Y{constructor(e=null){super(),this.textureEmissive=e}}class Ue extends ze{constructor(e,t,r,i,n,o,s){super(r),this.texture=e,this.textureNormal=t,this.textureOcclusion=i,this.textureMetallicRoughness=n,this.scale=o,this.normalTextureTransformMatrix=s}}var Ge=r(5482),Ve=r(68317),je=r(51976);class We extends Ve.Hz{constructor(){super(...arguments),this.oitPass=0,this.hasHighlightMixTexture=!1,this.bindType=1,this.instanced=!1,this.writeDepth=!0,this.oitPremultipliedAlpha=!1}}(0,Ge.Cg)([(0,je.W)({count:3})],We.prototype,"oitPass",void 0),(0,Ge.Cg)([(0,je.W)()],We.prototype,"hasHighlightMixTexture",void 0);var ke=r(19245);class Ze{constructor(e,t){this.id=(0,W.c)(),this.supportsEdges=!1,this._renderPriority=0,this._parameters=new t,(0,ke.MB)(this._parameters,e),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){(0,ke.MB)(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this._parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bind.decorations)&&0!==(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this._parametersChanged())}_parametersChanged(){this.repository?.materialChanged(this)}get renderOccludedFlags(){return this.visible?this.parameters.renderOccluded:0}get testsTransparentRenderOrder(){return this.parameters.testsTransparentRenderOrder}get hasEmissions(){return!1}getConfiguration(e,t,r=new We){return r.output=e,r.hasEmission=t.hasEmission&&(0,Ne._o)(e),r.oitPass=t.oitPass,r.hasHighlightMixTexture=8===e&&null!=t.highlightMixTexture,r}}Le.Y;class $e{constructor(e=0,t=!1,r=!0){this.tolerance=e,this.isVerticalRay=t,this.normalRequired=r}}const qe=(0,m.vt)();function Ye(e,t,r,i,n,o){if(!e.visible)return;const s=(0,d.jb)(lt,i,r),a=(e,t,r)=>o(e,r,t),{tolerance:l}=t,c=new $e(l,!1,t.options.normalRequired);if(e.boundingInfo)(0,G.vA)(0===e.type),Ke(e.boundingInfo,r,s,l,n,c,a);else{const t=e.positionAttribute,i=t.indices;!function(e,t,r,i,n,o,s,a,l,c){const u=t,h=ct,m=Math.abs(u[0]),p=Math.abs(u[1]),f=Math.abs(u[2]),g=m>=p?m>=f?0:2:p>=f?1:2,v=g,_=u[v]<0?2:1,x=(g+_)%3,y=(g+(3-_))%3,w=u[x]/u[v],b=u[y]/u[v],M=1/u[v],T=Qe,S=et,C=tt,{normalRequired:A}=l;for(let t=r;t<i;++t){const r=3*t,i=s*n[r];(0,d.hZ)(h[0],o[i+0],o[i+1],o[i+2]);const l=s*n[r+1];(0,d.hZ)(h[1],o[l+0],o[l+1],o[l+2]);const u=s*n[r+2];(0,d.hZ)(h[2],o[u+0],o[u+1],o[u+2]),a&&((0,d.C)(h[0],a.applyToVertex(h[0][0],h[0][1],h[0][2],t)),(0,d.C)(h[1],a.applyToVertex(h[1][0],h[1][1],h[1][2],t)),(0,d.C)(h[2],a.applyToVertex(h[2][0],h[2][1],h[2][2],t))),(0,d.jb)(T,h[0],e),(0,d.jb)(S,h[1],e),(0,d.jb)(C,h[2],e);const m=T[x]-w*T[v],p=T[y]-b*T[v],f=S[x]-w*S[v],g=S[y]-b*S[v],_=C[x]-w*C[v],E=C[y]-b*C[v],R=_*g-E*f,I=m*E-p*_,O=f*p-g*m;if((R<0||I<0||O<0)&&(R>0||I>0||O>0))continue;const F=R+I+O;if(0===F)continue;const P=R*(M*T[v])+I*(M*S[v])+O*(M*C[v]);if(P*Math.sign(F)<0)continue;const D=P/F;D>=0&&c(D,t,A?it(h):null)}}(r,s,0,i.length/3,i,t.data,t.stride,n,c,a)}}const Xe=(0,h.vt)();function Ke(e,t,r,i,n,o,s){if(null==e)return;const a=function(e,t){return(0,d.hZ)(t,1/e[0],1/e[1],1/e[2])}(r,Xe);if((0,m.Ne)(qe,e.bbMin),(0,m.vI)(qe,e.bbMax),null!=n&&n.applyToAabb(qe),function(e,t,r,i){return function(e,t,r,i){const n=(e[0]-i-t[0])*r[0],o=(e[3]+i-t[0])*r[0];let s=Math.min(n,o),a=Math.max(n,o);const l=(e[1]-i-t[1])*r[1],c=(e[4]+i-t[1])*r[1];if(a=Math.min(a,Math.max(l,c)),a<0)return!1;if(s=Math.max(s,Math.min(l,c)),s>a)return!1;const u=(e[2]-i-t[2])*r[2],d=(e[5]+i-t[2])*r[2];return a=Math.min(a,Math.max(u,d)),!(a<0)&&(s=Math.max(s,Math.min(u,d)),!(s>a)&&s<1/0)}(e,t,r,i)}(qe,t,a,i)){const{primitiveIndices:a,position:l}=e,c=a?a.length:l.indices.length/3;if(c>st){const a=e.getChildren();if(void 0!==a){for(const e of a)Ke(e,t,r,i,n,o,s);return}}!function(e,t,r,i,n,o,s,a,l,c,u){const d=e[0],h=e[1],m=e[2],p=t[0],f=t[1],g=t[2],{normalRequired:v}=c;for(let e=0;e<i;++e){const t=a[e],r=3*t,i=s*n[r];let c=o[i],_=o[i+1],x=o[i+2];const y=s*n[r+1];let w=o[y],b=o[y+1],M=o[y+2];const T=s*n[r+2];let S=o[T],C=o[T+1],A=o[T+2];null!=l&&([c,_,x]=l.applyToVertex(c,_,x,e),[w,b,M]=l.applyToVertex(w,b,M,e),[S,C,A]=l.applyToVertex(S,C,A,e));const E=w-c,R=b-_,I=M-x,O=S-c,F=C-_,P=A-x,D=f*P-F*g,N=g*O-P*p,H=p*F-O*f,L=E*D+R*N+I*H;if(Math.abs(L)<=at)continue;const B=d-c,z=h-_,U=m-x,G=B*D+z*N+U*H;if(L>0){if(G<0||G>L)continue}else if(G>0||G<L)continue;const V=z*I-R*U,j=U*E-I*B,W=B*R-E*z,k=p*V+f*j+g*W;if(L>0){if(k<0||G+k>L)continue}else if(k>0||G+k<L)continue;const Z=(O*V+F*j+P*W)/L;Z>=0&&u(Z,t,v?rt(E,R,I,O,F,P,Je):null)}}(t,r,0,c,l.indices,l.data,l.stride,a,n,o,s)}}const Je=(0,h.vt)();const Qe=(0,h.vt)(),et=(0,h.vt)(),tt=(0,h.vt)();function rt(e,t,r,i,n,o,s){return(0,d.hZ)(nt,e,t,r),(0,d.hZ)(ot,i,n,o),(0,d.$A)(s,nt,ot),(0,d.S8)(s,s),s}function it(e){return(0,d.jb)(nt,e[1],e[0]),(0,d.jb)(ot,e[2],e[0]),(0,d.$A)(Je,nt,ot),(0,d.S8)(Je,Je),Je}const nt=(0,h.vt)(),ot=(0,h.vt)(),st=1e3,at=1e-7,lt=(0,h.vt)(),ct=[(0,h.vt)(),(0,h.vt)(),(0,h.vt)()];var ut=r(16396);function dt(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length;r*=s;for(let e=0;e<a;++e){const t=2*n[e];o[r]=i[t],o[r+1]=i[t+1],r+=s}}function ht(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,l=o.length;if(r*=a,1===i)for(let e=0;e<l;++e){const t=3*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}else for(let e=0;e<l;++e){const t=3*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],r+=a}}function mt(e,t,r,i=1){const{data:n,indices:o}=e,s=t.typedBuffer,a=t.typedBufferStride,l=o.length;if(r*=a,1===i)for(let e=0;e<l;++e){const t=4*o[e];s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}else for(let e=0;e<l;++e){const t=4*o[e];for(let e=0;e<i;++e)s[r]=n[t],s[r+1]=n[t+1],s[r+2]=n[t+2],s[r+3]=n[t+3],r+=a}}function pt(e,t,r,i,n=1){const o=t.typedBuffer,s=t.typedBufferStride;if(i*=s,1===n)for(let t=0;t<r;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s;else for(let t=0;t<r;++t)for(let t=0;t<n;++t)o[i]=e[0],o[i+1]=e[1],o[i+2]=e[2],o[i+3]=e[3],i+=s}function ft(e,t,r,i,n,o){switch(e){case"position":{(0,G.vA)(3===t.size);const i=n.getField(e,g.xs);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ht(e,r,i,n);const{data:o,indices:s}=e,a=r.typedBuffer,c=r.typedBufferStride,u=s.length,d=t[0],h=t[1],m=t[2],p=t[4],f=t[5],g=t[6],v=t[8],_=t[9],x=t[10],y=t[12],w=t[13],b=t[14];i*=c;let M=0,T=0,S=0;const C=(0,l.tZ)(t)?e=>{M=o[e]+y,T=o[e+1]+w,S=o[e+2]+b}:e=>{const t=o[e],r=o[e+1],i=o[e+2];M=d*t+p*r+v*i+y,T=h*t+f*r+_*i+w,S=m*t+g*r+x*i+b};if(1===n)for(let e=0;e<u;++e)C(3*s[e]),a[i]=M,a[i+1]=T,a[i+2]=S,i+=c;else for(let e=0;e<u;++e){C(3*s[e]);for(let e=0;e<n;++e)a[i]=M,a[i+1]=T,a[i+2]=S,i+=c}}(t,r,i,o);break}case"normal":{(0,G.vA)(3===t.size);const r=n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void ht(e,r,i,n);const{data:o,indices:s}=e,a=t,c=r.typedBuffer,u=r.typedBufferStride,d=s.length,h=a[0],m=a[1],p=a[2],f=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,l.ut)(a),b=1e-6,M=1-b;i*=u;let T=0,S=0,C=0;const A=(0,l.tZ)(a)?e=>{T=o[e],S=o[e+1],C=o[e+2]}:e=>{const t=o[e],r=o[e+1],i=o[e+2];T=h*t+f*r+_*i,S=m*t+g*r+x*i,C=p*t+v*r+y*i};if(1===n)if(w)for(let e=0;e<d;++e){A(3*s[e]);const t=T*T+S*S+C*C;if(t<M&&t>b){const e=1/Math.sqrt(t);c[i]=T*e,c[i+1]=S*e,c[i+2]=C*e}else c[i]=T,c[i+1]=S,c[i+2]=C;i+=u}else for(let e=0;e<d;++e)A(3*s[e]),c[i]=T,c[i+1]=S,c[i+2]=C,i+=u;else for(let e=0;e<d;++e){if(A(3*s[e]),w){const e=T*T+S*S+C*C;if(e<M&&e>b){const t=1/Math.sqrt(e);T*=t,S*=t,C*=t}}for(let e=0;e<n;++e)c[i]=T,c[i+1]=S,c[i+2]=C,i+=u}}(t,i,r,o);break}case"normalCompressed":case"profileRight":case"profileUp":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"uv0":{(0,G.vA)(2===t.size);const r=n.getField(e,g.ZD)??n.getField(e,g.gH);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"uvi":{(0,G.vA)(2===t.size);const r=n.getField(e,g.mJ);(0,G.vA)(!!r,`No buffer view for ${e}`),dt(t,r,o);break}case"color":case"symbolColor":{const r=n.getField(e,g.XP);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(3===t.size||4===t.size),function(e,t,r,i,n=1){const{data:o,indices:s}=e,a=r.typedBuffer,l=r.typedBufferStride,c=s.length;if(i*=l,t===o.length&&4===t){a[i]=o[0],a[i+1]=o[1],a[i+2]=o[2],a[i+3]=o[3];const e=new Uint32Array(r.typedBuffer.buffer,r.start),t=l/4,s=e[i/=4];i+=t;const u=c*n;for(let r=1;r<u;++r)e[i]=s,i+=t;return}if(1!==n)if(4!==t)for(let e=0;e<c;++e){const t=3*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=l}else for(let e=0;e<c;++e){const t=4*s[e];for(let e=0;e<n;++e)a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=l}else{if(4===t){for(let e=0;e<c;++e){const t=4*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=o[t+3],i+=l}return}for(let e=0;e<c;++e){const t=3*s[e];a[i]=o[t],a[i+1]=o[t+1],a[i+2]=o[t+2],a[i+3]=255,i+=l}}}(t,t.size,r,o);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const r=n.getField(e,g.Y$)??n.getField(e,g.Y$);(0,G.vA)(!!r,`No buffer view for ${e}`),(0,G.vA)(1===t.size),function(e,t,r){const{data:i,indices:n}=e,o=t.typedBuffer,s=t.typedBufferStride,a=n.length,l=i[0];r*=s;for(let e=0;e<a;++e)o[r]=l,r+=s}(t,r,o);break}case"tangent":{(0,G.vA)(4===t.size);const i=n.getField(e,g.Eq);(0,G.vA)(!!i,`No buffer view for ${e}`),function(e,t,r,i,n=1){if(!t)return void mt(e,r,i,n);const{data:o,indices:s}=e,a=t,c=r.typedBuffer,u=r.typedBufferStride,d=s.length,h=a[0],m=a[1],p=a[2],f=a[4],g=a[5],v=a[6],_=a[8],x=a[9],y=a[10],w=!(0,l.ut)(a),b=1e-6,M=1-b;if(i*=u,1===n)for(let e=0;e<d;++e){const t=4*s[e],r=o[t],n=o[t+1],a=o[t+2],l=o[t+3];let d=h*r+f*n+_*a,T=m*r+g*n+x*a,S=p*r+v*n+y*a;if(w){const e=d*d+T*T+S*S;if(e<M&&e>b){const t=1/Math.sqrt(e);d*=t,T*=t,S*=t}}c[i]=d,c[i+1]=T,c[i+2]=S,c[i+3]=l,i+=u}else for(let e=0;e<d;++e){const t=4*s[e],r=o[t],a=o[t+1],l=o[t+2],d=o[t+3];let T=h*r+f*a+_*l,S=m*r+g*a+x*l,C=p*r+v*a+y*l;if(w){const e=T*T+S*S+C*C;if(e<M&&e>b){const t=1/Math.sqrt(e);T*=t,S*=t,C*=t}}for(let e=0;e<n;++e)c[i]=T,c[i+1]=S,c[i+2]=C,c[i+3]=d,i+=u}}(t,r,i,o);break}case"profileVertexAndNormal":{(0,G.vA)(4===t.size);const r=n.getField(e,g.jz)??n.getField(e,g.Eq);(0,G.vA)(!!r,`No buffer view for ${e}`),mt(t,r,o);break}case"profileAuxData":{(0,G.vA)(3===t.size);const r=n.getField(e,g.EC)??n.getField(e,g.xs);(0,G.vA)(!!r,`No buffer view for ${e}`),ht(t,r,o);break}}}(0,h.vt)();class gt{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,i,n,o){return function(e,t,r,i,n,o,s){let a={numItems:0,numVerticesPerItem:0};for(const l of r.fields.keys()){const r=e.get(l),c=r?.indices;if(r&&c)"position"===l&&(a={numItems:1,numVerticesPerItem:c.length}),ft(l,r,i,n,o,s);else if("olidColor"===l&&null!=t){const r=e.get("position")?.indices;if(r){const e=r.length;pt(t,o.getField(l,g.XP),e,s)}}}return a}(r,i,this.layout,e,t,n,o)}}var vt=r(91429),_t=r(91829),xt=r(4431),yt=r(1843),wt=r(72824),bt=r(13840),Mt=r(42958),Tt=r(16943),St=r(90644);const Ct=(0,St.p3)(1,0,1,771);function At(e,t=!1){switch(e){case 0:return t?St.RC:St.T8;case 1:return Ct;case 2:case 3:return null}}function Et(e){if(e.draped)return null;switch(e.oitPass){case 0:case 2:return e.writeDepth?St.Uy:null;case 1:case 3:return null}}function Rt(e,t=513){return{func:0===e||2===e?t:515}}const It={factor:-1,units:-2};function Ot({oitPass:e,enableOffset:t}){return t&&1===e?It:null}function Ft(e,t){const r={buffers:1===e?[me.r6,me.yI]:[me.r6]};return t&&r.buffers.push(me.r6+r.buffers.length),r.buffers.length>1?r:null}const Pt={mask:255},Dt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:0}},Nt={function:{func:519,ref:2,mask:2},operation:{fail:7680,zFail:7680,zPass:7681}};var Ht=r(4576);(0,r(44208).A)("esri-tests-disable-gpu-memory-measurements");var Lt=r(69622),Bt=r(32728);class zt{constructor(e){this.localTransform=e.localTransform,this.globalTransform=e.globalTransform,this.modelOrigin=e.modelOrigin,this.model=e.instanceModel,this.modelNormal=e.instanceModelNormal,this.modelScaleFactors=e.modelScaleFactors,this.boundingSphere=e.boundingSphere,this.featureAttribute=e.getField("instanceFeatureAttribute",g.Eq),this.color=e.getField("instanceColor",g.XP),this.olidColor=e.getField("instanceOlidColor",g.XP),this.state=e.getField("state",g.SL),this.lodLevel=e.getField("lodLevel",g.SL)}}let Ut=class extends Lt.A{constructor(e,t){super(e),this.events=new se.bk,this._capacity=0,this._size=0,this._next=0,this._highlightOptionsMap=new Map,this._highlightOptionsMapPrev=new Map,this._layout=function(e){return Vt(Gt.clone(),e).u8("state").u8("lodLevel")}(t),this._capacity=$t,this._buffer=this._layout.createBuffer(this._capacity),this._view=new zt(this._buffer)}get capacity(){return this._capacity}get size(){return this._size}get view(){return this._view}addInstance(){this._size+1>this._capacity&&this._grow();const e=this._findSlot();return this._view.state.set(e,1),this._size++,this.events.emit("instances-changed"),e}removeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),this._getStateFlag(e,18)?this._setStateFlags(e,32):this.freeInstance(e),this.events.emit("instances-changed")}freeInstance(e){const t=this._view.state;(0,G.vA)(e>=0&&e<this._capacity&&!!(1&t.get(e)),"invalid instance handle"),t.set(e,0),this._size--}setLocalTransform(e,t,r=!0){this._view.localTransform.setMat(e,t),r&&this.updateModelTransform(e)}getLocalTransform(e,t){this._view.localTransform.getMat(e,t)}setGlobalTransform(e,t,r=!0){this._view.globalTransform.setMat(e,t),r&&this.updateModelTransform(e)}getGlobalTransform(e,t){this._view.globalTransform.getMat(e,t)}updateModelTransform(e){const t=this._view,r=jt,i=Wt;t.localTransform.getMat(e,kt),t.globalTransform.getMat(e,Zt);const n=(0,l.lw)(Zt,Zt,kt);(0,d.hZ)(r,n[12],n[13],n[14]),t.modelOrigin.setVec(e,r),(0,s.z0)(i,n),t.model.setMat(e,i);const o=(0,Bt.wp)(jt,n);o.sort(),t.modelScaleFactors.set(e,0,o[1]),t.modelScaleFactors.set(e,1,o[2]),(0,s.B8)(i,i),(0,s.mg)(i,i),t.modelNormal.setMat(e,i),this._setStateFlags(e,64),this.events.emit("instance-transform-changed",{index:e})}getModelTransform(e,t){const r=this._view;r.model.getMat(e,Wt),r.modelOrigin.getVec(e,jt),t[0]=Wt[0],t[1]=Wt[1],t[2]=Wt[2],t[3]=0,t[4]=Wt[3],t[5]=Wt[4],t[6]=Wt[5],t[7]=0,t[8]=Wt[6],t[9]=Wt[7],t[10]=Wt[8],t[11]=0,t[12]=jt[0],t[13]=jt[1],t[14]=jt[2],t[15]=1}applyShaderTransformation(e,t){null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedModelTransform(e,t){return this.getModelTransform(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t),t}getCombinedLocalTransform(e,t){this._view.localTransform.getMat(e,t),null!=this.shaderTransformation&&this.shaderTransformation.applyTransform(this,e,t)}getCombinedMaxScaleFactor(e){let t=this._view.modelScaleFactors.get(e,1);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=Math.max(jt[0],jt[1],jt[2])),t}getCombinedMedianScaleFactor(e){let t=this._view.modelScaleFactors.get(e,0);return null!=this.shaderTransformation&&(this.shaderTransformation.scaleFactor(jt,this,e),t*=function(e,t,r){return Math.max(Math.min(e,t),Math.min(Math.max(e,t),r))}(jt[0],jt[1],jt[2])),t}getModel(e,t){this._view.model.getMat(e,t)}setFeatureAttribute(e,t){this._view.featureAttribute?.setVec(e,t)}getFeatureAttribute(e,t){this._view.featureAttribute?.getVec(e,t)}setColor(e,t){this._view.color?.setVec(e,t)}setObjectAndLayerIdColor(e,t){this._view.olidColor?.setVec(e,t)}setVisible(e,t){t!==this.getVisible(e)&&(this._setStateFlag(e,4,t),this.events.emit("instance-visibility-changed",{index:e}))}getVisible(e){return this._getStateFlag(e,4)}setHighlight(e,t){const{_highlightOptionsMap:r}=this,i=r.get(e);t?t!==i&&(r.set(e,t),this._setStateFlag(e,8,!0),this.events.emit("instance-highlight-changed")):i&&(r.delete(e),this._setStateFlag(e,8,!1),this.events.emit("instance-highlight-changed"))}get highlightOptionsMap(){return this._highlightOptionsMap}getHighlightStateFlag(e){return this._getStateFlag(e,8)}geHighlightOptionsPrev(e){const t=this._highlightOptionsMapPrev.get(e)??null;return this._highlightOptionsMapPrev.delete(e),t}getHighlightName(e){const t=this.highlightOptionsMap.get(e)??null;return t?this._highlightOptionsMapPrev.set(e,t):this._highlightOptionsMapPrev.delete(e),t}getState(e){return this._view.state.get(e)}getLodLevel(e){return this._view.lodLevel.get(e)}countFlags(e){let t=0;for(let r=0;r<this._capacity;++r)this.getState(r)&e&&++t;return t}_setStateFlags(e,t){const r=this._view.state;t=r.get(e)|t,r.set(e,t)}_clearStateFlags(e,t){const r=this._view.state;t=r.get(e)&~t,r.set(e,t)}_setStateFlag(e,t,r){r?this._setStateFlags(e,t):this._clearStateFlags(e,t)}_getStateFlag(e,t){return!!(this._view.state.get(e)&t)}_grow(){this._capacity=Math.max($t,Math.floor(this._capacity*Ht.Ji)),this._buffer=this._layout.createBuffer(this._capacity).copyFrom(this._buffer),this._view=new zt(this._buffer)}_findSlot(){const e=this._view.state;let t=this._next;for(;1&e.get(t);)t=t+1===this._capacity?0:t+1;return this._next=t+1===this._capacity?0:t+1,t}};(0,Ge.Cg)([(0,vt.MZ)({constructOnly:!0})],Ut.prototype,"shaderTransformation",void 0),(0,Ge.Cg)([(0,vt.MZ)()],Ut.prototype,"_size",void 0),(0,Ge.Cg)([(0,vt.MZ)({readOnly:!0})],Ut.prototype,"size",null),Ut=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.lib.lodRendering.InstanceData")],Ut);const Gt=(0,yt.BP)().mat4f64("localTransform").mat4f64("globalTransform").vec4f64("boundingSphere").vec3f64("modelOrigin").mat3f("instanceModel").mat3f("instanceModelNormal").vec2f("modelScaleFactors");function Vt(e,t){return t.instancedFeatureAttribute&&e.vec4f("instanceFeatureAttribute"),t.instancedColor&&e.vec4u8("instanceColor"),(0,Tt.E)()&&e.vec4u8("instanceOlidColor"),e}const jt=(0,h.vt)(),Wt=(0,a.vt)(),kt=(0,c.vt)(),Zt=(0,c.vt)(),$t=64,qt=(0,yt.BP)().vec3f("instanceModelOriginHi").vec3f("instanceModelOriginLo").mat3f("instanceModel").mat3f("instanceModelNormal");var Yt=r(74810),Xt=r(28491),Kt=r(49788);class Jt extends wt.Zo{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=Yt.mb,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=2,this.instanced=!1,this.instancedFeatureAttribute=!1,this.instancedColor=!1,this.instanceColorEncodesAlphaIgnore=!1,this.emissiveStrengthFromSymbol=0,this.emissiveStrengthKHR=1,this.emissiveSource=1,this.emissiveBaseColor=h.uY,this.instancedDoublePrecision=!1,this.normalType=0,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=(0,h.CN)(.2,.2,.2),this.diffuse=(0,h.CN)(.8,.8,.8),this.externalColor=(0,_t.fA)(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=(0,h.vt)(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=0,this.textureAlphaMode=0,this.textureAlphaCutoff=Kt.Q,this.textureAlphaPremultiplied=!1,this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}wt.gy;let Qt=class extends Mt.w{constructor(e,t){let i=(0,xt.U)(rr(t));t.instanced&&t.instancedDoublePrecision&&(i=i.concat((0,xt.U)(function(e){return Vt(qt.clone(),e)}(t)))),super(e,t,i),this.shader=new bt.r(Xt.D,()=>r.e(5141).then(r.bind(r,5141)))}_makePipeline(e,t){const{oitPass:r,output:i,hasEmission:n,transparent:o,cullFace:s,customDepthTest:a,hasOccludees:l}=e;return(0,St.Ey)({blending:(0,Ne._o)(i)&&o?At(r):null,culling:tr(e)?(0,St.Xt)(s):null,depthTest:Rt(r,er(a)),depthWrite:Et(e),drawBuffers:(0,Mt.L)(i,Ft(r,n)),colorWrite:St.kn,stencilWrite:l?Pt:null,stencilTest:l?t?Nt:Dt:null,polygonOffset:Ot(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e,t){return t?this._occludeePipelineState:super.getPipeline(e)}};function er(e){switch(e){case 1:return 515;case 0:case 3:return 513;case 2:return 516}}function tr(e){return 0!==e.cullFace||!e.hasSlicePlane&&!e.transparent&&!e.doubleSidedMode}function rr(e){const t=(0,yt.BP)().vec3f("position");return 1===e.normalType?t.vec2i16("normalCompressed",{glNormalized:!0}):t.vec3f("normal"),e.hasVertexTangents&&t.vec4f("tangent"),e.hasTextures&&t.vec2f16("uv0"),e.hasVertexColors&&t.vec4u8("color",{glNormalized:!0}),e.hasSymbolColors&&t.vec4u8("symbolColor"),!e.instanced&&(0,Tt.E)()&&t.vec4u8("olidColor"),t}Qt=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.shaders.DefaultMaterialTechnique")],Qt);class ir extends We{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.occlusionPass=!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}}(0,Ge.Cg)([(0,je.W)({count:4})],ir.prototype,"alphaDiscardMode",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"doubleSidedMode",void 0),(0,Ge.Cg)([(0,je.W)({count:7})],ir.prototype,"pbrMode",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"cullFace",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"normalType",void 0),(0,Ge.Cg)([(0,je.W)({count:3})],ir.prototype,"customDepthTest",void 0),(0,Ge.Cg)([(0,je.W)({count:8})],ir.prototype,"emissionSource",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVertexColors",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasSymbolColors",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVerticalOffset",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasColorTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasMetallicRoughnessTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOcclusionTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasNormalTexture",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasScreenSizePerspective",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVertexTangents",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOccludees",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instanced",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedDoublePrecision",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasModelTransformation",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"offsetBackfaces",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVVSize",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasVVColor",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"receiveShadows",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"receiveAmbientOcclusion",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"textureAlphaPremultiplied",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedFeatureAttribute",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"instancedColor",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"writeDepth",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"transparent",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"enableOffset",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"terrainDepthTest",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"cullAboveTerrain",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"snowCover",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasColorTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasEmissionTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasNormalTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasOcclusionTextureTransform",void 0),(0,Ge.Cg)([(0,je.W)()],ir.prototype,"hasMetallicRoughnessTextureTransform",void 0);var nr=r(57323);let or=class extends Qt{constructor(){super(...arguments),this.shader=new bt.r(nr.R,()=>r.e(2314).then(r.bind(r,39933)))}};or=(0,Ge.Cg)([(0,vt.$K)("esri.views.3d.webgl-engine.shaders.RealisticTreeTechnique")],or);class sr extends Ze{constructor(e,t){super(e,lr),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&!this.transparent],[4,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>((0,Ne.iq)(e)||(0,Ne.yT)(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=rr(this.parameters),this._configuration=new ir(t.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:i}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(i[3])?1:i[3])>=Kt.Q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!(0,d.t2)(this.parameters.emissiveBaseColor,h.uY)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}getConfiguration(e,t){const{parameters:r,_configuration:i}=this,{treeRendering:n,doubleSided:o,doubleSidedType:s}=r;return super.getConfiguration(e,t,this._configuration),i.hasNormalTexture=r.hasNormalTexture,i.hasColorTexture=r.hasColorTexture,i.hasMetallicRoughnessTexture=r.hasMetallicRoughnessTexture,i.hasOcclusionTexture=r.hasOcclusionTexture,i.hasVertexTangents=!n&&r.hasVertexTangents,i.instanced=r.instanced,i.instancedDoublePrecision=r.instancedDoublePrecision,i.hasVVColor=!!r.vvColor,i.hasVVSize=!!r.vvSize,i.hasVerticalOffset=null!=r.verticalOffset,i.hasScreenSizePerspective=null!=r.screenSizePerspective,i.hasSlicePlane=r.hasSlicePlane,i.alphaDiscardMode=r.textureAlphaMode,i.normalType=n?0:r.normalType,i.transparent=this.transparent,i.writeDepth=r.writeDepth,i.customDepthTest=r.customDepthTest??0,i.hasOccludees=t.hasOccludees,i.cullFace=r.hasSlicePlane?0:r.cullFace,i.cullAboveTerrain=t.cullAboveTerrain,i.hasModelTransformation=!n&&null!=r.modelTransformation,i.hasVertexColors=r.hasVertexColors,i.hasSymbolColors=r.hasSymbolColors,i.doubleSidedMode=n?2:o&&"normal"===s?1:o&&"winding-order"===s?2:0,i.instancedFeatureAttribute=r.instancedFeatureAttribute,i.instancedColor=r.instancedColor,(0,Ne._o)(e)?(i.terrainDepthTest=t.terrainDepthTest,i.receiveShadows=r.receiveShadows,i.receiveAmbientOcclusion=r.receiveAmbientOcclusion&&null!=t.ssao):(i.terrainDepthTest=!1,i.receiveShadows=i.receiveAmbientOcclusion=!1),i.textureAlphaPremultiplied=!!r.textureAlphaPremultiplied,i.pbrMode=r.usePBR?r.isSchematic?2:1:0,i.emissionSource=r.emissionSource,i.offsetBackfaces=!(!this.transparent||!r.offsetTransparentBackfaces),i.enableOffset=t.enableOffset,i.snowCover=t.snowCover>0,i.hasColorTextureTransform=!!r.colorTextureTransformMatrix,i.hasNormalTextureTransform=!!r.normalTextureTransformMatrix,i.hasEmissionTextureTransform=!!r.emissiveTextureTransformMatrix,i.hasOcclusionTextureTransform=!!r.occlusionTextureTransformMatrix,i.hasMetallicRoughnessTextureTransform=!!r.metallicRoughnessTextureTransformMatrix,i}intersect(e,t,r,i,n,o){if(null!=this.parameters.verticalOffset){const e=r.camera;(0,d.hZ)(pr,t[12],t[13],t[14]);let o=null;switch(r.viewingMode){case 1:o=(0,d.S8)(hr,pr);break;case 2:o=(0,d.C)(hr,dr)}const s=(0,d.Re)(fr,pr,e.eye),a=(0,d.Bw)(s),l=(0,d.hs)(s,s,1/a);let c=null;this.parameters.screenSizePerspective&&(c=(0,d.Om)(o,l));const u=(0,ke.kE)(e,a,this.parameters.verticalOffset,c??0,this.parameters.screenSizePerspective,null);(0,d.hs)(o,o,u),(0,d.ei)(mr,o,r.transform.inverseRotation),i=(0,d.Re)(cr,i,mr),n=(0,d.Re)(ur,n,mr)}Ye(e,r,i,n,(0,ut.ou)(r.verticalOffset),o)}createGLMaterial(e){return new ar(e)}createBufferWriter(){return new gt(this._layout)}get transparent(){return function(e){const{drivenOpacity:t,opacity:r,externalColor:i,layerOpacity:n,texture:o,textureId:s,textureAlphaMode:a,colorMixMode:l}=e,c=i[3];return t||r<1&&"replace"!==l||c<1&&"ignore"!==l||n<1||(null!=o||null!=s)&&1!==a&&2!==a&&"replace"!==l}(this.parameters)}}class ar extends Be{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const r=e.camera.viewInverseTransposeMatrix;return(0,d.hZ)(t.origin,r[3],r[7],r[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?or:Qt,e)}}class lr extends Jt{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const cr=(0,h.vt)(),ur=(0,h.vt)(),dr=(0,h.fA)(0,0,1),hr=(0,h.vt)(),mr=(0,h.vt)(),pr=(0,h.vt)(),fr=(0,h.vt)(),gr=()=>I.A.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class vr{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}function _r(e){const t=e.params,r=t.topology;let i=!0;switch(t.vertexAttributes||(gr().warn("Geometry must specify vertex attributes"),i=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(gr().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),i=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(gr().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),i=!1)):(gr().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),i=!1)}}else gr().warn("Indexed geometries must specify faces"),i=!1;break}default:gr().warn(`Unsupported topology '${r}'`),i=!1}e.params.material||(gr().warn("Geometry requires material"),i=!1);const n=e.params.vertexAttributes;for(const e in n)n[e].values||(gr().warn("Geometries with externally defined attributes are not yet supported"),i=!1);return i}function xr(e){const t=(0,m.Ie)();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&((0,m.iT)(t,r.bbMin),(0,m.iT)(t,r.bbMax))}),t}function yr(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function wr(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const br=new D.A(1,2,"wosr");async function Mr(e,t){const a=function(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);return t?{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null}:e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}((0,n.EM)(e));if("wosr"===a.fileType){const e=await(t.cache?t.cache.loadWOSR(a.url,t):async function(e,t){const r=await async function(e,t){const r=await(0,E.Ke)((0,A.A)(e,t));if(r.ok)return r.value.data;(0,P.QP)(r.error),function(e){throw new R.A("",`Request for object resource failed: ${e}`)}(r.error)}(e,t),i=await async function(e,t){const r=new Array;for(const i in e){const n=e[i],o=n.images[0].data;if(!o){gr().warn("Externally referenced texture data is not yet supported");continue}const s=n.encoding+";base64,"+o,a="/textureDefinitions/"+i,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",c={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==yr(l)},u=t?.disableTextures?Promise.resolve(null):H(s,t);r.push(u.then(e=>({refId:a,image:e,parameters:c,alphaChannelUsage:l})))}const i=await Promise.all(r),n={};for(const e of i)n[e.refId]=e;return n}(r.textureDefinitions??{},t);let n=0;for(const e in i)if(i.hasOwnProperty(e)){const t=i[e];n+=t?.image?t.image.width*t.image.height*4:0}return new vr(r,i,n+(0,O.Qh)(r))}(a.url,t)),{engineResources:r,referenceBoundingBox:i}=function(e,t){const r=new Array,i=new Array,n=new Array,o=new F.O,s=e.resource,a=D.A.parse(s.version||"1.0","wosr");br.validate(a);const l=s.model.name,c=s.model.geometries,u=s.materialDefinitions??{},d=e.textures;let m=0;const p=new Map;for(let e=0;e<c.length;e++){const s=c[e];if(!_r(s))continue;const a=wr(s),l=s.params.vertexAttributes,f=[],g=e=>{if("PerAttributeArray"===s.params.topology)return null;const t=s.params.faces;for(const r in t)if(r===e)return t[r].values;return null},v=l.position,_=v.values.length/v.valuesPerElement;for(const e in l){const t=l[e],r=t.values,i=g(e)??(0,N.tM)(_);f.push([e,new L.n(r,i,t.valuesPerElement,!0)])}const x=a.texture,y=d&&d[x];if(y&&!p.has(x)){const{image:e,parameters:t}=y,r=new Fe(e,t);i.push(r),p.set(x,r)}const w=p.get(x),b=w?w.id:void 0,M=a.material;let T=o.get(M,x);if(null==T){const e=u[M.slice(M.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=y?yr(y.alphaChannelUsage):void 0,i={ambient:(0,h.ci)(e.diffuse),diffuse:(0,h.ci)(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:b,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:y?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(i,t.materialParameters),T=new sr(i,t),o.set(M,x,T)}n.push(T);const S=new ne(T,f);m+=f.find(e=>"position"===e[0])?.[1]?.indices.length??0,r.push(S)}return{engineResources:[{name:l,stageResources:{textures:i,materials:n,geometries:r},pivotOffset:s.model.pivotOffset,numberOfVertices:m,lodThreshold:null}],referenceBoundingBox:xr(r)}}(e,t);return{lods:r,referenceBoundingBox:i,isEsriSymbolResource:!1,isWosr:!0}}let p;if(t.cache)p=await t.cache.loadGLTF(a.url,t,!!t.usePBR,!!t.useEmissive);else{const{loadGLTF:e}=await r.e(1698).then(r.bind(r,51698));p=await e(new y.R,a.url,t,t.usePBR,t.useEmissive)}const{engineResources:M,referenceBoundingBox:S}=function(e,t,r){const n=e.model,a=e.meta,p=n.meta?.ESRI_proxyEllipsoid,y=a.isEsriSymbolResource&&null!=p&&"EsriRealisticTreesStyle"===a.ESRI_webstyle;y&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,function(e,t){for(let r=0;r<e.model.lods.length;++r){const n=e.model.lods[r];for(const o of n.parts){const n=o.attributes.normal;if(null==n)return;const s=o.attributes.position,a=s.count,u=(0,h.vt)(),m=(0,h.vt)(),p=(0,h.vt)(),f=new Float32Array(4*a),v=new Float32Array(3*a),_=(0,l.B8)((0,c.vt)(),o.transform);let x=0,y=0;for(let l=0;l<a;l++){s.getVec(l,m),n.getVec(l,u),(0,d.Z0)(m,m,o.transform),(0,d.Re)(p,m,t.center),(0,d.Qr)(p,p,t.radius);const a=p[2],c=(0,d.Bw)(p),h=Math.min(.45+.55*c*c,1)**i.Tf;(0,d.Qr)(p,p,t.radius),null!==_&&(0,d.Z0)(p,p,_),(0,d.S8)(p,p),r+1!==e.model.lods.length&&e.model.lods.length>1&&(0,d.Cc)(p,p,u,a>-1?.2:Math.min(-4*a-3.8,1)),v[x]=p[0],v[x+1]=p[1],v[x+2]=p[2],x+=3,f[y]=h,f[y+1]=h,f[y+2]=h,f[y+3]=1,y+=4}o.attributes.normal=new g.xs(v.buffer),o.attributes.color=new g.Eq(f.buffer)}}}(e,p));const M=!!t.usePBR,S=a.isEsriSymbolResource?{usePBR:M,isSchematic:!1,treeRendering:y,mrrFactors:Yt.SY}:{usePBR:M,isSchematic:!1,treeRendering:!1,mrrFactors:Yt.mb},A={...t.materialParameters,treeRendering:y},E=new Array,R=new Map,I=new Map,O=n.lods.length,F=(0,m.Ie)();return n.lods.forEach((e,a)=>{const l=!0===t.skipHighLods&&(O>1&&0===a||O>3&&1===a)||!1===t.skipHighLods&&null!=r&&a!==r;if(l&&0!==a)return;const c=new C(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const r=l?new sr({},t):function(e,t,r,n,o,s,a,l,c){const d=e.materials.get(t.material);if(null==d)return null;const{normal:h,color:m,texCoord0:p,tangent:f}=t.attributes,g=t.material+(h?"_normal":"")+(m?"_color":"")+(p?"_texCoord0":"")+(f?"_tangent":""),v=null!=t.attributes.texCoord0,_=null!=t.attributes.normal,x=function(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}(d.alphaMode);if(!s.has(g)){if(v){const t=(t,r=!1,i=!1)=>{if(null!=t&&!a.has(t)){const n=e.textures.get(t);if(n){const e=n.data,o=r&&!(0,b.x3)(e)?l.compressionOptions:void 0;a.set(t,new Fe((0,b.x3)(e)?e.data:e,{...n.parameters,preMultiplyAlpha:!(0,b.x3)(e)&&i,encoding:(0,b.x3)(e)?e.encoding:void 0,compressionOptions:o}))}}},r=1!==x&&!c;t(d.colorTexture,r,1!==x),t(d.normalTexture),t(d.occlusionTexture,!0),t(d.emissiveTexture),t(d.metallicRoughnessTexture,!0)}const r=(0,i.xV)(d.color[0]),h=(0,i.xV)(d.color[1]),m=(0,i.xV)(d.color[2]),p=null!=d.colorTexture&&v?a.get(d.colorTexture):null,f=(0,Yt.Jr)(d),y=null!=d.normalTextureTransform?.scale?d.normalTextureTransform?.scale:u.Un;s.set(g,new sr({...n,customDepthTest:1,textureAlphaMode:x,textureAlphaCutoff:d.alphaCutoff,diffuse:[r,h,m],ambient:[r,h,m],opacity:"OPAQUE"===d.alphaMode?1:d.opacity,doubleSided:d.doubleSided,doubleSidedType:"winding-order",cullFace:d.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:_?0:2,castShadows:!0,receiveShadows:d.receiveShadows,receiveAmbientOcclusion:d.receiveAmbientOcclusion,textureId:null!=p?p.id:void 0,colorMixMode:d.colorMixMode,normalTextureId:null!=d.normalTexture&&v?a.get(d.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=d.occlusionTexture&&v?a.get(d.occlusionTexture).id:void 0,emissiveTextureId:null!=d.emissiveTexture&&v?a.get(d.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=d.metallicRoughnessTexture&&v?a.get(d.metallicRoughnessTexture).id:void 0,emissiveBaseColor:[d.emissiveFactor[0],d.emissiveFactor[1],d.emissiveFactor[2]],emissiveStrengthKHR:null!=d.emissiveStrengthKHR?d.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=o.emissiveStrengthFromSymbol?o.emissiveStrengthFromSymbol:void 0,mrrFactors:f?Yt.Bt:[d.metallicFactor,d.roughnessFactor,n.mrrFactors[2]],isSchematic:f,colorTextureTransformMatrix:T(d.colorTextureTransform),normalTextureTransformMatrix:T(d.normalTextureTransform),scale:[y[0],y[1]],occlusionTextureTransformMatrix:T(d.occlusionTextureTransform),emissiveTextureTransformMatrix:T(d.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:T(d.metallicRoughnessTextureTransform),...o},l))}const y=s.get(g);if(r.stageResources.materials.push(y),v){const e=e=>{null!=e&&r.stageResources.textures.push(a.get(e))};e(d.colorTexture),e(d.normalTexture),e(d.occlusionTexture),e(d.emissiveTexture),e(d.metallicRoughnessTexture)}return y}(n,e,c,S,A,R,I,t,y),{geometry:d,vertexCount:h}=function(e,t){const r=e.attributes.position.count,i=(0,w.x)(e.indices||r,e.primitiveType),n=f(3*r),{typedBuffer:a,typedBufferStride:l}=e.attributes.position;(0,v.t)(n,a,e.transform,3,l);const c=[["position",new L.n(n,i,3,!0)]];if(null!=e.attributes.normal){const t=f(3*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.normal;(0,s.Ge)(Tr,e.transform),(0,v.b)(t,n,Tr,3,a),(0,o.or)(Tr)&&(0,v.n)(t,t),c.push(["normal",new L.n(t,i,3,!0)])}if(null!=e.attributes.tangent){const t=f(4*r),{typedBuffer:n,typedBufferStride:a}=e.attributes.tangent;(0,s.z0)(Tr,e.transform),(0,_.t)(t,n,Tr,4,a),(0,o.or)(Tr)&&(0,v.n)(t,t,4),c.push(["tangent",new L.n(t,i,4,!0)])}if(null!=e.attributes.texCoord0){const t=f(2*r),{typedBuffer:n,typedBufferStride:o}=e.attributes.texCoord0;(0,x.a)(t,n,2,o),c.push(["uv0",new L.n(t,i,2,!0)])}const u=e.attributes.color;if(null!=u){const t=new Uint8Array(4*r);4===u.elementCount?u instanceof g.Eq?(0,_.b)(t,u,1,255):(u instanceof g.XP||u instanceof g.Uz)&&(0,_.b)(t,u,1/255,255):(t.fill(255),u instanceof g.xs?(0,v.f)(t,u.typedBuffer,1,255,4,u.typedBufferStride):(e.attributes.color instanceof g.eI||e.attributes.color instanceof g.nS)&&(0,v.f)(t,u.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new L.n(t,i,4,!0)])}return{geometry:new ne(t,c),vertexCount:r}}(e,r??new sr({},t)),p=d.boundingInfo;null!=p&&0===a&&((0,m.iT)(F,p.bbMin),(0,m.iT)(F,p.bbMax)),null!=r&&(c.stageResources.geometries.push(d),c.numberOfVertices+=h)}),l||E.push(c)}),{engineResources:E,referenceBoundingBox:F}}(p,t,a.specifiedLodIndex);return{lods:M,referenceBoundingBox:S,isEsriSymbolResource:p.meta.isEsriSymbolResource,isWosr:!1}}const Tr=(0,a.vt)()},46686(e,t,r){r.d(t,{o:()=>n});var i=r(31821);function n(e,t){t&&e.varyings.add("linearDepth","float",{invariant:!0}),e.vertex.code.add(i.H`
668
668
  void forwardLinearDepth(float _linearDepth) { ${(0,i.If)(t,"linearDepth = _linearDepth;")} }
669
- `)}},47286(e,t,r){r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},49255(e,t,r){function i(e){return 3===(t=e)||4===t||5===t||6===e||7===e;var t}function n(e){return function(e){return function(e){return o(e)||function(e){return 8===e||9===e}(e)}(e)||s(e)}(e)||2===e}function o(e){return 0===e}function s(e){return 1===e}function a(e){return s(e)||i(e)}r.d(t,{_o:()=>o,g1:()=>a,iq:()=>n,yT:()=>i})},49718(e,t,r){r(51850),r(6867).i},49788(e,t,r){r.d(t,{Q:()=>i});const i=1/255.5},51255(e,t,r){r.d(t,{D:()=>c});var i=r(49255),n=r(22911),o=r(42593),s=r(63365),a=r(31821),l=r(49788);function c(e,t){e.include(o.Q,t),e.include(n.NL,t),e.fragment.include(s.a);const{output:r,oitPass:c,hasEmission:u,discardInvisibleFragments:d,oitPremultipliedAlpha:h,snowCover:m}=t,p=9===r,f=(0,i._o)(r)&&1===c,g=(0,i._o)(r)&&2===c,v=(0,i._o)(r)&&1!==c;let _=0;(v||f)&&e.outputs.add("fragColor","vec4",_++),u&&e.outputs.add("fragEmission","vec4",_++),f&&e.outputs.add("fragAlpha","float",_++),e.fragment.code.add(a.H`
669
+ `)}},47286(e,t,r){r.d(t,{G:()=>n});var i=r(74333);class n extends i.n{constructor(e,t,r){super(e,"vec2",1,(i,n,o)=>i.setUniform2fv(e,t(n,o),r))}}},49255(e,t,r){function i(e){return 3===(t=e)||4===t||5===t||6===e||7===e;var t}function n(e){return function(e){return function(e){return o(e)||function(e){return 8===e||9===e}(e)}(e)||s(e)}(e)||2===e}function o(e){return 0===e}function s(e){return 1===e}function a(e){return s(e)||i(e)}r.d(t,{_o:()=>o,g1:()=>a,iq:()=>n,yT:()=>i})},49718(e,t,r){r(51850),r(6867).i},49788(e,t,r){r.d(t,{Q:()=>i});const i=1/255.5},51255(e,t,r){r.d(t,{D:()=>c});var i=r(49255),n=r(22911),o=r(42593),s=r(63365),a=r(31821),l=r(26934);function c(e,t){e.include(o.Q,t),e.include(n.NL,t),e.fragment.include(s.a);const{output:r,oitPass:c,hasEmission:u,discardInvisibleFragments:d,oitPremultipliedAlpha:h,snowCover:m}=t,p=9===r,f=(0,i._o)(r)&&1===c,g=(0,i._o)(r)&&2===c,v=(0,i._o)(r)&&1!==c;let _=0;(v||f)&&e.outputs.add("fragColor","vec4",_++),u&&e.outputs.add("fragEmission","vec4",_++),f&&e.outputs.add("fragAlpha","float",_++),e.fragment.include(l.Q),e.fragment.code.add(a.H`
670
670
  void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${(0,a.If)(m,", float snow")}) {
671
671
  ${(0,a.If)(p,"finalColor.a = 1.0;")}
672
- ${(0,a.If)(d,`if (finalColor.a < ${a.H.float(l.Q)}) { discard; }`)}
672
+ ${(0,a.If)(d,"if (finalColor.a < alphaCutoff) { discard; }")}
673
673
 
674
674
  ${(0,a.If)(f,`${(0,a.If)(h,"fragColor = finalColor;","fragColor = premultiplyAlpha(finalColor);")}\n fragAlpha = finalColor.a;`)}
675
675
  ${(0,a.If)(g&&h&&d,"finalColor.rgb /= finalColor.a;")}
@@ -742,7 +742,7 @@ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScal
742
742
  vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) {
743
743
  return worldPos + calculateVerticalOffset(worldPos, localOrigin);
744
744
  }
745
- `)):r.code.add(l.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const p=(0,n.vt)()},57323(e,t,r){r.d(t,{R:()=>B,b:()=>L});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),l=r(72722),c=r(43519),u=r(73955),d=r(71955),h=r(53466),m=r(92700),p=r(54154),f=r(9169),g=r(14527),v=r(28747),_=r(98619),x=r(22393),y=r(59469),w=r(32482),b=r(96598),M=r(986),T=r(58614),S=r(27950),C=r(20693),A=r(33079),E=r(71988),R=r(20304),I=r(31821),O=r(63761),F=r(10906),P=r(19245),D=r(51255),N=r(14113),H=r(49788);function L(e){const t=new N.N5,{attributes:r,vertex:L,fragment:B,varyings:z}=t,{output:U,offsetBackfaces:G,pbrMode:V,snowCover:j,spherical:W}=e,k=1===V||2===V;if((0,C.NB)(L,e),r.add("position","vec3"),z.add("vpos","vec3",{invariant:!0}),t.include(M.A,e),t.include(l.B,e),t.include(p.Ge,e),t.include(b.Z,e),!(0,n._o)(U))return t.include(f.E,e),t;(0,C.yu)(t.vertex,e),t.include(u.Y,e),t.include(s.d),G&&t.include(i.M),z.add("vNormalWorld","vec3"),z.add("localvpos","vec3",{invariant:!0}),t.include(h.U,e),t.include(d.K,e),t.include(a.v,e),t.include(m.c,e),L.include(c.WD),L.include(c.oF),L.uniforms.add(new E.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),z.add("vcolorExt","vec4"),t.include(e.instancedDoublePrecision?w.G:w.Bz,e),L.main.add(I.H`
745
+ `)):r.code.add(l.H`vec3 addVerticalOffset(vec3 worldPos, vec3 localOrigin) { return worldPos; }`)}const p=(0,n.vt)()},57323(e,t,r){r.d(t,{R:()=>B,b:()=>L});var i=r(32680),n=r(49255),o=r(68317),s=r(76597),a=r(24321),l=r(72722),c=r(43519),u=r(73955),d=r(71955),h=r(53466),m=r(92700),p=r(54154),f=r(9169),g=r(14527),v=r(28747),_=r(98619),x=r(22393),y=r(59469),w=r(32482),b=r(96598),M=r(986),T=r(58614),S=r(27950),C=r(20693),A=r(33079),E=r(71988),R=r(20304),I=r(31821),O=r(63761),F=r(10906),P=r(19245),D=r(26934),N=r(51255),H=r(14113);function L(e){const t=new H.N5,{attributes:r,vertex:L,fragment:B,varyings:z}=t,{output:U,offsetBackfaces:G,pbrMode:V,snowCover:j,spherical:W}=e,k=1===V||2===V;if((0,C.NB)(L,e),r.add("position","vec3"),z.add("vpos","vec3",{invariant:!0}),t.include(M.A,e),t.include(l.B,e),t.include(p.Ge,e),t.include(b.Z,e),!(0,n._o)(U))return t.include(f.E,e),t;(0,C.yu)(t.vertex,e),t.include(u.Y,e),t.include(s.d),G&&t.include(i.M),z.add("vNormalWorld","vec3"),z.add("localvpos","vec3",{invariant:!0}),t.include(h.U,e),t.include(d.K,e),t.include(a.v,e),t.include(m.c,e),L.include(c.WD),L.include(c.oF),L.uniforms.add(new E.E("externalColor",e=>e.externalColor,{supportsNaN:!0})),z.add("vcolorExt","vec4"),t.include(e.instancedDoublePrecision?w.G:w.Bz,e),L.include(D.Q),L.main.add(I.H`
746
746
  forwardVertexColor();
747
747
 
748
748
  MaskedColor maskedColorExt =
@@ -751,7 +751,7 @@ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScal
751
751
  vcolorExt = maskedColorExt.color;
752
752
  forwardColorMixMode(maskedColorExt.mask);
753
753
 
754
- bool alphaCut = opacityMixMode != ${I.H.int(P.Um.ignore)} && vcolorExt.a < ${I.H.float(H.Q)};
754
+ bool alphaCut = opacityMixMode != ${I.H.int(P.Um.ignore)} && vcolorExt.a < alphaCutoff;
755
755
  vpos = getVertexInLocalOriginSpace();
756
756
 
757
757
  localvpos = vpos - view[3].xyz;
@@ -765,11 +765,11 @@ return applyScreenSizePerspectiveScaleFactorVec2(size, screenSizePerspectiveScal
765
765
  forwardLinearDepthToReadShadowMap();
766
766
  gl_Position = alphaCut ? vec4(1e38, 1e38, 1e38, 1.0) :
767
767
  ${(0,I.If)(G,"offsetBackfacingClipPosition(basePosition, vpos, vNormalWorld, cameraPosition);","basePosition;")}
768
- `);const{hasColorTexture:$,hasColorTextureTransform:Z}=e;return B.include(v.kA,e),B.include(g.n,e),t.include(T.S,e),B.include(o.HQ,e),t.include(D.D,e),(0,C.yu)(B,e),(0,_.Gc)(B),(0,v.a8)(B),(0,v.eU)(B),B.uniforms.add(L.uniforms.get("localOrigin"),L.uniforms.get("view"),new A.t("ambient",e=>e.ambient),new A.t("diffuse",e=>e.diffuse),new R.m("opacity",e=>e.opacity),new R.m("layerOpacity",e=>e.layerOpacity)),$&&B.uniforms.add(new O.N("tex",e=>e.texture)),t.include(y._,e),B.include(x.c,e),B.include(S.N),B.include(F.b,e),(0,_.O4)(B),B.main.add(I.H`
768
+ `);const{hasColorTexture:Z,hasColorTextureTransform:$}=e;return B.include(v.kA,e),B.include(g.n,e),t.include(T.S,e),B.include(o.HQ,e),t.include(N.D,e),(0,C.yu)(B,e),(0,_.Gc)(B),(0,v.a8)(B),(0,v.eU)(B),B.uniforms.add(L.uniforms.get("localOrigin"),L.uniforms.get("view"),new A.t("ambient",e=>e.ambient),new A.t("diffuse",e=>e.diffuse),new R.m("opacity",e=>e.opacity),new R.m("layerOpacity",e=>e.layerOpacity)),Z&&B.uniforms.add(new O.N("tex",e=>e.texture)),t.include(y._,e),B.include(x.c,e),B.include(S.N),B.include(F.b,e),(0,_.O4)(B),B.main.add(I.H`
769
769
  discardBySlice(vpos);
770
770
  discardByTerrainDepth();
771
- vec4 texColor = ${$?`texture(tex, ${Z?"colorUV":"vuv0"})`:" vec4(1.0)"};
772
- ${(0,I.If)($,`${(0,I.If)(e.textureAlphaPremultiplied,"texColor.rgb /= texColor.a;")}\n discardOrAdjustAlpha(texColor);`)}
771
+ vec4 texColor = ${Z?`texture(tex, ${$?"colorUV":"vuv0"})`:" vec4(1.0)"};
772
+ ${(0,I.If)(Z,`${(0,I.If)(e.textureAlphaPremultiplied,"texColor.rgb /= texColor.a;")}\n discardOrAdjustAlpha(texColor);`)}
773
773
  vec3 viewDirection = normalize(vpos - cameraPosition);
774
774
  applyPBRFactors();
775
775
  float ssao = evaluateAmbientOcclusionInverse();