@deck.gl/jupyter-widget 9.1.11 → 9.1.13
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.
- package/dist/index.js +5 -5
- package/dist/index.js.map +2 -2
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -548,7 +548,7 @@ ${o}${s}${t.type.toUpperCase()}: ${t.message}
|
|
|
548
548
|
<code style="user-select:text;"><pre>
|
|
549
549
|
${i}
|
|
550
550
|
</pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),s.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},im=_O;Vr(im,"defaultProps",{...ei.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function bde(t){return L9(t.source)||t.id||rm(`unnamed ${t.stage}-shader`)}function L9(t,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return n?n[1]:e}var GE=class extends ei{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){r=GE.normalizeProps(e,r),super(e,r,GE.defaultProps)}static normalizeProps(e,r){let n=e?.props?._resourceDefaults?.sampler||{};return{...r,...n}}},om=GE;Vr(om,"defaultProps",{...ei.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var yO=class extends ei{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,r={}){super(e,r,yO.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let r=this.colorAttachments.map(i=>i.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:r,depthStencilAttachment:n})}resize(e){let r=!e;if(e){let[n,i]=Array.isArray(e)?e:[e.width,e.height];r=r||i!==this.height||n!==this.width,this.width=n,this.height=i}r&&(qt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((r,n)=>{if(typeof r=="string"){let i=this.createColorTexture(r,n);return this.attachResource(i),i.view}return r instanceof fi?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof fi?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,r){return this.device.createTexture({id:`${this.id}-color-attachment-${r}`,usage:fi.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:fi.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let i=this.colorAttachments[n].texture.clone({width:e,height:r});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},Of=yO;Vr(Of,"defaultProps",{...ei.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var xO=class extends ei{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,xO.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},Mh=xO;Vr(Mh,"defaultProps",{...ei.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var GA=class extends ei{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){r=GA.normalizeProps(e,r),super(e,r,GA.defaultProps)}static normalizeProps(e,r){return{...e.props._resourceDefaults?.renderPass,...r}}},Up=GA;Vr(Up,"defaultClearColor",[0,0,0,1]),Vr(Up,"defaultClearDepth",1),Vr(Up,"defaultClearStencil",0),Vr(Up,"defaultProps",{...ei.defaultProps,framebuffer:null,parameters:void 0,clearColor:GA.defaultClearColor,clearColors:void 0,clearDepth:GA.defaultClearDepth,clearStencil:GA.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var vO=class extends ei{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,r){super(e,r,vO.defaultProps),this.shaderLayout=r.shaderLayout}},XA=vO;Vr(XA,"defaultProps",{...ei.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var bO=class extends ei{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,bO.defaultProps)}},P_=bO;Vr(P_,"defaultProps",{...ei.defaultProps,measureExecutionTime:void 0});var wO=class extends ei{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,wO.defaultProps)}},I_=wO;Vr(I_,"defaultProps",{...ei.defaultProps});function O9(t){let[e,r]=Tde[t],n=e==="i32"||e==="u32",i=e!=="u32",o=Ede[e]*r,s=wde(e,r);return{dataType:e,components:r,defaultVertexFormat:s,byteLength:o,integer:n,signed:i}}function wde(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var Tde={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},Ede={f32:4,f16:2,i32:4,u32:4};function TO(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,n]=t.split("x"),i=r,o=n?parseInt(n):1,s=VE(i),c={type:i,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(c.webglOnly=!0),c}function XE(t,e){let r={};for(let n of t.attributes){let i=Mde(t,e,n.name);i&&(r[n.name]=i)}return r}function B9(t,e,r=16){let n=XE(t,e),i=new Array(r).fill(null);for(let o of Object.values(n))i[o.location]=o;return i}function Mde(t,e,r){let n=Sde(t,r),i=Cde(e,r);if(!n)return null;let o=O9(n.type),s=i?.vertexFormat||o.defaultVertexFormat,c=TO(s);return{attributeName:i?.attributeName||n.name,bufferName:i?.bufferName||n.name,location:n.location,shaderType:n.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:o.integer,stepMode:i?.stepMode||n.stepMode||"vertex",byteOffset:i?.byteOffset||0,byteStride:i?.byteStride||0}}function Sde(t,e){let r=t.attributes.find(n=>n.name===e);return r||qt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function Cde(t,e){Pde(t);let r=Ide(t,e);return r||(r=Rde(t,e),r)?r:(qt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Pde(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&qt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Ide(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function Rde(t,e){for(let r of t){let n=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=TO(o.format);n+=s.byteLength}let i=r.attributes?.find(o=>o.attribute===e);if(i)return{attributeName:i.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:n}}return null}var EO=class extends ei{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,EO.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null);let{shaderLayout:n,bufferLayout:i}=r.renderPipeline||{};if(!n||!i)throw new Error("VertexArray");this.attributeInfos=B9(n,i,this.maxVertexAttributes)}setConstantWebGL(e,r){this.device.reportError(new Error("constant attributes not supported"))}},R_=EO;Vr(R_,"defaultProps",{...ei.defaultProps,renderPipeline:null});var MO=class extends ei{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,MO.defaultProps)}},L_=MO;Vr(L_,"defaultProps",{...ei.defaultProps,layout:void 0,buffers:{}});var SO=class extends ei{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,SO.defaultProps)}},O_=SO;Vr(O_,"defaultProps",{...ei.defaultProps,type:void 0,count:void 0});var Lde={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function D9(t){return Lde[t]}function N9(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var YE;function CO(t){return(!YE||YE.byteLength<t)&&(YE=new ArrayBuffer(t)),YE}function PO(t,e){let r=CO(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function Ode(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function B_(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number":Ode(t)}var k9=1024,KE=class{layout={};byteLength;constructor(e){let r=0;for(let[i,o]of Object.entries(e)){let s=D9(o),{type:c,components:l}=s;r=N9(r,l);let h=r;r+=l,this.layout[i]={type:c,size:l,offset:h}}r+=(4-r%4)%4;let n=r*4;this.byteLength=Math.max(n,k9)}getData(e){let r=Math.max(this.byteLength,k9),n=CO(r),i={i32:new Int32Array(n),u32:new Uint32Array(n),f32:new Float32Array(n),f16:new Uint16Array(n)};for(let[o,s]of Object.entries(e)){let c=this.layout[o];if(!c){qt.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:l,size:h,offset:p}=c,x=i[l];if(h===1){if(typeof s!="number"&&typeof s!="boolean"){qt.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}x[p]=Number(s)}else{if(!B_(s)){qt.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}x.set(s,p)}}return new Uint8Array(n)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function F9(t,e,r=16){if(t!==e)return!1;let n=t,i=e;if(!B_(n))return!1;if(B_(i)&&n.length===i.length){for(let o=0;o<n.length;++o)if(i[o]!==n[o])return!1}return!0}function z9(t){return B_(t)?t.slice():t}var ZE=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(i=>i.type==="uniform"&&i.name===e?.name);if(!r)throw new Error(e?.name);let n=r;for(let i of n.uniforms||[])this.bindingLayout[i.name]=i}}setUniforms(e){for(let[r,n]of Object.entries(e))this._setUniform(r,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){F9(this.uniforms[e],r)||(this.uniforms[e]=z9(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Iv=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,n]of Object.entries(e)){let i=r,o=new KE(n.uniformTypes||{});this.uniformBufferLayouts.set(i,o);let s=new ZE({name:r});s.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(i,s)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,n]of Object.entries(e))this.uniformBlocks.get(r)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let r=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(r)}createUniformBuffer(e,r,n){n&&this.setUniforms(n);let i=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:Fn.UNIFORM|Fn.COPY_DST,byteLength:i}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let n=this.getUniformBufferByteLength(r),i=e.createBuffer({usage:Fn.UNIFORM|Fn.COPY_DST,byteLength:n});this.uniformBuffers.set(r,i)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(r);e||=n}return e&&qt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),n=this.uniformBuffers.get(e),i=!1;if(n&&r?.needsRedraw){i||=r.needsRedraw;let o=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n?.write(o);let s=this.uniformBlocks.get(e)?.getAllUniforms();qt.log(4,`Writing to uniform buffer ${String(e)}`,o,s)()}return i}};function $E(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function Rv(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function IO(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let n=e,i=$E(t);if(i==="uint8"&&r&&n===1)return"unorm8-webgl";if(i==="uint8"&&r&&n===3)return"unorm8x3-webgl";if(i==="uint8"||i==="sint8"){if(n===1||n===3)throw new Error(`size: ${e}`);return r&&(i=i.replace("int","norm")),`${i}x${n}`}if(i==="uint16"||i==="sint16"){if(n===1||n===3)throw new Error(`size: ${e}`);return r&&(i=i.replace("int","norm")),`${i}x${n}`}return n===1?i:`${i}x${n}`}var YA=class{bufferLayouts;constructor(e){this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(r=>r.name===e)||null}getAttributeNamesForBuffer(e){return e.attributes?e.attributes?.map(r=>r.attribute):[e.name]}mergeBufferLayouts(e,r){let n=[...e];for(let i of r){let o=n.findIndex(s=>s.name===i.name);o<0?n.push(i):n[o]=i}return n}};var Bf;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Bf||(Bf={}));var Ov={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},va=(t,e,r)=>e?t.enable(r):t.disable(r),U9=(t,e,r)=>t.hint(r,e),au=(t,e,r)=>t.pixelStorei(r,e),V9=(t,e,r)=>{let n=r===36006?36009:36008;return t.bindFramebuffer(n,e)},Lv=(t,e,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(i,e)};function RO(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var j9={[3042]:va,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:va,[2885]:(t,e)=>t.cullFace(e),[2929]:va,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:va,[35723]:U9,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:V9,[36010]:V9,[34964]:Lv,[36662]:Lv,[36663]:Lv,[35053]:Lv,[35055]:Lv,[2886]:(t,e)=>t.frontFace(e),[33170]:U9,[2849]:(t,e)=>t.lineWidth(e),[32823]:va,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:va,[32926]:va,[32928]:va,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:va,[3088]:(t,e)=>t.scissor(...e),[2960]:va,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(t,e)=>t.viewport(...e),[34383]:va,[10754]:va,[12288]:va,[12289]:va,[12290]:va,[12291]:va,[12292]:va,[12293]:va,[12294]:va,[12295]:va,[3333]:au,[3317]:au,[37440]:au,[37441]:au,[37443]:au,[3330]:au,[3332]:au,[3331]:au,[3314]:au,[32878]:au,[3316]:au,[3315]:au,[32877]:au,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(e[0],e[1]||!1),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=RO(e)?e:[e,e];let[r,n]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,n)},stencilFunc:(t,e)=>{e=RO(e)&&e.length===3?[...e,...e]:e;let[r,n,i,o,s,c]=e;t.stencilFuncSeparate(1028,r,n,i),t.stencilFuncSeparate(1029,o,s,c)},stencilOp:(t,e)=>{e=RO(e)&&e.length===3?[...e,...e]:e;let[r,n,i,o,s,c]=e;t.stencilOpSeparate(1028,r,n,i),t.stencilOpSeparate(1029,o,s,c)},viewport:(t,e)=>t.viewport(...e)};function qs(t,e,r){return e[t]!==void 0?e[t]:r[t]}var H9={blendEquation:(t,e,r)=>t.blendEquationSeparate(qs(32777,e,r),qs(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(qs(32969,e,r),qs(32968,e,r),qs(32971,e,r),qs(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(qs(32824,e,r),qs(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(qs(32938,e,r),qs(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,qs(2962,e,r),qs(2967,e,r),qs(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,qs(34816,e,r),qs(36003,e,r),qs(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,qs(2964,e,r),qs(2965,e,r),qs(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,qs(34817,e,r),qs(34818,e,r),qs(34819,e,r))},LO={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return n?t({[n]:r}):{valueChanged:!0}},blendColor:(t,e,r,n,i)=>t({[32773]:new Float32Array([e,r,n,i])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,n,i)=>t({[32969]:e,[32968]:r,[32971]:n,[32970]:i}),clearColor:(t,e,r,n,i)=>t({[3106]:new Float32Array([e,r,n,i])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,n,i)=>t({[3107]:[e,r,n,i]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,n,i)=>t({[3088]:new Int32Array([e,r,n,i])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,n)=>t({[2962]:e,[2967]:r,[2963]:n,[34816]:e,[36003]:r,[36004]:n}),stencilFuncSeparate:(t,e,r,n,i)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:n,[e===1028?2963:36004]:i}),stencilOp:(t,e,r,n)=>t({[2964]:e,[2965]:r,[2966]:n,[34817]:e,[34818]:r,[34819]:n}),stencilOpSeparate:(t,e,r,n,i)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:n,[e===1028?2966:34819]:i}),viewport:(t,e,r,n,i)=>t({[2978]:[e,r,n,i]})},Df=(t,e)=>t.isEnabled(e),OO={[3042]:Df,[2884]:Df,[2929]:Df,[3024]:Df,[32823]:Df,[32926]:Df,[32928]:Df,[3089]:Df,[2960]:Df,[35977]:Df},W9=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Sh(t,e){if(Bde(e))return;let r={};for(let i in e){let o=Number(i),s=j9[i];s&&(typeof s=="string"?r[s]=!0:s(t,e[i],o))}let n=t.state&&t.state.cache;if(n)for(let i in r){let o=H9[i];o(t,e,n)}}function QE(t,e=Ov){if(typeof e=="number"){let i=e,o=OO[i];return o?o(t,i):t.getParameter(i)}let r=Array.isArray(e)?e:Object.keys(e),n={};for(let i of r){let o=OO[i];n[i]=o?o(t,Number(i)):t.getParameter(Number(i))}return n}function q9(t){Sh(t,Ov)}function Bde(t){for(let e in t)return!1;return!0}function G9(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),n=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&n&&t.length===e.length){for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}return!1}var Ch=class{static get(e){return e.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(e,r){this.gl=e,this.log=r?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){let e=this.stateStack[this.stateStack.length-1];Sh(this.gl,e),this.stateStack.pop()}trackState(e,r){if(this.cache=r.copyState?QE(e):Object.assign({},Ov),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,Nde(e);for(let n in LO){let i=LO[n];Dde(e,n,i)}X9(e,"getParameter"),X9(e,"isEnabled")}_updateCache(e){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){let s=e[o],c=this.cache[o];G9(s,c)||(r=!0,n=c,i&&!(o in i)&&(i[o]=c),this.cache[o]=s)}return{valueChanged:r,oldValue:n}}};function X9(t,e){let r=t[e].bind(t);t[e]=function(i){if(i===void 0||W9.has(i))return r(i);let o=Ch.get(t);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function Dde(t,e,r){if(!t[e])return;let n=t[e].bind(t);t[e]=function(...o){let s=Ch.get(t),{valueChanged:c,oldValue:l}=r(s._updateCache,...o);return c&&n(...o),l},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function Nde(t){let e=t.useProgram.bind(t);t.useProgram=function(n){let i=Ch.get(t);i.program!==n&&(e(n),i.program=n)}}function Y9(t,e,r){let n="",i={preserveDrawingBuffer:!0,...r},o=null;if(o||=t.getContext("webgl2",i),i.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!o&&!r.failIfMajorPerformanceCaveat&&(i.failIfMajorPerformanceCaveat=!1,o=t.getContext("webgl2",i),o.luma||={},o.luma.softwareRenderer=!0),o||(o=t.getContext("webgl",{}),o&&(o=null,n||="Your browser only supports WebGL1")),!o)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);let{onContextLost:s,onContextRestored:c}=e;return t.addEventListener("webglcontextlost",l=>s(l),!1),t.addEventListener("webglcontextrestored",l=>c(l),!1),o.luma||={},o}function Nf(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function K9(t,e){let r=t.getParameter(7936),n=t.getParameter(7937);Nf(t,"WEBGL_debug_renderer_info",e);let i=e.WEBGL_debug_renderer_info,o=t.getParameter(i?i.UNMASKED_VENDOR_WEBGL:7936),s=t.getParameter(i?i.UNMASKED_RENDERER_WEBGL:7937),c=o||r,l=s||n,h=t.getParameter(7938),p=Z9(c,l),x=kde(c,l),w=Fde(c,l);return{type:"webgl",gpu:p,gpuType:w,gpuBackend:x,vendor:c,renderer:l,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function Z9(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function kde(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function Fde(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(Z9(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function JE(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var Bv="WEBGL_compressed_texture_s3tc",Dv="WEBGL_compressed_texture_s3tc_srgb",D_="EXT_texture_compression_rgtc",N_="EXT_texture_compression_bptc",zde="WEBGL_compressed_texture_etc",Ude="WEBGL_compressed_texture_astc",Vde="WEBGL_compressed_texture_etc1",jde="WEBGL_compressed_texture_pvrtc",Hde="WEBGL_compressed_texture_atc",$9="EXT_texture_norm16",Q9="EXT_render_snorm",Wde="EXT_color_buffer_float",eM={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat-renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[Q9],"norm16-renderable-webgl":[$9],"snorm16-renderable-webgl":[$9,Q9],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[Bv,Dv,D_,N_],"texture-compression-bc5-webgl":[D_],"texture-compression-bc7-webgl":[N_],"texture-compression-etc2":[zde],"texture-compression-astc":[Ude],"texture-compression-etc1-webgl":[Vde],"texture-compression-pvrtc-webgl":[jde],"texture-compression-atc-webgl":[Hde]};function J9(t){return t in eM}function e7(t,e,r){return(eM[e]||[]).every(i=>Nf(t,i,r))}var BO={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},"r16unorm-webgl":{gl:33322,rb:!0},"r16snorm-webgl":{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},"rg16unorm-webgl":{gl:33324},"rg16snorm-webgl":{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},"rgb10a2uint-webgl":{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},"rgba16unorm-webgl":{gl:32859,rb:!0},"rgba16snorm-webgl":{gl:36763},"rgb32float-webgl":{gl:34837,x:Wde,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Bv},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Dv},"bc1-rgba-unorm":{gl:33777,x:Bv},"bc1-rgba-unorm-srgb":{gl:35916,x:Dv},"bc2-rgba-unorm":{gl:33778,x:Bv},"bc2-rgba-unorm-srgb":{gl:35918,x:Dv},"bc3-rgba-unorm":{gl:33779,x:Bv},"bc3-rgba-unorm-srgb":{gl:35919,x:Dv},"bc4-r-unorm":{gl:36283,x:D_},"bc4-r-snorm":{gl:36284,x:D_},"bc5-rg-unorm":{gl:36285,x:D_},"bc5-rg-snorm":{gl:36286,x:D_},"bc6h-rgb-ufloat":{gl:36495,x:N_},"bc6h-rgb-float":{gl:36494,x:N_},"bc7-rgba-unorm":{gl:36492,x:N_},"bc7-rgba-unorm-srgb":{gl:36493,x:N_},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function t7(t,e,r){let n=e.create,i=BO[e.format];return i?.gl===void 0&&(n=!1),i?.x&&(n=n&&Boolean(Nf(t,i.x,r))),{format:e.format,create:n&&e.create,render:n&&e.render,filter:n&&e.filter,blend:n&&e.blend,store:n&&e.store}}function tM(t){let e=BO[t],r=Gde(t),n=M_(t);return{internalFormat:r,format:e?.dataFormat||qde(n.channels,n.integer,n.normalized,r),type:n.dataType?JE(n.dataType):e?.types?.[0]||5121,compressed:n.compressed||!1}}function r7(t){switch(M_(t).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${t}`)}}function qde(t,e,r,n){if(n===6408||n===6407)return n;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function Gde(t){let r=BO[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}var n7={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},rM=class extends Sv{gl;extensions;testedFeatures=new Set;constructor(e,r,n){super([],n),this.gl=e,this.extensions=r,Nf(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures?.[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),J9(e)&&e7(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(n7),...Object.keys(eM)]}getWebGLFeature(e){let r=n7[e];return Boolean(typeof r=="string"?Nf(this.gl,r,this.extensions):r)}};var nM=class extends Mv{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]||0}};var kf=class extends Of{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(e,r){super(e,r);let n=r.handle===null;this.device=e,this.gl=e.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let e=this.gl.bindFramebuffer(36160,this.handle);for(let r=0;r<this.colorAttachments.length;++r){let n=this.colorAttachments[r];if(n){let i=36064+r;this._attachTextureView(i,n)}}if(this.depthStencilAttachment){let r=r7(this.depthStencilAttachment.props.format);this._attachTextureView(r,this.depthStencilAttachment)}if(this.device.props.debug){let r=this.gl.checkFramebufferStatus(36160);if(r!==36053)throw new Error(`Framebuffer ${Yde(r)}`)}this.gl.bindFramebuffer(36160,e)}_attachTextureView(e,r){let{gl:n}=this.device,{texture:i}=r,o=r.props.baseMipLevel,s=r.props.baseArrayLayer;switch(n.bindTexture(i.glTarget,i.handle),i.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,e,i.handle,o,s);break;case 34067:let c=Xde(s);n.framebufferTexture2D(36160,e,c,i.handle,o);break;case 3553:n.framebufferTexture2D(36160,e,3553,i.handle,o);break;default:throw new Error("Illegal texture type")}n.bindTexture(i.glTarget,null)}};function Xde(t){return t<34069?t+34069:t}function Yde(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}var iM=class extends C_{device;format="rgba8unorm";depthStencilFormat="depth24plus";presentationSize;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new kf(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};async function oM(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",t),e&&(n.id=e),new Promise((i,o)=>{n.onload=i,n.onerror=s=>o(new Error(`Unable to load script '${t}': ${s}`)),r.appendChild(n)})}var Kde=1,cu=null,i7=!1,sM={debugSpectorJS:qt.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0};async function o7(t){if(!globalThis.SPECTOR)try{await oM(t.debugSpectorJSUrl||sM.debugSpectorJSUrl)}catch(e){qt.warn(String(e))}}function s7(t){if(t={...sM,...t},!t.debugSpectorJS)return null;if(!cu&&globalThis.SPECTOR&&!globalThis.luma?.spector){qt.probe(Kde,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();let{Spector:e}=globalThis.SPECTOR;cu=new e,globalThis.luma&&(globalThis.luma.spector=cu)}if(!cu)return null;if(i7||(i7=!0,cu.spyCanvases(),cu?.onCaptureStarted.add(e=>qt.info("Spector capture started:",e)()),cu?.onCapture.add(e=>{qt.info("Spector capture complete:",e)(),cu?.getResultUI(),cu?.resultView.display(),cu?.resultView.addCapture(e)})),t.gl){let e=t.gl,r=e.device;cu?.startCapture(t.gl,500),e.device=r,new Promise(n=>setTimeout(n,2e3)).then(n=>{qt.info("Spector capture stopped after 2 seconds")(),cu?.stopCapture()})}return cu}var Zde="https://unpkg.com/webgl-debug@2.0.1/index.js";function c7(t){return t.luma=t.luma||{},t.luma}async function l7(){ul()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await oM(Zde))}function u7(t,e={}){return e.debugWebGL||e.traceWebGL?Qde(t,e):$de(t)}function $de(t){let e=c7(t);return e.realContext?e.realContext:t}function Qde(t,e){if(!globalThis.WebGLDebugUtils)return qt.warn("webgl-debug not loaded")(),t;let r=c7(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...Bf,...t});let n=globalThis.WebGLDebugUtils.makeDebugContext(t,Jde.bind(null,e),eme.bind(null,e));for(let s in Bf)!(s in n)&&typeof Bf[s]=="number"&&(n[s]=Bf[s]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function a7(t,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function Jde(t,e,r,n){n=Array.from(n).map(c=>c===void 0?"undefined":c);let i=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),s=`${i} in gl.${r}(${o})`;qt.error(s)();debugger}function eme(t,e,r){let n="";qt.level>=1&&(n=a7(e,r),t.traceWebGL&&qt.log(1,n)());for(let i of r)if(i===void 0){n=n||a7(e,r);debugger}}var DO={};function h7(t="id"){DO[t]=DO[t]||1;let e=DO[t]++;return`${t}-${e}`}var Ph=class extends Fn{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=tme(this.props.usage),this.glUsage=rme(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,n=e.byteLength+r){let i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,e),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(e,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(e){let r=e;e===0&&(r=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let n=new Uint8Array(r),i=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,n,i,r),this.gl.bindBuffer(36662,null),this._setDebugData(n,e,r),n}};function tme(t){return t&Fn.INDEX?34963:t&Fn.VERTEX?34962:t&Fn.UNIFORM?35345:34962}function rme(t){return t&Fn.INDEX||t&Fn.VERTEX?35044:t&Fn.UNIFORM?35048:35044}function p7(t){let e=t.split(/\r?\n/),r=[];for(let n of e){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[x,w]=i;r.push({message:w.trim(),type:f7(x),lineNum:0,linePos:0});continue}let[o,s,c,...l]=i,h=parseInt(c,10);isNaN(h)&&(h=0);let p=parseInt(s,10);isNaN(p)&&(p=0),r.push({message:l.join(":").trim(),type:f7(o),lineNum:h,linePos:p})}return r}function f7(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var aM=class extends im{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>this.compilationStatus)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return e?p7(e):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(e){e=e.startsWith("#version ")?e:`#version 300 es
|
|
551
|
-
${e}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,e),r.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}qt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),qt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};function m7(t,e,r,n){if(sme(e))return n(t);let i=t;i.pushState();try{return nme(t,e),Sh(i.gl,r),n(t)}finally{i.popState()}}function nme(t,e){let r=t,{gl:n}=r;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(KA("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=KA("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=KA("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&n.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(ome("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(lM("depthCompare",e.depthCompare))),e.stencilWriteMask){let i=e.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(e.stencilReadMask&&qt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let i=e.stencilReadMask||4294967295,o=lM("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let i=NO("stencilPassOperation",e.stencilPassOperation),o=NO("stencilFailOperation",e.stencilFailOperation),s=NO("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(e.blendColorOperation||e.blendAlphaOperation){let i=d7("blendColorOperation",e.blendColorOperation||"add"),o=d7("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=cM("blendColorSrcFactor",e.blendColorSrcFactor||"one"),c=cM("blendColorDstFactor",e.blendColorDstFactor||"zero"),l=cM("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=cM("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,c,l,h)}}function lM(t,e){return KA(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function NO(t,e){return KA(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function d7(t,e){return KA(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function cM(t,e){return KA(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function ime(t,e){return`Illegal parameter ${e} for ${t}`}function KA(t,e,r){if(!(e in r))throw new Error(ime(t,e));return r[e]}function ome(t,e){return e}function sme(t){let e=!0;for(let r in t){e=!1;break}return e}function uM(t){let e={};return t.addressModeU&&(e[10242]=kO(t.addressModeU)),t.addressModeV&&(e[10243]=kO(t.addressModeV)),t.addressModeW&&(e[32882]=kO(t.addressModeW)),t.magFilter&&(e[10240]=FO(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=ame(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=lM("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function kO(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function FO(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function ame(t,e="none"){if(!e)return FO(t);switch(e){case"none":return FO(t);case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var ZA=class extends om{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=uM(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,n]of Object.entries(e)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}};var Ff=class extends nm{device;gl;handle;texture;constructor(e,r){super(e,{...fi.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var cme="Failed to deduce GL constant from typed array";function A7(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(cme)}}function g7(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function zO(t){switch(t){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function _7(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function $A(t,e,r){if(lme(e))return r(t);let{nocatch:n=!0}=e,i=Ch.get(t);i.push(),Sh(t,e);let o;if(n)o=r(t),i.pop();else try{o=r(t)}finally{i.pop()}return o}function lme(t){for(let e in t)return!1;return!0}function y7(t,e,r){let{dimension:n,width:i,height:o,depth:s=0}=r,{glInternalFormat:c}=r,l=r.glTarget;switch(n){case"2d-array":case"3d":t.texStorage3D(l,e,c,i,o,s);break;default:t.texStorage2D(l,e,c,i,o)}}function UO(t,e,r,n){let{width:i,height:o}=n,{dimension:s,depth:c=0,mipLevel:l=0}=n,{x:h=0,y:p=0,z:x=0}=n,{glFormat:w,glType:E}=n,C=v7(n.glTarget,s,c),B=n.flipY?{[37440]:!0}:{};$A(t,B,()=>{switch(s){case"2d-array":case"3d":t.bindTexture(C,e),t.texSubImage3D(C,l,h,p,x,i,o,c,w,E,r),t.bindTexture(C,null);break;case"2d":case"cube":t.bindTexture(C,e),t.texSubImage2D(C,l,h,p,i,o,w,E,r),t.bindTexture(C,null);break;default:throw new Error(s)}})}function VO(t,e,r){let{dimension:n,width:i,height:o,depth:s=0,mipLevel:c=0,byteOffset:l=0}=r,{x:h=0,y:p=0,z:x=0}=r,{glFormat:w,glType:E,compressed:C}=r,B=v7(r.glTarget,n,s);switch(n){case"2d-array":case"3d":C?t.compressedTexSubImage3D(B,c,h,p,x,i,o,s,w,e,l):t.texSubImage3D(B,c,h,p,x,i,o,s,w,E,e,l);break;case"2d":case"cube":C?t.compressedTexSubImage2D(B,c,h,p,i,o,w,e,l):t.texSubImage2D(B,c,h,p,i,o,w,E,e,l);break;default:throw new Error(n)}}function x7(t){switch(t){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(t)}function v7(t,e,r){return e==="cube"?34069+r:t}function b7(t,e){let{sourceX:r=0,sourceY:n=0,sourceAttachment:i=0}=e||{},{target:o=null,sourceWidth:s,sourceHeight:c,sourceDepth:l,sourceFormat:h,sourceType:p}=e||{},{framebuffer:x,deleteFramebuffer:w}=T7(t),{gl:E,handle:C}=x;s||=x.width,c||=x.height;let B=x.colorAttachments[i]?.texture;if(!B)throw new Error(`Invalid framebuffer attachment ${i}`);l=B?.depth||1,h||=B?.glFormat||6408,p||=B?.glType||5121,o=hme(o,p,h,s,c,l),p=p||A7(o);let D=E.bindFramebuffer(36160,C);return E.readBuffer(36064+i),E.readPixels(r,n,s,c,h,p,o),E.readBuffer(36064),E.bindFramebuffer(36160,D||null),w&&x.destroy(),o}function w7(t,e){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:c,sourceHeight:l,sourceType:h}=e||{},{framebuffer:p,deleteFramebuffer:x}=T7(t);c=c||p.width,l=l||p.height;let w=p;h=h||5121;let E=r;if(!E){let B=zO(o),D=_7(h),W=s+c*l*B*D;E=w.device.createBuffer({byteLength:W})}let C=t.device.createCommandEncoder();return C.copyTextureToBuffer({sourceTexture:t,width:c,height:l,origin:[n,i],destinationBuffer:E,byteOffset:s}),C.destroy(),x&&p.destroy(),E}function T7(t){return t instanceof Of?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:ume(t),deleteFramebuffer:!0}}function ume(t,e){let{device:r,width:n,height:i,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[t]})}function hme(t,e,r,n,i,o){if(t)return t;e||=5121;let s=g7(e,{clamped:!1}),c=zO(r);return new s(n*i*c)}var zf=class extends fi{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(e,r){super(e,r);let n={...this.props};n.data=r.data,this.device=e,this.gl=this.device.gl,this.glTarget=x7(this.props.dimension);let i=tM(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=Boolean(this.props.mipmaps),this._initialize(n),Object.seal(this)}_initialize(e){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:e.data});let{width:r,height:n}=e;if(!r||!n){let i=fi.getTextureDataSize(e.data);r=i?.width||1,n=i?.height||1}if(this.width=r,this.height=n,this.depth=e.depth,this.setSampler(e.sampler),this.view=new Ff(this.device,{...this.props,texture:this}),this.bind(),y7(this.gl,this.mipLevels,this),e.data)switch(e.dimension){case"1d":this.setTexture1DData(e.data);break;case"2d":this.setTexture2DData(e.data);break;case"3d":this.setTexture3DData(e.data);break;case"cube":this.setTextureCubeData(e.data);break;case"2d-array":this.setTextureArrayData(e.data);break;case"cube-array":this.setTextureCubeArrayData(e.data);break;default:throw new Error(e.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new Ff(this.device,{...e,texture:this})}setSampler(e={}){let r;e instanceof ZA?(this.sampler=e,r=e.props):(this.sampler=new ZA(this.device,e),r=e);let n=uM(r);this._setSamplerParameters(n)}generateMipmap(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(qt.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!e?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){qt.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(e){let r=fi.getExternalImageSize(e.image),n={...fi.defaultCopyExternalImageOptions,...r,...e},{image:i,depth:o,mipLevel:s,x:c,y:l,z:h,flipY:p}=n,{width:x,height:w}=n,{dimension:E,glTarget:C,glFormat:B,glInternalFormat:D,glType:W}=this;if(x=Math.min(x,this.width-c),w=Math.min(w,this.height-l),e.sourceX||e.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return UO(this.device.gl,this.handle,i,{dimension:E,mipLevel:s,x:c,y:l,z:h,width:x,height:w,depth:o,glFormat:B,glInternalFormat:D,glType:W,glTarget:C,flipY:p}),{width:n.width,height:n.height}}setTexture1DData(e){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(e,r=0){this.bind();let n=fi.normalizeTextureData(e,this);n.length>1&&this.props.mipmaps!==!1&&qt.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let i=0;i<n.length;i++){let o=n[i];this._setMipLevel(r,i,o)}this.unbind()}setTexture3DData(e){if(this.props.dimension!=="3d")throw new Error(this.id);ArrayBuffer.isView(e)&&(this.bind(),VO(this.device.gl,e,this),this.unbind())}setTextureCubeData(e,r=0){if(this.props.dimension!=="cube")throw new Error(this.id);for(let n of fi.CubeFaces)this.setTextureCubeFaceData(e[n],n)}setTextureArrayData(e){throw this.props.dimension!=="2d-array"?new Error(this.id):new Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(e){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(e,r,n=0){Array.isArray(e)&&e.length>1&&this.props.mipmaps!==!1&&qt.warn(`${this.id} has mipmap and multiple LODs.`)();let i=fi.CubeFaces.indexOf(r);this.setTexture2DData(e,i)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(e){let{face:r,width:n,height:i,pixels:o,data:s,format:c=6408,type:l=5121}=e,{gl:h}=this,p=o||s;this.bind(),p instanceof Promise?p.then(x=>this.setImageDataForFace(Object.assign({},e,{face:r,data:x,pixels:x}))):this.width||this.height?h.texImage2D(r,0,c,n,i,0,c,l,p):h.texImage2D(r,0,c,c,l,p)}_getImageDataMap(e){for(let r=0;r<fi.CubeFaces.length;++r){let n=fi.CubeFaces[r];e[n]&&(e[34069+r]=e[n],delete e[n])}return e}_setSamplerParameters(e){qt.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(e)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.glTarget,i,o);break;case 10241:this.gl.texParameteri(this.glTarget,i,o);break;case 10242:case 10243:this.gl.texParameteri(this.glTarget,i,o);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,i,o);break;default:this.gl.texParameteri(this.glTarget,i,o);break}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(e,r,n,i=this.glTarget){if(fi.isExternalImage(n)){UO(this.device.gl,this.handle,n,{...this,depth:e,mipLevel:r,glTarget:i,flipY:this.props.flipY});return}if(fi.isTextureLevelData(n)){VO(this.device.gl,n.data,{...this,depth:e,mipLevel:r,glTarget:i});return}throw new Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.glTarget,this.handle),e}unbind(e){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.glTarget,null),e}};var fme=[1,2,4,8],hM=class extends Up{device;glParameters;constructor(e,r){super(e,r),this.device=e;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:o,height:s}=r.framebuffer;n=[0,0,o,s]}else{let[o,s]=e.getCanvasContext().getDrawingBufferSize();n=[0,0,o,s]}if(this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters}),this.props.framebuffer?.handle)if(this.props.framebuffer){let o=this.props.framebuffer.colorAttachments.map((s,c)=>36064+c);this.device.gl.drawBuffers(o)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};r.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=fme.map(n=>Boolean(n&e.colorMask))),this.glParameters=r,Sh(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,i)=>{n&&this.clearColorBuffer(i,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,e.clearStencil=this.props.clearStencil),r!==0&&$A(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){$A(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,e,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}};function E7(t){return pme.includes(t)}var pme=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],M7={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function jO(t){let e=M7[t];if(!e)throw new Error("uniform");let[r,n,,i]=e;return{format:i,components:n,glType:r}}function S7(t){let e=M7[t];if(!e)throw new Error("attribute");let[,r,,n,i]=e;return{attributeType:n,vertexFormat:i,components:r}}function C7(t,e){let r={attributes:[],bindings:[]};r.attributes=dme(t,e);let n=gme(t,e);for(let c of n){let l=c.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:c.name,group:0,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:l})}let i=Ame(t,e),o=0;for(let c of i)if(E7(c.type)){let{viewDimension:l,sampleType:h}=yme(c.type);r.bindings.push({type:"texture",name:c.name,group:0,location:o,viewDimension:l,sampleType:h}),c.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=mme(t,e);return s?.length&&(r.varyings=s),r}function dme(t,e){let r=[],n=t.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=t.getActiveAttrib(e,i);if(!o)throw new Error("activeInfo");let{name:s,type:c}=o,l=t.getAttribLocation(e,s);if(l>=0){let{attributeType:h}=S7(c),p=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:p,type:h})}}return r.sort((i,o)=>i.location-o.location),r}function mme(t,e){let r=[],n=t.getProgramParameter(e,35971);for(let i=0;i<n;i++){let o=t.getTransformFeedbackVarying(e,i);if(!o)throw new Error("activeInfo");let{name:s,type:c,size:l}=o,{glType:h,components:p}=jO(c),x={location:i,name:s,type:h,size:l*p};r.push(x)}return r.sort((i,o)=>i.location-o.location),r}function Ame(t,e){let r=[],n=t.getProgramParameter(e,35718);for(let i=0;i<n;i++){let o=t.getActiveUniform(e,i);if(!o)throw new Error("activeInfo");let{name:s,size:c,type:l}=o,{name:h,isArray:p}=xme(s),x=t.getUniformLocation(e,h),w={location:x,name:h,size:c,type:l,isArray:p};if(r.push(w),w.size>1)for(let E=0;E<w.size;E++){let C=`${h}[${E}]`;x=t.getUniformLocation(e,C);let B={...w,name:C,location:x};r.push(B)}}return r}function gme(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),n=[],i=t.getProgramParameter(e,35382);for(let o=0;o<i;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},c=r(o,35395)||[],l=t.getActiveUniforms(e,c,35383),h=t.getActiveUniforms(e,c,35384),p=t.getActiveUniforms(e,c,35387),x=t.getActiveUniforms(e,c,35388);for(let w=0;w<s.uniformCount;++w){let E=t.getActiveUniform(e,c[w]);if(!E)throw new Error("activeInfo");s.uniforms.push({name:E.name,format:jO(l[w]).format,type:l[w],arrayLength:h[w],byteOffset:p[w],byteStride:x[w]})}n.push(s)}return n.sort((o,s)=>o.location-s.location),n}var _me={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function yme(t){let e=_me[t];if(!e)throw new Error("sampler");let[r,n]=e;return{viewDimension:r,sampleType:n}}function xme(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function P7(t,e,r,n){let i=t,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,n);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return i.uniform1uiv(e,s,1);case 36294:return i.uniform2uiv(e,s,2);case 36295:return i.uniform3uiv(e,s,3);case 36296:return i.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return i.uniformMatrix2x3fv(e,!1,s);case 35686:return i.uniformMatrix2x4fv(e,!1,s);case 35687:return i.uniformMatrix3x2fv(e,!1,s);case 35688:return i.uniformMatrix3x4fv(e,!1,s);case 35689:return i.uniformMatrix4x2fv(e,!1,s);case 35690:return i.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function I7(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function R7(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number":!1}function Nv(t){return I7(t)||R7(t)}function vme(t){return Nv(t)!==null||typeof t=="number"||typeof t=="boolean"}function L7(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let n=t[r];vme(n)?e.uniforms[r]=n:e.bindings[r]=n}),e}function O7(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(t)}}function B7(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(t)}}var D7=4,fM=class extends Mh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:i=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),qt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=C7(this.device.gl,this.handle),qt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=bme(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[n,i]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===n)||this.shaderLayout.bindings.find(s=>s.name===`${n}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");r?.disableWarnings||qt.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${s}`,i)();continue}switch(i||qt.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(i instanceof Ph)&&!(i.buffer instanceof Ph))throw new Error("buffer value");break;case"texture":if(!(i instanceof Ff||i instanceof zf||i instanceof kf))throw new Error("texture value");break;case"sampler":qt.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(o.type)}this.bindings[n]=i}}draw(e){let{renderPass:r,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:c,isInstanced:l=!1,firstVertex:h=0,transformFeedback:p}=e,x=O7(i),w=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return qt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return qt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),p&&p.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let C=r;return m7(this.device,n,C.glParameters,()=>{w&&l?this.device.gl.drawElementsInstanced(x,s||0,E,h,c||0):w?this.device.gl.drawElements(x,s||0,E,h):l?this.device.gl.drawArraysInstanced(x,h,s||0,c||0):this.device.gl.drawArrays(x,h,s||0),p&&p.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=L7(e);Object.keys(r).forEach(n=>{qt.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),qt.time(D7,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),qt.timeEnd(D7,`linkProgram for ${this.id}`)(),qt.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}qt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),qt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(e){switch(e){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break;case"success":break}let r=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${e}: ${r}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(qt.warn(`Binding ${r.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,c=e.getUniformBlockIndex(this.handle,s);if(c===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,n,c),o instanceof Ph?e.bindBufferBase(35345,n,o.handle):e.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof Ff||o instanceof zf||o instanceof kf))throw new Error("texture");let l;if(o instanceof Ff)l=o.texture;else if(o instanceof zf)l=o;else if(o instanceof kf&&o.colorAttachments[0]instanceof Ff)qt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(l.glTarget,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:i,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&P7(this.device.gl,n,i,s)}}};function bme(t,e){let r={...t,attributes:t.attributes.map(n=>({...n}))};for(let n of e?.attributes||[]){let i=r.attributes.find(o=>o.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):qt.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var pM=class extends I_{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":wme(this.device,r.options);break;case"copy-buffer-to-texture":Tme(this.device,r.options);break;case"copy-texture-to-buffer":Eme(this.device,r.options);break;case"copy-texture-to-texture":Mme(this.device,r.options);break;default:throw new Error(r.name)}}};function wme(t,e){let r=e.sourceBuffer,n=e.destinationBuffer;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,n.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function Tme(t,e){throw new Error("Not implemented")}function Eme(t,e){let{sourceTexture:r,mipLevel:n=0,aspect:i="all",width:o=e.sourceTexture.width,height:s=e.sourceTexture.height,depthOrArrayLayers:c=0,origin:l=[0,0],destinationBuffer:h,byteOffset:p=0,bytesPerRow:x,rowsPerImage:w}=e;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||c!==0||x||w)throw new Error("not implemented");let{framebuffer:E,destroyFramebuffer:C}=N7(r),B;try{let D=h,W=o||E.width,X=s||E.height,q=tM(E.colorAttachments[0].texture.props.format),$=q.format,te=q.type;t.gl.bindBuffer(35051,D.handle),B=t.gl.bindFramebuffer(36160,E.handle),t.gl.readPixels(l[0],l[1],W,X,$,te,p)}finally{t.gl.bindBuffer(35051,null),B!==void 0&&t.gl.bindFramebuffer(36160,B),C&&E.destroy()}}function Mme(t,e){let{sourceTexture:r,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:o=[0,0],destinationTexture:s}=e,{width:c=e.destinationTexture.width,height:l=e.destinationTexture.height}=e,{framebuffer:h,destroyFramebuffer:p}=N7(r),[x,w]=i,[E,C,B]=o,D=t.gl.bindFramebuffer(36160,h.handle),W=null,X;if(s instanceof zf)W=s,c=Number.isFinite(c)?c:W.width,l=Number.isFinite(l)?l:W.height,W.bind(0),X=W.glTarget;else throw new Error("invalid destination");switch(X){case 3553:case 34067:t.gl.copyTexSubImage2D(X,n,E,C,x,w,c,l);break;case 35866:case 32879:t.gl.copyTexSubImage3D(X,n,E,C,B,x,w,c,l);break;default:}W&&W.unbind(),t.gl.bindFramebuffer(36160,D),p&&h.destroy()}function N7(t){if(t instanceof fi){let{width:e,height:r,id:n}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var dM=class extends P_{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new pM(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,n){}};function k7(t){let{target:e,source:r,start:n=0,count:i=1}=t,o=r.length,s=i*o,c=0;for(let l=n;c<o;c++)e[l++]=r[c];for(;c<s;)c<s-c?(e.copyWithin(n+c,n,n+c),c*=2):(e.copyWithin(n+c,n,n+s-c),c=s);return t.target}var k_=class extends R_{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return RL()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:c,normalized:l,integer:h,divisor:p}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),h?this.device.gl.vertexAttribIPointer(e,i,o,s,c):this.device.gl.vertexAttribPointer(e,i,o,l,s,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,p||0),this.attributes[e]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let n=JE(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let i=k_.isConstantAttributeZeroSupported(this.device)||e!==0;(r||i)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let n=Sme(r),i=n.byteLength*e,o=n.length*e;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!Cme(n,this.bufferValue),s){let c=PO(r.constructor,o);k7({target:c,source:n,start:0,count:o}),this.buffer.write(c),this.bufferValue=r}return this.buffer}};function Sme(t){return Array.isArray(t)?new Float32Array(t):t}function Cme(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var mM=class extends L_{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(B7(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let n=this._getVaryingIndex(e),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[e]=i,qt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(e){if(F7(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Ph)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=e.buffer.byteLength}=e;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(e){if(F7(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,i,n)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,n=0,i){let o=r&&r.handle;!o||i===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,n,i)}};function F7(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var AM=class extends O_{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,i)=>{let o=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>e?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};var Fc=class extends hl{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(e){super({...e,id:e.id||h7("webgl-device")});let r=hl._getCanvasContextProps(e);if(!r)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=r.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new iM(this,r),this.lost=new Promise(p=>{this._resolveContextLost=p});let i={...e.webgl};r.alphaMode==="premultiplied"&&(i.premultipliedAlpha=!0),e.powerPreference!==void 0&&(i.powerPreference=e.powerPreference);let s=this.props._handle||Y9(this.canvasContext.canvas,{onContextLost:p=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:p=>console.log("WebGL context restored")},i);if(!s)throw new Error("WebGL context creation failed");if(n=s.device,n){if(e._reuseDevices)return qt.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=s,this.gl=s,this.spectorJS=s7({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=K9(this.gl,this._extensions),this.limits=new nM(this.gl),this.features=new rM(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),r.autoResize!==!1&&this.canvasContext.resize(),new Ch(this.gl,{log:(...p)=>qt.log(1,...p)()}).trackState(this.gl,{copyState:!1});let l=e.debugWebGL||e.debug,h=e.debugWebGL;l&&(this.gl=u7(this.gl,{debugWebGL:l,traceWebGL:h}),qt.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(qt.level=Math.max(qt.level,1)))}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._normalizeBufferProps(e);return new Ph(this,r)}createTexture(e){return new zf(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new ZA(this,e)}createShader(e){return new aM(this,e)}createFramebuffer(e){return new kf(this,e)}createVertexArray(e){return new k_(this,e)}createTransformFeedback(e){return new mM(this,e)}createQuerySet(e){return new AM(this,e)}createRenderPipeline(e){return new fM(this,e)}beginRenderPass(e){return new hM(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e={}){return new dM(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return b7(e,r)}readPixelsToBufferWebGL(e,r){return w7(e,r)}setParametersWebGL(e){Sh(this.gl,e)}getParametersWebGL(e){return QE(this.gl,e)}withParametersWebGL(e,r){return $A(this.gl,e,r)}resetWebGL(){qt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),q9(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return t7(this.gl,e,this._extensions)}loseDevice(){let e=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Ch.get(this.gl).push()}popState(){Ch.get(this.gl).pop()}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){let n=Number(e);for(let i in this.gl)if(this.gl[i]===n)return`GL.${i}`;return r?.emptyIfUnknown?"":String(e)}getGLKeys(e){let r={emptyIfUnknown:!0};return Object.entries(e).reduce((n,[i,o])=>(n[`${i}:${this.getGLKey(i,r)}`]=`${o}:${this.getGLKey(o,r)}`,n),{})}_constants;setConstantAttributeWebGL(e,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let i=this._constants[e];switch(i&&Lme(i,r)&&qt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:Pme(this,e,r);break;case Int32Array:Ime(this,e,r);break;case Uint32Array:Rme(this,e,r);break;default:throw new Error("constant")}}getExtension(e){return Nf(this.gl,e,this._extensions),this._extensions}};function Pme(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:}}function Ime(t,e,r){t.gl.vertexAttribI4iv(e,r)}function Rme(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function Lme(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var Ome={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},Bme=t=>({drawBuffersWEBGL(e){return t.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),Dme=t=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return t.createVertexArray()},deleteVertexArrayOES(e){return t.deleteVertexArray(e)},isVertexArrayOES(e){return t.isVertexArray(e)},bindVertexArrayOES(e){return t.bindVertexArray(e)}}),Nme=t=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return t.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return t.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return t.vertexAttribDivisor(...e)}});function z7(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(r,n){if(r==="webgl"||r==="experimental-webgl"){let i=this.originalGetContext("webgl2",n);return i instanceof HTMLElement&&kme(i),i}return this.originalGetContext(r,n)}}function kme(t){t.getExtension("EXT_color_buffer_float");let e={...Ome,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:Bme(t),OES_vertex_array_object:Dme(t),ANGLE_instanced_arrays:Nme(t)},r=t.getExtension;t.getExtension=function(i){let o=r.call(t,i);return o||(i in e?e[i]:null)};let n=t.getSupportedExtensions;t.getSupportedExtensions=function(){return(n.apply(t)||[])?.concat(Object.keys(e))}}var gM=1,HO=class extends Pv{type="webgl";constructor(){super(),hl.defaultProps={...hl.defaultProps,...sM},Fc.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(e){z7(e)}async attach(e){if(e instanceof Fc)return e;if(e?.device instanceof hl)return e.device;if(!Fme(e))throw new Error("Invalid WebGL2RenderingContext");return new Fc({_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1}})}async create(e={}){qt.groupCollapsed(gM,"WebGLDevice created")();let r=[];(e.debugWebGL||e.debug)&&r.push(l7()),e.debugSpectorJS&&r.push(o7(e));let n=await Promise.allSettled(r);for(let s of n)s.status==="rejected"&&qt.error(`Failed to initialize debug libraries ${s.reason}`)();let i=new Fc(e),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return qt.probe(gM,o)(),qt.table(gM,i.info)(),qt.groupEnd(gM)(),i}};function Fme(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}var _M=new HO;var U7,V7,H7={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function yM(){return document.createElement("div")}function zme(t){if(!t.picked)return null;if(t.object===U7)return V7;let e={html:Vme(t.object),style:H7};return V7=e,U7=t.object,e}var Ume=new Set(["position","index"]);function Vme(t){let e=yM();for(let r in t){if(Ume.has(r))continue;let n=yM();n.className="header",n.textContent=r;let i=yM();i.className="value",i.textContent=Hme(t[r]);let o=yM();jme(o,n,i),o.appendChild(n),o.appendChild(i),e.appendChild(o)}return e.innerHTML}function jme(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Hme(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function j7(t,e){let r,n=t,i="properties",o=/{[^}]*}/g,s=l=>l.replace(/[{}]/g,""),c=[...new Set(t.match(o).map(s))];for(let l of c){if(l.includes(".")){r=e;let h=l.split(".");for(let p of h)if(r.hasOwnProperty(p))r=r[p];else{r=void 0;break}}else e.hasOwnProperty(l)?r=e[l]:e[i]&&e[i].hasOwnProperty(l)?r=e[i][l]:r=void 0;n=n.replaceAll(`{${l}}`,r)}return n}function WO(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||H7};return t.html?r.html=j7(t.html,e.object):r.text=j7(t.text,e.object),r}:zme:null}function W7(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function q7(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var X7=tc(G7()),Wme="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",XO=X7.default;function Y7(t=Wme){W7(t)}function K7(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var YO={};function Z7(t){if(!YO[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),YO[t]=new Promise(n=>{e.onload=n})}return YO[t]}var $7="4.2.1";var qme=globalThis.loaders?.parseImageNode,KO=typeof Image<"u",ZO=typeof ImageBitmap<"u",Gme=Boolean(qme),$O=Fp?!0:Gme;function Q7(t){switch(t){case"auto":return ZO||KO||$O;case"imagebitmap":return ZO;case"image":return KO;case"data":return $O;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function J7(){if(ZO)return"imagebitmap";if(KO)return"image";if($O)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function ej(t){let e=Xme(t);if(!e)throw new Error("Not an image");return e}function kv(t){switch(ej(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Xme(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Yme=/^data:image\/svg\+xml/,Kme=/\.svg((\?|#).*)?$/;function xM(t){return t&&(Yme.test(t)||Kme.test(t))}function tj(t,e){if(xM(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return QO(t,e)}function QO(t,e){if(xM(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function vM(t,e,r){let n=tj(t,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Zme(o||n,e)}finally{o&&i.revokeObjectURL(o)}}async function Zme(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var $me={},rj=!0;async function nj(t,e,r){let n;xM(r)?n=await vM(t,e,r):n=QO(t,r);let i=e&&e.imagebitmap;return await Qme(n,i)}async function Qme(t,e=null){if((Jme(e)||!rj)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),rj=!1}return await createImageBitmap(t)}function Jme(t){for(let e in t||$me)return!1;return!0}function ij(t){return!nAe(t,"ftyp",4)||!(t[8]&96)?null:eAe(t)}function eAe(t){switch(tAe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function tAe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function rAe(t){return[...t].map(e=>e.charCodeAt(0))}function nAe(t,e,r=0){let n=rAe(e);for(let i=0;i<n.length;++i)if(n[i]!==t[i+r])return!1;return!0}var Uf=!1,Fv=!0;function QA(t){let e=zv(t);return oAe(e)||cAe(e)||sAe(e)||aAe(e)||iAe(e)}function iAe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=ij(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function oAe(t){let e=zv(t);return e.byteLength>=24&&e.getUint32(0,Uf)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Uf),height:e.getUint32(20,Uf)}:null}function sAe(t){let e=zv(t);return e.byteLength>=10&&e.getUint32(0,Uf)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Fv),height:e.getUint16(8,Fv)}:null}function aAe(t){let e=zv(t);return e.byteLength>=14&&e.getUint16(0,Uf)===16973&&e.getUint32(2,Fv)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Fv),height:e.getUint32(22,Fv)}:null}function cAe(t){let e=zv(t);if(!(e.byteLength>=3&&e.getUint16(0,Uf)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=lAe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Uf);if(i.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Uf),width:e.getUint16(o+7,Uf)};if(!n.has(s))return null;o+=2,o+=e.getUint16(o,Uf)}return null}function lAe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function zv(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function oj(t,e){let{mimeType:r}=QA(t)||{},n=globalThis.loaders?.parseImageNode;return Ti(n),await n(t,r)}async function sj(t,e,r){e=e||{};let i=(e.image||{}).type||"auto",{url:o}=r||{},s=uAe(i),c;switch(s){case"imagebitmap":c=await nj(t,e,o);break;case"image":c=await vM(t,e,o);break;case"data":c=await oj(t,e);break;default:Ti(!1)}return i==="data"&&(c=kv(c)),c}function uAe(t){switch(t){case"auto":case"data":return J7();default:return Q7(t),t}}var hAe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],fAe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pAe={image:{type:"auto",decode:!0}},Vf={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:$7,mimeTypes:fAe,extensions:hAe,parse:sj,tests:[t=>Boolean(QA(new DataView(t)))],options:pAe};var JO={};function eB(t){if(JO[t]===void 0){let e=Fp?mAe(t):dAe(t);JO[t]=e}return JO[t]}function dAe(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(t)}function mAe(t){switch(t){case"image/avif":case"image/webp":return AAe(t);default:return!0}}function AAe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var gAe=new Dl({id:"deck"}),br=gAe;var tB={};function aj(t){tB=t}function Gs(t,e,r,n){br.level>0&&tB[t]&&tB[t].call(null,e,r,n)}function _Ae(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var cj={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:_Ae,parseTextSync:JSON.parse};function yAe(){let t="9.1.11",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(br.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:br,_registerLoggers:aj},qA([cj,[Vf,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var bM=yAe();function wM(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var rB={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function uj(t){let e={};for(let[r,n]of Object.entries(t))e[r]=xAe(n);return e}function xAe(t){let e=lj(t);if(e!=="object")return{value:t,...rB[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...rB[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=lj(t.value),{...t,...rB[e],type:e}):{type:"object",value:null};throw new Error("props")}function lj(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var hj=`#ifdef MODULE_LOGDEPTH
|
|
551
|
+
${e}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,e),r.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}qt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),qt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};function m7(t,e,r,n){if(sme(e))return n(t);let i=t;i.pushState();try{return nme(t,e),Sh(i.gl,r),n(t)}finally{i.popState()}}function nme(t,e){let r=t,{gl:n}=r;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(KA("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=KA("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=KA("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&n.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(ome("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(lM("depthCompare",e.depthCompare))),e.stencilWriteMask){let i=e.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(e.stencilReadMask&&qt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let i=e.stencilReadMask||4294967295,o=lM("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let i=NO("stencilPassOperation",e.stencilPassOperation),o=NO("stencilFailOperation",e.stencilFailOperation),s=NO("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(e.blendColorOperation||e.blendAlphaOperation){let i=d7("blendColorOperation",e.blendColorOperation||"add"),o=d7("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=cM("blendColorSrcFactor",e.blendColorSrcFactor||"one"),c=cM("blendColorDstFactor",e.blendColorDstFactor||"zero"),l=cM("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=cM("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,c,l,h)}}function lM(t,e){return KA(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function NO(t,e){return KA(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function d7(t,e){return KA(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function cM(t,e){return KA(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function ime(t,e){return`Illegal parameter ${e} for ${t}`}function KA(t,e,r){if(!(e in r))throw new Error(ime(t,e));return r[e]}function ome(t,e){return e}function sme(t){let e=!0;for(let r in t){e=!1;break}return e}function uM(t){let e={};return t.addressModeU&&(e[10242]=kO(t.addressModeU)),t.addressModeV&&(e[10243]=kO(t.addressModeV)),t.addressModeW&&(e[32882]=kO(t.addressModeW)),t.magFilter&&(e[10240]=FO(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=ame(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=lM("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function kO(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function FO(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function ame(t,e="none"){if(!e)return FO(t);switch(e){case"none":return FO(t);case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var ZA=class extends om{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=uM(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,n]of Object.entries(e)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,i,n);break;default:this.device.gl.samplerParameteri(this.handle,i,n);break}}}};var Ff=class extends nm{device;gl;handle;texture;constructor(e,r){super(e,{...fi.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var cme="Failed to deduce GL constant from typed array";function A7(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(cme)}}function g7(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function zO(t){switch(t){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function _7(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function $A(t,e,r){if(lme(e))return r(t);let{nocatch:n=!0}=e,i=Ch.get(t);i.push(),Sh(t,e);let o;if(n)o=r(t),i.pop();else try{o=r(t)}finally{i.pop()}return o}function lme(t){for(let e in t)return!1;return!0}function y7(t,e,r){let{dimension:n,width:i,height:o,depth:s=0}=r,{glInternalFormat:c}=r,l=r.glTarget;switch(n){case"2d-array":case"3d":t.texStorage3D(l,e,c,i,o,s);break;default:t.texStorage2D(l,e,c,i,o)}}function UO(t,e,r,n){let{width:i,height:o}=n,{dimension:s,depth:c=0,mipLevel:l=0}=n,{x:h=0,y:p=0,z:x=0}=n,{glFormat:w,glType:E}=n,C=v7(n.glTarget,s,c),B=n.flipY?{[37440]:!0}:{};$A(t,B,()=>{switch(s){case"2d-array":case"3d":t.bindTexture(C,e),t.texSubImage3D(C,l,h,p,x,i,o,c,w,E,r),t.bindTexture(C,null);break;case"2d":case"cube":t.bindTexture(C,e),t.texSubImage2D(C,l,h,p,i,o,w,E,r),t.bindTexture(C,null);break;default:throw new Error(s)}})}function VO(t,e,r){let{dimension:n,width:i,height:o,depth:s=0,mipLevel:c=0,byteOffset:l=0}=r,{x:h=0,y:p=0,z:x=0}=r,{glFormat:w,glType:E,compressed:C}=r,B=v7(r.glTarget,n,s);switch(n){case"2d-array":case"3d":C?t.compressedTexSubImage3D(B,c,h,p,x,i,o,s,w,e,l):t.texSubImage3D(B,c,h,p,x,i,o,s,w,E,e,l);break;case"2d":case"cube":C?t.compressedTexSubImage2D(B,c,h,p,i,o,w,e,l):t.texSubImage2D(B,c,h,p,i,o,w,E,e,l);break;default:throw new Error(n)}}function x7(t){switch(t){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866;case"cube-array":break}throw new Error(t)}function v7(t,e,r){return e==="cube"?34069+r:t}function b7(t,e){let{sourceX:r=0,sourceY:n=0,sourceAttachment:i=0}=e||{},{target:o=null,sourceWidth:s,sourceHeight:c,sourceDepth:l,sourceFormat:h,sourceType:p}=e||{},{framebuffer:x,deleteFramebuffer:w}=T7(t),{gl:E,handle:C}=x;s||=x.width,c||=x.height;let B=x.colorAttachments[i]?.texture;if(!B)throw new Error(`Invalid framebuffer attachment ${i}`);l=B?.depth||1,h||=B?.glFormat||6408,p||=B?.glType||5121,o=hme(o,p,h,s,c,l),p=p||A7(o);let D=E.bindFramebuffer(36160,C);return E.readBuffer(36064+i),E.readPixels(r,n,s,c,h,p,o),E.readBuffer(36064),E.bindFramebuffer(36160,D||null),w&&x.destroy(),o}function w7(t,e){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:c,sourceHeight:l,sourceType:h}=e||{},{framebuffer:p,deleteFramebuffer:x}=T7(t);c=c||p.width,l=l||p.height;let w=p;h=h||5121;let E=r;if(!E){let B=zO(o),D=_7(h),W=s+c*l*B*D;E=w.device.createBuffer({byteLength:W})}let C=t.device.createCommandEncoder();return C.copyTextureToBuffer({sourceTexture:t,width:c,height:l,origin:[n,i],destinationBuffer:E,byteOffset:s}),C.destroy(),x&&p.destroy(),E}function T7(t){return t instanceof Of?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:ume(t),deleteFramebuffer:!0}}function ume(t,e){let{device:r,width:n,height:i,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[t]})}function hme(t,e,r,n,i,o){if(t)return t;e||=5121;let s=g7(e,{clamped:!1}),c=zO(r);return new s(n*i*c)}var zf=class extends fi{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(e,r){super(e,r);let n={...this.props};n.data=r.data,this.device=e,this.gl=this.device.gl,this.glTarget=x7(this.props.dimension);let i=tM(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=Boolean(this.props.mipmaps),this._initialize(n),Object.seal(this)}_initialize(e){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:e.data});let{width:r,height:n}=e;if(!r||!n){let i=fi.getTextureDataSize(e.data);r=i?.width||1,n=i?.height||1}if(this.width=r,this.height=n,this.depth=e.depth,this.setSampler(e.sampler),this.view=new Ff(this.device,{...this.props,texture:this}),this.bind(),y7(this.gl,this.mipLevels,this),e.data)switch(e.dimension){case"1d":this.setTexture1DData(e.data);break;case"2d":this.setTexture2DData(e.data);break;case"3d":this.setTexture3DData(e.data);break;case"cube":this.setTextureCubeData(e.data);break;case"2d-array":this.setTextureArrayData(e.data);break;case"cube-array":this.setTextureCubeArrayData(e.data);break;default:throw new Error(e.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new Ff(this.device,{...e,texture:this})}setSampler(e={}){let r;e instanceof ZA?(this.sampler=e,r=e.props):(this.sampler=new ZA(this.device,e),r=e);let n=uM(r);this._setSamplerParameters(n)}generateMipmap(e){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(qt.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!e?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){qt.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(e){let r=fi.getExternalImageSize(e.image),n={...fi.defaultCopyExternalImageOptions,...r,...e},{image:i,depth:o,mipLevel:s,x:c,y:l,z:h,flipY:p}=n,{width:x,height:w}=n,{dimension:E,glTarget:C,glFormat:B,glInternalFormat:D,glType:W}=this;if(x=Math.min(x,this.width-c),w=Math.min(w,this.height-l),e.sourceX||e.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");return UO(this.device.gl,this.handle,i,{dimension:E,mipLevel:s,x:c,y:l,z:h,width:x,height:w,depth:o,glFormat:B,glInternalFormat:D,glType:W,glTarget:C,flipY:p}),{width:n.width,height:n.height}}setTexture1DData(e){throw new Error("setTexture1DData not supported in WebGL.")}setTexture2DData(e,r=0){this.bind();let n=fi.normalizeTextureData(e,this);n.length>1&&this.props.mipmaps!==!1&&qt.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let i=0;i<n.length;i++){let o=n[i];this._setMipLevel(r,i,o)}this.unbind()}setTexture3DData(e){if(this.props.dimension!=="3d")throw new Error(this.id);ArrayBuffer.isView(e)&&(this.bind(),VO(this.device.gl,e,this),this.unbind())}setTextureCubeData(e,r=0){if(this.props.dimension!=="cube")throw new Error(this.id);for(let n of fi.CubeFaces)this.setTextureCubeFaceData(e[n],n)}setTextureArrayData(e){throw this.props.dimension!=="2d-array"?new Error(this.id):new Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(e){throw new Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(e,r,n=0){Array.isArray(e)&&e.length>1&&this.props.mipmaps!==!1&&qt.warn(`${this.id} has mipmap and multiple LODs.`)();let i=fi.CubeFaces.indexOf(r);this.setTexture2DData(e,i)}update(){throw new Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(e){let{face:r,width:n,height:i,pixels:o,data:s,format:c=6408,type:l=5121}=e,{gl:h}=this,p=o||s;this.bind(),p instanceof Promise?p.then(x=>this.setImageDataForFace(Object.assign({},e,{face:r,data:x,pixels:x}))):this.width||this.height?h.texImage2D(r,0,c,n,i,0,c,l,p):h.texImage2D(r,0,c,c,l,p)}_getImageDataMap(e){for(let r=0;r<fi.CubeFaces.length;++r){let n=fi.CubeFaces[r];e[n]&&(e[34069+r]=e[n],delete e[n])}return e}_setSamplerParameters(e){qt.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(e)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.glTarget,i,o);break;case 10241:this.gl.texParameteri(this.glTarget,i,o);break;case 10242:case 10243:this.gl.texParameteri(this.glTarget,i,o);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,i,o);break;default:this.gl.texParameteri(this.glTarget,i,o);break}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(e,r,n,i=this.glTarget){if(fi.isExternalImage(n)){UO(this.device.gl,this.handle,n,{...this,depth:e,mipLevel:r,glTarget:i,flipY:this.props.flipY});return}if(fi.isTextureLevelData(n)){VO(this.device.gl,n.data,{...this,depth:e,mipLevel:r,glTarget:i});return}throw new Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.glTarget,this.handle),e}unbind(e){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.glTarget,null),e}};var fme=[1,2,4,8],hM=class extends Up{device;glParameters;constructor(e,r){super(e,r),this.device=e;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:o,height:s}=r.framebuffer;n=[0,0,o,s]}else{let[o,s]=e.getCanvasContext().getDrawingBufferSize();n=[0,0,o,s]}if(this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters}),this.props.framebuffer?.handle)if(this.props.framebuffer){let o=this.props.framebuffer.colorAttachments.map((s,c)=>36064+c);this.device.gl.drawBuffers(o)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};r.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=fme.map(n=>Boolean(n&e.colorMask))),this.glParameters=r,Sh(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,i)=>{n&&this.clearColorBuffer(i,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,e.clearStencil=this.props.clearStencil),r!==0&&$A(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){$A(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,e,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}};function E7(t){return pme.includes(t)}var pme=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],M7={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function jO(t){let e=M7[t];if(!e)throw new Error("uniform");let[r,n,,i]=e;return{format:i,components:n,glType:r}}function S7(t){let e=M7[t];if(!e)throw new Error("attribute");let[,r,,n,i]=e;return{attributeType:n,vertexFormat:i,components:r}}function C7(t,e){let r={attributes:[],bindings:[]};r.attributes=dme(t,e);let n=gme(t,e);for(let c of n){let l=c.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:c.name,group:0,location:c.location,visibility:(c.vertex?1:0)&(c.fragment?2:0),minBindingSize:c.byteLength,uniforms:l})}let i=Ame(t,e),o=0;for(let c of i)if(E7(c.type)){let{viewDimension:l,sampleType:h}=yme(c.type);r.bindings.push({type:"texture",name:c.name,group:0,location:o,viewDimension:l,sampleType:h}),c.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=mme(t,e);return s?.length&&(r.varyings=s),r}function dme(t,e){let r=[],n=t.getProgramParameter(e,35721);for(let i=0;i<n;i++){let o=t.getActiveAttrib(e,i);if(!o)throw new Error("activeInfo");let{name:s,type:c}=o,l=t.getAttribLocation(e,s);if(l>=0){let{attributeType:h}=S7(c),p=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:p,type:h})}}return r.sort((i,o)=>i.location-o.location),r}function mme(t,e){let r=[],n=t.getProgramParameter(e,35971);for(let i=0;i<n;i++){let o=t.getTransformFeedbackVarying(e,i);if(!o)throw new Error("activeInfo");let{name:s,type:c,size:l}=o,{glType:h,components:p}=jO(c),x={location:i,name:s,type:h,size:l*p};r.push(x)}return r.sort((i,o)=>i.location-o.location),r}function Ame(t,e){let r=[],n=t.getProgramParameter(e,35718);for(let i=0;i<n;i++){let o=t.getActiveUniform(e,i);if(!o)throw new Error("activeInfo");let{name:s,size:c,type:l}=o,{name:h,isArray:p}=xme(s),x=t.getUniformLocation(e,h),w={location:x,name:h,size:c,type:l,isArray:p};if(r.push(w),w.size>1)for(let E=0;E<w.size;E++){let C=`${h}[${E}]`;x=t.getUniformLocation(e,C);let B={...w,name:C,location:x};r.push(B)}}return r}function gme(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),n=[],i=t.getProgramParameter(e,35382);for(let o=0;o<i;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},c=r(o,35395)||[],l=t.getActiveUniforms(e,c,35383),h=t.getActiveUniforms(e,c,35384),p=t.getActiveUniforms(e,c,35387),x=t.getActiveUniforms(e,c,35388);for(let w=0;w<s.uniformCount;++w){let E=t.getActiveUniform(e,c[w]);if(!E)throw new Error("activeInfo");s.uniforms.push({name:E.name,format:jO(l[w]).format,type:l[w],arrayLength:h[w],byteOffset:p[w],byteStride:x[w]})}n.push(s)}return n.sort((o,s)=>o.location-s.location),n}var _me={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function yme(t){let e=_me[t];if(!e)throw new Error("sampler");let[r,n]=e;return{viewDimension:r,sampleType:n}}function xme(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function P7(t,e,r,n){let i=t,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,n);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return i.uniform1uiv(e,s,1);case 36294:return i.uniform2uiv(e,s,2);case 36295:return i.uniform3uiv(e,s,3);case 36296:return i.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return i.uniformMatrix2x3fv(e,!1,s);case 35686:return i.uniformMatrix2x4fv(e,!1,s);case 35687:return i.uniformMatrix3x2fv(e,!1,s);case 35688:return i.uniformMatrix3x4fv(e,!1,s);case 35689:return i.uniformMatrix4x2fv(e,!1,s);case 35690:return i.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function I7(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function R7(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number":!1}function Nv(t){return I7(t)||R7(t)}function vme(t){return Nv(t)!==null||typeof t=="number"||typeof t=="boolean"}function L7(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let n=t[r];vme(n)?e.uniforms[r]=n:e.bindings[r]=n}),e}function O7(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(t)}}function B7(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(t)}}var D7=4,fM=class extends Mh{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:i=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,i)),this._linkShaders(),qt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=C7(this.device.gl,this.handle),qt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=bme(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[n,i]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===n)||this.shaderLayout.bindings.find(s=>s.name===`${n}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(c=>`"${c.name}"`).join(", ");r?.disableWarnings||qt.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${s}`,i)();continue}switch(i||qt.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(i instanceof Ph)&&!(i.buffer instanceof Ph))throw new Error("buffer value");break;case"texture":if(!(i instanceof Ff||i instanceof zf||i instanceof kf))throw new Error("texture value");break;case"sampler":qt.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(o.type)}this.bindings[n]=i}}draw(e){let{renderPass:r,parameters:n=this.props.parameters,topology:i=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:c,isInstanced:l=!1,firstVertex:h=0,transformFeedback:p}=e,x=O7(i),w=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return qt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return qt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),p&&p.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let C=r;return m7(this.device,n,C.glParameters,()=>{w&&l?this.device.gl.drawElementsInstanced(x,s||0,E,h,c||0):w?this.device.gl.drawElements(x,s||0,E,h):l?this.device.gl.drawArraysInstanced(x,h,s||0,c||0):this.device.gl.drawArrays(x,h,s||0),p&&p.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=L7(e);Object.keys(r).forEach(n=>{qt.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),qt.time(D7,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),qt.timeEnd(D7,`linkProgram for ${this.id}`)(),qt.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}qt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),qt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(e){switch(e){case"success":return;default:switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader());break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader());break;case"success":break}let r=this.device.gl.getProgramInfoLog(this.handle);throw new Error(`Error during ${e}: ${r}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async i=>await new Promise(o=>setTimeout(o,i));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(qt.warn(`Binding ${r.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,c=e.getUniformBlockIndex(this.handle,s);if(c===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,n,c),o instanceof Ph?e.bindBufferBase(35345,n,o.handle):e.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof Ff||o instanceof zf||o instanceof kf))throw new Error("texture");let l;if(o instanceof Ff)l=o.texture;else if(o instanceof zf)l=o;else if(o instanceof kf&&o.colorAttachments[0]instanceof Ff)qt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(l.glTarget,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:i,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&P7(this.device.gl,n,i,s)}}};function bme(t,e){let r={...t,attributes:t.attributes.map(n=>({...n}))};for(let n of e?.attributes||[]){let i=r.attributes.find(o=>o.name===n.name);i?(i.type=n.type||i.type,i.stepMode=n.stepMode||i.stepMode):qt.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var pM=class extends I_{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":wme(this.device,r.options);break;case"copy-buffer-to-texture":Tme(this.device,r.options);break;case"copy-texture-to-buffer":Eme(this.device,r.options);break;case"copy-texture-to-texture":Mme(this.device,r.options);break;default:throw new Error(r.name)}}};function wme(t,e){let r=e.sourceBuffer,n=e.destinationBuffer;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,n.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function Tme(t,e){throw new Error("Not implemented")}function Eme(t,e){let{sourceTexture:r,mipLevel:n=0,aspect:i="all",width:o=e.sourceTexture.width,height:s=e.sourceTexture.height,depthOrArrayLayers:c=0,origin:l=[0,0],destinationBuffer:h,byteOffset:p=0,bytesPerRow:x,rowsPerImage:w}=e;if(i!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||c!==0||x||w)throw new Error("not implemented");let{framebuffer:E,destroyFramebuffer:C}=N7(r),B;try{let D=h,W=o||E.width,X=s||E.height,q=tM(E.colorAttachments[0].texture.props.format),$=q.format,te=q.type;t.gl.bindBuffer(35051,D.handle),B=t.gl.bindFramebuffer(36160,E.handle),t.gl.readPixels(l[0],l[1],W,X,$,te,p)}finally{t.gl.bindBuffer(35051,null),B!==void 0&&t.gl.bindFramebuffer(36160,B),C&&E.destroy()}}function Mme(t,e){let{sourceTexture:r,destinationMipLevel:n=0,origin:i=[0,0],destinationOrigin:o=[0,0],destinationTexture:s}=e,{width:c=e.destinationTexture.width,height:l=e.destinationTexture.height}=e,{framebuffer:h,destroyFramebuffer:p}=N7(r),[x,w]=i,[E,C,B]=o,D=t.gl.bindFramebuffer(36160,h.handle),W=null,X;if(s instanceof zf)W=s,c=Number.isFinite(c)?c:W.width,l=Number.isFinite(l)?l:W.height,W.bind(0),X=W.glTarget;else throw new Error("invalid destination");switch(X){case 3553:case 34067:t.gl.copyTexSubImage2D(X,n,E,C,x,w,c,l);break;case 35866:case 32879:t.gl.copyTexSubImage3D(X,n,E,C,B,x,w,c,l);break;default:}W&&W.unbind(),t.gl.bindFramebuffer(36160,D),p&&h.destroy()}function N7(t){if(t instanceof fi){let{width:e,height:r,id:n}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var dM=class extends P_{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new pM(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,n){}};function k7(t){let{target:e,source:r,start:n=0,count:i=1}=t,o=r.length,s=i*o,c=0;for(let l=n;c<o;c++)e[l++]=r[c];for(;c<s;)c<s-c?(e.copyWithin(n+c,n,n+c),c*=2):(e.copyWithin(n+c,n,n+s-c),c=s);return t.target}var k_=class extends R_{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return RL()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:c,normalized:l,integer:h,divisor:p}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),h?this.device.gl.vertexAttribIPointer(e,i,o,s,c):this.device.gl.vertexAttribPointer(e,i,o,l,s,c),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,p||0),this.attributes[e]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let n=JE(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let i=k_.isConstantAttributeZeroSupported(this.device)||e!==0;(r||i)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let n=Sme(r),i=n.byteLength*e,o=n.length*e;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!Cme(n,this.bufferValue),s){let c=PO(r.constructor,o);k7({target:c,source:n,start:0,count:o}),this.buffer.write(c),this.bufferValue=r}return this.buffer}};function Sme(t){return Array.isArray(t)?new Float32Array(t):t}function Cme(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var mM=class extends L_{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(B7(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let n=this._getVaryingIndex(e),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[e]=i,qt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(e){if(F7(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Ph)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=e.buffer.byteLength}=e;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(e){if(F7(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,i,n)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,n=0,i){let o=r&&r.handle;!o||i===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,n,i)}};function F7(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var AM=class extends O_{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,i)=>{let o=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>e?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};var Fc=class extends hl{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(e){super({...e,id:e.id||h7("webgl-device")});let r=hl._getCanvasContextProps(e);if(!r)throw new Error("WebGLDevice requires props.createCanvasContext to be set");let n=r.canvas?.gl?.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new iM(this,r),this.lost=new Promise(p=>{this._resolveContextLost=p});let i={...e.webgl};r.alphaMode==="premultiplied"&&(i.premultipliedAlpha=!0),e.powerPreference!==void 0&&(i.powerPreference=e.powerPreference);let s=this.props._handle||Y9(this.canvasContext.canvas,{onContextLost:p=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:p=>console.log("WebGL context restored")},i);if(!s)throw new Error("WebGL context creation failed");if(n=s.device,n){if(e._reuseDevices)return qt.log(1,`Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`,n)(),n._reused=!0,n;throw new Error(`WebGL context already attached to device ${n.id}`)}this.handle=s,this.gl=s,this.spectorJS=s7({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=K9(this.gl,this._extensions),this.limits=new nM(this.gl),this.features=new rM(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),r.autoResize!==!1&&this.canvasContext.resize(),new Ch(this.gl,{log:(...p)=>qt.log(1,...p)()}).trackState(this.gl,{copyState:!1});let l=e.debugWebGL||e.debug,h=e.debugWebGL;l&&(this.gl=u7(this.gl,{debugWebGL:l,traceWebGL:h}),qt.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(qt.level=Math.max(qt.level,1)))}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._normalizeBufferProps(e);return new Ph(this,r)}createTexture(e){return new zf(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new ZA(this,e)}createShader(e){return new aM(this,e)}createFramebuffer(e){return new kf(this,e)}createVertexArray(e){return new k_(this,e)}createTransformFeedback(e){return new mM(this,e)}createQuerySet(e){return new AM(this,e)}createRenderPipeline(e){return new fM(this,e)}beginRenderPass(e){return new hM(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e={}){return new dM(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return b7(e,r)}readPixelsToBufferWebGL(e,r){return w7(e,r)}setParametersWebGL(e){Sh(this.gl,e)}getParametersWebGL(e){return QE(this.gl,e)}withParametersWebGL(e,r){return $A(this.gl,e,r)}resetWebGL(){qt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),q9(this.gl)}_getDeviceSpecificTextureFormatCapabilities(e){return t7(this.gl,e,this._extensions)}loseDevice(){let e=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(e=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Ch.get(this.gl).push()}popState(){Ch.get(this.gl).pop()}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){let n=Number(e);for(let i in this.gl)if(this.gl[i]===n)return`GL.${i}`;return r?.emptyIfUnknown?"":String(e)}getGLKeys(e){let r={emptyIfUnknown:!0};return Object.entries(e).reduce((n,[i,o])=>(n[`${i}:${this.getGLKey(i,r)}`]=`${o}:${this.getGLKey(o,r)}`,n),{})}_constants;setConstantAttributeWebGL(e,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let i=this._constants[e];switch(i&&Lme(i,r)&&qt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:Pme(this,e,r);break;case Int32Array:Ime(this,e,r);break;case Uint32Array:Rme(this,e,r);break;default:throw new Error("constant")}}getExtension(e){return Nf(this.gl,e,this._extensions),this._extensions}};function Pme(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:}}function Ime(t,e,r){t.gl.vertexAttribI4iv(e,r)}function Rme(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function Lme(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var Ome={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},Bme=t=>({drawBuffersWEBGL(e){return t.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),Dme=t=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return t.createVertexArray()},deleteVertexArrayOES(e){return t.deleteVertexArray(e)},isVertexArrayOES(e){return t.isVertexArray(e)},bindVertexArrayOES(e){return t.bindVertexArray(e)}}),Nme=t=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return t.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return t.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return t.vertexAttribDivisor(...e)}});function z7(t=!0){let e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(r,n){if(r==="webgl"||r==="experimental-webgl"){let i=this.originalGetContext("webgl2",n);return i instanceof HTMLElement&&kme(i),i}return this.originalGetContext(r,n)}}function kme(t){t.getExtension("EXT_color_buffer_float");let e={...Ome,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:Bme(t),OES_vertex_array_object:Dme(t),ANGLE_instanced_arrays:Nme(t)},r=t.getExtension;t.getExtension=function(i){let o=r.call(t,i);return o||(i in e?e[i]:null)};let n=t.getSupportedExtensions;t.getSupportedExtensions=function(){return(n.apply(t)||[])?.concat(Object.keys(e))}}var gM=1,HO=class extends Pv{type="webgl";constructor(){super(),hl.defaultProps={...hl.defaultProps,...sM},Fc.adapter=this}isSupported(){return typeof WebGL2RenderingContext<"u"}enforceWebGL2(e){z7(e)}async attach(e){if(e instanceof Fc)return e;if(e?.device instanceof hl)return e.device;if(!Fme(e))throw new Error("Invalid WebGL2RenderingContext");return new Fc({_handle:e,createCanvasContext:{canvas:e.canvas,autoResize:!1}})}async create(e={}){qt.groupCollapsed(gM,"WebGLDevice created")();let r=[];(e.debugWebGL||e.debug)&&r.push(l7()),e.debugSpectorJS&&r.push(o7(e));let n=await Promise.allSettled(r);for(let s of n)s.status==="rejected"&&qt.error(`Failed to initialize debug libraries ${s.reason}`)();let i=new Fc(e),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return qt.probe(gM,o)(),qt.table(gM,i.info)(),qt.groupEnd(gM)(),i}};function Fme(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}var _M=new HO;var U7,V7,H7={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function yM(){return document.createElement("div")}function zme(t){if(!t.picked)return null;if(t.object===U7)return V7;let e={html:Vme(t.object),style:H7};return V7=e,U7=t.object,e}var Ume=new Set(["position","index"]);function Vme(t){let e=yM();for(let r in t){if(Ume.has(r))continue;let n=yM();n.className="header",n.textContent=r;let i=yM();i.className="value",i.textContent=Hme(t[r]);let o=yM();jme(o,n,i),o.appendChild(n),o.appendChild(i),e.appendChild(o)}return e.innerHTML}function jme(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Hme(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function j7(t,e){let r,n=t,i="properties",o=/{[^}]*}/g,s=l=>l.replace(/[{}]/g,""),c=[...new Set(t.match(o).map(s))];for(let l of c){if(l.includes(".")){r=e;let h=l.split(".");for(let p of h)if(r.hasOwnProperty(p))r=r[p];else{r=void 0;break}}else e.hasOwnProperty(l)?r=e[l]:e[i]&&e[i].hasOwnProperty(l)?r=e[i][l]:r=void 0;n=n.replaceAll(`{${l}}`,r)}return n}function WO(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||H7};return t.html?r.html=j7(t.html,e.object):r.text=j7(t.text,e.object),r}:zme:null}function W7(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function q7(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var X7=tc(G7()),Wme="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",XO=X7.default;function Y7(t=Wme){W7(t)}function K7(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var YO={};function Z7(t){if(!YO[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),YO[t]=new Promise(n=>{e.onload=n})}return YO[t]}var $7="4.2.1";var qme=globalThis.loaders?.parseImageNode,KO=typeof Image<"u",ZO=typeof ImageBitmap<"u",Gme=Boolean(qme),$O=Fp?!0:Gme;function Q7(t){switch(t){case"auto":return ZO||KO||$O;case"imagebitmap":return ZO;case"image":return KO;case"data":return $O;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function J7(){if(ZO)return"imagebitmap";if(KO)return"image";if($O)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function ej(t){let e=Xme(t);if(!e)throw new Error("Not an image");return e}function kv(t){switch(ej(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Xme(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Yme=/^data:image\/svg\+xml/,Kme=/\.svg((\?|#).*)?$/;function xM(t){return t&&(Yme.test(t)||Kme.test(t))}function tj(t,e){if(xM(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return QO(t,e)}function QO(t,e){if(xM(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function vM(t,e,r){let n=tj(t,r),i=self.URL||self.webkitURL,o=typeof n!="string"&&i.createObjectURL(n);try{return await Zme(o||n,e)}finally{o&&i.revokeObjectURL(o)}}async function Zme(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,i)=>{try{r.onload=()=>n(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";i(new Error(s))}}catch(o){i(o)}})}var $me={},rj=!0;async function nj(t,e,r){let n;xM(r)?n=await vM(t,e,r):n=QO(t,r);let i=e&&e.imagebitmap;return await Qme(n,i)}async function Qme(t,e=null){if((Jme(e)||!rj)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),rj=!1}return await createImageBitmap(t)}function Jme(t){for(let e in t||$me)return!1;return!0}function ij(t){return!nAe(t,"ftyp",4)||!(t[8]&96)?null:eAe(t)}function eAe(t){switch(tAe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function tAe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function rAe(t){return[...t].map(e=>e.charCodeAt(0))}function nAe(t,e,r=0){let n=rAe(e);for(let i=0;i<n.length;++i)if(n[i]!==t[i+r])return!1;return!0}var Uf=!1,Fv=!0;function QA(t){let e=zv(t);return oAe(e)||cAe(e)||sAe(e)||aAe(e)||iAe(e)}function iAe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=ij(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function oAe(t){let e=zv(t);return e.byteLength>=24&&e.getUint32(0,Uf)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Uf),height:e.getUint32(20,Uf)}:null}function sAe(t){let e=zv(t);return e.byteLength>=10&&e.getUint32(0,Uf)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,Fv),height:e.getUint16(8,Fv)}:null}function aAe(t){let e=zv(t);return e.byteLength>=14&&e.getUint16(0,Uf)===16973&&e.getUint32(2,Fv)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,Fv),height:e.getUint32(22,Fv)}:null}function cAe(t){let e=zv(t);if(!(e.byteLength>=3&&e.getUint16(0,Uf)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:i}=lAe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Uf);if(i.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Uf),width:e.getUint16(o+7,Uf)};if(!n.has(s))return null;o+=2,o+=e.getUint16(o,Uf)}return null}function lAe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function zv(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function oj(t,e){let{mimeType:r}=QA(t)||{},n=globalThis.loaders?.parseImageNode;return Ti(n),await n(t,r)}async function sj(t,e,r){e=e||{};let i=(e.image||{}).type||"auto",{url:o}=r||{},s=uAe(i),c;switch(s){case"imagebitmap":c=await nj(t,e,o);break;case"image":c=await vM(t,e,o);break;case"data":c=await oj(t,e);break;default:Ti(!1)}return i==="data"&&(c=kv(c)),c}function uAe(t){switch(t){case"auto":case"data":return J7();default:return Q7(t),t}}var hAe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],fAe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],pAe={image:{type:"auto",decode:!0}},Vf={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:$7,mimeTypes:fAe,extensions:hAe,parse:sj,tests:[t=>Boolean(QA(new DataView(t)))],options:pAe};var JO={};function eB(t){if(JO[t]===void 0){let e=Fp?mAe(t):dAe(t);JO[t]=e}return JO[t]}function dAe(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(t)}function mAe(t){switch(t){case"image/avif":case"image/webp":return AAe(t);default:return!0}}function AAe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var gAe=new Dl({id:"deck"}),br=gAe;var tB={};function aj(t){tB=t}function Gs(t,e,r,n){br.level>0&&tB[t]&&tB[t].call(null,e,r,n)}function _Ae(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var cj={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:_Ae,parseTextSync:JSON.parse};function yAe(){let t="9.1.13",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(br.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:br,_registerLoggers:aj},qA([cj,[Vf,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var bM=yAe();function wM(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var rB={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function uj(t){let e={};for(let[r,n]of Object.entries(t))e[r]=xAe(n);return e}function xAe(t){let e=lj(t);if(e!=="object")return{value:t,...rB[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...rB[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=lj(t.value),{...t,...rB[e],type:e}):{type:"object",value:null};throw new Error("props")}function lj(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var hj=`#ifdef MODULE_LOGDEPTH
|
|
552
552
|
logdepth_adjustPosition(gl_Position);
|
|
553
553
|
#endif
|
|
554
554
|
`,fj=`#ifdef MODULE_MATERIAL
|
|
@@ -1952,7 +1952,7 @@ struct FragmentGeometry {
|
|
|
1952
1952
|
float smoothedge(float edge, float x) {
|
|
1953
1953
|
return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
|
|
1954
1954
|
}
|
|
1955
|
-
`,aS={name:"geometry",source:G_e,vs:X_e,fs:Y_e};var Ao;(function(t){t[t.Start=1]="Start",t[t.Move=2]="Move",t[t.End=4]="End",t[t.Cancel=8]="Cancel"})(Ao||(Ao={}));var hs;(function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=4]="Up",t[t.Down=8]="Down",t[t.Horizontal=3]="Horizontal",t[t.Vertical=12]="Vertical",t[t.All=15]="All"})(hs||(hs={}));var Mn;(function(t){t[t.Possible=1]="Possible",t[t.Began=2]="Began",t[t.Changed=4]="Changed",t[t.Ended=8]="Ended",t[t.Recognized=8]="Recognized",t[t.Cancelled=16]="Cancelled",t[t.Failed=32]="Failed"})(Mn||(Mn={}));var KH="compute",V4="auto",n2="manipulation",o0="none",i2="pan-x",o2="pan-y";function j4(t){if(t.includes(o0))return o0;let e=t.includes(i2),r=t.includes(o2);return e&&r?o0:e||r?e?i2:o2:t.includes(n2)?n2:V4}var s2=class{constructor(e,r){this.actions="",this.manager=e,this.set(r)}set(e){e===KH&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(let r of this.manager.recognizers)r.options.enable&&(e=e.concat(r.getTouchAction()));return j4(e.join(" "))}};function Q_(t){return t.trim().split(/\s+/g)}function cS(t,e,r){if(t)for(let n of Q_(e))t.addEventListener(n,r,!1)}function lS(t,e,r){if(t)for(let n of Q_(e))t.removeEventListener(n,r,!1)}function H4(t){return(t.ownerDocument||t).defaultView}function W4(t,e){let r=t;for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function uS(t){let e=t.length;if(e===1)return{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)};let r=0,n=0,i=0;for(;i<e;)r+=t[i].clientX,n+=t[i].clientY,i++;return{x:Math.round(r/e),y:Math.round(n/e)}}function q4(t){let e=[],r=0;for(;r<t.pointers.length;)e[r]={clientX:Math.round(t.pointers[r].clientX),clientY:Math.round(t.pointers[r].clientY)},r++;return{timeStamp:Date.now(),pointers:e,center:uS(e),deltaX:t.deltaX,deltaY:t.deltaY}}function hS(t,e){let r=e.x-t.x,n=e.y-t.y;return Math.sqrt(r*r+n*n)}function G4(t,e){let r=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.sqrt(r*r+n*n)}function ZH(t,e){let r=e.x-t.x,n=e.y-t.y;return Math.atan2(n,r)*180/Math.PI}function X4(t,e){let r=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.atan2(n,r)*180/Math.PI}function fS(t,e){return t===e?hs.None:Math.abs(t)>=Math.abs(e)?t<0?hs.Left:hs.Right:e<0?hs.Up:hs.Down}function $H(t,e){let r=e.center,n=t.offsetDelta,i=t.prevDelta,o=t.prevInput;return(e.eventType===Ao.Start||o?.eventType===Ao.End)&&(i=t.prevDelta={x:o?.deltaX||0,y:o?.deltaY||0},n=t.offsetDelta={x:r.x,y:r.y}),{deltaX:i.x+(r.x-n.x),deltaY:i.y+(r.y-n.y)}}function pS(t,e,r){return{x:e/t||0,y:r/t||0}}function QH(t,e){return G4(e[0],e[1])/G4(t[0],t[1])}function JH(t,e){return X4(e[1],e[0])-X4(t[1],t[0])}function eW(t,e){let r=t.lastInterval||e,n=e.timeStamp-r.timeStamp,i,o,s,c;if(e.eventType!==Ao.Cancel&&(n>25||r.velocity===void 0)){let l=e.deltaX-r.deltaX,h=e.deltaY-r.deltaY,p=pS(n,l,h);o=p.x,s=p.y,i=Math.abs(p.x)>Math.abs(p.y)?p.x:p.y,c=fS(l,h),t.lastInterval=e}else i=r.velocity,o=r.velocityX,s=r.velocityY,c=r.direction;e.velocity=i,e.velocityX=o,e.velocityY=s,e.direction=c}function tW(t,e){let{session:r}=t,{pointers:n}=e,{length:i}=n;r.firstInput||(r.firstInput=q4(e)),i>1&&!r.firstMultiple?r.firstMultiple=q4(e):i===1&&(r.firstMultiple=!1);let{firstInput:o,firstMultiple:s}=r,c=s?s.center:o.center,l=e.center=uS(n);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=ZH(c,l),e.distance=hS(c,l);let{deltaX:h,deltaY:p}=$H(r,e);e.deltaX=h,e.deltaY=p,e.offsetDirection=fS(e.deltaX,e.deltaY);let x=pS(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=x.x,e.overallVelocityY=x.y,e.overallVelocity=Math.abs(x.x)>Math.abs(x.y)?x.x:x.y,e.scale=s?QH(s.pointers,n):1,e.rotation=s?JH(s.pointers,n):0,e.maxPointers=r.prevInput?e.pointers.length>r.prevInput.maxPointers?e.pointers.length:r.prevInput.maxPointers:e.pointers.length;let w=t.element;return W4(e.srcEvent.target,w)&&(w=e.srcEvent.target),e.target=w,eW(r,e),e}function rW(t,e,r){let n=r.pointers.length,i=r.changedPointers.length,o=e&Ao.Start&&n-i===0,s=e&(Ao.End|Ao.Cancel)&&n-i===0;r.isFirst=Boolean(o),r.isFinal=Boolean(s),o&&(t.session={}),r.eventType=e;let c=tW(t,r);t.emit("hammer.input",c),t.recognize(c),t.session.prevInput=c}var a2=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=r=>{this.manager.options.enable&&this.handler(r)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,r){rW(this.manager,e,r)}init(){cS(this.element,this.evEl,this.domHandler),cS(this.target,this.evTarget,this.domHandler),cS(H4(this.element),this.evWin,this.domHandler)}destroy(){lS(this.element,this.evEl,this.domHandler),lS(this.target,this.evTarget,this.domHandler),lS(H4(this.element),this.evWin,this.domHandler)}};var Z_e={pointerdown:Ao.Start,pointermove:Ao.Move,pointerup:Ao.End,pointercancel:Ao.Cancel,pointerout:Ao.Cancel},$_e="pointerdown",Q_e="pointermove pointerup pointercancel",c2=class extends a2{constructor(e){super(e),this.evEl=$_e,this.evWin=Q_e,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){let{store:r}=this,n=!1,i=Z_e[e.type],o=e.pointerType,s=o==="touch",c=r.findIndex(l=>l.pointerId===e.pointerId);i&Ao.Start&&(e.buttons||s)?c<0&&(r.push(e),c=r.length-1):i&(Ao.End|Ao.Cancel)&&(n=!0),!(c<0)&&(r[c]=e,this.callback(i,{pointers:r,changedPointers:[e],eventType:i,pointerType:o,srcEvent:e}),n&&r.splice(c,1))}};var J_e=["","webkit","Moz","MS","ms","o"];function nW(t,e){let r=e[0].toUpperCase()+e.slice(1);for(let n of J_e){let i=n?n+r:e;if(i in t)return i}}var eye=1,iW=2,oW={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}},l2=class{constructor(e,r){this.options={...oW,...r,cssProps:{...oW.cssProps,...r.cssProps},inputTarget:r.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new c2(this),this.touchAction=new s2(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?iW:eye}recognize(e){let{session:r}=this;if(r.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let n,{recognizers:i}=this,{curRecognizer:o}=r;(!o||o&&o.state&Mn.Recognized)&&(o=r.curRecognizer=null);let s=0;for(;s<i.length;)n=i[s],r.stopped!==iW&&(!o||n===o||n.canRecognizeWith(o))?n.recognize(e):n.reset(),!o&&n.state&(Mn.Began|Mn.Changed|Mn.Ended)&&(o=r.curRecognizer=n),s++}get(e){let{recognizers:r}=this;for(let n=0;n<r.length;n++)if(r[n].options.event===e)return r[n];return null}add(e){if(Array.isArray(e)){for(let n of e)this.add(n);return this}let r=this.get(e.options.event);return r&&this.remove(r),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e}remove(e){if(Array.isArray(e)){for(let n of e)this.remove(n);return this}let r=typeof e=="string"?this.get(e):e;if(r){let{recognizers:n}=this,i=n.indexOf(r);i!==-1&&(n.splice(i,1),this.touchAction.update())}return this}on(e,r){if(!e||!r)return;let{handlers:n}=this;for(let i of Q_(e))n[i]=n[i]||[],n[i].push(r)}off(e,r){if(!e)return;let{handlers:n}=this;for(let i of Q_(e))r?n[i]&&n[i].splice(n[i].indexOf(r),1):delete n[i]}emit(e,r){let n=this.handlers[e]&&this.handlers[e].slice();if(!n||!n.length)return;let i=r;i.type=e,i.preventDefault=function(){r.srcEvent.preventDefault()};let o=0;for(;o<n.length;)n[o](i),o++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(e){let{element:r}=this;if(r){for(let[n,i]of Object.entries(this.options.cssProps)){let o=nW(r.style,n);e?(this.oldCssProps[o]=r.style[o],r.style[o]=i):r.style[o]=this.oldCssProps[o]||""}e||(this.oldCssProps={})}}};var tye=1;function sW(){return tye++}function Y4(t){return t&Mn.Cancelled?"cancel":t&Mn.Ended?"end":t&Mn.Changed?"move":t&Mn.Began?"start":""}var qp=class{constructor(e){this.options=e,this.id=sW(),this.state=Mn.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){if(Array.isArray(e)){for(let i of e)this.recognizeWith(i);return this}let r;if(typeof e=="string"){if(r=this.manager.get(e),!r)throw new Error(`Cannot find recognizer ${e}`)}else r=e;let{simultaneous:n}=this;return n[r.id]||(n[r.id]=r,r.recognizeWith(this)),this}dropRecognizeWith(e){if(Array.isArray(e)){for(let n of e)this.dropRecognizeWith(n);return this}let r;return typeof e=="string"?r=this.manager.get(e):r=e,r&&delete this.simultaneous[r.id],this}requireFailure(e){if(Array.isArray(e)){for(let i of e)this.requireFailure(i);return this}let r;if(typeof e=="string"){if(r=this.manager.get(e),!r)throw new Error(`Cannot find recognizer ${e}`)}else r=e;let{requireFail:n}=this;return n.indexOf(r)===-1&&(n.push(r),r.requireFailure(this)),this}dropRequireFailure(e){if(Array.isArray(e)){for(let n of e)this.dropRequireFailure(n);return this}let r;if(typeof e=="string"?r=this.manager.get(e):r=e,r){let n=this.requireFail.indexOf(r);n>-1&&this.requireFail.splice(n,1)}return this}hasRequireFailures(){return Boolean(this.requireFail.find(e=>e.options.enable))}canRecognizeWith(e){return Boolean(this.simultaneous[e.id])}emit(e){if(!e)return;let{state:r}=this;r<Mn.Ended&&this.manager.emit(this.options.event+Y4(r),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),r>=Mn.Ended&&this.manager.emit(this.options.event+Y4(r),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=Mn.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Mn.Failed|Mn.Possible)))return!1;e++}return!0}recognize(e){let r={...e};if(!this.options.enable){this.reset(),this.state=Mn.Failed;return}this.state&(Mn.Recognized|Mn.Cancelled|Mn.Failed)&&(this.state=Mn.Possible),this.state=this.process(r),this.state&(Mn.Began|Mn.Changed|Mn.Ended|Mn.Cancelled)&&this.tryEmit(r)}getEventNames(){return[this.options.event]}reset(){}};var Gp=class extends qp{attrTest(e){let r=this.options.pointers;return r===0||e.pointers.length===r}process(e){let{state:r}=this,{eventType:n}=e,i=r&(Mn.Began|Mn.Changed),o=this.attrTest(e);return i&&(n&Ao.Cancel||!o)?r|Mn.Cancelled:i||o?n&Ao.End?r|Mn.Ended:r&Mn.Began?r|Mn.Changed:Mn.Began:Mn.Failed}};var s0=class extends qp{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[n2]}process(e){let{options:r}=this,n=e.pointers.length===r.pointers,i=e.distance<r.threshold,o=e.deltaTime<r.time;if(this.reset(),e.eventType&Ao.Start&&this.count===0)return this.failTimeout();if(i&&o&&n){if(e.eventType!==Ao.End)return this.failTimeout();let s=this.pTime?e.timeStamp-this.pTime<r.interval:!0,c=!this.pCenter||hS(this.pCenter,e.center)<r.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!c||!s?this.count=1:this.count+=1,this._input=e,this.count%r.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=Mn.Recognized,this.tryEmit(this._input)},r.interval),Mn.Began):Mn.Recognized}return Mn.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=Mn.Failed},this.options.interval),Mn.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===Mn.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}};var rye=["","start","move","end","cancel","up","down","left","right"],Am=class extends Gp{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:hs.All,...e}),this.pX=null,this.pY=null}getTouchAction(){let{options:{direction:e}}=this,r=[];return e&hs.Horizontal&&r.push(o2),e&hs.Vertical&&r.push(i2),r}getEventNames(){return rye.map(e=>this.options.event+e)}directionTest(e){let{options:r}=this,n=!0,{distance:i}=e,{direction:o}=e,s=e.deltaX,c=e.deltaY;return o&r.direction||(r.direction&hs.Horizontal?(o=s===0?hs.None:s<0?hs.Left:hs.Right,n=s!==this.pX,i=Math.abs(e.deltaX)):(o=c===0?hs.None:c<0?hs.Up:hs.Down,n=c!==this.pY,i=Math.abs(e.deltaY))),e.direction=o,n&&i>r.threshold&&Boolean(o&r.direction)}attrTest(e){return super.attrTest(e)&&(Boolean(this.state&Mn.Began)||!(this.state&Mn.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;let r=hs[e.direction].toLowerCase();r&&(e.additionalEvent=this.options.event+r),super.emit(e)}};var nye=["","start","move","end","cancel","in","out"],J_=class extends Gp{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[o0]}getEventNames(){return nye.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||Boolean(this.state&Mn.Began))}emit(e){if(e.scale!==1){let r=e.scale<1?"in":"out";e.additionalEvent=this.options.event+r}super.emit(e)}};var Wf=class{constructor(e,r,n){this.element=e,this.callback=r,this.options=n}};var aW=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",WJe=typeof window<"u"?window:global;var aye=aW.indexOf("firefox")!==-1,cW=4.000244140625,cye=40,lye=.25,dS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,...n}),this.handleEvent=i=>{if(!this.options.enable)return;let o=i.deltaY;globalThis.WheelEvent&&(aye&&i.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(o/=globalThis.devicePixelRatio),i.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(o*=cye)),o!==0&&o%cW===0&&(o=Math.floor(o/cW)),i.shiftKey&&o&&(o=o*lye),this.callback({type:"wheel",center:{x:i.clientX,y:i.clientY},delta:-o,srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,r){e==="wheel"&&(this.options.enable=r)}};var lW=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],mS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,...n}),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;let{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,lW.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){lW.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){switch(e){case"pointermove":this.enableMoveEvent=r;break;case"pointerover":this.enableOverEvent=r;break;case"pointerout":this.enableOutEvent=r;break;case"pointerenter":this.enableEnterEvent=r;break;case"pointerleave":this.enableLeaveEvent=r;break;default:}}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var uW=["keydown","keyup"],AS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,tabIndex:0,...n}),this.handleEvent=i=>{let o=i.target||i.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&i.type==="keydown"&&this.callback({type:"keydown",srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:"keyup",srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",uW.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){uW.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e==="keydown"&&(this.enableDownEvent=r),e==="keyup"&&(this.enableUpEvent=r)}};var gS=class extends Wf{constructor(e,r,n){super(e,r,n),this.handleEvent=i=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e==="contextmenu"&&(this.options.enable=r)}};var uye={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},hye=0,fye=1,pye=2,dye=1,mye=2,Aye=4;function hW(t){let e=uye[t.srcEvent.type];if(!e)return null;let{buttons:r,button:n}=t.srcEvent,i=!1,o=!1,s=!1;return e===2?(i=Boolean(r&dye),o=Boolean(r&Aye),s=Boolean(r&mye)):(i=n===hye,o=n===fye,s=n===pye),{leftButton:i,middleButton:o,rightButton:s}}function fW(t,e){let r=t.center;if(!r)return null;let n=e.getBoundingClientRect(),i=n.width/e.offsetWidth||1,o=n.height/e.offsetHeight||1,s={x:(r.x-n.left-e.clientLeft)/i,y:(r.y-n.top-e.clientTop)/o};return{center:r,offsetCenter:s}}var gye={srcElement:"root",priority:0},_S=class{constructor(e,r){this.handleEvent=n=>{if(this.isEmpty())return;let i=this._normalizeEvent(n),o=n.srcEvent.target;for(;o&&o!==i.rootElement;){if(this._emit(i,o),i.handled)return;o=o.parentNode}this._emit(i,"root")},this.eventManager=e,this.recognizerName=r,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,n,i=!1,o=!1){let{handlers:s,handlersByElement:c}=this,l={...gye,...n},h=c.get(l.srcElement);h||(h=[],c.set(l.srcElement,h));let p={type:e,handler:r,srcElement:l.srcElement,priority:l.priority};i&&(p.once=!0),o&&(p.passive=!0),s.push(p),this._active=this._active||!p.passive;let x=h.length-1;for(;x>=0&&!(h[x].priority>=p.priority);)x--;h.splice(x+1,0,p)}remove(e,r){let{handlers:n,handlersByElement:i}=this;for(let o=n.length-1;o>=0;o--){let s=n[o];if(s.type===e&&s.handler===r){n.splice(o,1);let c=i.get(s.srcElement);c.splice(c.indexOf(s),1),c.length===0&&i.delete(s.srcElement)}}this._active=n.some(o=>!o.passive)}_emit(e,r){let n=this.handlersByElement.get(r);if(n){let i=!1,o=()=>{e.handled=!0},s=()=>{e.handled=!0,i=!0},c=[];for(let l=0;l<n.length;l++){let{type:h,handler:p,once:x}=n[l];if(p({...e,type:h,stopPropagation:o,stopImmediatePropagation:s}),x&&c.push(n[l]),i)break}for(let l=0;l<c.length;l++){let{type:h,handler:p}=c[l];this.remove(h,p)}}}_normalizeEvent(e){let r=this.eventManager.getElement();return{...e,...hW(e),...fW(e,r),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};function _ye(t){if("recognizer"in t)return t;let e,r=Array.isArray(t)?[...t]:[t];if(typeof r[0]=="function"){let n=r.shift(),i=r.shift()||{};e=new n(i)}else e=r.shift();return{recognizer:e,recognizeWith:typeof r[0]=="string"?[r[0]]:r[0],requireFailure:typeof r[1]=="string"?[r[1]]:r[1]}}var u2=class{constructor(e=null,r={}){if(this._onBasicInput=n=>{this.manager.emit(n.srcEvent.type,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...r},this.events=new Map,this.element=e,!!e){this.manager=new l2(e,this.options);for(let n of this.options.recognizers){let{recognizer:i,recognizeWith:o,requireFailure:s}=_ye(n);this.manager.add(i),o&&i.recognizeWith(o),s&&i.requireFailure(s)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new dS(e,this._onOtherEvent,{enable:!1}),this.moveInput=new mS(e,this._onOtherEvent,{enable:!1}),this.keyInput=new AS(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new gS(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,r,n){this._addEventHandler(e,r,n,!1)}once(e,r,n){this._addEventHandler(e,r,n,!0)}watch(e,r,n){this._addEventHandler(e,r,n,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:n}=this;if(!n)return;let i=n.get(e);i&&(i.set({enable:r}),n.touchAction.update()),this.wheelInput?.enableEventType(e,r),this.moveInput?.enableEventType(e,r),this.keyInput?.enableEventType(e,r),this.contextmenuInput?.enableEventType(e,r)}_addEventHandler(e,r,n,i,o){if(typeof e!="string"){n=r;for(let[h,p]of Object.entries(e))this._addEventHandler(h,p,n,i,o);return}let{manager:s,events:c}=this;if(!s)return;let l=c.get(e);if(!l){let h=this._getRecognizerName(e)||e;l=new _S(this,h),c.set(e,l),s&&s.on(e,l.handleEvent)}l.add(e,r,n,i,o),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let[o,s]of Object.entries(e))this._removeEventHandler(o,s);return}let{events:n}=this,i=n.get(e);if(i&&(i.remove(e,r),i.isEmpty())){let{recognizerName:o}=i,s=!1;for(let c of n.values())if(c.recognizerName===o&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(o,!1)}}_getRecognizerName(e){return this.manager.recognizers.find(r=>r.getEventNames().includes(e))?.options.event}};var Hr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Hr,"IDENTITY",{get:()=>(br.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var Fa={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},Do={common:0,meters:1,pixels:2},h2={click:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},K4={multipan:[Am,{threshold:10,direction:hs.Vertical,pointers:2}],pinch:[J_,{},null,["multipan"]],pan:[Am,{threshold:1},["pinch"],["multipan"]],dblclick:[s0,{event:"dblclick",taps:2}],click:[s0,{event:"click"},null,["dblclick"]]},pW={DRAW:"draw",MASK:"mask",TERRAIN:"terrain"};function yye(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}function Xu(t){let e={},r;return n=>{for(let i in n)if(!yye(n[i],e[i])){r=t(n),e=n;break}return r}}var dW=[0,0,0,0],xye=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],mW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],vye=[0,0,0],AW=[0,0,0],bye=Xu(Tye);function Z4(t,e,r=AW){r.length<3&&(r=[r[0],r[1],0]);let n=r,i,o=!0;switch(e===Hr.LNGLAT_OFFSETS||e===Hr.METER_OFFSETS?i=r:i=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Fa.WEB_MERCATOR:(e===Hr.LNGLAT||e===Hr.CARTESIAN)&&(i=[0,0,0],o=!1);break;case Fa.WEB_MERCATOR_AUTO_OFFSET:e===Hr.LNGLAT?n=i:e===Hr.CARTESIAN&&(n=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],i=t.unprojectPosition(n),n[0]-=r[0],n[1]-=r[1],n[2]-=r[2]);break;case Fa.IDENTITY:n=t.position.map(Math.fround),n[2]=n[2]||0;break;case Fa.GLOBE:o=!1,i=null;break;default:o=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:n,offsetMode:o}}function wye(t,e,r){let{viewMatrixUncentered:n,projectionMatrix:i}=t,{viewMatrix:o,viewProjectionMatrix:s}=t,c=dW,l=dW,h=t.cameraPosition,{geospatialOrigin:p,shaderCoordinateOrigin:x,offsetMode:w}=Z4(t,e,r);return w&&(l=t.projectPosition(p||x),h=[h[0]-l[0],h[1]-l[1],h[2]-l[2]],l[3]=1,c=fl.transformMat4([],l,s),o=n||o,s=Xs.multiply([],i,o),s=Xs.multiply([],s,xye)),{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:c,originCommon:l,cameraPosCommon:h,shaderCoordinateOrigin:x,geospatialOrigin:p}}function yS({viewport:t,devicePixelRatio:e=1,modelMatrix:r=null,coordinateSystem:n=Hr.DEFAULT,coordinateOrigin:i=AW,autoWrapLongitude:o=!1}){n===Hr.DEFAULT&&(n=t.isGeospatial?Hr.LNGLAT:Hr.CARTESIAN);let s=bye({viewport:t,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:i});return s.wrapLongitude=o,s.modelMatrix=r||mW,s}function Tye({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:n}){let{projectionCenter:i,viewProjectionMatrix:o,originCommon:s,cameraPosCommon:c,shaderCoordinateOrigin:l,geospatialOrigin:h}=wye(t,r,n),p=t.getDistanceScales(),x=[t.width*e,t.height*e],w=fl.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,E={coordinateSystem:r,projectionMode:t.projectionMode,coordinateOrigin:l,commonOrigin:s.slice(0,3),center:i,pseudoMeters:Boolean(t._pseudoMeters),viewportSize:x,devicePixelRatio:e,focalDistance:w,commonUnitsPerMeter:p.unitsPerMeter,commonUnitsPerWorldUnit:p.unitsPerMeter,commonUnitsPerWorldUnit2:vye,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:o,modelMatrix:mW,cameraPosition:c};if(h){let C=t.getDistanceScales(h);switch(r){case Hr.METER_OFFSETS:E.commonUnitsPerWorldUnit=C.unitsPerMeter,E.commonUnitsPerWorldUnit2=C.unitsPerMeter2;break;case Hr.LNGLAT:case Hr.LNGLAT_OFFSETS:t._pseudoMeters||(E.commonUnitsPerMeter=C.unitsPerMeter),E.commonUnitsPerWorldUnit=C.unitsPerDegree,E.commonUnitsPerWorldUnit2=C.unitsPerDegree2;break;case Hr.CARTESIAN:E.commonUnitsPerWorldUnit=[1,1,C.unitsPerMeter[2]],E.commonUnitsPerWorldUnit2=[0,0,C.unitsPerMeter2[2]];break;default:break}}return E}var Eye=Object.keys(Hr).map(t=>`const COORDINATE_SYSTEM_${t}: i32 = ${Hr[t]};`).join(""),Mye=Object.keys(Fa).map(t=>`const PROJECTION_MODE_${t}: i32 = ${Fa[t]};`).join(""),Sye=Object.keys(Do).map(t=>`const UNIT_${t.toUpperCase()}: i32 = ${Do[t]};`).join(""),Cye=`${Eye}
|
|
1955
|
+
`,aS={name:"geometry",source:G_e,vs:X_e,fs:Y_e};var Ao;(function(t){t[t.Start=1]="Start",t[t.Move=2]="Move",t[t.End=4]="End",t[t.Cancel=8]="Cancel"})(Ao||(Ao={}));var hs;(function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=4]="Up",t[t.Down=8]="Down",t[t.Horizontal=3]="Horizontal",t[t.Vertical=12]="Vertical",t[t.All=15]="All"})(hs||(hs={}));var Mn;(function(t){t[t.Possible=1]="Possible",t[t.Began=2]="Began",t[t.Changed=4]="Changed",t[t.Ended=8]="Ended",t[t.Recognized=8]="Recognized",t[t.Cancelled=16]="Cancelled",t[t.Failed=32]="Failed"})(Mn||(Mn={}));var KH="compute",V4="auto",n2="manipulation",o0="none",i2="pan-x",o2="pan-y";function j4(t){if(t.includes(o0))return o0;let e=t.includes(i2),r=t.includes(o2);return e&&r?o0:e||r?e?i2:o2:t.includes(n2)?n2:V4}var s2=class{constructor(e,r){this.actions="",this.manager=e,this.set(r)}set(e){e===KH&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(let r of this.manager.recognizers)r.options.enable&&(e=e.concat(r.getTouchAction()));return j4(e.join(" "))}};function Q_(t){return t.trim().split(/\s+/g)}function cS(t,e,r){if(t)for(let n of Q_(e))t.addEventListener(n,r,!1)}function lS(t,e,r){if(t)for(let n of Q_(e))t.removeEventListener(n,r,!1)}function H4(t){return(t.ownerDocument||t).defaultView}function W4(t,e){let r=t;for(;r;){if(r===e)return!0;r=r.parentNode}return!1}function uS(t){let e=t.length;if(e===1)return{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)};let r=0,n=0,i=0;for(;i<e;)r+=t[i].clientX,n+=t[i].clientY,i++;return{x:Math.round(r/e),y:Math.round(n/e)}}function q4(t){let e=[],r=0;for(;r<t.pointers.length;)e[r]={clientX:Math.round(t.pointers[r].clientX),clientY:Math.round(t.pointers[r].clientY)},r++;return{timeStamp:Date.now(),pointers:e,center:uS(e),deltaX:t.deltaX,deltaY:t.deltaY}}function hS(t,e){let r=e.x-t.x,n=e.y-t.y;return Math.sqrt(r*r+n*n)}function G4(t,e){let r=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.sqrt(r*r+n*n)}function ZH(t,e){let r=e.x-t.x,n=e.y-t.y;return Math.atan2(n,r)*180/Math.PI}function X4(t,e){let r=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.atan2(n,r)*180/Math.PI}function fS(t,e){return t===e?hs.None:Math.abs(t)>=Math.abs(e)?t<0?hs.Left:hs.Right:e<0?hs.Up:hs.Down}function $H(t,e){let r=e.center,n=t.offsetDelta,i=t.prevDelta,o=t.prevInput;return(e.eventType===Ao.Start||o?.eventType===Ao.End)&&(i=t.prevDelta={x:o?.deltaX||0,y:o?.deltaY||0},n=t.offsetDelta={x:r.x,y:r.y}),{deltaX:i.x+(r.x-n.x),deltaY:i.y+(r.y-n.y)}}function pS(t,e,r){return{x:e/t||0,y:r/t||0}}function QH(t,e){return G4(e[0],e[1])/G4(t[0],t[1])}function JH(t,e){return X4(e[1],e[0])-X4(t[1],t[0])}function eW(t,e){let r=t.lastInterval||e,n=e.timeStamp-r.timeStamp,i,o,s,c;if(e.eventType!==Ao.Cancel&&(n>25||r.velocity===void 0)){let l=e.deltaX-r.deltaX,h=e.deltaY-r.deltaY,p=pS(n,l,h);o=p.x,s=p.y,i=Math.abs(p.x)>Math.abs(p.y)?p.x:p.y,c=fS(l,h),t.lastInterval=e}else i=r.velocity,o=r.velocityX,s=r.velocityY,c=r.direction;e.velocity=i,e.velocityX=o,e.velocityY=s,e.direction=c}function tW(t,e){let{session:r}=t,{pointers:n}=e,{length:i}=n;r.firstInput||(r.firstInput=q4(e)),i>1&&!r.firstMultiple?r.firstMultiple=q4(e):i===1&&(r.firstMultiple=!1);let{firstInput:o,firstMultiple:s}=r,c=s?s.center:o.center,l=e.center=uS(n);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-o.timeStamp,e.angle=ZH(c,l),e.distance=hS(c,l);let{deltaX:h,deltaY:p}=$H(r,e);e.deltaX=h,e.deltaY=p,e.offsetDirection=fS(e.deltaX,e.deltaY);let x=pS(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=x.x,e.overallVelocityY=x.y,e.overallVelocity=Math.abs(x.x)>Math.abs(x.y)?x.x:x.y,e.scale=s?QH(s.pointers,n):1,e.rotation=s?JH(s.pointers,n):0,e.maxPointers=r.prevInput?e.pointers.length>r.prevInput.maxPointers?e.pointers.length:r.prevInput.maxPointers:e.pointers.length;let w=t.element;return W4(e.srcEvent.target,w)&&(w=e.srcEvent.target),e.target=w,eW(r,e),e}function rW(t,e,r){let n=r.pointers.length,i=r.changedPointers.length,o=e&Ao.Start&&n-i===0,s=e&(Ao.End|Ao.Cancel)&&n-i===0;r.isFirst=Boolean(o),r.isFinal=Boolean(s),o&&(t.session={}),r.eventType=e;let c=tW(t,r);t.emit("hammer.input",c),t.recognize(c),t.session.prevInput=c}var a2=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=r=>{this.manager.options.enable&&this.handler(r)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,r){rW(this.manager,e,r)}init(){cS(this.element,this.evEl,this.domHandler),cS(this.target,this.evTarget,this.domHandler),cS(H4(this.element),this.evWin,this.domHandler)}destroy(){lS(this.element,this.evEl,this.domHandler),lS(this.target,this.evTarget,this.domHandler),lS(H4(this.element),this.evWin,this.domHandler)}};var Z_e={pointerdown:Ao.Start,pointermove:Ao.Move,pointerup:Ao.End,pointercancel:Ao.Cancel,pointerout:Ao.Cancel},$_e="pointerdown",Q_e="pointermove pointerup pointercancel",c2=class extends a2{constructor(e){super(e),this.evEl=$_e,this.evWin=Q_e,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){let{store:r}=this,n=!1,i=Z_e[e.type],o=e.pointerType,s=o==="touch",c=r.findIndex(l=>l.pointerId===e.pointerId);i&Ao.Start&&(e.buttons||s)?c<0&&(r.push(e),c=r.length-1):i&(Ao.End|Ao.Cancel)&&(n=!0),!(c<0)&&(r[c]=e,this.callback(i,{pointers:r,changedPointers:[e],eventType:i,pointerType:o,srcEvent:e}),n&&r.splice(c,1))}};var J_e=["","webkit","Moz","MS","ms","o"];function nW(t,e){let r=e[0].toUpperCase()+e.slice(1);for(let n of J_e){let i=n?n+r:e;if(i in t)return i}}var eye=1,iW=2,oW={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}},l2=class{constructor(e,r){this.options={...oW,...r,cssProps:{...oW.cssProps,...r.cssProps},inputTarget:r.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new c2(this),this.touchAction=new s2(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?iW:eye}recognize(e){let{session:r}=this;if(r.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let n,{recognizers:i}=this,{curRecognizer:o}=r;(!o||o&&o.state&Mn.Recognized)&&(o=r.curRecognizer=null);let s=0;for(;s<i.length;)n=i[s],r.stopped!==iW&&(!o||n===o||n.canRecognizeWith(o))?n.recognize(e):n.reset(),!o&&n.state&(Mn.Began|Mn.Changed|Mn.Ended)&&(o=r.curRecognizer=n),s++}get(e){let{recognizers:r}=this;for(let n=0;n<r.length;n++)if(r[n].options.event===e)return r[n];return null}add(e){if(Array.isArray(e)){for(let n of e)this.add(n);return this}let r=this.get(e.options.event);return r&&this.remove(r),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e}remove(e){if(Array.isArray(e)){for(let n of e)this.remove(n);return this}let r=typeof e=="string"?this.get(e):e;if(r){let{recognizers:n}=this,i=n.indexOf(r);i!==-1&&(n.splice(i,1),this.touchAction.update())}return this}on(e,r){if(!e||!r)return;let{handlers:n}=this;for(let i of Q_(e))n[i]=n[i]||[],n[i].push(r)}off(e,r){if(!e)return;let{handlers:n}=this;for(let i of Q_(e))r?n[i]&&n[i].splice(n[i].indexOf(r),1):delete n[i]}emit(e,r){let n=this.handlers[e]&&this.handlers[e].slice();if(!n||!n.length)return;let i=r;i.type=e,i.preventDefault=function(){r.srcEvent.preventDefault()};let o=0;for(;o<n.length;)n[o](i),o++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(e){let{element:r}=this;if(r){for(let[n,i]of Object.entries(this.options.cssProps)){let o=nW(r.style,n);e?(this.oldCssProps[o]=r.style[o],r.style[o]=i):r.style[o]=this.oldCssProps[o]||""}e||(this.oldCssProps={})}}};var tye=1;function sW(){return tye++}function Y4(t){return t&Mn.Cancelled?"cancel":t&Mn.Ended?"end":t&Mn.Changed?"move":t&Mn.Began?"start":""}var qp=class{constructor(e){this.options=e,this.id=sW(),this.state=Mn.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){if(Array.isArray(e)){for(let i of e)this.recognizeWith(i);return this}let r;if(typeof e=="string"){if(r=this.manager.get(e),!r)throw new Error(`Cannot find recognizer ${e}`)}else r=e;let{simultaneous:n}=this;return n[r.id]||(n[r.id]=r,r.recognizeWith(this)),this}dropRecognizeWith(e){if(Array.isArray(e)){for(let n of e)this.dropRecognizeWith(n);return this}let r;return typeof e=="string"?r=this.manager.get(e):r=e,r&&delete this.simultaneous[r.id],this}requireFailure(e){if(Array.isArray(e)){for(let i of e)this.requireFailure(i);return this}let r;if(typeof e=="string"){if(r=this.manager.get(e),!r)throw new Error(`Cannot find recognizer ${e}`)}else r=e;let{requireFail:n}=this;return n.indexOf(r)===-1&&(n.push(r),r.requireFailure(this)),this}dropRequireFailure(e){if(Array.isArray(e)){for(let n of e)this.dropRequireFailure(n);return this}let r;if(typeof e=="string"?r=this.manager.get(e):r=e,r){let n=this.requireFail.indexOf(r);n>-1&&this.requireFail.splice(n,1)}return this}hasRequireFailures(){return Boolean(this.requireFail.find(e=>e.options.enable))}canRecognizeWith(e){return Boolean(this.simultaneous[e.id])}emit(e){if(!e)return;let{state:r}=this;r<Mn.Ended&&this.manager.emit(this.options.event+Y4(r),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),r>=Mn.Ended&&this.manager.emit(this.options.event+Y4(r),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=Mn.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Mn.Failed|Mn.Possible)))return!1;e++}return!0}recognize(e){let r={...e};if(!this.options.enable){this.reset(),this.state=Mn.Failed;return}this.state&(Mn.Recognized|Mn.Cancelled|Mn.Failed)&&(this.state=Mn.Possible),this.state=this.process(r),this.state&(Mn.Began|Mn.Changed|Mn.Ended|Mn.Cancelled)&&this.tryEmit(r)}getEventNames(){return[this.options.event]}reset(){}};var Gp=class extends qp{attrTest(e){let r=this.options.pointers;return r===0||e.pointers.length===r}process(e){let{state:r}=this,{eventType:n}=e,i=r&(Mn.Began|Mn.Changed),o=this.attrTest(e);return i&&(n&Ao.Cancel||!o)?r|Mn.Cancelled:i||o?n&Ao.End?r|Mn.Ended:r&Mn.Began?r|Mn.Changed:Mn.Began:Mn.Failed}};var s0=class extends qp{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[n2]}process(e){let{options:r}=this,n=e.pointers.length===r.pointers,i=e.distance<r.threshold,o=e.deltaTime<r.time;if(this.reset(),e.eventType&Ao.Start&&this.count===0)return this.failTimeout();if(i&&o&&n){if(e.eventType!==Ao.End)return this.failTimeout();let s=this.pTime?e.timeStamp-this.pTime<r.interval:!0,c=!this.pCenter||hS(this.pCenter,e.center)<r.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!c||!s?this.count=1:this.count+=1,this._input=e,this.count%r.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=Mn.Recognized,this.tryEmit(this._input)},r.interval),Mn.Began):Mn.Recognized}return Mn.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=Mn.Failed},this.options.interval),Mn.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===Mn.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}};var rye=["","start","move","end","cancel","up","down","left","right"],Am=class extends Gp{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:hs.All,...e}),this.pX=null,this.pY=null}getTouchAction(){let{options:{direction:e}}=this,r=[];return e&hs.Horizontal&&r.push(o2),e&hs.Vertical&&r.push(i2),r}getEventNames(){return rye.map(e=>this.options.event+e)}directionTest(e){let{options:r}=this,n=!0,{distance:i}=e,{direction:o}=e,s=e.deltaX,c=e.deltaY;return o&r.direction||(r.direction&hs.Horizontal?(o=s===0?hs.None:s<0?hs.Left:hs.Right,n=s!==this.pX,i=Math.abs(e.deltaX)):(o=c===0?hs.None:c<0?hs.Up:hs.Down,n=c!==this.pY,i=Math.abs(e.deltaY))),e.direction=o,n&&i>r.threshold&&Boolean(o&r.direction)}attrTest(e){return super.attrTest(e)&&(Boolean(this.state&Mn.Began)||!(this.state&Mn.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;let r=hs[e.direction].toLowerCase();r&&(e.additionalEvent=this.options.event+r),super.emit(e)}};var nye=["","start","move","end","cancel","in","out"],J_=class extends Gp{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[o0]}getEventNames(){return nye.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||Boolean(this.state&Mn.Began))}emit(e){if(e.scale!==1){let r=e.scale<1?"in":"out";e.additionalEvent=this.options.event+r}super.emit(e)}};var Wf=class{constructor(e,r,n){this.element=e,this.callback=r,this.options=n}};var aW=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",WJe=typeof window<"u"?window:global;var aye=aW.indexOf("firefox")!==-1,cW=4.000244140625,cye=40,lye=.25,dS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,...n}),this.handleEvent=i=>{if(!this.options.enable)return;let o=i.deltaY;globalThis.WheelEvent&&(aye&&i.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(o/=globalThis.devicePixelRatio),i.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(o*=cye)),o!==0&&o%cW===0&&(o=Math.floor(o/cW)),i.shiftKey&&o&&(o=o*lye),this.callback({type:"wheel",center:{x:i.clientX,y:i.clientY},delta:-o,srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,r){e==="wheel"&&(this.options.enable=r)}};var lW=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],mS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,...n}),this.handleEvent=o=>{this.handleOverEvent(o),this.handleOutEvent(o),this.handleEnterEvent(o),this.handleLeaveEvent(o),this.handleMoveEvent(o)},this.pressed=!1;let{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,lW.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){lW.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){switch(e){case"pointermove":this.enableMoveEvent=r;break;case"pointerover":this.enableOverEvent=r;break;case"pointerout":this.enableOutEvent=r;break;case"pointerenter":this.enableEnterEvent=r;break;case"pointerleave":this.enableLeaveEvent=r;break;default:}}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1;break;default:}}_emit(e,r){this.callback({type:e,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})}};var uW=["keydown","keyup"],AS=class extends Wf{constructor(e,r,n){super(e,r,{enable:!0,tabIndex:0,...n}),this.handleEvent=i=>{let o=i.target||i.srcElement;o.tagName==="INPUT"&&o.type==="text"||o.tagName==="TEXTAREA"||(this.enableDownEvent&&i.type==="keydown"&&this.callback({type:"keydown",srcEvent:i,key:i.key,target:i.target}),this.enableUpEvent&&i.type==="keyup"&&this.callback({type:"keyup",srcEvent:i,key:i.key,target:i.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",uW.forEach(i=>e.addEventListener(i,this.handleEvent))}destroy(){uW.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,r){e==="keydown"&&(this.enableDownEvent=r),e==="keyup"&&(this.enableUpEvent=r)}};var gS=class extends Wf{constructor(e,r,n){super(e,r,n),this.handleEvent=i=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,r){e==="contextmenu"&&(this.options.enable=r)}};var uye={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},hye=0,fye=1,pye=2,dye=1,mye=2,Aye=4;function hW(t){let e=uye[t.srcEvent.type];if(!e)return null;let{buttons:r,button:n}=t.srcEvent,i=!1,o=!1,s=!1;return e===2?(i=Boolean(r&dye),o=Boolean(r&Aye),s=Boolean(r&mye)):(i=n===hye,o=n===fye,s=n===pye),{leftButton:i,middleButton:o,rightButton:s}}function fW(t,e){let r=t.center;if(!r)return null;let n=e.getBoundingClientRect(),i=n.width/e.offsetWidth||1,o=n.height/e.offsetHeight||1,s={x:(r.x-n.left-e.clientLeft)/i,y:(r.y-n.top-e.clientTop)/o};return{center:r,offsetCenter:s}}var gye={srcElement:"root",priority:0},_S=class{constructor(e,r){this.handleEvent=n=>{if(this.isEmpty())return;let i=this._normalizeEvent(n),o=n.srcEvent.target;for(;o&&o!==i.rootElement;){if(this._emit(i,o),i.handled)return;o=o.parentNode}this._emit(i,"root")},this.eventManager=e,this.recognizerName=r,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,r,n,i=!1,o=!1){let{handlers:s,handlersByElement:c}=this,l={...gye,...n},h=c.get(l.srcElement);h||(h=[],c.set(l.srcElement,h));let p={type:e,handler:r,srcElement:l.srcElement,priority:l.priority};i&&(p.once=!0),o&&(p.passive=!0),s.push(p),this._active=this._active||!p.passive;let x=h.length-1;for(;x>=0&&!(h[x].priority>=p.priority);)x--;h.splice(x+1,0,p)}remove(e,r){let{handlers:n,handlersByElement:i}=this;for(let o=n.length-1;o>=0;o--){let s=n[o];if(s.type===e&&s.handler===r){n.splice(o,1);let c=i.get(s.srcElement);c.splice(c.indexOf(s),1),c.length===0&&i.delete(s.srcElement)}}this._active=n.some(o=>!o.passive)}_emit(e,r){let n=this.handlersByElement.get(r);if(n){let i=!1,o=()=>{e.handled=!0},s=()=>{e.handled=!0,i=!0},c=[];for(let l=0;l<n.length;l++){let{type:h,handler:p,once:x}=n[l];if(p({...e,type:h,stopPropagation:o,stopImmediatePropagation:s}),x&&c.push(n[l]),i)break}for(let l=0;l<c.length;l++){let{type:h,handler:p}=c[l];this.remove(h,p)}}}_normalizeEvent(e){let r=this.eventManager.getElement();return{...e,...hW(e),...fW(e,r),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:r}}};function _ye(t){if("recognizer"in t)return t;let e,r=Array.isArray(t)?[...t]:[t];if(typeof r[0]=="function"){let n=r.shift(),i=r.shift()||{};e=new n(i)}else e=r.shift();return{recognizer:e,recognizeWith:typeof r[0]=="string"?[r[0]]:r[0],requireFailure:typeof r[1]=="string"?[r[1]]:r[1]}}var u2=class{constructor(e=null,r={}){if(this._onBasicInput=n=>{this.manager.emit(n.srcEvent.type,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...r},this.events=new Map,this.element=e,!!e){this.manager=new l2(e,this.options);for(let n of this.options.recognizers){let{recognizer:i,recognizeWith:o,requireFailure:s}=_ye(n);this.manager.add(i),o&&i.recognizeWith(o),s&&i.requireFailure(s)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new dS(e,this._onOtherEvent,{enable:!1}),this.moveInput=new mS(e,this._onOtherEvent,{enable:!1}),this.keyInput=new AS(e,this._onOtherEvent,{enable:!1,tabIndex:r.tabIndex}),this.contextmenuInput=new gS(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,r,n){this._addEventHandler(e,r,n,!1)}once(e,r,n){this._addEventHandler(e,r,n,!0)}watch(e,r,n){this._addEventHandler(e,r,n,!1,!0)}off(e,r){this._removeEventHandler(e,r)}_toggleRecognizer(e,r){let{manager:n}=this;if(!n)return;let i=n.get(e);i&&(i.set({enable:r}),n.touchAction.update()),this.wheelInput?.enableEventType(e,r),this.moveInput?.enableEventType(e,r),this.keyInput?.enableEventType(e,r),this.contextmenuInput?.enableEventType(e,r)}_addEventHandler(e,r,n,i,o){if(typeof e!="string"){n=r;for(let[h,p]of Object.entries(e))this._addEventHandler(h,p,n,i,o);return}let{manager:s,events:c}=this;if(!s)return;let l=c.get(e);if(!l){let h=this._getRecognizerName(e)||e;l=new _S(this,h),c.set(e,l),s&&s.on(e,l.handleEvent)}l.add(e,r,n,i,o),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(e,r){if(typeof e!="string"){for(let[o,s]of Object.entries(e))this._removeEventHandler(o,s);return}let{events:n}=this,i=n.get(e);if(i&&(i.remove(e,r),i.isEmpty())){let{recognizerName:o}=i,s=!1;for(let c of n.values())if(c.recognizerName===o&&!c.isEmpty()){s=!0;break}s||this._toggleRecognizer(o,!1)}}_getRecognizerName(e){return this.manager.recognizers.find(r=>r.getEventNames().includes(e))?.options.event}};var Hr={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(Hr,"IDENTITY",{get:()=>(br.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});var Fa={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},Do={common:0,meters:1,pixels:2},h2={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},K4={multipan:[Am,{threshold:10,direction:hs.Vertical,pointers:2}],pinch:[J_,{},null,["multipan"]],pan:[Am,{threshold:1},["pinch"],["multipan"]],dblclick:[s0,{event:"dblclick",taps:2}],click:[s0,{event:"click"},null,["dblclick"]]},pW={DRAW:"draw",MASK:"mask",TERRAIN:"terrain"};function yye(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}return!1}function Xu(t){let e={},r;return n=>{for(let i in n)if(!yye(n[i],e[i])){r=t(n),e=n;break}return r}}var dW=[0,0,0,0],xye=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],mW=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],vye=[0,0,0],AW=[0,0,0],bye=Xu(Tye);function Z4(t,e,r=AW){r.length<3&&(r=[r[0],r[1],0]);let n=r,i,o=!0;switch(e===Hr.LNGLAT_OFFSETS||e===Hr.METER_OFFSETS?i=r:i=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Fa.WEB_MERCATOR:(e===Hr.LNGLAT||e===Hr.CARTESIAN)&&(i=[0,0,0],o=!1);break;case Fa.WEB_MERCATOR_AUTO_OFFSET:e===Hr.LNGLAT?n=i:e===Hr.CARTESIAN&&(n=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],i=t.unprojectPosition(n),n[0]-=r[0],n[1]-=r[1],n[2]-=r[2]);break;case Fa.IDENTITY:n=t.position.map(Math.fround),n[2]=n[2]||0;break;case Fa.GLOBE:o=!1,i=null;break;default:o=!1}return{geospatialOrigin:i,shaderCoordinateOrigin:n,offsetMode:o}}function wye(t,e,r){let{viewMatrixUncentered:n,projectionMatrix:i}=t,{viewMatrix:o,viewProjectionMatrix:s}=t,c=dW,l=dW,h=t.cameraPosition,{geospatialOrigin:p,shaderCoordinateOrigin:x,offsetMode:w}=Z4(t,e,r);return w&&(l=t.projectPosition(p||x),h=[h[0]-l[0],h[1]-l[1],h[2]-l[2]],l[3]=1,c=fl.transformMat4([],l,s),o=n||o,s=Xs.multiply([],i,o),s=Xs.multiply([],s,xye)),{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:c,originCommon:l,cameraPosCommon:h,shaderCoordinateOrigin:x,geospatialOrigin:p}}function yS({viewport:t,devicePixelRatio:e=1,modelMatrix:r=null,coordinateSystem:n=Hr.DEFAULT,coordinateOrigin:i=AW,autoWrapLongitude:o=!1}){n===Hr.DEFAULT&&(n=t.isGeospatial?Hr.LNGLAT:Hr.CARTESIAN);let s=bye({viewport:t,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:i});return s.wrapLongitude=o,s.modelMatrix=r||mW,s}function Tye({viewport:t,devicePixelRatio:e,coordinateSystem:r,coordinateOrigin:n}){let{projectionCenter:i,viewProjectionMatrix:o,originCommon:s,cameraPosCommon:c,shaderCoordinateOrigin:l,geospatialOrigin:h}=wye(t,r,n),p=t.getDistanceScales(),x=[t.width*e,t.height*e],w=fl.transformMat4([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,E={coordinateSystem:r,projectionMode:t.projectionMode,coordinateOrigin:l,commonOrigin:s.slice(0,3),center:i,pseudoMeters:Boolean(t._pseudoMeters),viewportSize:x,devicePixelRatio:e,focalDistance:w,commonUnitsPerMeter:p.unitsPerMeter,commonUnitsPerWorldUnit:p.unitsPerMeter,commonUnitsPerWorldUnit2:vye,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:o,modelMatrix:mW,cameraPosition:c};if(h){let C=t.getDistanceScales(h);switch(r){case Hr.METER_OFFSETS:E.commonUnitsPerWorldUnit=C.unitsPerMeter,E.commonUnitsPerWorldUnit2=C.unitsPerMeter2;break;case Hr.LNGLAT:case Hr.LNGLAT_OFFSETS:t._pseudoMeters||(E.commonUnitsPerMeter=C.unitsPerMeter),E.commonUnitsPerWorldUnit=C.unitsPerDegree,E.commonUnitsPerWorldUnit2=C.unitsPerDegree2;break;case Hr.CARTESIAN:E.commonUnitsPerWorldUnit=[1,1,C.unitsPerMeter[2]],E.commonUnitsPerWorldUnit2=[0,0,C.unitsPerMeter2[2]];break;default:break}}return E}var Eye=Object.keys(Hr).map(t=>`const COORDINATE_SYSTEM_${t}: i32 = ${Hr[t]};`).join(""),Mye=Object.keys(Fa).map(t=>`const PROJECTION_MODE_${t}: i32 = ${Fa[t]};`).join(""),Sye=Object.keys(Do).map(t=>`const UNIT_${t.toUpperCase()}: i32 = ${Do[t]};`).join(""),Cye=`${Eye}
|
|
1956
1956
|
${Mye}
|
|
1957
1957
|
${Sye}
|
|
1958
1958
|
|
|
@@ -2628,7 +2628,7 @@ void main(void) {
|
|
|
2628
2628
|
${r.source}`}),super(e,{id:r.id||Vc("clip-space"),...r,vs:J1e,vertexCount:4,geometry:new Si({topology:"triangle-strip",vertexCount:4,attributes:{clipSpacePositions:{size:2,value:new Float32Array(GW)},texCoords:{size:2,value:new Float32Array(n)},coordinates:{size:2,value:new Float32Array(n)}}})})}};var $u=class{id;matrix=new zn;display=!0;position=new ur;rotation=new ur;scale=new ur(1,1,1);userData={};props={};constructor(e={}){let{id:r}=e;this.id=r||Vc(this.constructor.name),this._setScenegraphNodeProps(e)}getBounds(){return null}destroy(){}delete(){this.destroy()}setProps(e){return this._setScenegraphNodeProps(e),this}toString(){return`{type: ScenegraphNode, id: ${this.id})}`}setPosition(e){return this.position=e,this}setRotation(e){return this.rotation=e,this}setScale(e){return this.scale=e,this}setMatrix(e,r=!0){r?this.matrix.copy(e):this.matrix=e}setMatrixComponents(e){let{position:r,rotation:n,scale:i,update:o=!0}=e;return r&&this.setPosition(r),n&&this.setRotation(n),i&&this.setScale(i),o&&this.updateMatrix(),this}updateMatrix(){let e=this.position,r=this.rotation,n=this.scale;return this.matrix.identity(),this.matrix.translate(e),this.matrix.rotateXYZ(r),this.matrix.scale(n),this}update(e={}){let{position:r,rotation:n,scale:i}=e;return r&&this.setPosition(r),n&&this.setRotation(n),i&&this.setScale(i),this.updateMatrix(),this}getCoordinateUniforms(e,r){r=r||this.matrix;let n=new zn(e).multiplyRight(r),i=n.invert(),o=i.transpose();return{viewMatrix:e,modelMatrix:r,objectMatrix:r,worldMatrix:n,worldInverseMatrix:i,worldInverseTransposeMatrix:o}}_setScenegraphNodeProps(e){"position"in e&&this.setPosition(e.position),"rotation"in e&&this.setRotation(e.rotation),"scale"in e&&this.setScale(e.scale),"matrix"in e&&this.setMatrix(e.matrix),Object.assign(this.props,e)}};var fu=class extends $u{children;constructor(e={}){e=Array.isArray(e)?{children:e}:e;let{children:r=[]}=e;qt.assert(r.every(n=>n instanceof $u),"every child must an instance of ScenegraphNode"),super(e),this.children=r}getBounds(){let e=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];return this.traverse((r,{worldMatrix:n})=>{let i=r.getBounds();if(!i)return;let[o,s]=i,c=new ur(o).add(s).divide([2,2,2]);n.transformAsPoint(c,c);let l=new ur(s).subtract(o).divide([2,2,2]);n.transformAsVector(l,l);for(let h=0;h<8;h++){let p=new ur(h&1?-1:1,h&2?-1:1,h&4?-1:1).multiply(l).add(c);for(let x=0;x<3;x++)e[0][x]=Math.min(e[0][x],p[x]),e[1][x]=Math.max(e[1][x],p[x])}}),Number.isFinite(e[0][0])?e:null}destroy(){this.children.forEach(e=>e.destroy()),this.removeAll(),super.destroy()}add(...e){for(let r of e)Array.isArray(r)?this.add(...r):this.children.push(r);return this}remove(e){let r=this.children,n=r.indexOf(e);return n>-1&&r.splice(n,1),this}removeAll(){return this.children=[],this}traverse(e,{worldMatrix:r=new zn}={}){let n=new zn(r).multiplyRight(this.matrix);for(let i of this.children)i instanceof fu?i.traverse(e,{worldMatrix:n}):e(i,{worldMatrix:n})}};var qf=class extends $u{model;bounds=null;managedResources;constructor(e){super(e),this.model=e.model,this.managedResources=e.managedResources||[],this.bounds=e.bounds||null,this.setProps(e)}destroy(){this.model&&(this.model.destroy(),this.model=null),this.managedResources.forEach(e=>e.destroy()),this.managedResources=[]}getBounds(){return this.bounds}draw(e){return this.model.draw(e)}};var Zp=class extends Si{constructor(e={}){let{id:r=Vc("cube-geometry"),indices:n=!0}=e;super(n?{...e,id:r,topology:"triangle-list",indices:{size:1,value:exe},attributes:{...axe,...e.attributes}}:{...e,id:r,topology:"triangle-list",indices:void 0,attributes:{...cxe,...e.attributes}})}},exe=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),txe=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),rxe=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),nxe=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),ixe=new Float32Array([1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),oxe=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),sxe=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),axe={POSITION:{size:3,value:txe},NORMAL:{size:3,value:rxe},TEXCOORD_0:{size:2,value:nxe}},cxe={POSITION:{size:3,value:ixe},TEXCOORD_0:{size:2,value:oxe},COLOR_0:{size:3,value:sxe}};var E2=class extends Si{constructor(e={}){let{id:r=Vc("sphere-geometry")}=e,{indices:n,attributes:i}=lxe(e);super({...e,id:r,topology:"triangle-list",indices:n,attributes:{...i,...e.attributes}})}};function lxe(t){let{nlat:e=10,nlong:r=10}=t,o=Math.PI-0,s=0,l=2*Math.PI-s,h=(e+1)*(r+1),p=(W,X,q,$,te)=>t.radius||1,x=new Float32Array(h*3),w=new Float32Array(h*3),E=new Float32Array(h*2),C=h>65535?Uint32Array:Uint16Array,B=new C(e*r*6);for(let W=0;W<=e;W++)for(let X=0;X<=r;X++){let q=X/r,$=W/e,te=X+W*(r+1),F=te*2,ue=te*3,oe=l*q,J=o*$,G=Math.sin(oe),Ae=Math.cos(oe),Se=Math.sin(J),ce=Math.cos(J),me=Ae*Se,tt=ce,Dt=G*Se,Ut=p(me,tt,Dt,q,$);x[ue+0]=Ut*me,x[ue+1]=Ut*tt,x[ue+2]=Ut*Dt,w[ue+0]=me,w[ue+1]=tt,w[ue+2]=Dt,E[F+0]=q,E[F+1]=1-$}let D=r+1;for(let W=0;W<r;W++)for(let X=0;X<e;X++){let q=(W*e+X)*6;B[q+0]=X*D+W,B[q+1]=X*D+W+1,B[q+2]=(X+1)*D+W,B[q+3]=(X+1)*D+W,B[q+4]=X*D+W+1,B[q+5]=(X+1)*D+W+1}return{indices:{size:1,value:B},attributes:{POSITION:{size:3,value:x},NORMAL:{size:3,value:w},TEXCOORD_0:{size:2,value:E}}}}var uxe=`uniform screenUniforms {
|
|
2629
2629
|
vec2 texSize;
|
|
2630
2630
|
} screen;
|
|
2631
|
-
`,XW={name:"screen",fs:uxe,uniformTypes:{texSize:"vec2<f32>"}};var M2=class extends a0{constructor(e,r){super(e,r);let{module:n,fs:i,id:o}=r,s={depthWriteEnabled:!1,depthCompare:"always"};this.model=new T2(e,{id:o,fs:i,modules:[n,XW],parameters:s})}render(e){this._renderPass(this.device,e)}delete(){this.model.destroy(),this.model=null}_renderPass(e,r){let{clearCanvas:n,inputBuffer:i,outputBuffer:o}=r,s=[i.width,i.height],c={texSrc:i.colorAttachments[0],texSize:s};this.model.shaderInputs.setProps({screen:c,...r.moduleProps});let l=this.device.beginRenderPass({framebuffer:o,parameters:{viewport:[0,0,...s]},clearColor:n?[0,0,0,0]:!1,clearDepth:1});this.model.draw(l),l.end()}};var S2=class{constructor(e,r){this.id=`${e.name}-pass`,this.props=r,TM(e),this.module=e}setup({device:e}){this.passes=hxe(e,this.module,this.id)}setProps(e){this.props=e}preRender(){}postRender(e){let r=this.passes,{target:n}=e,i=e.inputBuffer,o=e.swapBuffer;for(let s=0;s<r.length;s++){let c=s===r.length-1,l=n!==void 0&&c;l&&(o=n);let h=!l||Boolean(e.clearCanvas),p={},x=this.module.passes[s].uniforms;p[this.module.name]={...this.props,...x},r[s].render({clearCanvas:h,inputBuffer:i,outputBuffer:o,moduleProps:p});let w=o;o=i,i=w}return i}cleanup(){if(this.passes){for(let e of this.passes)e.delete();this.passes=void 0}}};function hxe(t,e,r){return e.passes.map((n,i)=>{let o=dxe(e,n),s=`${r}-${i}`;return new M2(t,{id:s,module:e,fs:o})})}var YW=`#version 300 es
|
|
2631
|
+
`,XW={name:"screen",fs:uxe,uniformTypes:{texSize:"vec2<f32>"}};var M2=class extends a0{constructor(e,r){super(e,r);let{module:n,fs:i,id:o}=r,s={depthWriteEnabled:!1,depthCompare:"always"};this.model=new T2(e,{id:o,fs:i,modules:[n,XW],parameters:s})}render(e){this._renderPass(this.device,e)}delete(){this.model.destroy(),this.model=null}_renderPass(e,r){let{clearCanvas:n,inputBuffer:i,outputBuffer:o}=r,s=[i.width,i.height],c={texSrc:i.colorAttachments[0],texSize:s};this.model.shaderInputs.setProps({screen:c,...r.moduleProps});let l=this.device.beginRenderPass({framebuffer:o,parameters:{viewport:[0,0,...s]},clearColor:n?[0,0,0,0]:!1,clearDepth:1,clearStencil:!1});this.model.draw(l),l.end()}};var S2=class{constructor(e,r){this.id=`${e.name}-pass`,this.props=r,TM(e),this.module=e}setup({device:e}){this.passes=hxe(e,this.module,this.id)}setProps(e){this.props=e}preRender(){}postRender(e){let r=this.passes,{target:n}=e,i=e.inputBuffer,o=e.swapBuffer;for(let s=0;s<r.length;s++){let c=s===r.length-1,l=n!==void 0&&c;l&&(o=n);let h=!l||Boolean(e.clearCanvas),p={},x=this.module.passes[s].uniforms;p[this.module.name]={...this.props,...x},r[s].render({clearCanvas:h,inputBuffer:i,outputBuffer:o,moduleProps:p});let w=o;o=i,i=w}return i}cleanup(){if(this.passes){for(let e of this.passes)e.delete();this.passes=void 0}}};function hxe(t,e,r){return e.passes.map((n,i)=>{let o=dxe(e,n),s=`${r}-${i}`;return new M2(t,{id:s,module:e,fs:o})})}var YW=`#version 300 es
|
|
2632
2632
|
uniform sampler2D texSrc;
|
|
2633
2633
|
|
|
2634
2634
|
in vec2 position;
|
|
@@ -2725,7 +2725,7 @@ void main(void) {
|
|
|
2725
2725
|
discard;
|
|
2726
2726
|
}
|
|
2727
2727
|
fragColor = vec4(1.0);
|
|
2728
|
-
}`;function Xxe(t,e){let r=HS(e.size),n=WS(e.size);return new hu(t,{vs:qxe,fs:Gxe,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[Wxe],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function Yxe(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function Kxe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var Zxe={interpolation:j2,spring:H2},W2=class{constructor(e,{id:r,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:n}){this.numInstances=n||1;for(let i in e){let o=e[i],s=o.getTransitionSetting(r);s&&this._updateAttribute(i,o,s)}for(let i in this.transitions){let o=e[i];(!o||!o.getTransitionSetting(r))&&this._removeTransition(i)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let n=this.transitions[r];n.inProgress&&(e[r]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,n){let i=this.transitions[e],o=!i||i.type!==n.type;if(o){i&&this._removeTransition(e);let s=Zxe[n.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(br.error(`unsupported transition type '${n.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}};var mq="attributeManager.invalidate",$xe="attributeManager.updateStart",Qxe="attributeManager.updateEnd",Jxe="attribute.updateStart",eve="attribute.allocate",tve="attribute.updateEnd",pu=class{constructor(e,{id:r="attribute-manager",stats:n,timeline:i}={}){this.mergeBoundsMemoized=Xu(DW),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new W2(e,{id:`${r}-transitions`,timeline:i}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let n=this._invalidateTrigger(e,r);Gs(mq,this,e,n)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Gs(mq,this,"all")}update({data:e,numInstances:r,startIndices:n=null,transitions:i,props:o={},buffers:s={},context:c={}}){let l=!1;Gs($xe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let p=this.attributes[h],x=p.settings.accessor;p.startIndices=n,p.numInstances=r,o[h]&&br.removed(`props.${h}`,`data.attributes.${h}`)(),p.setExternalBuffer(s[h])||p.setBinaryValue(typeof x=="string"?s[x]:void 0,e.startIndices)||typeof x=="string"&&!s[x]&&p.setConstantValue(o[x])||p.needsUpdate()&&(l=!0,this._updateAttribute({attribute:p,numInstances:r,data:e,props:o,context:c})),this.needsRedraw=this.needsRedraw||p.needsRedraw()}l&&Gs(Qxe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:i})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(n=>this.attributes[n]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:n}=this,i={...n.getAttributes()};for(let o in r){let s=r[o];s.needsRedraw(e)&&!n.hasAttribute(o)&&(i[o]=s)}return i}getBufferLayouts(e){return Object.values(this.getAttributes()).map(r=>r.getBufferLayout(e))}_add(e,r){for(let n in e){let i=e[n],o={...i,id:n,size:i.isIndexed&&1||i.size||1,...r};this.attributes[n]=new nd(this.device,o)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(i=>{e[i]||(e[i]=[]),e[i].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:n,updateTriggers:i}=this,o=i[e];return o&&o.forEach(s=>{let c=n[s];c&&c.setNeedsUpdate(c.id,r)}),o}_updateAttribute(e){let{attribute:r,numInstances:n}=e;if(Gs(Jxe,r),r.constant){r.setConstantValue(r.value);return}r.allocate(n)&&Gs(eve,r,n),r.updateBuffer(e)&&(this.needsRedraw=!0,Gs(tve,r,n))}};var q2=class extends kh{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:n,duration:i,easing:o}}=this,s=o(e/i);this._value=Na(r,n,s)}};var Aq=1e-5;function gq(t,e,r,n,i){let o=e-t,c=(r-e)*i,l=-o*n;return c+l+o+e}function rve(t,e,r,n,i){if(Array.isArray(r)){let o=[];for(let s=0;s<r.length;s++)o[s]=gq(t[s],e[s],r[s],n,i);return o}return gq(t,e,r,n,i)}function _q(t,e){if(Array.isArray(t)){let r=0;for(let n=0;n<t.length;n++){let i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}return Math.abs(t-e)}var G2=class extends kh{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:r,damping:n,stiffness:i}=this.settings,{_prevValue:o=e,_currValue:s=e}=this,c=rve(o,s,r,n,i),l=_q(c,r),h=_q(c,s);l<Aq&&h<Aq&&(c=r,this.end()),this._prevValue=s,this._currValue=c}};var nve={interpolation:q2,spring:G2},X2=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,r,n,i){let{transitions:o}=this;if(o.has(e)){let l=o.get(e),{value:h=l.settings.fromValue}=l;r=h,this.remove(e)}if(i=jS(i),!i)return;let s=nve[i.type];if(!s){br.error(`unsupported transition type '${i.type}'`)();return}let c=new s(this.timeline);c.start({...i,fromValue:r,toValue:n}),o.set(e,c)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,n]of this.transitions)n.update(),e[r]=n.value,n.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function xq(t){let e=t[Qu];for(let r in e){let n=e[r],{validate:i}=n;if(i&&!i(t[r],n))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function vq(t,e){let r=Ay({newProps:t,oldProps:e,propTypes:t[Qu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=ove(t,e),i=!1;return n||(i=sve(t,e)),{dataChanged:n,propsChanged:r,updateTriggersChanged:i,extensionsChanged:ave(t,e),transitionsChanged:ive(t,e)}}function ive(t,e){if(!t.transitions)return!1;let r={},n=t[Qu],i=!1;for(let o in t.transitions){let s=n[o],c=s&&s.type;(c==="number"||c==="color"||c==="array")&&_D(t[o],e[o],s)&&(r[o]=!0,i=!0)}return i?r:!1}function Ay({newProps:t,oldProps:e,ignoreProps:r={},propTypes:n={},triggerName:i="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${i} changed shallowly`;if(typeof e!="object"||e===null)return`${i} changed shallowly`;for(let o of Object.keys(t))if(!(o in r)){if(!(o in e))return`${i}.${o} added`;let s=_D(t[o],e[o],n[o]);if(s)return`${i}.${o} ${s}`}for(let o of Object.keys(e))if(!(o in r)){if(!(o in t))return`${i}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let s=_D(t[o],e[o],n[o]);if(s)return`${i}.${o} ${s}`}}return!1}function _D(t,e,r){let n=r&&r.equal;return n&&!n(t,e,r)||!n&&(n=t&&e&&t.equals,n&&!n.call(t,e))?"changed deeply":!n&&e!==t?"changed shallowly":null}function ove(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:n,_dataDiff:i}=t;return n?n(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&i&&(r=i(t.data,e.data)||r),r}function sve(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&yq(t,e,"all"))return{all:!0};let r={},n=!1;for(let i in t.updateTriggers)i!=="all"&&yq(t,e,i)&&(r[i]=!0,n=!0);return n?r:!1}function ave(t,e){if(e===null)return!0;let r=e.extensions,{extensions:n}=t;if(n===r)return!1;if(!r||!n||n.length!==r.length)return!0;for(let i=0;i<n.length;i++)if(!n[i].equals(r[i]))return!0;return!1}function yq(t,e,r){let n=t.updateTriggers[r];n=n??{};let i=e.updateTriggers[r];return i=i??{},Ay({oldProps:i,newProps:n,triggerName:r})}var cve="count(): argument not an object",lve="count(): argument not a container";function YS(t){if(!hve(t))throw new Error(cve);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(uve(t))return Object.keys(t).length;throw new Error(lve)}function uve(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function hve(t){return t!==null&&typeof t=="object"}function Y2(t,e){if(!e)return t;let r={...t,...e};if("defines"in e&&(r.defines={...t.defines,...e.defines}),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){let n=r.modules.findIndex(i=>i.name==="project32");n>=0&&r.modules.splice(n,1)}if("inject"in e)if(!t.inject)r.inject=e.inject;else{let n={...t.inject};for(let i in e.inject)n[i]=(n[i]||"")+e.inject[i];r.inject=n}return r}var fve={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},yD={};function bq(t,e,r,n){if(r instanceof fi)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let i=null;r.compressed&&(i={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let o=e.createTexture({...r,sampler:{...fve,...i,...n},mipmaps:!0});return yD[o.id]=t,o}function wq(t,e){!e||!(e instanceof fi)||yD[e.id]===t&&(e.delete(),delete yD[e.id])}var pve={boolean:{validate(t,e){return!0},equal(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||xD(t)&&(t.length===3||t.length===4)},equal(t,e,r){return Mi(t,e,1)}},accessor:{validate(t,e){let r=KS(t);return r==="function"||r===KS(e.value)},equal(t,e,r){return typeof e=="function"?!0:Mi(t,e,1)}},array:{validate(t,e){return e.optional&&!t||xD(t)},equal(t,e,r){let{compare:n}=r,i=Number.isInteger(n)?n:n?1:0;return n?Mi(t,e,i):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:n}=r,i=Number.isInteger(n)?n:n?1:0;return n?Mi(t,e,i):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:n}=r.props;return n?n(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let n=r.context;return!n||!n.device?null:bq(r.id,n.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{wq(r.id,t)}}};function Tq(t){let e={},r={},n={};for(let[i,o]of Object.entries(t)){let s=o?.deprecatedFor;if(s)n[i]=Array.isArray(s)?s:[s];else{let c=dve(i,o);e[i]=c,r[i]=c.value}}return{propTypes:e,defaultProps:r,deprecatedProps:n}}function dve(t,e){switch(KS(e)){case"object":return K2(t,e);case"array":return K2(t,{type:"array",value:e,compare:!1});case"boolean":return K2(t,{type:"boolean",value:e});case"number":return K2(t,{type:"number",value:e});case"function":return K2(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function K2(t,e){return"type"in e?{name:t,...pve[e.type],...e}:"value"in e?{name:t,type:KS(e.value),...e}:{name:t,type:"object",value:e}}function xD(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function KS(t){return xD(t)?"array":t===null?"null":typeof t}function Eq(t,e){let r;for(let o=e.length-1;o>=0;o--){let s=e[o];"extensions"in s&&(r=s.extensions)}let n=vD(t.constructor,r),i=Object.create(n);i[hy]=t,i[Gf]={},i[Nh]={};for(let o=0;o<e.length;++o){let s=e[o];for(let c in s)i[c]=s[c]}return Object.freeze(i),i}var mve="_mergedDefaultProps";function vD(t,e){if(!(t instanceof gy.constructor))return{};let r=mve;if(e)for(let i of e){let o=i.constructor;o&&(r+=`:${o.extensionName||o.name}`)}let n=Mq(t,r);return n||(t[r]=Ave(t,e||[]))}function Ave(t,e){if(!t.prototype)return null;let n=Object.getPrototypeOf(t),i=vD(n),o=Mq(t,"defaultProps")||{},s=Tq(o),c=Object.assign(Object.create(null),i,s.defaultProps),l=Object.assign(Object.create(null),i?.[Qu],s.propTypes),h=Object.assign(Object.create(null),i?.[DS],s.deprecatedProps);for(let p of e){let x=vD(p.constructor);x&&(Object.assign(c,x),Object.assign(l,x[Qu]),Object.assign(h,x[DS]))}return gve(c,t),yve(c,l),_ve(c,h),c[Qu]=l,c[DS]=h,e.length===0&&!bD(t,"_propTypes")&&(t._propTypes=l),c}function gve(t,e){let r=vve(e);Object.defineProperties(t,{id:{writable:!0,value:r}})}function _ve(t,e){for(let r in e)Object.defineProperty(t,r,{enumerable:!1,set(n){let i=`${this.id}: ${r}`;for(let o of e[r])bD(this,o)||(this[o]=n);br.deprecated(i,e[r].join("/"))()}})}function yve(t,e){let r={},n={};for(let i in e){let o=e[i],{name:s,value:c}=o;o.async&&(r[s]=c,n[s]=xve(s))}t[Qp]=r,t[Gf]={},Object.defineProperties(t,n)}function xve(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||US(e)?this[Gf][t]=e:this[Nh][t]=e},get(){if(this[Nh]){if(t in this[Nh])return this[Nh][t]||this[Qp][t];if(t in this[Gf]){let e=this[hy]&&this[hy].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[Qp][t]}}return this[Qp][t]}}}function bD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Mq(t,e){return bD(t,e)&&t[e]}function vve(t){let e=t.componentName;return e||br.warn(`${t.name}.componentName not specified`)(),e||t.name}var bve=0,Z2=class{constructor(...e){this.props=Eq(this,e),this.id=this.props.id,this.count=bve++}clone(e){let{props:r}=this,n={};for(let i in r[Qp])i in r[Nh]?n[i]=r[Nh][i]:i in r[Gf]&&(n[i]=r[Gf][i]);return new this.constructor({...r,...n,...e})}};Z2.componentName="Component";Z2.defaultProps={};var gy=Z2;var wve=Object.freeze({}),g0=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||wve}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return Boolean(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[hy]||this.component;let r=e[Nh]||{},n=e[Gf]||e,i=e[Qp]||{};for(let o in r){let s=r[o];this._createAsyncPropData(o,i[o]),this._updateAsyncProp(o,s),r[o]=this.getAsyncProp(o)}for(let o in n){let s=n[o];this._createAsyncPropData(o,i[o]),this._updateAsyncProp(o,s)}}_fetch(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(US(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let n=this.asyncProps[e];return r===n.resolvedValue||r===n.lastValue?!1:(n.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let n=this.asyncProps[e];n&&(r=this._postProcessValue(n,r),n.resolvedValue=r,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,r,n){let i=this.asyncProps[e];i&&n>=i.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),i.resolvedValue=r,i.resolvedLoadCount=n,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let n=this.asyncProps[e];if(n){n.pendingLoadCount++;let i=n.pendingLoadCount;r.then(o=>{this.component&&(o=this._postProcessValue(n,o),this._setAsyncPropValue(e,o,i),this._onResolve(e,o))}).catch(o=>{this._onError(e,o)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;let i=n.pendingLoadCount,o=[],s=0;for await(let c of r){if(!this.component)return;let{dataTransform:l}=this.component.props;l?o=l(c,o):o=o.concat(c),Object.defineProperty(o,"__diff",{enumerable:!1,value:[{startRow:s,endRow:o.length}]}),s=o.length,this._setAsyncPropValue(e,o,i)}this._onResolve(e,o)}_postProcessValue(e,r){let n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(r,n,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let i=this.component&&this.component.props[Qu];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var $2=class extends g0{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let n=this.layer,i=n?.props.fetch;return i?i(r,{propName:e,layer:n}):super._fetch(e,r)}_onResolve(e,r){let n=this.layer;if(n){let i=n.props.onDataLoad;e==="data"&&i&&i(r,{propName:e,layer:n})}}_onError(e,r){let n=this.layer;n&&n.raiseError(r,`loading ${e} of ${this.layer}`)}};var Tve="layer.changeFlag",Eve="layer.initialize",Mve="layer.update",Sve="layer.finalize",Cve="layer.matched",Sq=2**24-1,Pve=Object.freeze([]),Ive=Xu(({oldViewport:t,viewport:e})=>t.equals(e)),Fh=new Uint8ClampedArray(0),Rve={data:{type:"data",value:Pve,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:r,loaders:n,loadOptions:i,signal:o})=>{let{resourceManager:s}=r.context;i=i||r.getLoadOptions(),n=n||r.props.loaders,o&&(i={...i,fetch:{...i?.fetch,signal:o}});let c=s.contains(t);return!c&&!i&&(s.add({resourceId:t,data:xa(t,n),persistent:!1}),c=!0),c?s.subscribe({resourceId:t,onChange:l=>r.internalState?.reloadAsyncProp(e,l),consumerId:r.id,requestId:e}):xa(t,n,i)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Hr.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},Q2=class extends gy{constructor(){super(...arguments),this.internalState=null,this.lifecycle=vm.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){Qo(this.internalState);let r=this.internalState.viewport||this.context.viewport,n=aD(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,o,s]=ny(n,r.pixelProjectionMatrix);return e.length===2?[i,o]:[i,o,s]}unproject(e){return Qo(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){Qo(this.internalState);let n=this.internalState.viewport||this.context.viewport;return SS(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Hr.DEFAULT||e===Hr.LNGLAT||e===Hr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){Qo(e instanceof Uint8Array);let[r,n,i]=e;return r+n*256+i*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:YS(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=Y2(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=Y2(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&r)if(Array.isArray(n))for(let i of n)r.invalidateAll(i);else r.invalidateAll();if(r){let{props:i}=e,o=this.internalState.hasPickingBuffer,s=Number.isInteger(i.highlightedObjectIndex)||i.pickable||i.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(o!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:c,instancePickingColors:l}=r.attributes,h=c||l;h&&(s&&h.constant&&(h.constant=!1,r.invalidate(h.id)),!h.value&&!s&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(let n of this.getModels())n.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let r of this.getModels())r.draw(e.renderPass)}getPickingInfo({info:e,mode:r,sourceLayer:n}){let{index:i}=e;return i>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[i]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!Ive({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let n in e)e[n].layoutChanged()&&(r=!0);for(let n of this.getModels())this._setModelAttributes(n,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,n=this.getNumInstances(),i=this.getStartIndices();e.update({data:r.data,numInstances:n,startIndices:i,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let o=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(o)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),n=Object.create(this.props);for(let i in r)Object.defineProperty(n,i,{value:r[i]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let n=Math.floor(Fh.length/4);if(this.internalState.usesPickingColorCache=!0,n<r){r>Sq&&br.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Fh=Dh.allocate(Fh,r,{size:4,copy:!0,maxCount:Math.max(r,Sq)});let i=Math.floor(Fh.length/4),o=[0,0,0];for(let s=n;s<i;s++)this.encodePickingColor(s,o),Fh[s*4+0]=o[0],Fh[s*4+1]=o[1],Fh[s*4+2]=o[2],Fh[s*4+3]=0}e.value=Fh.subarray(0,r*4)}_setModelAttributes(e,r,n=!1){if(!Object.keys(r).length)return;if(n){let c=this.getAttributeManager();e.setBufferLayout(c.getBufferLayouts(e)),r=c.getAttributes()}let i=e.userData?.excludeAttributes||{},o={},s={};for(let c in r){if(i[c])continue;let l=r[c].getValue();for(let h in l){let p=l[h];p instanceof Fn?r[c].settings.isIndexed?e.setIndexBuffer(p):o[h]=p:p&&(s[h]=p)}}e.setAttributes(o),e.setConstantAttributes(s)}disablePickingIndex(e){let r=this.props.data;if(!("attributes"in r)){this._disablePickingIndex(e);return}let{pickingColors:n,instancePickingColors:i}=this.getAttributeManager().attributes,o=n||i,s=o&&r.attributes&&r.attributes[o.id];if(s&&s.value){let c=s.value,l=this.encodePickingColor(e);for(let h=0;h<r.length;h++){let p=o.getVertexOffset(h);c[p]===l[0]&&c[p+1]===l[1]&&c[p+2]===l[2]&&this._disablePickingIndex(h)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:r,instancePickingColors:n}=this.getAttributeManager().attributes,i=r||n;if(!i)return;let o=i.getVertexOffset(e),s=i.getVertexOffset(e+1);i.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let{pickingColors:e,instancePickingColors:r}=this.getAttributeManager().attributes,n=e||r;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==Fh.buffer&&(n.value=Fh.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){Qo(!this.internalState),Qo(Number.isFinite(this.props.coordinateSystem)),Gs(Eve,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new $2({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(br.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new X2(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Gs(Cve,this,this===e);let{state:r,internalState:n}=e;this!==e&&(this.internalState=n,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Gs(Mve,this,e),!e)return;let r=this.props,n=this.context,i=this.internalState,o=n.viewport,s=this._updateUniformTransition();i.propsInTransition=s,n.viewport=i.viewport||o,this.props=s;try{let c=this._getUpdateParams(),l=this.getModels();if(n.device)this.updateState(c);else try{this.updateState(c)}catch{}for(let p of this.props.extensions)p.updateState.call(this,c,p);this.setNeedsRedraw(),this._updateAttributes();let h=this.getModels()[0]!==l[0];this._postUpdate(c,h)}finally{n.viewport=o,this.props=r,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){Gs(Sve,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:r=null,uniforms:n={},parameters:i={}}){this._updateAttributeTransition();let o=this.props,s=this.context;this.props=this.internalState.propsInTransition||o;try{r&&this.setShaderModuleProps(r);let{getPolygonOffset:c}=this.props,l=c&&c(n)||[0,0];s.device instanceof Fc&&s.device.setParametersWebGL({polygonOffset:l});for(let h of this.getModels())h.device.type==="webgpu"?h.setParameters({...h.parameters,...i}):h.setParameters(i);if(s.device instanceof Fc)s.device.withParametersWebGL(i,()=>{let h={renderPass:e,shaderModuleProps:r,uniforms:n,parameters:i,context:s};for(let p of this.props.extensions)p.draw.call(this,h,p);this.draw(h)});else{let h={renderPass:e,shaderModuleProps:r,uniforms:n,parameters:i,context:s};for(let p of this.props.extensions)p.draw.call(this,h,p);this.draw(h)}}finally{this.props=o}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let i in e)if(e[i]){let o=!1;switch(i){case"dataChanged":let s=e[i],c=r[i];s&&Array.isArray(c)&&(r.dataChanged=Array.isArray(s)?c.concat(s):s,o=!0);default:r[i]||(r[i]=e[i],o=!0)}o&&Gs(Tve,this,i,e)}let n=Boolean(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=n,r.somethingChanged=n||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,r){let n=vq(e,r);if(n.updateTriggersChanged)for(let i in n.updateTriggersChanged)n.updateTriggersChanged[i]&&this.invalidateAttribute(i);if(n.transitionsChanged)for(let i in n.transitionsChanged)this.internalState.uniformTransitions.add(i,r[i],e[i],e.transitions?.[i]);return this.setChangeFlags(n)}validateProps(){xq(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(r.highlightColor=n(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new pu(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:n,oldProps:i}=e,o=this.state.model;o?.isInstanced&&o.setInstanceCount(this.getNumInstances());let{autoHighlight:s,highlightedObjectIndex:c,highlightColor:l}=n;if(r||i.autoHighlight!==s||i.highlightedObjectIndex!==c||i.highlightColor!==l){let h={};Array.isArray(l)&&(h.highlightColor=l),(r||i.autoHighlight!==s||c!==i.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let n=this.getAttributeManager(),i=n?n.getNeedsRedraw(e):!1;if(r=r||i,r)for(let o of this.props.extensions)o.onNeedsRedraw.call(this,o);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};Q2.defaultProps=Rve;Q2.layerName="Layer";var qi=Q2;var Lve="compositeLayer.renderLayers",ZS=class extends qi{get isComposite(){return!0}get isDrawable(){return!1}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:n}=this.props;return n&&n[e]&&n[e].type||r}getSubLayerRow(e,r,n){return e.__source={parent:this,object:r,index:n},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(n,i)=>n&&n.__source?(r.index=n.__source.index,e(n.__source.object,r)):e(n,i)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:n,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:c,autoHighlight:l,highlightColor:h,coordinateSystem:p,coordinateOrigin:x,wrapLongitude:w,positionFormat:E,modelMatrix:C,extensions:B,fetch:D,operation:W,_subLayerProps:X}=this.props,q={id:"",updateTriggers:{},opacity:r,pickable:n,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:c,autoHighlight:l,highlightColor:h,coordinateSystem:p,coordinateOrigin:x,wrapLongitude:w,positionFormat:E,modelMatrix:C,extensions:B,fetch:D,operation:W},$=X&&e.id&&X[e.id],te=$&&$.updateTriggers,F=e.id||"sublayer";if($){let ue=this.props[Qu],oe=e.type?e.type._propTypes:{};for(let J in $){let G=oe[J]||ue[J];G&&G.type==="accessor"&&($[J]=this.getSubLayerAccessor($[J]))}}Object.assign(q,e,$),q.id=`${this.props.id}-${F}`,q.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...te};for(let ue of B){let oe=ue.getSubLayerProps.call(this,ue);oe&&Object.assign(q,oe,{updateTriggers:Object.assign(q.updateTriggers,oe.updateTriggers)})}return q}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let n=this.internalState.subLayers,i=!n||this.needsUpdate();if(i){let o=this.renderLayers();n=Xf(o,Boolean),this.internalState.subLayers=n}Gs(Lve,this,i,n);for(let o of n)o.parent=this}};ZS.layerName="CompositeLayer";var bs=ZS;var $S=Math.PI/180,Cq=180/Math.PI,QS=6370972,_y=256;function Ove(){let t=_y/QS,e=Math.PI/180*_y;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var zh=class extends wa{constructor(e={}){let{longitude:r=0,zoom:n=0,nearZMultiplier:i=.5,farZMultiplier:o=1,resolution:s=10}=e,{latitude:c=0,height:l,altitude:h=1.5,fovy:p}=e;c=Math.max(Math.min(c,Ku),-Ku),l=l||1,p?h=Yp(p):p=Xp(h);let x=1/Math.PI/Math.cos(c*Math.PI/180),w=Math.pow(2,n)*x,E=e.nearZ??i,C=e.farZ??(h+_y*2*w/l)*o,B=new zn().lookAt({eye:[0,-h,0],up:[0,0,1]});B.rotateX(c*$S),B.rotateZ(-r*$S),B.scale(w/l),super({...e,height:l,viewMatrix:B,longitude:r,latitude:c,zoom:n,distanceScales:Ove(),fovy:p,focalDistance:h,near:E,far:C}),this.scale=w,this.latitude=c,this.longitude=r,this.resolution=s}get projectionMode(){return Fa.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.z||0},n=this.unproject([0,this.height/2],r),i=this.unproject([this.width/2,0],r),o=this.unproject([this.width,this.height/2],r),s=this.unproject([this.width/2,this.height],r);return o[0]<this.longitude&&(o[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],o[0],i[0],s[0]),Math.min(n[1],o[1],i[1],s[1]),Math.max(n[0],o[0],i[0],s[0]),Math.max(n[1],o[1],i[1],s[1])]}unproject(e,{topLeft:r=!0,targetZ:n}={}){let[i,o,s]=e,c=r?o:this.height-o,{pixelUnprojectionMatrix:l}=this,h;if(Number.isFinite(s))h=wD(l,[i,c,s,1]);else{let E=wD(l,[i,c,-1,1]),C=wD(l,[i,c,1,1]),B=((n||0)/QS+1)*_y,D=zc.sqrLen(zc.sub([],E,C)),W=zc.sqrLen(E),X=zc.sqrLen(C),$=4*((4*W*X-(D-W-X)**2)/16)/D,te=Math.sqrt(W-$),F=Math.sqrt(Math.max(0,B*B-$)),ue=(te-F)/Math.sqrt(D);h=zc.lerp([],E,C,ue)}let[p,x,w]=this.unprojectPosition(h);return Number.isFinite(s)?[p,x,w]:Number.isFinite(n)?[p,x,n]:[p,x]}projectPosition(e){let[r,n,i=0]=e,o=r*$S,s=n*$S,c=Math.cos(s),l=(i/QS+1)*_y;return[Math.sin(o)*c*l,-Math.cos(o)*c*l,Math.sin(s)*l]}unprojectPosition(e){let[r,n,i]=e,o=zc.len(e),s=Math.asin(i/o),l=Math.atan2(r,-n)*Cq,h=s*Cq,p=(o/_y-1)*QS;return[l,h,p]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let n=this.unproject(r);return{longitude:e[0]-n[0]+this.longitude,latitude:e[1]-n[1]+this.latitude}}};function wD(t,e){let r=fl.transformMat4([],e,t);return fl.scale(r,r,1/r[3]),r}var TD=Math.PI/180;function Bve({height:t,focalDistance:e,orbitAxis:r,rotationX:n,rotationOrbit:i,zoom:o}){let s=r==="Z"?[0,0,1]:[0,1,0],c=r==="Z"?[0,-e,0]:[0,0,e],l=new zn().lookAt({eye:c,up:s});l.rotateX(n*TD),r==="Z"?l.rotateZ(i*TD):l.rotateY(i*TD);let h=Math.pow(2,o)/t;return l.scale(h),l}var _0=class extends wa{constructor(e){let{height:r,projectionMatrix:n,fovy:i=50,orbitAxis:o="Z",target:s=[0,0,0],rotationX:c=0,rotationOrbit:l=0,zoom:h=0}=e,p=n?n[5]/2:Yp(i);super({...e,longitude:void 0,viewMatrix:Bve({height:r||1,focalDistance:p,orbitAxis:o,rotationX:c,rotationOrbit:l,zoom:h}),fovy:i,focalDistance:p,position:s,zoom:h}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:r=!0}={}){let[n,i,o=this.projectedCenter[2]]=e,s=r?i:this.height-i,[c,l,h]=Zu([n,s,o],this.pixelUnprojectionMatrix);return[c,l,h]}panByPosition(e,r){let n=this.project(e),i=[this.width/2+n[0]-r[0],this.height/2+n[1]-r[1],this.projectedCenter[2]];return{target:this.unproject(i)}}};var Dve=new zn().lookAt({eye:[0,0,1]});function Nve({width:t,height:e,near:r,far:n,padding:i}){let o=-t/2,s=t/2,c=-e/2,l=e/2;if(i){let{left:h=0,right:p=0,top:x=0,bottom:w=0}=i,E=ro((h+t-p)/2,0,t)-t/2,C=ro((x+e-w)/2,0,e)-e/2;o-=E,s-=E,c+=C,l+=C}return new zn().ortho({left:o,right:s,bottom:c,top:l,near:r,far:n})}var y0=class extends wa{constructor(e){let{width:r,height:n,near:i=.1,far:o=1e3,zoom:s=0,target:c=[0,0,0],padding:l=null,flipY:h=!0}=e,p=Array.isArray(s)?s[0]:s,x=Array.isArray(s)?s[1]:s,w=Math.min(p,x),E=Math.pow(2,w),C;if(p!==x){let B=Math.pow(2,p),D=Math.pow(2,x);C={unitsPerMeter:[B/E,D/E,1],metersPerUnit:[E/B,E/D,1]}}super({...e,longitude:void 0,position:c,viewMatrix:Dve.clone().scale([E,E*(h?-1:1),E]),projectionMatrix:Nve({width:r||1,height:n||1,padding:l,near:i,far:o}),zoom:w,distanceScales:C})}projectFlat([e,r]){let{unitsPerMeter:n}=this.distanceScales;return[e*n[0],r*n[1]]}unprojectFlat([e,r]){let{metersPerUnit:n}=this.distanceScales;return[e*n[0],r*n[1]]}panByPosition(e,r){let n=Zu(r,this.pixelUnprojectionMatrix),i=this.projectFlat(e),o=ba.add([],i,ba.negate([],n)),s=ba.add([],this.center,o);return{target:this.unprojectFlat(s)}}};var x0=class extends wa{constructor(e){let{longitude:r,latitude:n,modelMatrix:i,bearing:o=0,pitch:s=0,up:c=[0,0,1]}=e,h=new Rh({bearing:o,pitch:s===-90?1e-4:90+s}).toVector3().normalize(),p=i?new zn(i).transformAsVector(h):h,x=Number.isFinite(n)?d2({latitude:n}):0,w=Math.pow(2,x),E=new zn().lookAt({eye:[0,0,0],center:p,up:c}).scale(w);super({...e,zoom:x,viewMatrix:E}),this.latitude=n,this.longitude=r}};var v0=20,Pq=500,J2=class extends rd{constructor(e){let{width:r,height:n,position:i=[0,0,0],bearing:o=0,pitch:s=0,longitude:c=null,latitude:l=null,maxPitch:h=90,minPitch:p=-90,startRotatePos:x,startBearing:w,startPitch:E,startZoomPosition:C,startPanPos:B,startPanPosition:D}=e;super({width:r,height:n,position:i,bearing:o,pitch:s,longitude:c,latitude:l,maxPitch:h,minPitch:p},{startRotatePos:x,startBearing:w,startPitch:E,startZoomPosition:C,startPanPos:B,startPanPosition:D}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:r}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:r})}pan({pos:e}){if(!e)return this;let{startPanPos:r=[0,0],startPanPosition:n=[0,0]}=this.getState(),{width:i,height:o,bearing:s,pitch:c}=this.getViewportProps(),l=Pq*(e[0]-r[0])/i,h=Pq*(e[1]-r[1])/o,p=new Rh({bearing:s,pitch:c}),x=new Rh({bearing:s,pitch:-90}),w=p.toVector3().normalize(),E=x.toVector3().cross(w).normalize();return this._getUpdatedState({position:new ur(n).add(E.scale(l)).add(w.scale(h))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:i,startBearing:o,startPitch:s}=this.getState(),{width:c,height:l}=this.getViewportProps();if(!i||o===void 0||s===void 0)return this;let h;if(e){let p=(e[0]-i[0])/c,x=(e[1]-i[1])/l;h={bearing:o-p*180,pitch:s-x*90}}else h={bearing:o-r,pitch:s-n};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:r}){let n=this.getViewportProps(),i=this.getState().startZoomPosition||n.position,o=this.makeViewport(n),{projectionMatrix:s,width:c}=o,h=2*Math.atan(1/s[0])*(e[0]/c-.5),p=this.getDirection(!0);return this._move(p.rotateZ({radians:-h}),Math.log2(r)*v0,i)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=v0){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:Math.PI/2}),e)}moveRight(e=v0){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=v0){let r=this.getDirection(!0);return this._move(r,e)}moveDown(e=v0){let r=this.getDirection(!0);return this._move(r.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=v0){return this._move(new ur(0,0,1),e)}zoomOut(e=v0){return this._move(new ur(0,0,-1),e)}shortestPathFrom(e){let r=e.getViewportProps(),n={...this.getViewportProps()},{bearing:i,longitude:o}=n;return Math.abs(i-r.bearing)>180&&(n.bearing=i<0?i+360:i-360),o!==null&&r.longitude!==null&&Math.abs(o-r.longitude)>180&&(n.longitude=o<0?o+360:o-360),n}_move(e,r,n=this.getViewportProps().position){let i=e.scale(r);return this._getUpdatedState({position:new ur(n).add(i)})}getDirection(e=!1){return new Rh({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new J2({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:r,maxPitch:n,minPitch:i,longitude:o,bearing:s}=e;return e.pitch=ro(r,i,n),o!==null&&(o<-180||o>180)&&(e.longitude=c0(o+180,360)-180),(s<-180||s>180)&&(e.bearing=c0(s+180,360)-180),e}},b0=class extends dl{constructor(){super(...arguments),this.ControllerState=J2,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["position","pitch","bearing"])}}};var JS=class extends pl{constructor(e={}){super(e)}getViewportType(){return x0}get ControllerType(){return b0}};JS.displayName="FirstPersonView";var Iq=JS;var eb=class extends rd{constructor(e){let{width:r,height:n,rotationX:i=0,rotationOrbit:o=0,target:s=[0,0,0],zoom:c=0,minRotationX:l=-90,maxRotationX:h=90,minZoom:p=-1/0,maxZoom:x=1/0,startPanPosition:w,startRotatePos:E,startRotationX:C,startRotationOrbit:B,startZoomPosition:D,startZoom:W}=e;super({width:r,height:n,rotationX:i,rotationOrbit:o,target:s,zoom:c,minRotationX:l,maxRotationX:h,minZoom:p,maxZoom:x},{startPanPosition:w,startRotatePos:E,startRotationX:C,startRotationOrbit:B,startZoomPosition:D,startZoom:W}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:r}){let n=this.getState().startPanPosition||r;if(!n)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:i,startRotationX:o,startRotationOrbit:s}=this.getState(),{width:c,height:l}=this.getViewportProps();if(!i||o===void 0||s===void 0)return this;let h;if(e){let p=(e[0]-i[0])/c,x=(e[1]-i[1])/l;(o<-90||o>90)&&(p*=-1),h={rotationX:o+x*180,rotationOrbit:s+p*180}}else h={rotationX:o+n,rotationOrbit:s+r};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let r=e.getViewportProps(),n={...this.getViewportProps()},{rotationOrbit:i}=n;return Math.abs(i-r.rotationOrbit)>180&&(n.rotationOrbit=i<0?i+360:i-360),n}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:n}){let{startZoom:i,startZoomPosition:o}=this.getState();if(o||(i=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let s=this._calculateNewZoom({scale:n,startZoom:i}),c=this.makeViewport({...this.getViewportProps(),zoom:s});return this._getUpdatedState({zoom:s,...c.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:n,minZoom:i}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=r+Math.log2(e);return ro(o,i,n)}_panFromCenter(e){let{width:r,height:n,target:i}=this.getViewportProps();return this.pan({startPosition:i,pos:[r/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:r,minZoom:n,zoom:i,maxRotationX:o,minRotationX:s,rotationOrbit:c}=e;return e.zoom=Array.isArray(i)?[ro(i[0],n,r),ro(i[1],n,r)]:ro(i,n,r),e.rotationX=ro(e.rotationX,s,o),(c<-180||c>180)&&(e.rotationOrbit=c0(c+180,360)-180),e}},w0=class extends dl{constructor(){super(...arguments),this.ControllerState=eb,this.transition={transitionDuration:300,transitionInterpolator:new Ua({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var e3=class extends pl{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}getViewportType(){return _0}get ControllerType(){return w0}};e3.displayName="OrbitView";var Rq=e3;var ED=class extends eb{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:n,minZoom:i}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=Math.log2(e);if(Array.isArray(r)){let[s,c]=r;switch(this.zoomAxis){case"X":s=ro(s+o,i,n);break;case"Y":c=ro(c+o,i,n);break;default:let l=Math.min(s+o,c+o);l<i&&(o+=i-l),l=Math.max(s+o,c+o),l>n&&(o+=n-l),s+=o,c+=o}return[s,c]}return ro(r+o,i,n)}},T0=class extends dl{constructor(){super(...arguments),this.ControllerState=ED,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var t3=class extends pl{constructor(e={}){super(e)}getViewportType(){return y0}get ControllerType(){return T0}};t3.displayName="OrthographicView";var Lq=t3;var MD=class extends O2{applyConstraints(e){let{maxZoom:r,minZoom:n,zoom:i}=e;e.zoom=ro(i,n,r);let{longitude:o,latitude:s}=e;return(o<-180||o>180)&&(e.longitude=c0(o+180,360)-180),e.latitude=ro(s,-Ku,Ku),e}},E0=class extends dl{constructor(){super(...arguments),this.ControllerState=MD,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var r3=class extends pl{constructor(e={}){super(e)}getViewportType(e){return e.zoom>12?Uc:zh}get ControllerType(){return E0}};r3.displayName="GlobeView";var Oq=r3;var tb=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&Mi(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.constructor,n={updateTriggers:{}};for(let i in r)if(i in this.props){let o=r[i],s=this.props[i];n[i]=s,o&&o.type==="accessor"&&(n.updateTriggers[i]=this.props.updateTriggers[i],typeof s=="function"&&(n[i]=this.getSubLayerAccessor(s)))}return n}initializeState(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}};tb.defaultProps={};tb.extensionName="LayerExtension";var n3=tb;var SD={bearing:0,pitch:0,position:[0,0,0]},kve={speed:1.2,curve:1.414},id=class extends td{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...kve,...e}}interpolateProps(e,r,n){let i=rD(e,r,n,this.opts);for(let o in SD)i[o]=Na(e[o]||SD[o],r[o]||SD[o],n);return i}getDuration(e,r){let{transitionDuration:n}=r;return n==="auto"&&(n=nD(e,r,this.opts)),n}};var od=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=Dh,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:n={},getGeometry:i,geometryBuffer:o,positionFormat:s,dataChanged:c,normalize:l=!0}=this.opts;if(this.data=r,this.getGeometry=i,this.positionSize=o&&o.size||(s==="XY"?2:3),this.buffers=n,this.normalize=l,o&&(Qo(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(o),l||(n.vertexPositions=o)),this.geometryBuffer=n.vertexPositions,Array.isArray(c))for(let h of c)this._rebuildGeometry(h);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?VS(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,r){let{attributes:n,buffers:i,_attributeDefs:o,typedArrayManager:s}=this;for(let c in o)if(c in i)s.release(n[c]),n[c]=null;else{let l=o[c];l.copy=r,n[c]=s.allocate(n[c],e,l)}}_forEachGeometry(e,r,n){let{data:i,getGeometry:o}=this,{iterable:s,objectInfo:c}=Ys(i,r,n);for(let l of s){c.index++;let h=o?o(l,c):null;e(h,c.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:n,instanceCount:i}=this,{data:o,geometryBuffer:s}=this,{startRow:c=0,endRow:l=1/0}=e||{},h={};if(e||(r=[0],n=[0]),this.normalize||!s)this._forEachGeometry((x,w)=>{let E=x&&this.normalizeGeometry(x);h[w]=E,n[w+1]=n[w]+(E?this.getGeometrySize(E):0)},c,l),i=n[n.length-1];else if(n=o.startIndices,i=n[o.length]||0,ArrayBuffer.isView(s))i=i||s.length/this.positionSize;else if(s instanceof Fn){let x=this.positionSize*4;i=i||s.byteLength/x}else if(s.buffer){let x=s.stride||this.positionSize*4;i=i||s.buffer.byteLength/x}else if(s.value){let x=s.value,w=s.stride/x.BYTES_PER_ELEMENT||this.positionSize;i=i||x.length/w}this._allocate(i,Boolean(e)),this.indexStarts=r,this.vertexStarts=n,this.instanceCount=i;let p={};this._forEachGeometry((x,w)=>{let E=h[w]||x;p.vertexStart=n[w],p.indexStart=r[w];let C=w<n.length-1?n[w+1]:i;p.geometrySize=C-n[w],p.geometryIndex=w,this.updateGeometryAttributes(E,p)},c,l),this.vertexCount=r[r.length-1]}};function Nl(t,e){e&&Object.entries(e).map(([r,n])=>{r.startsWith("--")?t.style.setProperty(r,n):t.style[r]=n})}function Yf(t,e){e&&Object.keys(e).map(r=>{r.startsWith("--")?t.style.removeProperty(r):t.style[r]=""})}var CD=85.05113;function ID(t,e,r,n){if(r){if(r.userData._googleMap===t)return r;i3(r)}let i={click:null,rightclick:null,dblclick:null,mousemove:null,mouseout:null},o=new dy({...n,useDevicePixels:n.interleaved?!0:n.useDevicePixels,style:n.interleaved?null:{pointerEvents:"none"},parent:Fve(e,n.style),views:new py({repeat:!0}),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1});for(let s in i)i[s]=t.addListener(s,c=>Uve(o,s,c));return o.userData._googleMap=t,o.userData._eventListeners=i,o}function Fve(t,e){let r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),"getPanes"in t?t.getPanes()?.overlayLayer.appendChild(r):t.getMap()?.getDiv().appendChild(r),r}function i3(t){let{_eventListeners:e}=t.userData;for(let r in e)e[r]&&e[r].remove();t.finalize()}function Bq(t,e){let{width:r,height:n}=Dq(t),i=e.getProjection(),o=t.getBounds();if(!o)return{width:r,height:n,left:0,top:0};let s=o.getNorthEast(),c=o.getSouthWest(),l=i.fromLatLngToDivPixel(s),h=i.fromLatLngToDivPixel(c),p=PD(i,r/2,n/2),x=new google.maps.LatLng(0,p[0]),w=i.fromLatLngToContainerPixel(x),E=i.fromLatLngToDivPixel(x);if(!l||!h||!E||!w)return{width:r,height:n,left:0,top:0};let C=Math.round(E.x-w.x),B=E.y-w.y,D=PD(i,r/2,0),W=PD(i,r/2,n),X=p[1],q=p[0];if(Math.abs(X)>CD){X=X>0?CD:-CD;let J=new google.maps.LatLng(X,q),G=i.fromLatLngToContainerPixel(J);B+=G.y-n/2}B=Math.round(B);let te=180*new t0(D).sub(W).verticalAngle()/Math.PI;te<0&&(te+=360);let F=t.getHeading()||0,ue=t.getZoom()-1,oe;if(te===0)oe=n?(h.y-l.y)/n:1;else if(te===F){let J=new t0([l.x,l.y]).sub([h.x,h.y]).len(),G=new t0([r,-n]).len();oe=G?J/G:1}return ue+=Math.log2(oe||1),{width:r,height:n,left:C,top:B,zoom:ue,bearing:te,pitch:t.getTilt(),latitude:X,longitude:q}}function RD(t,e){let{width:r,height:n}=Dq(t),{center:i,heading:o,tilt:s,zoom:c}=e.getCameraParams(),l=25,h=n?r/n:1,p=.75,x=3e14,w=new zn().perspective({fovy:l*Math.PI/180,aspect:h,near:p,far:x}),E=.5*w[5];return{width:r,height:n,viewState:{altitude:E,bearing:o,latitude:i.lat(),longitude:i.lng(),pitch:s,projectionMatrix:w,repeat:!0,zoom:c-1}}}function Dq(t){let e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function PD(t,e,r){let n=new google.maps.Point(e,r),i=t.fromContainerPixelToLatLng(n);return[i.lng(),i.lat()]}function zve(t,e){if(t.pixel)return t.pixel;let r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function Uve(t,e,r){if(!t.isInitialized)return;let n={type:e,offsetCenter:zve(r,t),srcEvent:r};switch(e){case"click":case"rightclick":n.type="click",n.tapCount=1,t._onPointerDown(n),t._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,t._onEvent(n);break;case"mousemove":n.type="pointermove",t._onPointerMove(n);break;case"mouseout":n.type="pointerleave",t._onPointerMove(n);break;default:return}}var Vve=()=>!1,jve={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774};function Nq(){}var Hve={interleaved:!0},M0=class{constructor(e){this.props={},this._map=null,this._deck=null,this._overlay=null,this.setProps({...Hve,...e})}setMap(e){if(e===this._map)return;let{VECTOR:r,UNINITIALIZED:n}=google.maps.RenderingType;this._map&&(!e&&this._map.getRenderingType()===r&&this.props.interleaved&&this._overlay.requestRedraw(),this._overlay?.setMap(null),this._map=null),e&&(this._map=e,e.getRenderingType()!==n?this._createOverlay(e):e.addListener("renderingtype_changed",()=>{this._createOverlay(e)}))}setProps(e){if(Object.assign(this.props,e),this._deck){let r=this._deck.getCanvas();if(e.style&&r?.parentElement){let n=r.parentElement.style;Object.assign(n,e.style),e.style=null}this._deck.setProps(e)}}pickObject(e){return this._deck&&this._deck.pickObject(e)}pickMultipleObjects(e){return this._deck&&this._deck.pickMultipleObjects(e)}pickObjects(e){return this._deck&&this._deck.pickObjects(e)}finalize(){this.setMap(null),this._deck&&(i3(this._deck),this._deck=null)}_createOverlay(e){let{interleaved:r}=this.props,{VECTOR:n,UNINITIALIZED:i}=google.maps.RenderingType,o=e.getRenderingType();if(o===i)return;let c=o===n&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView,l=new c;l instanceof google.maps.WebGLOverlayView?(r?(l.onAdd=Nq,l.onContextRestored=this._onContextRestored.bind(this),l.onDraw=this._onDrawVectorInterleaved.bind(this)):(l.onAdd=this._onAdd.bind(this),l.onContextRestored=Nq,l.onDraw=this._onDrawVectorOverlay.bind(this)),l.onContextLost=this._onContextLost.bind(this)):(l.onAdd=this._onAdd.bind(this),l.draw=this._onDrawRaster.bind(this)),l.onRemove=this._onRemove.bind(this),this._overlay=l,this._overlay.setMap(e)}_onAdd(){this._deck=ID(this._map,this._overlay,this._deck,this.props)}_onContextRestored({gl:e}){if(!this._map||!this._overlay)return;let r=()=>{this._overlay&&this._overlay.requestRedraw()},n=ID(this._map,this._overlay,this._deck,{gl:e,_customRender:r,...this.props});this._deck=n;let i=n.animationLoop;i._renderFrame=()=>{let o=e.getParameter(34964);n.device.withParametersWebGL({},()=>{i.props.onRender(i.animationProps)}),e.bindBuffer(34962,o)}}_onContextLost(){this._deck&&(i3(this._deck),this._deck=null)}_onRemove(){this._deck?.setProps({layerFilter:Vve})}_onDrawRaster(){if(!this._deck||!this._map)return;let e=this._deck,{width:r,height:n,left:i,top:o,...s}=Bq(this._map,this._overlay),l=e.getCanvas()?.parentElement||e.props.parent;if(l){let p=l.style;p.left=`${i}px`,p.top=`${o}px`}let h=1e4;e.setProps({width:r,height:n,viewState:{altitude:h,...s}}),e.redraw()}_onDrawVectorInterleaved({gl:e,transformer:r}){if(!this._deck||!this._map)return;let n=this._deck;if(n.setProps({...RD(this._map,r),width:null,height:null}),n.isInitialized){let i=n.device;if(i instanceof Fc){let o=i.getParametersWebGL(36006);n.setProps({_framebuffer:o})}i.getDefaultCanvasContext().resize(),n.needsRedraw({clearRedrawFlags:!0}),i instanceof Fc&&(i.setParametersWebGL({viewport:[0,0,e.canvas.width,e.canvas.height],scissor:[0,0,e.canvas.width,e.canvas.height],stencilFunc:[519,0,255,519,0,255]}),i.withParametersWebGL(jve,()=>{n._drawLayers("google-vector",{clearCanvas:!1})}))}}_onDrawVectorOverlay({transformer:e}){if(!this._deck||!this._map)return;let r=this._deck;r.setProps({...RD(this._map,e)}),r.redraw()}};function kq({container:t,onClick:e,onComplete:r,getTooltip:n,googleMapsKey:i,layers:o,mapStyle:s="satellite",initialViewState:c={latitude:0,longitude:0,zoom:1}}){if(!i)return br.warn("No Google Maps API key set")(),null;let l=new M0({layers:o}),h={center:{lat:c.latitude,lng:c.longitude},mapTypeId:s,zoom:c.zoom},p=new window.google.maps.Map(t,h);return l.setMap(p),l}var Fq={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1};var LD=class{constructor({container:e,props:r}){let{description:n}=r,i=document.createElement("div");i.className="deck-json-description-box",Object.assign(i.style,Fq),this.el=i;let o=document.createElement("div");o.innerHTML=n,i.appendChild(o),e.append(i)}remove(){this.el.remove(),this.description=null}static get stringName(){return"description"}},zq=LD;function OD(t,e){let r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);let n=[];for(let i of Object.keys(e))switch(i){case"description":let o=new zq({container:r,props:e});n.push(o);break;default:break}return n}var Gw={};Mo(Gw,{AmbientLight:()=>oy,ArcLayer:()=>s3,Attribute:()=>nd,AttributeManager:()=>pu,BitmapLayer:()=>a3,COORDINATE_SYSTEM:()=>Hr,CPUAggregator:()=>ml,ColumnLayer:()=>Kf,CompassWidget:()=>MI,CompositeLayer:()=>bs,ContourLayer:()=>FY,Controller:()=>dl,DarkGlassTheme:()=>TDe,DarkTheme:()=>bDe,Deck:()=>dy,DeckRenderer:()=>A0,DirectionalLight:()=>Kp,FirstPersonController:()=>b0,FirstPersonView:()=>Iq,FirstPersonViewport:()=>x0,FlyToInterpolator:()=>id,FullscreenWidget:()=>EI,GeoJsonLayer:()=>I0,GeohashLayer:()=>Jie,GoogleMapsOverlay:()=>M0,GreatCircleLayer:()=>ZK,GridCellLayer:()=>RG,GridLayer:()=>HY,H3ClusterLayer:()=>JZ,H3HexagonLayer:()=>aC,HeatmapLayer:()=>aK,HexagonLayer:()=>oY,IconLayer:()=>yy,JSONConfiguration:()=>bd,JSONConverter:()=>cg,Layer:()=>qi,LayerExtension:()=>n3,LayerManager:()=>p0,LightGlassTheme:()=>wDe,LightTheme:()=>vDe,LightingEffect:()=>ym,LineLayer:()=>cG,LinearInterpolator:()=>Ua,MVTLayer:()=>Kie,MapController:()=>m0,MapView:()=>py,OPERATION:()=>pW,OrbitController:()=>w0,OrbitView:()=>Rq,OrbitViewport:()=>_0,OrthographicController:()=>T0,OrthographicView:()=>Lq,OrthographicViewport:()=>y0,PathLayer:()=>Zf,PointCloudLayer:()=>c3,PointLight:()=>ly,PolygonLayer:()=>Cm,PostProcessEffect:()=>S2,QuadkeyLayer:()=>uZ,ResetViewWidget:()=>dg,S2Layer:()=>cZ,ScatterplotLayer:()=>l3,ScenegraphLayer:()=>DC,ScreenGridLayer:()=>YX,ScreenshotWidget:()=>pg,SimpleMeshLayer:()=>U0,SolidPolygonLayer:()=>Sm,TRANSITION_EVENTS:()=>R2,TerrainLayer:()=>Aie,Tesselator:()=>od,TextLayer:()=>S3,Tile3DLayer:()=>lie,TileLayer:()=>k0,TransitionInterpolator:()=>td,Transport:()=>ap,TripsLayer:()=>IZ,UNIT:()=>Do,VERSION:()=>bM,View:()=>pl,Viewport:()=>wa,WebGLAggregator:()=>na,WebMercatorViewport:()=>Uc,ZoomWidget:()=>fg,_AggregationLayer:()=>$f,_CameraLight:()=>y2,_Component:()=>gy,_ComponentState:()=>g0,_GeoCellLayer:()=>Qf,_GlobeController:()=>E0,_GlobeView:()=>Oq,_GlobeViewport:()=>zh,_LayersPass:()=>Bh,_MultiIconLayer:()=>T3,_PickLayersPass:()=>$p,_SunLight:()=>x2,_TextBackgroundLayer:()=>M3,_Tile2DHeader:()=>B0,_Tileset2D:()=>N0,_WMSLayer:()=>Uy,_WidgetImpl:()=>Yh,_applyStyles:()=>Nl,_compareProps:()=>Ay,_components:()=>s5,_convertFunctions:()=>N1,_count:()=>YS,_deepEqual:()=>Mi,_fillArray:()=>NS,_flatten:()=>Xf,_getURLFromTemplate:()=>ep,_memoize:()=>Xu,_mergeShaders:()=>Y2,_parseExpressionString:()=>ag,_removeStyles:()=>Yf,_shallowEqualObjects:()=>uoe,assert:()=>Qo,createIterable:()=>Ys,fp64LowPart:()=>oD,getShaderAssembler:()=>ES,gouraudLighting:()=>oS,log:()=>br,phongLighting:()=>sS,picking:()=>So,project:()=>gm,project32:()=>Ei,shadow:()=>iy});var Uq=`uniform arcUniforms {
|
|
2728
|
+
}`;function Xxe(t,e){let r=HS(e.size),n=WS(e.size);return new hu(t,{vs:qxe,fs:Gxe,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[Wxe],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function Yxe(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function Kxe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var Zxe={interpolation:j2,spring:H2},W2=class{constructor(e,{id:r,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:n}){this.numInstances=n||1;for(let i in e){let o=e[i],s=o.getTransitionSetting(r);s&&this._updateAttribute(i,o,s)}for(let i in this.transitions){let o=e[i];(!o||!o.getTransitionSetting(r))&&this._removeTransition(i)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let n=this.transitions[r];n.inProgress&&(e[r]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,n){let i=this.transitions[e],o=!i||i.type!==n.type;if(o){i&&this._removeTransition(e);let s=Zxe[n.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(br.error(`unsupported transition type '${n.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}};var mq="attributeManager.invalidate",$xe="attributeManager.updateStart",Qxe="attributeManager.updateEnd",Jxe="attribute.updateStart",eve="attribute.allocate",tve="attribute.updateEnd",pu=class{constructor(e,{id:r="attribute-manager",stats:n,timeline:i}={}){this.mergeBoundsMemoized=Xu(DW),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new W2(e,{id:`${r}-transitions`,timeline:i}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let n=this._invalidateTrigger(e,r);Gs(mq,this,e,n)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Gs(mq,this,"all")}update({data:e,numInstances:r,startIndices:n=null,transitions:i,props:o={},buffers:s={},context:c={}}){let l=!1;Gs($xe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let p=this.attributes[h],x=p.settings.accessor;p.startIndices=n,p.numInstances=r,o[h]&&br.removed(`props.${h}`,`data.attributes.${h}`)(),p.setExternalBuffer(s[h])||p.setBinaryValue(typeof x=="string"?s[x]:void 0,e.startIndices)||typeof x=="string"&&!s[x]&&p.setConstantValue(o[x])||p.needsUpdate()&&(l=!0,this._updateAttribute({attribute:p,numInstances:r,data:e,props:o,context:c})),this.needsRedraw=this.needsRedraw||p.needsRedraw()}l&&Gs(Qxe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:i})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(n=>this.attributes[n]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:n}=this,i={...n.getAttributes()};for(let o in r){let s=r[o];s.needsRedraw(e)&&!n.hasAttribute(o)&&(i[o]=s)}return i}getBufferLayouts(e){return Object.values(this.getAttributes()).map(r=>r.getBufferLayout(e))}_add(e,r){for(let n in e){let i=e[n],o={...i,id:n,size:i.isIndexed&&1||i.size||1,...r};this.attributes[n]=new nd(this.device,o)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(i=>{e[i]||(e[i]=[]),e[i].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:n,updateTriggers:i}=this,o=i[e];return o&&o.forEach(s=>{let c=n[s];c&&c.setNeedsUpdate(c.id,r)}),o}_updateAttribute(e){let{attribute:r,numInstances:n}=e;if(Gs(Jxe,r),r.constant){r.setConstantValue(r.value);return}r.allocate(n)&&Gs(eve,r,n),r.updateBuffer(e)&&(this.needsRedraw=!0,Gs(tve,r,n))}};var q2=class extends kh{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:n,duration:i,easing:o}}=this,s=o(e/i);this._value=Na(r,n,s)}};var Aq=1e-5;function gq(t,e,r,n,i){let o=e-t,c=(r-e)*i,l=-o*n;return c+l+o+e}function rve(t,e,r,n,i){if(Array.isArray(r)){let o=[];for(let s=0;s<r.length;s++)o[s]=gq(t[s],e[s],r[s],n,i);return o}return gq(t,e,r,n,i)}function _q(t,e){if(Array.isArray(t)){let r=0;for(let n=0;n<t.length;n++){let i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}return Math.abs(t-e)}var G2=class extends kh{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:r,damping:n,stiffness:i}=this.settings,{_prevValue:o=e,_currValue:s=e}=this,c=rve(o,s,r,n,i),l=_q(c,r),h=_q(c,s);l<Aq&&h<Aq&&(c=r,this.end()),this._prevValue=s,this._currValue=c}};var nve={interpolation:q2,spring:G2},X2=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,r,n,i){let{transitions:o}=this;if(o.has(e)){let l=o.get(e),{value:h=l.settings.fromValue}=l;r=h,this.remove(e)}if(i=jS(i),!i)return;let s=nve[i.type];if(!s){br.error(`unsupported transition type '${i.type}'`)();return}let c=new s(this.timeline);c.start({...i,fromValue:r,toValue:n}),o.set(e,c)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,n]of this.transitions)n.update(),e[r]=n.value,n.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function xq(t){let e=t[Qu];for(let r in e){let n=e[r],{validate:i}=n;if(i&&!i(t[r],n))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function vq(t,e){let r=Ay({newProps:t,oldProps:e,propTypes:t[Qu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=ove(t,e),i=!1;return n||(i=sve(t,e)),{dataChanged:n,propsChanged:r,updateTriggersChanged:i,extensionsChanged:ave(t,e),transitionsChanged:ive(t,e)}}function ive(t,e){if(!t.transitions)return!1;let r={},n=t[Qu],i=!1;for(let o in t.transitions){let s=n[o],c=s&&s.type;(c==="number"||c==="color"||c==="array")&&_D(t[o],e[o],s)&&(r[o]=!0,i=!0)}return i?r:!1}function Ay({newProps:t,oldProps:e,ignoreProps:r={},propTypes:n={},triggerName:i="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${i} changed shallowly`;if(typeof e!="object"||e===null)return`${i} changed shallowly`;for(let o of Object.keys(t))if(!(o in r)){if(!(o in e))return`${i}.${o} added`;let s=_D(t[o],e[o],n[o]);if(s)return`${i}.${o} ${s}`}for(let o of Object.keys(e))if(!(o in r)){if(!(o in t))return`${i}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let s=_D(t[o],e[o],n[o]);if(s)return`${i}.${o} ${s}`}}return!1}function _D(t,e,r){let n=r&&r.equal;return n&&!n(t,e,r)||!n&&(n=t&&e&&t.equals,n&&!n.call(t,e))?"changed deeply":!n&&e!==t?"changed shallowly":null}function ove(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:n,_dataDiff:i}=t;return n?n(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&i&&(r=i(t.data,e.data)||r),r}function sve(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&yq(t,e,"all"))return{all:!0};let r={},n=!1;for(let i in t.updateTriggers)i!=="all"&&yq(t,e,i)&&(r[i]=!0,n=!0);return n?r:!1}function ave(t,e){if(e===null)return!0;let r=e.extensions,{extensions:n}=t;if(n===r)return!1;if(!r||!n||n.length!==r.length)return!0;for(let i=0;i<n.length;i++)if(!n[i].equals(r[i]))return!0;return!1}function yq(t,e,r){let n=t.updateTriggers[r];n=n??{};let i=e.updateTriggers[r];return i=i??{},Ay({oldProps:i,newProps:n,triggerName:r})}var cve="count(): argument not an object",lve="count(): argument not a container";function YS(t){if(!hve(t))throw new Error(cve);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(uve(t))return Object.keys(t).length;throw new Error(lve)}function uve(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function hve(t){return t!==null&&typeof t=="object"}function Y2(t,e){if(!e)return t;let r={...t,...e};if("defines"in e&&(r.defines={...t.defines,...e.defines}),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){let n=r.modules.findIndex(i=>i.name==="project32");n>=0&&r.modules.splice(n,1)}if("inject"in e)if(!t.inject)r.inject=e.inject;else{let n={...t.inject};for(let i in e.inject)n[i]=(n[i]||"")+e.inject[i];r.inject=n}return r}var fve={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},yD={};function bq(t,e,r,n){if(r instanceof fi)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let i=null;r.compressed&&(i={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let o=e.createTexture({...r,sampler:{...fve,...i,...n},mipmaps:!0});return yD[o.id]=t,o}function wq(t,e){!e||!(e instanceof fi)||yD[e.id]===t&&(e.delete(),delete yD[e.id])}var pve={boolean:{validate(t,e){return!0},equal(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||xD(t)&&(t.length===3||t.length===4)},equal(t,e,r){return Mi(t,e,1)}},accessor:{validate(t,e){let r=KS(t);return r==="function"||r===KS(e.value)},equal(t,e,r){return typeof e=="function"?!0:Mi(t,e,1)}},array:{validate(t,e){return e.optional&&!t||xD(t)},equal(t,e,r){let{compare:n}=r,i=Number.isInteger(n)?n:n?1:0;return n?Mi(t,e,i):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:n}=r,i=Number.isInteger(n)?n:n?1:0;return n?Mi(t,e,i):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:n}=r.props;return n?n(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let n=r.context;return!n||!n.device?null:bq(r.id,n.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{wq(r.id,t)}}};function Tq(t){let e={},r={},n={};for(let[i,o]of Object.entries(t)){let s=o?.deprecatedFor;if(s)n[i]=Array.isArray(s)?s:[s];else{let c=dve(i,o);e[i]=c,r[i]=c.value}}return{propTypes:e,defaultProps:r,deprecatedProps:n}}function dve(t,e){switch(KS(e)){case"object":return K2(t,e);case"array":return K2(t,{type:"array",value:e,compare:!1});case"boolean":return K2(t,{type:"boolean",value:e});case"number":return K2(t,{type:"number",value:e});case"function":return K2(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function K2(t,e){return"type"in e?{name:t,...pve[e.type],...e}:"value"in e?{name:t,type:KS(e.value),...e}:{name:t,type:"object",value:e}}function xD(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function KS(t){return xD(t)?"array":t===null?"null":typeof t}function Eq(t,e){let r;for(let o=e.length-1;o>=0;o--){let s=e[o];"extensions"in s&&(r=s.extensions)}let n=vD(t.constructor,r),i=Object.create(n);i[hy]=t,i[Gf]={},i[Nh]={};for(let o=0;o<e.length;++o){let s=e[o];for(let c in s)i[c]=s[c]}return Object.freeze(i),i}var mve="_mergedDefaultProps";function vD(t,e){if(!(t instanceof gy.constructor))return{};let r=mve;if(e)for(let i of e){let o=i.constructor;o&&(r+=`:${o.extensionName||o.name}`)}let n=Mq(t,r);return n||(t[r]=Ave(t,e||[]))}function Ave(t,e){if(!t.prototype)return null;let n=Object.getPrototypeOf(t),i=vD(n),o=Mq(t,"defaultProps")||{},s=Tq(o),c=Object.assign(Object.create(null),i,s.defaultProps),l=Object.assign(Object.create(null),i?.[Qu],s.propTypes),h=Object.assign(Object.create(null),i?.[DS],s.deprecatedProps);for(let p of e){let x=vD(p.constructor);x&&(Object.assign(c,x),Object.assign(l,x[Qu]),Object.assign(h,x[DS]))}return gve(c,t),yve(c,l),_ve(c,h),c[Qu]=l,c[DS]=h,e.length===0&&!bD(t,"_propTypes")&&(t._propTypes=l),c}function gve(t,e){let r=vve(e);Object.defineProperties(t,{id:{writable:!0,value:r}})}function _ve(t,e){for(let r in e)Object.defineProperty(t,r,{enumerable:!1,set(n){let i=`${this.id}: ${r}`;for(let o of e[r])bD(this,o)||(this[o]=n);br.deprecated(i,e[r].join("/"))()}})}function yve(t,e){let r={},n={};for(let i in e){let o=e[i],{name:s,value:c}=o;o.async&&(r[s]=c,n[s]=xve(s))}t[Qp]=r,t[Gf]={},Object.defineProperties(t,n)}function xve(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||US(e)?this[Gf][t]=e:this[Nh][t]=e},get(){if(this[Nh]){if(t in this[Nh])return this[Nh][t]||this[Qp][t];if(t in this[Gf]){let e=this[hy]&&this[hy].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[Qp][t]}}return this[Qp][t]}}}function bD(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Mq(t,e){return bD(t,e)&&t[e]}function vve(t){let e=t.componentName;return e||br.warn(`${t.name}.componentName not specified`)(),e||t.name}var bve=0,Z2=class{constructor(...e){this.props=Eq(this,e),this.id=this.props.id,this.count=bve++}clone(e){let{props:r}=this,n={};for(let i in r[Qp])i in r[Nh]?n[i]=r[Nh][i]:i in r[Gf]&&(n[i]=r[Gf][i]);return new this.constructor({...r,...n,...e})}};Z2.componentName="Component";Z2.defaultProps={};var gy=Z2;var wve=Object.freeze({}),g0=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||wve}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return Boolean(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[hy]||this.component;let r=e[Nh]||{},n=e[Gf]||e,i=e[Qp]||{};for(let o in r){let s=r[o];this._createAsyncPropData(o,i[o]),this._updateAsyncProp(o,s),r[o]=this.getAsyncProp(o)}for(let o in n){let s=n[o];this._createAsyncPropData(o,i[o]),this._updateAsyncProp(o,s)}}_fetch(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(US(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let n=this.asyncProps[e];return r===n.resolvedValue||r===n.lastValue?!1:(n.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let n=this.asyncProps[e];n&&(r=this._postProcessValue(n,r),n.resolvedValue=r,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,r,n){let i=this.asyncProps[e];i&&n>=i.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),i.resolvedValue=r,i.resolvedLoadCount=n,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let n=this.asyncProps[e];if(n){n.pendingLoadCount++;let i=n.pendingLoadCount;r.then(o=>{this.component&&(o=this._postProcessValue(n,o),this._setAsyncPropValue(e,o,i),this._onResolve(e,o))}).catch(o=>{this._onError(e,o)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;let i=n.pendingLoadCount,o=[],s=0;for await(let c of r){if(!this.component)return;let{dataTransform:l}=this.component.props;l?o=l(c,o):o=o.concat(c),Object.defineProperty(o,"__diff",{enumerable:!1,value:[{startRow:s,endRow:o.length}]}),s=o.length,this._setAsyncPropValue(e,o,i)}this._onResolve(e,o)}_postProcessValue(e,r){let n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(r,n,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let i=this.component&&this.component.props[Qu];this.asyncProps[e]={type:i&&i[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var $2=class extends g0{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let n=this.layer,i=n?.props.fetch;return i?i(r,{propName:e,layer:n}):super._fetch(e,r)}_onResolve(e,r){let n=this.layer;if(n){let i=n.props.onDataLoad;e==="data"&&i&&i(r,{propName:e,layer:n})}}_onError(e,r){let n=this.layer;n&&n.raiseError(r,`loading ${e} of ${this.layer}`)}};var Tve="layer.changeFlag",Eve="layer.initialize",Mve="layer.update",Sve="layer.finalize",Cve="layer.matched",Sq=2**24-1,Pve=Object.freeze([]),Ive=Xu(({oldViewport:t,viewport:e})=>t.equals(e)),Fh=new Uint8ClampedArray(0),Rve={data:{type:"data",value:Pve,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:r,loaders:n,loadOptions:i,signal:o})=>{let{resourceManager:s}=r.context;i=i||r.getLoadOptions(),n=n||r.props.loaders,o&&(i={...i,fetch:{...i?.fetch,signal:o}});let c=s.contains(t);return!c&&!i&&(s.add({resourceId:t,data:xa(t,n),persistent:!1}),c=!0),c?s.subscribe({resourceId:t,onChange:l=>r.internalState?.reloadAsyncProp(e,l),consumerId:r.id,requestId:e}):xa(t,n,i)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Hr.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},Q2=class extends gy{constructor(){super(...arguments),this.internalState=null,this.lifecycle=vm.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){Qo(this.internalState);let r=this.internalState.viewport||this.context.viewport,n=aD(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[i,o,s]=ny(n,r.pixelProjectionMatrix);return e.length===2?[i,o]:[i,o,s]}unproject(e){return Qo(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){Qo(this.internalState);let n=this.internalState.viewport||this.context.viewport;return SS(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Hr.DEFAULT||e===Hr.LNGLAT||e===Hr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){Qo(e instanceof Uint8Array);let[r,n,i]=e;return r+n*256+i*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:YS(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=Y2(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=Y2(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&r)if(Array.isArray(n))for(let i of n)r.invalidateAll(i);else r.invalidateAll();if(r){let{props:i}=e,o=this.internalState.hasPickingBuffer,s=Number.isInteger(i.highlightedObjectIndex)||i.pickable||i.extensions.some(c=>c.getNeedsPickingBuffer.call(this,c));if(o!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:c,instancePickingColors:l}=r.attributes,h=c||l;h&&(s&&h.constant&&(h.constant=!1,r.invalidate(h.id)),!h.value&&!s&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(let n of this.getModels())n.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let r of this.getModels())r.draw(e.renderPass)}getPickingInfo({info:e,mode:r,sourceLayer:n}){let{index:i}=e;return i>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[i]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!Ive({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let n in e)e[n].layoutChanged()&&(r=!0);for(let n of this.getModels())this._setModelAttributes(n,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,n=this.getNumInstances(),i=this.getStartIndices();e.update({data:r.data,numInstances:n,startIndices:i,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let o=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(o)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),n=Object.create(this.props);for(let i in r)Object.defineProperty(n,i,{value:r[i]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let n=Math.floor(Fh.length/4);if(this.internalState.usesPickingColorCache=!0,n<r){r>Sq&&br.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Fh=Dh.allocate(Fh,r,{size:4,copy:!0,maxCount:Math.max(r,Sq)});let i=Math.floor(Fh.length/4),o=[0,0,0];for(let s=n;s<i;s++)this.encodePickingColor(s,o),Fh[s*4+0]=o[0],Fh[s*4+1]=o[1],Fh[s*4+2]=o[2],Fh[s*4+3]=0}e.value=Fh.subarray(0,r*4)}_setModelAttributes(e,r,n=!1){if(!Object.keys(r).length)return;if(n){let c=this.getAttributeManager();e.setBufferLayout(c.getBufferLayouts(e)),r=c.getAttributes()}let i=e.userData?.excludeAttributes||{},o={},s={};for(let c in r){if(i[c])continue;let l=r[c].getValue();for(let h in l){let p=l[h];p instanceof Fn?r[c].settings.isIndexed?e.setIndexBuffer(p):o[h]=p:p&&(s[h]=p)}}e.setAttributes(o),e.setConstantAttributes(s)}disablePickingIndex(e){let r=this.props.data;if(!("attributes"in r)){this._disablePickingIndex(e);return}let{pickingColors:n,instancePickingColors:i}=this.getAttributeManager().attributes,o=n||i,s=o&&r.attributes&&r.attributes[o.id];if(s&&s.value){let c=s.value,l=this.encodePickingColor(e);for(let h=0;h<r.length;h++){let p=o.getVertexOffset(h);c[p]===l[0]&&c[p+1]===l[1]&&c[p+2]===l[2]&&this._disablePickingIndex(h)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:r,instancePickingColors:n}=this.getAttributeManager().attributes,i=r||n;if(!i)return;let o=i.getVertexOffset(e),s=i.getVertexOffset(e+1);i.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let{pickingColors:e,instancePickingColors:r}=this.getAttributeManager().attributes,n=e||r;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==Fh.buffer&&(n.value=Fh.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){Qo(!this.internalState),Qo(Number.isFinite(this.props.coordinateSystem)),Gs(Eve,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new $2({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(br.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new X2(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Gs(Cve,this,this===e);let{state:r,internalState:n}=e;this!==e&&(this.internalState=n,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Gs(Mve,this,e),!e)return;let r=this.props,n=this.context,i=this.internalState,o=n.viewport,s=this._updateUniformTransition();i.propsInTransition=s,n.viewport=i.viewport||o,this.props=s;try{let c=this._getUpdateParams(),l=this.getModels();if(n.device)this.updateState(c);else try{this.updateState(c)}catch{}for(let p of this.props.extensions)p.updateState.call(this,c,p);this.setNeedsRedraw(),this._updateAttributes();let h=this.getModels()[0]!==l[0];this._postUpdate(c,h)}finally{n.viewport=o,this.props=r,this._clearChangeFlags(),i.needsUpdate=!1,i.resetOldProps()}}_finalize(){Gs(Sve,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:r=null,uniforms:n={},parameters:i={}}){this._updateAttributeTransition();let o=this.props,s=this.context;this.props=this.internalState.propsInTransition||o;try{r&&this.setShaderModuleProps(r);let{getPolygonOffset:c}=this.props,l=c&&c(n)||[0,0];s.device instanceof Fc&&s.device.setParametersWebGL({polygonOffset:l});for(let h of this.getModels())h.device.type==="webgpu"?h.setParameters({...h.parameters,...i}):h.setParameters(i);if(s.device instanceof Fc)s.device.withParametersWebGL(i,()=>{let h={renderPass:e,shaderModuleProps:r,uniforms:n,parameters:i,context:s};for(let p of this.props.extensions)p.draw.call(this,h,p);this.draw(h)});else{let h={renderPass:e,shaderModuleProps:r,uniforms:n,parameters:i,context:s};for(let p of this.props.extensions)p.draw.call(this,h,p);this.draw(h)}}finally{this.props=o}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let i in e)if(e[i]){let o=!1;switch(i){case"dataChanged":let s=e[i],c=r[i];s&&Array.isArray(c)&&(r.dataChanged=Array.isArray(s)?c.concat(s):s,o=!0);default:r[i]||(r[i]=e[i],o=!0)}o&&Gs(Tve,this,i,e)}let n=Boolean(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=n,r.somethingChanged=n||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,r){let n=vq(e,r);if(n.updateTriggersChanged)for(let i in n.updateTriggersChanged)n.updateTriggersChanged[i]&&this.invalidateAttribute(i);if(n.transitionsChanged)for(let i in n.transitionsChanged)this.internalState.uniformTransitions.add(i,r[i],e[i],e.transitions?.[i]);return this.setChangeFlags(n)}validateProps(){xq(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(r.highlightColor=n(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new pu(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:n,oldProps:i}=e,o=this.state.model;o?.isInstanced&&o.setInstanceCount(this.getNumInstances());let{autoHighlight:s,highlightedObjectIndex:c,highlightColor:l}=n;if(r||i.autoHighlight!==s||i.highlightedObjectIndex!==c||i.highlightColor!==l){let h={};Array.isArray(l)&&(h.highlightColor=l),(r||i.autoHighlight!==s||c!==i.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(c)&&c>=0?this.encodePickingColor(c):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let n=this.getAttributeManager(),i=n?n.getNeedsRedraw(e):!1;if(r=r||i,r)for(let o of this.props.extensions)o.onNeedsRedraw.call(this,o);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}};Q2.defaultProps=Rve;Q2.layerName="Layer";var qi=Q2;var Lve="compositeLayer.renderLayers",ZS=class extends qi{get isComposite(){return!0}get isDrawable(){return!1}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:n}=this.props;return n&&n[e]&&n[e].type||r}getSubLayerRow(e,r,n){return e.__source={parent:this,object:r,index:n},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(n,i)=>n&&n.__source?(r.index=n.__source.index,e(n.__source.object,r)):e(n,i)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:n,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:c,autoHighlight:l,highlightColor:h,coordinateSystem:p,coordinateOrigin:x,wrapLongitude:w,positionFormat:E,modelMatrix:C,extensions:B,fetch:D,operation:W,_subLayerProps:X}=this.props,q={id:"",updateTriggers:{},opacity:r,pickable:n,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:c,autoHighlight:l,highlightColor:h,coordinateSystem:p,coordinateOrigin:x,wrapLongitude:w,positionFormat:E,modelMatrix:C,extensions:B,fetch:D,operation:W},$=X&&e.id&&X[e.id],te=$&&$.updateTriggers,F=e.id||"sublayer";if($){let ue=this.props[Qu],oe=e.type?e.type._propTypes:{};for(let J in $){let G=oe[J]||ue[J];G&&G.type==="accessor"&&($[J]=this.getSubLayerAccessor($[J]))}}Object.assign(q,e,$),q.id=`${this.props.id}-${F}`,q.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...te};for(let ue of B){let oe=ue.getSubLayerProps.call(this,ue);oe&&Object.assign(q,oe,{updateTriggers:Object.assign(q.updateTriggers,oe.updateTriggers)})}return q}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let n=this.internalState.subLayers,i=!n||this.needsUpdate();if(i){let o=this.renderLayers();n=Xf(o,Boolean),this.internalState.subLayers=n}Gs(Lve,this,i,n);for(let o of n)o.parent=this}};ZS.layerName="CompositeLayer";var bs=ZS;var $S=Math.PI/180,Cq=180/Math.PI,QS=6370972,_y=256;function Ove(){let t=_y/QS,e=Math.PI/180*_y;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var zh=class extends wa{constructor(e={}){let{longitude:r=0,zoom:n=0,nearZMultiplier:i=.5,farZMultiplier:o=1,resolution:s=10}=e,{latitude:c=0,height:l,altitude:h=1.5,fovy:p}=e;c=Math.max(Math.min(c,Ku),-Ku),l=l||1,p?h=Yp(p):p=Xp(h);let x=1/Math.PI/Math.cos(c*Math.PI/180),w=Math.pow(2,n)*x,E=e.nearZ??i,C=e.farZ??(h+_y*2*w/l)*o,B=new zn().lookAt({eye:[0,-h,0],up:[0,0,1]});B.rotateX(c*$S),B.rotateZ(-r*$S),B.scale(w/l),super({...e,height:l,viewMatrix:B,longitude:r,latitude:c,zoom:n,distanceScales:Ove(),fovy:p,focalDistance:h,near:E,far:C}),this.scale=w,this.latitude=c,this.longitude=r,this.resolution=s}get projectionMode(){return Fa.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.z||0},n=this.unproject([0,this.height/2],r),i=this.unproject([this.width/2,0],r),o=this.unproject([this.width,this.height/2],r),s=this.unproject([this.width/2,this.height],r);return o[0]<this.longitude&&(o[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],o[0],i[0],s[0]),Math.min(n[1],o[1],i[1],s[1]),Math.max(n[0],o[0],i[0],s[0]),Math.max(n[1],o[1],i[1],s[1])]}unproject(e,{topLeft:r=!0,targetZ:n}={}){let[i,o,s]=e,c=r?o:this.height-o,{pixelUnprojectionMatrix:l}=this,h;if(Number.isFinite(s))h=wD(l,[i,c,s,1]);else{let E=wD(l,[i,c,-1,1]),C=wD(l,[i,c,1,1]),B=((n||0)/QS+1)*_y,D=zc.sqrLen(zc.sub([],E,C)),W=zc.sqrLen(E),X=zc.sqrLen(C),$=4*((4*W*X-(D-W-X)**2)/16)/D,te=Math.sqrt(W-$),F=Math.sqrt(Math.max(0,B*B-$)),ue=(te-F)/Math.sqrt(D);h=zc.lerp([],E,C,ue)}let[p,x,w]=this.unprojectPosition(h);return Number.isFinite(s)?[p,x,w]:Number.isFinite(n)?[p,x,n]:[p,x]}projectPosition(e){let[r,n,i=0]=e,o=r*$S,s=n*$S,c=Math.cos(s),l=(i/QS+1)*_y;return[Math.sin(o)*c*l,-Math.cos(o)*c*l,Math.sin(s)*l]}unprojectPosition(e){let[r,n,i]=e,o=zc.len(e),s=Math.asin(i/o),l=Math.atan2(r,-n)*Cq,h=s*Cq,p=(o/_y-1)*QS;return[l,h,p]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let n=this.unproject(r);return{longitude:e[0]-n[0]+this.longitude,latitude:e[1]-n[1]+this.latitude}}};function wD(t,e){let r=fl.transformMat4([],e,t);return fl.scale(r,r,1/r[3]),r}var TD=Math.PI/180;function Bve({height:t,focalDistance:e,orbitAxis:r,rotationX:n,rotationOrbit:i,zoom:o}){let s=r==="Z"?[0,0,1]:[0,1,0],c=r==="Z"?[0,-e,0]:[0,0,e],l=new zn().lookAt({eye:c,up:s});l.rotateX(n*TD),r==="Z"?l.rotateZ(i*TD):l.rotateY(i*TD);let h=Math.pow(2,o)/t;return l.scale(h),l}var _0=class extends wa{constructor(e){let{height:r,projectionMatrix:n,fovy:i=50,orbitAxis:o="Z",target:s=[0,0,0],rotationX:c=0,rotationOrbit:l=0,zoom:h=0}=e,p=n?n[5]/2:Yp(i);super({...e,longitude:void 0,viewMatrix:Bve({height:r||1,focalDistance:p,orbitAxis:o,rotationX:c,rotationOrbit:l,zoom:h}),fovy:i,focalDistance:p,position:s,zoom:h}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:r=!0}={}){let[n,i,o=this.projectedCenter[2]]=e,s=r?i:this.height-i,[c,l,h]=Zu([n,s,o],this.pixelUnprojectionMatrix);return[c,l,h]}panByPosition(e,r){let n=this.project(e),i=[this.width/2+n[0]-r[0],this.height/2+n[1]-r[1],this.projectedCenter[2]];return{target:this.unproject(i)}}};var Dve=new zn().lookAt({eye:[0,0,1]});function Nve({width:t,height:e,near:r,far:n,padding:i}){let o=-t/2,s=t/2,c=-e/2,l=e/2;if(i){let{left:h=0,right:p=0,top:x=0,bottom:w=0}=i,E=ro((h+t-p)/2,0,t)-t/2,C=ro((x+e-w)/2,0,e)-e/2;o-=E,s-=E,c+=C,l+=C}return new zn().ortho({left:o,right:s,bottom:c,top:l,near:r,far:n})}var y0=class extends wa{constructor(e){let{width:r,height:n,near:i=.1,far:o=1e3,zoom:s=0,target:c=[0,0,0],padding:l=null,flipY:h=!0}=e,p=Array.isArray(s)?s[0]:s,x=Array.isArray(s)?s[1]:s,w=Math.min(p,x),E=Math.pow(2,w),C;if(p!==x){let B=Math.pow(2,p),D=Math.pow(2,x);C={unitsPerMeter:[B/E,D/E,1],metersPerUnit:[E/B,E/D,1]}}super({...e,longitude:void 0,position:c,viewMatrix:Dve.clone().scale([E,E*(h?-1:1),E]),projectionMatrix:Nve({width:r||1,height:n||1,padding:l,near:i,far:o}),zoom:w,distanceScales:C})}projectFlat([e,r]){let{unitsPerMeter:n}=this.distanceScales;return[e*n[0],r*n[1]]}unprojectFlat([e,r]){let{metersPerUnit:n}=this.distanceScales;return[e*n[0],r*n[1]]}panByPosition(e,r){let n=Zu(r,this.pixelUnprojectionMatrix),i=this.projectFlat(e),o=ba.add([],i,ba.negate([],n)),s=ba.add([],this.center,o);return{target:this.unprojectFlat(s)}}};var x0=class extends wa{constructor(e){let{longitude:r,latitude:n,modelMatrix:i,bearing:o=0,pitch:s=0,up:c=[0,0,1]}=e,h=new Rh({bearing:o,pitch:s===-90?1e-4:90+s}).toVector3().normalize(),p=i?new zn(i).transformAsVector(h):h,x=Number.isFinite(n)?d2({latitude:n}):0,w=Math.pow(2,x),E=new zn().lookAt({eye:[0,0,0],center:p,up:c}).scale(w);super({...e,zoom:x,viewMatrix:E}),this.latitude=n,this.longitude=r}};var v0=20,Pq=500,J2=class extends rd{constructor(e){let{width:r,height:n,position:i=[0,0,0],bearing:o=0,pitch:s=0,longitude:c=null,latitude:l=null,maxPitch:h=90,minPitch:p=-90,startRotatePos:x,startBearing:w,startPitch:E,startZoomPosition:C,startPanPos:B,startPanPosition:D}=e;super({width:r,height:n,position:i,bearing:o,pitch:s,longitude:c,latitude:l,maxPitch:h,minPitch:p},{startRotatePos:x,startBearing:w,startPitch:E,startZoomPosition:C,startPanPos:B,startPanPosition:D}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:r}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:r})}pan({pos:e}){if(!e)return this;let{startPanPos:r=[0,0],startPanPosition:n=[0,0]}=this.getState(),{width:i,height:o,bearing:s,pitch:c}=this.getViewportProps(),l=Pq*(e[0]-r[0])/i,h=Pq*(e[1]-r[1])/o,p=new Rh({bearing:s,pitch:c}),x=new Rh({bearing:s,pitch:-90}),w=p.toVector3().normalize(),E=x.toVector3().cross(w).normalize();return this._getUpdatedState({position:new ur(n).add(E.scale(l)).add(w.scale(h))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:i,startBearing:o,startPitch:s}=this.getState(),{width:c,height:l}=this.getViewportProps();if(!i||o===void 0||s===void 0)return this;let h;if(e){let p=(e[0]-i[0])/c,x=(e[1]-i[1])/l;h={bearing:o-p*180,pitch:s-x*90}}else h={bearing:o-r,pitch:s-n};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:r}){let n=this.getViewportProps(),i=this.getState().startZoomPosition||n.position,o=this.makeViewport(n),{projectionMatrix:s,width:c}=o,h=2*Math.atan(1/s[0])*(e[0]/c-.5),p=this.getDirection(!0);return this._move(p.rotateZ({radians:-h}),Math.log2(r)*v0,i)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=v0){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:Math.PI/2}),e)}moveRight(e=v0){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=v0){let r=this.getDirection(!0);return this._move(r,e)}moveDown(e=v0){let r=this.getDirection(!0);return this._move(r.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=v0){return this._move(new ur(0,0,1),e)}zoomOut(e=v0){return this._move(new ur(0,0,-1),e)}shortestPathFrom(e){let r=e.getViewportProps(),n={...this.getViewportProps()},{bearing:i,longitude:o}=n;return Math.abs(i-r.bearing)>180&&(n.bearing=i<0?i+360:i-360),o!==null&&r.longitude!==null&&Math.abs(o-r.longitude)>180&&(n.longitude=o<0?o+360:o-360),n}_move(e,r,n=this.getViewportProps().position){let i=e.scale(r);return this._getUpdatedState({position:new ur(n).add(i)})}getDirection(e=!1){return new Rh({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new J2({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:r,maxPitch:n,minPitch:i,longitude:o,bearing:s}=e;return e.pitch=ro(r,i,n),o!==null&&(o<-180||o>180)&&(e.longitude=c0(o+180,360)-180),(s<-180||s>180)&&(e.bearing=c0(s+180,360)-180),e}},b0=class extends dl{constructor(){super(...arguments),this.ControllerState=J2,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["position","pitch","bearing"])}}};var JS=class extends pl{constructor(e={}){super(e)}getViewportType(){return x0}get ControllerType(){return b0}};JS.displayName="FirstPersonView";var Iq=JS;var eb=class extends rd{constructor(e){let{width:r,height:n,rotationX:i=0,rotationOrbit:o=0,target:s=[0,0,0],zoom:c=0,minRotationX:l=-90,maxRotationX:h=90,minZoom:p=-1/0,maxZoom:x=1/0,startPanPosition:w,startRotatePos:E,startRotationX:C,startRotationOrbit:B,startZoomPosition:D,startZoom:W}=e;super({width:r,height:n,rotationX:i,rotationOrbit:o,target:s,zoom:c,minRotationX:l,maxRotationX:h,minZoom:p,maxZoom:x},{startPanPosition:w,startRotatePos:E,startRotationX:C,startRotationOrbit:B,startZoomPosition:D,startZoom:W}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:r}){let n=this.getState().startPanPosition||r;if(!n)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:i,startRotationX:o,startRotationOrbit:s}=this.getState(),{width:c,height:l}=this.getViewportProps();if(!i||o===void 0||s===void 0)return this;let h;if(e){let p=(e[0]-i[0])/c,x=(e[1]-i[1])/l;(o<-90||o>90)&&(p*=-1),h={rotationX:o+x*180,rotationOrbit:s+p*180}}else h={rotationX:o+n,rotationOrbit:s+r};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let r=e.getViewportProps(),n={...this.getViewportProps()},{rotationOrbit:i}=n;return Math.abs(i-r.rotationOrbit)>180&&(n.rotationOrbit=i<0?i+360:i-360),n}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:n}){let{startZoom:i,startZoomPosition:o}=this.getState();if(o||(i=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let s=this._calculateNewZoom({scale:n,startZoom:i}),c=this.makeViewport({...this.getViewportProps(),zoom:s});return this._getUpdatedState({zoom:s,...c.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:n,minZoom:i}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=r+Math.log2(e);return ro(o,i,n)}_panFromCenter(e){let{width:r,height:n,target:i}=this.getViewportProps();return this.pan({startPosition:i,pos:[r/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:r,minZoom:n,zoom:i,maxRotationX:o,minRotationX:s,rotationOrbit:c}=e;return e.zoom=Array.isArray(i)?[ro(i[0],n,r),ro(i[1],n,r)]:ro(i,n,r),e.rotationX=ro(e.rotationX,s,o),(c<-180||c>180)&&(e.rotationOrbit=c0(c+180,360)-180),e}},w0=class extends dl{constructor(){super(...arguments),this.ControllerState=eb,this.transition={transitionDuration:300,transitionInterpolator:new Ua({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var e3=class extends pl{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}getViewportType(){return _0}get ControllerType(){return w0}};e3.displayName="OrbitView";var Rq=e3;var ED=class extends eb{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:n,minZoom:i}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=Math.log2(e);if(Array.isArray(r)){let[s,c]=r;switch(this.zoomAxis){case"X":s=ro(s+o,i,n);break;case"Y":c=ro(c+o,i,n);break;default:let l=Math.min(s+o,c+o);l<i&&(o+=i-l),l=Math.max(s+o,c+o),l>n&&(o+=n-l),s+=o,c+=o}return[s,c]}return ro(r+o,i,n)}},T0=class extends dl{constructor(){super(...arguments),this.ControllerState=ED,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var t3=class extends pl{constructor(e={}){super(e)}getViewportType(){return y0}get ControllerType(){return T0}};t3.displayName="OrthographicView";var Lq=t3;var MD=class extends O2{applyConstraints(e){let{maxZoom:r,minZoom:n,zoom:i}=e;e.zoom=ro(i,n,r);let{longitude:o,latitude:s}=e;return(o<-180||o>180)&&(e.longitude=c0(o+180,360)-180),e.latitude=ro(s,-Ku,Ku),e}},E0=class extends dl{constructor(){super(...arguments),this.ControllerState=MD,this.transition={transitionDuration:300,transitionInterpolator:new Ua(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var r3=class extends pl{constructor(e={}){super(e)}getViewportType(e){return e.zoom>12?Uc:zh}get ControllerType(){return E0}};r3.displayName="GlobeView";var Oq=r3;var tb=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&Mi(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.constructor,n={updateTriggers:{}};for(let i in r)if(i in this.props){let o=r[i],s=this.props[i];n[i]=s,o&&o.type==="accessor"&&(n.updateTriggers[i]=this.props.updateTriggers[i],typeof s=="function"&&(n[i]=this.getSubLayerAccessor(s)))}return n}initializeState(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}};tb.defaultProps={};tb.extensionName="LayerExtension";var n3=tb;var SD={bearing:0,pitch:0,position:[0,0,0]},kve={speed:1.2,curve:1.414},id=class extends td{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...kve,...e}}interpolateProps(e,r,n){let i=rD(e,r,n,this.opts);for(let o in SD)i[o]=Na(e[o]||SD[o],r[o]||SD[o],n);return i}getDuration(e,r){let{transitionDuration:n}=r;return n==="auto"&&(n=nD(e,r,this.opts)),n}};var od=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=Dh,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:n={},getGeometry:i,geometryBuffer:o,positionFormat:s,dataChanged:c,normalize:l=!0}=this.opts;if(this.data=r,this.getGeometry=i,this.positionSize=o&&o.size||(s==="XY"?2:3),this.buffers=n,this.normalize=l,o&&(Qo(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(o),l||(n.vertexPositions=o)),this.geometryBuffer=n.vertexPositions,Array.isArray(c))for(let h of c)this._rebuildGeometry(h);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?VS(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,r){let{attributes:n,buffers:i,_attributeDefs:o,typedArrayManager:s}=this;for(let c in o)if(c in i)s.release(n[c]),n[c]=null;else{let l=o[c];l.copy=r,n[c]=s.allocate(n[c],e,l)}}_forEachGeometry(e,r,n){let{data:i,getGeometry:o}=this,{iterable:s,objectInfo:c}=Ys(i,r,n);for(let l of s){c.index++;let h=o?o(l,c):null;e(h,c.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:n,instanceCount:i}=this,{data:o,geometryBuffer:s}=this,{startRow:c=0,endRow:l=1/0}=e||{},h={};if(e||(r=[0],n=[0]),this.normalize||!s)this._forEachGeometry((x,w)=>{let E=x&&this.normalizeGeometry(x);h[w]=E,n[w+1]=n[w]+(E?this.getGeometrySize(E):0)},c,l),i=n[n.length-1];else if(n=o.startIndices,i=n[o.length]||0,ArrayBuffer.isView(s))i=i||s.length/this.positionSize;else if(s instanceof Fn){let x=this.positionSize*4;i=i||s.byteLength/x}else if(s.buffer){let x=s.stride||this.positionSize*4;i=i||s.buffer.byteLength/x}else if(s.value){let x=s.value,w=s.stride/x.BYTES_PER_ELEMENT||this.positionSize;i=i||x.length/w}this._allocate(i,Boolean(e)),this.indexStarts=r,this.vertexStarts=n,this.instanceCount=i;let p={};this._forEachGeometry((x,w)=>{let E=h[w]||x;p.vertexStart=n[w],p.indexStart=r[w];let C=w<n.length-1?n[w+1]:i;p.geometrySize=C-n[w],p.geometryIndex=w,this.updateGeometryAttributes(E,p)},c,l),this.vertexCount=r[r.length-1]}};function Nl(t,e){e&&Object.entries(e).map(([r,n])=>{r.startsWith("--")?t.style.setProperty(r,n):t.style[r]=n})}function Yf(t,e){e&&Object.keys(e).map(r=>{r.startsWith("--")?t.style.removeProperty(r):t.style[r]=""})}var CD=85.05113;function ID(t,e,r,n){if(r){if(r.userData._googleMap===t)return r;i3(r)}let i={click:null,rightclick:null,dblclick:null,mousemove:null,mouseout:null},o=new dy({...n,useDevicePixels:n.interleaved?!0:n.useDevicePixels,style:n.interleaved?null:{pointerEvents:"none"},parent:Fve(e,n.style),views:new py({repeat:!0}),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1});for(let s in i)i[s]=t.addListener(s,c=>Uve(o,s,c));return o.userData._googleMap=t,o.userData._eventListeners=i,o}function Fve(t,e){let r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),"getPanes"in t?t.getPanes()?.overlayLayer.appendChild(r):t.getMap()?.getDiv().appendChild(r),r}function i3(t){let{_eventListeners:e}=t.userData;for(let r in e)e[r]&&e[r].remove();t.finalize()}function Bq(t,e){let{width:r,height:n}=Dq(t),i=e.getProjection(),o=t.getBounds();if(!o)return{width:r,height:n,left:0,top:0};let s=o.getNorthEast(),c=o.getSouthWest(),l=i.fromLatLngToDivPixel(s),h=i.fromLatLngToDivPixel(c),p=PD(i,r/2,n/2),x=new google.maps.LatLng(0,p[0]),w=i.fromLatLngToContainerPixel(x),E=i.fromLatLngToDivPixel(x);if(!l||!h||!E||!w)return{width:r,height:n,left:0,top:0};let C=Math.round(E.x-w.x),B=E.y-w.y,D=PD(i,r/2,0),W=PD(i,r/2,n),X=p[1],q=p[0];if(Math.abs(X)>CD){X=X>0?CD:-CD;let J=new google.maps.LatLng(X,q),G=i.fromLatLngToContainerPixel(J);B+=G.y-n/2}B=Math.round(B);let te=180*new t0(D).sub(W).verticalAngle()/Math.PI;te<0&&(te+=360);let F=t.getHeading()||0,ue=t.getZoom()-1,oe;if(te===0)oe=n?(h.y-l.y)/n:1;else if(te===F){let J=new t0([l.x,l.y]).sub([h.x,h.y]).len(),G=new t0([r,-n]).len();oe=G?J/G:1}return ue+=Math.log2(oe||1),{width:r,height:n,left:C,top:B,zoom:ue,bearing:te,pitch:t.getTilt(),latitude:X,longitude:q}}function RD(t,e){let{width:r,height:n}=Dq(t),{center:i,heading:o,tilt:s,zoom:c}=e.getCameraParams(),l=25,h=n?r/n:1,p=.75,x=3e14,w=new zn().perspective({fovy:l*Math.PI/180,aspect:h,near:p,far:x}),E=.5*w[5];return{width:r,height:n,viewState:{altitude:E,bearing:o,latitude:i.lat(),longitude:i.lng(),pitch:s,projectionMatrix:w,repeat:!0,zoom:c-1}}}function Dq(t){let e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function PD(t,e,r){let n=new google.maps.Point(e,r),i=t.fromContainerPixelToLatLng(n);return[i.lng(),i.lat()]}function zve(t,e){if(t.pixel)return t.pixel;let r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function Uve(t,e,r){if(!t.isInitialized)return;let n={type:e,offsetCenter:zve(r,t),srcEvent:r};switch(e){case"click":case"rightclick":n.type="click",n.tapCount=1,t._onPointerDown(n),t._onEvent(n);break;case"dblclick":n.type="click",n.tapCount=2,t._onEvent(n);break;case"mousemove":n.type="pointermove",t._onPointerMove(n);break;case"mouseout":n.type="pointerleave",t._onPointerMove(n);break;default:return}}var Vve=()=>!1,jve={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774};function Nq(){}var Hve={interleaved:!0},M0=class{constructor(e){this.props={},this._map=null,this._deck=null,this._overlay=null,this.setProps({...Hve,...e})}setMap(e){if(e===this._map)return;let{VECTOR:r,UNINITIALIZED:n}=google.maps.RenderingType;this._map&&(!e&&this._map.getRenderingType()===r&&this.props.interleaved&&this._overlay.requestRedraw(),this._overlay?.setMap(null),this._map=null),e&&(this._map=e,e.getRenderingType()!==n?this._createOverlay(e):e.addListener("renderingtype_changed",()=>{this._createOverlay(e)}))}setProps(e){if(Object.assign(this.props,e),this._deck){let r=this._deck.getCanvas();if(e.style&&r?.parentElement){let n=r.parentElement.style;Object.assign(n,e.style),e.style=null}this._deck.setProps(e)}}pickObject(e){return this._deck&&this._deck.pickObject(e)}pickMultipleObjects(e){return this._deck&&this._deck.pickMultipleObjects(e)}pickObjects(e){return this._deck&&this._deck.pickObjects(e)}finalize(){this.setMap(null),this._deck&&(i3(this._deck),this._deck=null)}_createOverlay(e){let{interleaved:r}=this.props,{VECTOR:n,UNINITIALIZED:i}=google.maps.RenderingType,o=e.getRenderingType();if(o===i)return;let c=o===n&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView,l=new c;l instanceof google.maps.WebGLOverlayView?(r?(l.onAdd=Nq,l.onContextRestored=this._onContextRestored.bind(this),l.onDraw=this._onDrawVectorInterleaved.bind(this)):(l.onAdd=this._onAdd.bind(this),l.onContextRestored=Nq,l.onDraw=this._onDrawVectorOverlay.bind(this)),l.onContextLost=this._onContextLost.bind(this)):(l.onAdd=this._onAdd.bind(this),l.draw=this._onDrawRaster.bind(this)),l.onRemove=this._onRemove.bind(this),this._overlay=l,this._overlay.setMap(e)}_onAdd(){this._deck=ID(this._map,this._overlay,this._deck,this.props)}_onContextRestored({gl:e}){if(!this._map||!this._overlay)return;let r=()=>{this._overlay&&this._overlay.requestRedraw()},n=ID(this._map,this._overlay,this._deck,{gl:e,_customRender:r,...this.props});this._deck=n;let i=n.animationLoop;i._renderFrame=()=>{let o=e.getParameter(34964);n.device.withParametersWebGL({},()=>{i.props.onRender(i.animationProps)}),e.bindBuffer(34962,o)}}_onContextLost(){this._deck&&(i3(this._deck),this._deck=null)}_onRemove(){this._deck?.setProps({layerFilter:Vve})}_onDrawRaster(){if(!this._deck||!this._map)return;let e=this._deck,{width:r,height:n,left:i,top:o,...s}=Bq(this._map,this._overlay),l=e.getCanvas()?.parentElement||e.props.parent;if(l){let p=l.style;p.left=`${i}px`,p.top=`${o}px`}let h=1e4;e.setProps({width:r,height:n,viewState:{altitude:h,...s}}),e.redraw()}_onDrawVectorInterleaved({gl:e,transformer:r}){if(!this._deck||!this._map)return;let n=this._deck;if(n.setProps({...RD(this._map,r),width:null,height:null}),n.isInitialized){let i=n.device;if(i instanceof Fc){let o=i.getParametersWebGL(36006);n.setProps({_framebuffer:o})}n.needsRedraw({clearRedrawFlags:!0}),i instanceof Fc&&(i.setParametersWebGL({viewport:[0,0,e.canvas.width,e.canvas.height],scissor:[0,0,e.canvas.width,e.canvas.height],stencilFunc:[519,0,255,519,0,255]}),i.withParametersWebGL(jve,()=>{n._drawLayers("google-vector",{clearCanvas:!1})}))}}_onDrawVectorOverlay({transformer:e}){if(!this._deck||!this._map)return;let r=this._deck;r.setProps({...RD(this._map,e)}),r.redraw()}};function kq({container:t,onClick:e,onComplete:r,getTooltip:n,googleMapsKey:i,layers:o,mapStyle:s="satellite",initialViewState:c={latitude:0,longitude:0,zoom:1}}){if(!i)return br.warn("No Google Maps API key set")(),null;let l=new M0({layers:o}),h={center:{lat:c.latitude,lng:c.longitude},mapTypeId:s,zoom:c.zoom},p=new window.google.maps.Map(t,h);return l.setMap(p),l}var Fq={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1};var LD=class{constructor({container:e,props:r}){let{description:n}=r,i=document.createElement("div");i.className="deck-json-description-box",Object.assign(i.style,Fq),this.el=i;let o=document.createElement("div");o.innerHTML=n,i.appendChild(o),e.append(i)}remove(){this.el.remove(),this.description=null}static get stringName(){return"description"}},zq=LD;function OD(t,e){let r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);let n=[];for(let i of Object.keys(e))switch(i){case"description":let o=new zq({container:r,props:e});n.push(o);break;default:break}return n}var Gw={};Mo(Gw,{AmbientLight:()=>oy,ArcLayer:()=>s3,Attribute:()=>nd,AttributeManager:()=>pu,BitmapLayer:()=>a3,COORDINATE_SYSTEM:()=>Hr,CPUAggregator:()=>ml,ColumnLayer:()=>Kf,CompassWidget:()=>MI,CompositeLayer:()=>bs,ContourLayer:()=>FY,Controller:()=>dl,DarkGlassTheme:()=>TDe,DarkTheme:()=>bDe,Deck:()=>dy,DeckRenderer:()=>A0,DirectionalLight:()=>Kp,FirstPersonController:()=>b0,FirstPersonView:()=>Iq,FirstPersonViewport:()=>x0,FlyToInterpolator:()=>id,FullscreenWidget:()=>EI,GeoJsonLayer:()=>I0,GeohashLayer:()=>Jie,GoogleMapsOverlay:()=>M0,GreatCircleLayer:()=>ZK,GridCellLayer:()=>RG,GridLayer:()=>HY,H3ClusterLayer:()=>JZ,H3HexagonLayer:()=>aC,HeatmapLayer:()=>aK,HexagonLayer:()=>oY,IconLayer:()=>yy,JSONConfiguration:()=>bd,JSONConverter:()=>cg,Layer:()=>qi,LayerExtension:()=>n3,LayerManager:()=>p0,LightGlassTheme:()=>wDe,LightTheme:()=>vDe,LightingEffect:()=>ym,LineLayer:()=>cG,LinearInterpolator:()=>Ua,MVTLayer:()=>Kie,MapController:()=>m0,MapView:()=>py,OPERATION:()=>pW,OrbitController:()=>w0,OrbitView:()=>Rq,OrbitViewport:()=>_0,OrthographicController:()=>T0,OrthographicView:()=>Lq,OrthographicViewport:()=>y0,PathLayer:()=>Zf,PointCloudLayer:()=>c3,PointLight:()=>ly,PolygonLayer:()=>Cm,PostProcessEffect:()=>S2,QuadkeyLayer:()=>uZ,ResetViewWidget:()=>dg,S2Layer:()=>cZ,ScatterplotLayer:()=>l3,ScenegraphLayer:()=>DC,ScreenGridLayer:()=>YX,ScreenshotWidget:()=>pg,SimpleMeshLayer:()=>U0,SolidPolygonLayer:()=>Sm,TRANSITION_EVENTS:()=>R2,TerrainLayer:()=>Aie,Tesselator:()=>od,TextLayer:()=>S3,Tile3DLayer:()=>lie,TileLayer:()=>k0,TransitionInterpolator:()=>td,Transport:()=>ap,TripsLayer:()=>IZ,UNIT:()=>Do,VERSION:()=>bM,View:()=>pl,Viewport:()=>wa,WebGLAggregator:()=>na,WebMercatorViewport:()=>Uc,ZoomWidget:()=>fg,_AggregationLayer:()=>$f,_CameraLight:()=>y2,_Component:()=>gy,_ComponentState:()=>g0,_GeoCellLayer:()=>Qf,_GlobeController:()=>E0,_GlobeView:()=>Oq,_GlobeViewport:()=>zh,_LayersPass:()=>Bh,_MultiIconLayer:()=>T3,_PickLayersPass:()=>$p,_SunLight:()=>x2,_TextBackgroundLayer:()=>M3,_Tile2DHeader:()=>B0,_Tileset2D:()=>N0,_WMSLayer:()=>Uy,_WidgetImpl:()=>Yh,_applyStyles:()=>Nl,_compareProps:()=>Ay,_components:()=>s5,_convertFunctions:()=>N1,_count:()=>YS,_deepEqual:()=>Mi,_fillArray:()=>NS,_flatten:()=>Xf,_getURLFromTemplate:()=>ep,_memoize:()=>Xu,_mergeShaders:()=>Y2,_parseExpressionString:()=>ag,_removeStyles:()=>Yf,_shallowEqualObjects:()=>uoe,assert:()=>Qo,createIterable:()=>Ys,fp64LowPart:()=>oD,getShaderAssembler:()=>ES,gouraudLighting:()=>oS,log:()=>br,phongLighting:()=>sS,picking:()=>So,project:()=>gm,project32:()=>Ei,shadow:()=>iy});var Uq=`uniform arcUniforms {
|
|
2729
2729
|
bool greatCircle;
|
|
2730
2730
|
bool useShortestPath;
|
|
2731
2731
|
float numSegments;
|
|
@@ -4304,7 +4304,7 @@ fragColor = vFillColor;
|
|
|
4304
4304
|
}
|
|
4305
4305
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
4306
4306
|
}
|
|
4307
|
-
`;var cbe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},Pb=class extends qi{getShaders(){return super.getShaders({vs:EX,fs:MX,modules:[Ei,So,TX]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:r}=e;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:r,sizeScale:n,sizeUnits:i,sizeMinPixels:o,sizeMaxPixels:s,getLineWidth:c}=this.props,{padding:l,borderRadius:h}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),Array.isArray(h)||(h=[h,h,h,h]);let p=this.state.model,x={billboard:r,stroked:Boolean(c),borderRadius:h,padding:l,sizeUnits:Do[i],sizeScale:n,sizeMinPixels:o,sizeMaxPixels:s};p.shaderInputs.setProps({textBackground:x}),p.draw(this.context.renderPass)}_getModel(){let e=[0,0,1,0,0,1,1,1];return new jn(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Si({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}};Pb.defaultProps=cbe;Pb.layerName="TextBackgroundLayer";var M3=Pb;var SX={start:1,middle:0,end:-1},CX={top:1,center:0,bottom:-1},GD=[0,0,0,255],lbe=1,ube={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:GD},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:P0.characterSet},fontFamily:P0.fontFamily,fontWeight:P0.fontWeight,lineHeight:lbe,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:GD},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:GD},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},Ib=class extends bs{constructor(){super(...arguments),this.getBoundingRect=(e,r)=>{let{size:[n,i]}=this.transformParagraph(e,r),{fontSize:o}=this.state.fontAtlasManager.props;n/=o,i/=o;let{getTextAnchor:s,getAlignmentBaseline:c}=this.props,l=SX[typeof s=="function"?s(e,r):s],h=CX[typeof c=="function"?c(e,r):c];return[(l-1)*n/2,(h-1)*i/2,n,i]},this.getIconOffsets=(e,r)=>{let{getTextAnchor:n,getAlignmentBaseline:i}=this.props,{x:o,y:s,rowWidth:c,size:[l,h]}=this.transformParagraph(e,r),p=SX[typeof n=="function"?n(e,r):n],x=CX[typeof i=="function"?i(e,r):i],w=o.length,E=new Array(w*2),C=0;for(let B=0;B<w;B++){let D=(1-p)*(l-c[B])/2;E[C++]=(p-1)*l/2+D+o[B],E[C++]=(x-1)*h/2+s[B]}return E}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Cb},this.props.maxWidth>0&&br.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){let{props:r,oldProps:n,changeFlags:i}=e;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==n.lineHeight||r.wordBreak!==n.wordBreak||r.maxWidth!==n.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:r,fontWeight:n}=this.props,{fontAtlasManager:i,characterSet:o}=this.state,s={...e,characterSet:o,fontFamily:r,fontWeight:n};if(!i.mapping)return i.setProps(s),!0;for(let c in s)if(s[c]!==i.props[c])return i.setProps(s),!0;return!1}_updateText(){let{data:e,characterSet:r}=this.props,n=e.attributes?.getText,{getText:i}=this.props,o=e.startIndices,s,c=r==="auto"&&new Set;if(n&&o){let{texts:l,characterCount:h}=AX({...ArrayBuffer.isView(n)?{value:n}:n,length:e.length,startIndices:o,characterSet:c});s=h,i=(p,{index:x})=>l[x]}else{let{iterable:l,objectInfo:h}=Ys(e);o=[0],s=0;for(let p of l){h.index++;let x=Array.from(i(p,h)||"");c&&x.forEach(c.add,c),s+=x.length,o.push(s)}}this.setState({getText:i,startIndices:o,numInstances:s,characterSet:c||r})}transformParagraph(e,r){let{fontAtlasManager:n}=this.state,i=n.mapping,o=this.state.getText,{wordBreak:s,lineHeight:c,maxWidth:l}=this.props,h=o(e,r)||"";return mX(h,c,s,l*n.props.fontSize,i)}renderLayers(){let{startIndices:e,numInstances:r,getText:n,fontAtlasManager:{scale:i,atlas:o,mapping:s},styleVersion:c}=this.state,{data:l,_dataDiff:h,getPosition:p,getColor:x,getSize:w,getAngle:E,getPixelOffset:C,getBackgroundColor:B,getBorderColor:D,getBorderWidth:W,backgroundBorderRadius:X,backgroundPadding:q,background:$,billboard:te,fontSettings:F,outlineWidth:ue,outlineColor:oe,sizeScale:J,sizeUnits:G,sizeMinPixels:Ae,sizeMaxPixels:Se,transitions:ce,updateTriggers:me}=this.props,tt=this.getSubLayerClass("characters",T3),Dt=this.getSubLayerClass("background",M3);return[$&&new Dt({getFillColor:B,getLineColor:D,getLineWidth:W,borderRadius:X,padding:q,getPosition:p,getSize:w,getAngle:E,getPixelOffset:C,billboard:te,sizeScale:J,sizeUnits:G,sizeMinPixels:Ae,sizeMaxPixels:Se,transitions:ce&&{getPosition:ce.getPosition,getAngle:ce.getAngle,getSize:ce.getSize,getFillColor:ce.getBackgroundColor,getLineColor:ce.getBorderColor,getLineWidth:ce.getBorderWidth,getPixelOffset:ce.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:me.getPosition,getAngle:me.getAngle,getSize:me.getSize,getFillColor:me.getBackgroundColor,getLineColor:me.getBorderColor,getLineWidth:me.getBorderWidth,getPixelOffset:me.getPixelOffset,getBoundingRect:{getText:me.getText,getTextAnchor:me.getTextAnchor,getAlignmentBaseline:me.getAlignmentBaseline,styleVersion:c}}}),{data:l.attributes&&l.attributes.background?{length:l.length,attributes:l.attributes.background}:l,_dataDiff:h,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new tt({sdf:F.sdf,smoothing:Number.isFinite(F.smoothing)?F.smoothing:P0.smoothing,outlineWidth:ue/(F.radius||P0.radius),outlineColor:oe,iconAtlas:o,iconMapping:s,getPosition:p,getColor:x,getSize:w,getAngle:E,getPixelOffset:C,billboard:te,sizeScale:J*i,sizeUnits:G,sizeMinPixels:Ae*i,sizeMaxPixels:Se*i,transitions:ce&&{getPosition:ce.getPosition,getAngle:ce.getAngle,getColor:ce.getColor,getSize:ce.getSize,getPixelOffset:ce.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:me.getText,getPosition:me.getPosition,getAngle:me.getAngle,getColor:me.getColor,getSize:me.getSize,getPixelOffset:me.getPixelOffset,getIconOffsets:{getTextAnchor:me.getTextAnchor,getAlignmentBaseline:me.getAlignmentBaseline,styleVersion:c}}}),{data:l,_dataDiff:h,startIndices:e,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){bX(e)}};Ib.defaultProps=ube;Ib.layerName="TextLayer";var S3=Ib;var Rb={circle:{type:l3,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:yy,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:S3,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},Lb={type:Zf,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},C3={type:Sm,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function Ty({type:t,props:e}){let r={};for(let n in e)r[n]=t.defaultProps[e[n]];return r}function P3(t,e){let{transitions:r,updateTriggers:n}=t.props,i={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let o in e){let s=e[o],c=t.props[o];o.startsWith("get")&&(c=t.getSubLayerAccessor(c),i.updateTriggers[s]=n[o],r&&(i.transitions[s]=r[o])),i[s]=c}return i}function IX(t){if(Array.isArray(t))return t;switch(br.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return br.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function XD(t,e,r={}){let n={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:o=t.length}=r;for(let s=i;s<o;s++){let c=t[s],{geometry:l}=c;if(l)if(l.type==="GeometryCollection"){br.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");let{geometries:h}=l;for(let p=0;p<h.length;p++){let x=h[p];PX(x,n,e,c,s)}}else PX(l,n,e,c,s)}return n}function PX(t,e,r,n,i){let{type:o,coordinates:s}=t,{pointFeatures:c,lineFeatures:l,polygonFeatures:h,polygonOutlineFeatures:p}=e;if(!fbe(o,s)){br.warn(`${o} coordinates are malformed`)();return}switch(o){case"Point":c.push(r({geometry:t},n,i));break;case"MultiPoint":s.forEach(x=>{c.push(r({geometry:{type:"Point",coordinates:x}},n,i))});break;case"LineString":l.push(r({geometry:t},n,i));break;case"MultiLineString":s.forEach(x=>{l.push(r({geometry:{type:"LineString",coordinates:x}},n,i))});break;case"Polygon":h.push(r({geometry:t},n,i)),s.forEach(x=>{p.push(r({geometry:{type:"LineString",coordinates:x}},n,i))});break;case"MultiPolygon":s.forEach(x=>{h.push(r({geometry:{type:"Polygon",coordinates:x}},n,i)),x.forEach(w=>{p.push(r({geometry:{type:"LineString",coordinates:w}},n,i))})});break;default:}}var hbe={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function fbe(t,e){let r=hbe[t];for(br.assert(r,`Unknown GeoJSON type ${t}`);e&&--r>0;)e=e[0];return e&&Number.isFinite(e[0])}function RX(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function I3(t){return t.geometry.coordinates}function LX(t,e){let r=RX(),{pointFeatures:n,lineFeatures:i,polygonFeatures:o,polygonOutlineFeatures:s}=t;return r.points.data=n,r.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),r.points.getPosition=I3,r.lines.data=i,r.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),r.lines.getPath=I3,r.polygons.data=o,r.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),r.polygons.getPolygon=I3,r.polygonsOutline.data=s,r.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),r.polygonsOutline.getPath=I3,r}function OX(t,e){let r=RX(),{points:n,lines:i,polygons:o}=t,s=oX(t,e);return r.points.data={length:n.positions.value.length/n.positions.size,attributes:{...n.attributes,getPosition:n.positions,instancePickingColors:{size:4,value:s.points}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{...i.attributes,getPath:i.positions,instancePickingColors:{size:4,value:s.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines._pathType="open",r.polygons.data={length:o.polygonIndices.value.length-1,startIndices:o.polygonIndices.value,attributes:{...o.attributes,getPolygon:o.positions,pickingColors:{size:4,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygons._normalize=!1,o.triangles&&(r.polygons.data.attributes.indices=o.triangles.value),r.polygonsOutline.data={length:o.primitivePolygonIndices.value.length-1,startIndices:o.primitivePolygonIndices.value,attributes:{...o.attributes,getPath:o.positions,instancePickingColors:{size:4,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygonsOutline._pathType="open",r}var pbe=["points","linestrings","polygons"],dbe={...Ty(Rb.circle),...Ty(Rb.icon),...Ty(Rb.text),...Ty(Lb),...Ty(C3),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},Ob=class extends bs{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:r}){if(!r.dataChanged)return;let{data:n}=this.props,i=n&&"points"in n&&"polygons"in n&&"lines"in n;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:r}):this._updateStateJSON({props:e,changeFlags:r})}_updateStateBinary({props:e,changeFlags:r}){let n=OX(e.data,this.encodePickingColor);this.setState({layerProps:n})}_updateStateJSON({props:e,changeFlags:r}){let n=IX(e.data),i=this.getSubLayerRow.bind(this),o={},s={};if(Array.isArray(r.dataChanged)){let l=this.state.features;for(let h in l)o[h]=l[h].slice(),s[h]=[];for(let h of r.dataChanged){let p=XD(n,i,h);for(let x in l)s[x].push(w3({data:o[x],getIndex:w=>w.__source.index,dataRange:h,replace:p[x]}))}}else o=XD(n,i);let c=LX(o,s);this.setState({features:o,featuresDiff:s,layerProps:c})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:n,sourceLayer:i}=r;return r.featureType=pbe.find(o=>i.id.startsWith(`${this.id}-${o}-`)),n>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[n]),r}_updateAutoHighlight(e){let r=`${this.id}-points-`,n=e.featureType==="points";for(let i of this.getSubLayers())i.id.startsWith(r)===n&&i.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:r}=this.props,{layerProps:n}=this.state,i="polygons-fill",o=this.shouldRenderSubLayer(i,n.polygons?.data)&&this.getSubLayerClass(i,C3.type);if(o){let s=P3(this,C3.props),c=e&&r;return c||delete s.getLineColor,s.updateTriggers.lineColors=c,new o(s,this.getSubLayerProps({id:i,updateTriggers:s.updateTriggers}),n.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:r}=this.props,{layerProps:n}=this.state,i="polygons-stroke",o="linestrings",s=!e&&r&&this.shouldRenderSubLayer(i,n.polygonsOutline?.data)&&this.getSubLayerClass(i,Lb.type),c=this.shouldRenderSubLayer(o,n.lines?.data)&&this.getSubLayerClass(o,Lb.type);if(s||c){let l=P3(this,Lb.props);return[s&&new s(l,this.getSubLayerProps({id:i,updateTriggers:l.updateTriggers}),n.polygonsOutline),c&&new c(l,this.getSubLayerProps({id:o,updateTriggers:l.updateTriggers}),n.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:r,binary:n}=this.state,{highlightedObjectIndex:i}=this.props;!n&&Number.isFinite(i)&&(i=r.points.data.findIndex(c=>c.__source.index===i));let o=new Set(e.split("+")),s=[];for(let c of o){let l=`points-${c}`,h=Rb[c],p=h&&this.shouldRenderSubLayer(l,r.points?.data)&&this.getSubLayerClass(l,h.type);if(p){let x=P3(this,h.props),w=r.points;if(c==="text"&&n){let{instancePickingColors:E,...C}=w.data.attributes;w={...w,data:{...w.data,attributes:C}}}s.push(new p(x,this.getSubLayerProps({id:l,updateTriggers:x.updateTriggers,highlightedObjectIndex:i}),w))}}return s}renderLayers(){let{extruded:e}=this.props,r=this._renderPolygonLayer(),n=this._renderLineLayers(),i=this._renderPointLayers();return[!e&&r,n,i,e&&r]}getSubLayerAccessor(e){let{binary:r}=this.state;return!r||typeof e!="function"?super.getSubLayerAccessor(e):(n,i)=>{let{data:o,index:s}=i,c=iX(o,s);return e(c,i)}}};Ob.layerName="GeoJsonLayer";Ob.defaultProps=dbe;var I0=Ob;function BX({pointCount:t,getBinId:e}){let r=new Map;for(let n=0;n<t;n++){let i=e(n);if(i===null)continue;let o=r.get(String(i));o?o.points.push(n):(o={id:i,index:r.size,points:[n]},r.set(String(i),o))}return Array.from(r.values())}function DX({bins:t,dimensions:e,target:r}){let n=t.length*e;(!r||r.length<n)&&(r=new Float32Array(n));for(let i=0;i<t.length;i++){let{id:o}=t[i];Array.isArray(o)?r.set(o,i*e):r[i]=o}return r}var mbe=t=>t.length,NX=(t,e)=>{let r=0;for(let n of t)r+=e(n);return r},Abe=(t,e)=>t.length===0?NaN:NX(t,e)/t.length,gbe=(t,e)=>{let r=1/0;for(let n of t){let i=e(n);i<r&&(r=i)}return r},_be=(t,e)=>{let r=-1/0;for(let n of t){let i=e(n);i>r&&(r=i)}return r},kX={COUNT:mbe,SUM:NX,MEAN:Abe,MIN:gbe,MAX:_be};function FX({bins:t,getValue:e,operation:r,target:n}){(!n||n.length<t.length)&&(n=new Float32Array(t.length));let i=1/0,o=-1/0;for(let s=0;s<t.length;s++){let{points:c}=t[s];n[s]=r(c,e),n[s]<i&&(i=n[s]),n[s]>o&&(o=n[s])}return{value:n,domain:[i,o]}}function YD(t,e,r){let n={};for(let o of t.sources||[]){let s=e[o];if(s)n[o]=ybe(s);else throw new Error(`Cannot find attribute ${o}`)}let i={};return o=>{for(let s in n)i[s]=n[s](o);return t.getValue(i,o,r)}}function ybe(t){let e=t.value,{offset:r=0,stride:n,size:i}=t.getAccessor(),o=e.BYTES_PER_ELEMENT,s=r/o,c=n?n/o:i;if(i===1)return t.isConstant?()=>e[0]:h=>{let p=s+c*h;return e[p]};let l;return t.isConstant?(l=Array.from(e),()=>l):(l=new Array(i),h=>{let p=s+c*h;for(let x=0;x<i;x++)l[x]=e[p+x];return l})}var ml=class{constructor(e){this.bins=[],this.binIds=null,this.results=[],this.dimensions=e.dimensions,this.channelCount=e.getValue.length,this.props={...e,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(e)}destroy(){}get binCount(){return this.bins.length}setProps(e){let r=this.props;if(e.binOptions&&(Mi(e.binOptions,r.binOptions,2)||this.setNeedsUpdate()),e.operations)for(let n=0;n<this.channelCount;n++)e.operations[n]!==r.operations[n]&&this.setNeedsUpdate(n);if(e.customOperations)for(let n=0;n<this.channelCount;n++)Boolean(e.customOperations[n])!==Boolean(r.customOperations[n])&&this.setNeedsUpdate(n);e.pointCount!==void 0&&e.pointCount!==r.pointCount&&this.setNeedsUpdate(),e.attributes&&(e.attributes={...r.attributes,...e.attributes}),Object.assign(this.props,e)}setNeedsUpdate(e){e===void 0?this.needsUpdate=!0:this.needsUpdate!==!0&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[e]=!0)}update(){if(this.needsUpdate===!0){this.bins=BX({pointCount:this.props.pointCount,getBinId:YD(this.props.getBin,this.props.attributes,this.props.binOptions)});let e=DX({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:e,type:"float32",size:this.dimensions}}for(let e=0;e<this.channelCount;e++)if(this.needsUpdate===!0||this.needsUpdate[e]){let r=this.props.customOperations[e]||kX[this.props.operations[e]],{value:n,domain:i}=FX({bins:this.bins,getValue:YD(this.props.getValue[e],this.props.attributes,void 0),operation:r,target:this.results[e]?.value});this.results[e]={value:n,domain:i,type:"float32",size:1},this.props.onUpdate?.({channel:e})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(e){return this.results[e]}getResultDomain(e){return this.results[e]?.domain??[1/0,-1/0]}getBin(e){let r=this.bins[e];if(!r)return null;let n=new Array(this.channelCount);for(let i=0;i<n.length;i++){let o=this.results[i];n[i]=o?.value[e]}return{id:r.id,value:n,count:r.points.length,pointIndices:r.points}}};function R3(t,e,r){return t.createFramebuffer({width:e,height:r,colorAttachments:[t.createTexture({width:e,height:r,format:"rgba32float",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}var xbe=`uniform binSorterUniforms {
|
|
4307
|
+
`;var cbe={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,borderRadius:{type:"object",value:0},padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}},Pb=class extends qi{getShaders(){return super.getShaders({vs:EX,fs:MX,modules:[Ei,So,TX]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,type:"unorm8",accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,type:"unorm8",accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(e){super.updateState(e);let{changeFlags:r}=e;r.extensionsChanged&&(this.state.model?.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){let{billboard:r,sizeScale:n,sizeUnits:i,sizeMinPixels:o,sizeMaxPixels:s,getLineWidth:c}=this.props,{padding:l,borderRadius:h}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),Array.isArray(h)||(h=[h,h,h,h]);let p=this.state.model,x={billboard:r,stroked:Boolean(c),borderRadius:h,padding:l,sizeUnits:Do[i],sizeScale:n,sizeMinPixels:o,sizeMaxPixels:s};p.shaderInputs.setProps({textBackground:x}),p.draw(this.context.renderPass)}_getModel(){let e=[0,0,1,0,0,1,1,1];return new jn(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Si({topology:"triangle-strip",vertexCount:4,attributes:{positions:{size:2,value:new Float32Array(e)}}}),isInstanced:!0})}};Pb.defaultProps=cbe;Pb.layerName="TextBackgroundLayer";var M3=Pb;var SX={start:1,middle:0,end:-1},CX={top:1,center:0,bottom:-1},GD=[0,0,0,255],lbe=1,ube={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:GD},getBorderWidth:{type:"accessor",value:0},backgroundBorderRadius:{type:"object",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:P0.characterSet},fontFamily:P0.fontFamily,fontWeight:P0.fontWeight,lineHeight:lbe,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:GD},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:GD},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}},Ib=class extends bs{constructor(){super(...arguments),this.getBoundingRect=(e,r)=>{let{size:[n,i]}=this.transformParagraph(e,r),{fontSize:o}=this.state.fontAtlasManager.props;n/=o,i/=o;let{getTextAnchor:s,getAlignmentBaseline:c}=this.props,l=SX[typeof s=="function"?s(e,r):s],h=CX[typeof c=="function"?c(e,r):c];return[(l-1)*n/2,(h-1)*i/2,n,i]},this.getIconOffsets=(e,r)=>{let{getTextAnchor:n,getAlignmentBaseline:i}=this.props,{x:o,y:s,rowWidth:c,size:[l,h]}=this.transformParagraph(e,r),p=SX[typeof n=="function"?n(e,r):n],x=CX[typeof i=="function"?i(e,r):i],w=o.length,E=new Array(w*2),C=0;for(let B=0;B<w;B++){let D=(1-p)*(l-c[B])/2;E[C++]=(p-1)*l/2+D+o[B],E[C++]=(x-1)*h/2+s[B]}return E}}initializeState(){this.state={styleVersion:0,fontAtlasManager:new Cb},this.props.maxWidth>0&&br.once(1,"v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(e){let{props:r,oldProps:n,changeFlags:i}=e;(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getText))&&this._updateText(),(this._updateFontAtlas()||r.lineHeight!==n.lineHeight||r.wordBreak!==n.wordBreak||r.maxWidth!==n.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo({info:e}){return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){let{fontSettings:e,fontFamily:r,fontWeight:n}=this.props,{fontAtlasManager:i,characterSet:o}=this.state,s={...e,characterSet:o,fontFamily:r,fontWeight:n};if(!i.mapping)return i.setProps(s),!0;for(let c in s)if(s[c]!==i.props[c])return i.setProps(s),!0;return!1}_updateText(){let{data:e,characterSet:r}=this.props,n=e.attributes?.getText,{getText:i}=this.props,o=e.startIndices,s,c=r==="auto"&&new Set;if(n&&o){let{texts:l,characterCount:h}=AX({...ArrayBuffer.isView(n)?{value:n}:n,length:e.length,startIndices:o,characterSet:c});s=h,i=(p,{index:x})=>l[x]}else{let{iterable:l,objectInfo:h}=Ys(e);o=[0],s=0;for(let p of l){h.index++;let x=Array.from(i(p,h)||"");c&&x.forEach(c.add,c),s+=x.length,o.push(s)}}this.setState({getText:i,startIndices:o,numInstances:s,characterSet:c||r})}transformParagraph(e,r){let{fontAtlasManager:n}=this.state,i=n.mapping,o=this.state.getText,{wordBreak:s,lineHeight:c,maxWidth:l}=this.props,h=o(e,r)||"";return mX(h,c,s,l*n.props.fontSize,i)}renderLayers(){let{startIndices:e,numInstances:r,getText:n,fontAtlasManager:{scale:i,atlas:o,mapping:s},styleVersion:c}=this.state,{data:l,_dataDiff:h,getPosition:p,getColor:x,getSize:w,getAngle:E,getPixelOffset:C,getBackgroundColor:B,getBorderColor:D,getBorderWidth:W,backgroundBorderRadius:X,backgroundPadding:q,background:$,billboard:te,fontSettings:F,outlineWidth:ue,outlineColor:oe,sizeScale:J,sizeUnits:G,sizeMinPixels:Ae,sizeMaxPixels:Se,transitions:ce,updateTriggers:me}=this.props,tt=this.getSubLayerClass("characters",T3),Dt=this.getSubLayerClass("background",M3);return[$&&new Dt({getFillColor:B,getLineColor:D,getLineWidth:W,borderRadius:X,padding:q,getPosition:p,getSize:w,getAngle:E,getPixelOffset:C,billboard:te,sizeScale:J,sizeUnits:G,sizeMinPixels:Ae,sizeMaxPixels:Se,transitions:ce&&{getPosition:ce.getPosition,getAngle:ce.getAngle,getSize:ce.getSize,getFillColor:ce.getBackgroundColor,getLineColor:ce.getBorderColor,getLineWidth:ce.getBorderWidth,getPixelOffset:ce.getPixelOffset}},this.getSubLayerProps({id:"background",updateTriggers:{getPosition:me.getPosition,getAngle:me.getAngle,getSize:me.getSize,getFillColor:me.getBackgroundColor,getLineColor:me.getBorderColor,getLineWidth:me.getBorderWidth,getPixelOffset:me.getPixelOffset,getBoundingRect:{getText:me.getText,getTextAnchor:me.getTextAnchor,getAlignmentBaseline:me.getAlignmentBaseline,styleVersion:c}}}),{data:l.attributes&&l.attributes.background?{length:l.length,attributes:l.attributes.background}:l,_dataDiff:h,autoHighlight:!1,getBoundingRect:this.getBoundingRect}),new tt({sdf:F.sdf,smoothing:Number.isFinite(F.smoothing)?F.smoothing:P0.smoothing,outlineWidth:ue/(F.radius||P0.radius),outlineColor:oe,iconAtlas:o,iconMapping:s,getPosition:p,getColor:x,getSize:w,getAngle:E,getPixelOffset:C,billboard:te,sizeScale:J*i,sizeUnits:G,sizeMinPixels:Ae*i,sizeMaxPixels:Se*i,transitions:ce&&{getPosition:ce.getPosition,getAngle:ce.getAngle,getColor:ce.getColor,getSize:ce.getSize,getPixelOffset:ce.getPixelOffset}},this.getSubLayerProps({id:"characters",updateTriggers:{all:me.getText,getPosition:me.getPosition,getAngle:me.getAngle,getColor:me.getColor,getSize:me.getSize,getPixelOffset:me.getPixelOffset,getIconOffsets:{getTextAnchor:me.getTextAnchor,getAlignmentBaseline:me.getAlignmentBaseline,styleVersion:c}}}),{data:l,_dataDiff:h,startIndices:e,numInstances:r,getIconOffsets:this.getIconOffsets,getIcon:n})]}static set fontAtlasCacheLimit(e){bX(e)}};Ib.defaultProps=ube;Ib.layerName="TextLayer";var S3=Ib;var Rb={circle:{type:l3,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:yy,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:S3,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},Lb={type:Zf,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},C3={type:Sm,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function Ty({type:t,props:e}){let r={};for(let n in e)r[n]=t.defaultProps[e[n]];return r}function P3(t,e){let{transitions:r,updateTriggers:n}=t.props,i={updateTriggers:{},transitions:r&&{getPosition:r.geometry}};for(let o in e){let s=e[o],c=t.props[o];o.startsWith("get")&&(c=t.getSubLayerAccessor(c),i.updateTriggers[s]=n[o],r&&(i.transitions[s]=r[o])),i[s]=c}return i}function IX(t){if(Array.isArray(t))return t;switch(br.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return br.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}function XD(t,e,r={}){let n={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:o=t.length}=r;for(let s=i;s<o;s++){let c=t[s],{geometry:l}=c;if(l)if(l.type==="GeometryCollection"){br.assert(Array.isArray(l.geometries),"GeoJSON does not have geometries array");let{geometries:h}=l;for(let p=0;p<h.length;p++){let x=h[p];PX(x,n,e,c,s)}}else PX(l,n,e,c,s)}return n}function PX(t,e,r,n,i){let{type:o,coordinates:s}=t,{pointFeatures:c,lineFeatures:l,polygonFeatures:h,polygonOutlineFeatures:p}=e;if(!fbe(o,s)){br.warn(`${o} coordinates are malformed`)();return}switch(o){case"Point":c.push(r({geometry:t},n,i));break;case"MultiPoint":s.forEach(x=>{c.push(r({geometry:{type:"Point",coordinates:x}},n,i))});break;case"LineString":l.push(r({geometry:t},n,i));break;case"MultiLineString":s.forEach(x=>{l.push(r({geometry:{type:"LineString",coordinates:x}},n,i))});break;case"Polygon":h.push(r({geometry:t},n,i)),s.forEach(x=>{p.push(r({geometry:{type:"LineString",coordinates:x}},n,i))});break;case"MultiPolygon":s.forEach(x=>{h.push(r({geometry:{type:"Polygon",coordinates:x}},n,i)),x.forEach(w=>{p.push(r({geometry:{type:"LineString",coordinates:w}},n,i))})});break;default:}}var hbe={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function fbe(t,e){let r=hbe[t];for(br.assert(r,`Unknown GeoJSON type ${t}`);e&&--r>0;)e=e[0];return e&&Number.isFinite(e[0])}function RX(){return{points:{},lines:{},polygons:{},polygonsOutline:{}}}function I3(t){return t.geometry.coordinates}function LX(t,e){let r=RX(),{pointFeatures:n,lineFeatures:i,polygonFeatures:o,polygonOutlineFeatures:s}=t;return r.points.data=n,r.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),r.points.getPosition=I3,r.lines.data=i,r.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),r.lines.getPath=I3,r.polygons.data=o,r.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),r.polygons.getPolygon=I3,r.polygonsOutline.data=s,r.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),r.polygonsOutline.getPath=I3,r}function OX(t,e){let r=RX(),{points:n,lines:i,polygons:o}=t,s=oX(t,e);return r.points.data={length:n.positions.value.length/n.positions.size,attributes:{...n.attributes,getPosition:n.positions,instancePickingColors:{size:4,value:s.points}},properties:n.properties,numericProps:n.numericProps,featureIds:n.featureIds},r.lines.data={length:i.pathIndices.value.length-1,startIndices:i.pathIndices.value,attributes:{...i.attributes,getPath:i.positions,instancePickingColors:{size:4,value:s.lines}},properties:i.properties,numericProps:i.numericProps,featureIds:i.featureIds},r.lines._pathType="open",r.polygons.data={length:o.polygonIndices.value.length-1,startIndices:o.polygonIndices.value,attributes:{...o.attributes,getPolygon:o.positions,pickingColors:{size:4,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygons._normalize=!1,o.triangles&&(r.polygons.data.attributes.indices=o.triangles.value),r.polygonsOutline.data={length:o.primitivePolygonIndices.value.length-1,startIndices:o.primitivePolygonIndices.value,attributes:{...o.attributes,getPath:o.positions,instancePickingColors:{size:4,value:s.polygons}},properties:o.properties,numericProps:o.numericProps,featureIds:o.featureIds},r.polygonsOutline._pathType="open",r}var pbe=["points","linestrings","polygons"],dbe={...Ty(Rb.circle),...Ty(Rb.icon),...Ty(Rb.text),...Ty(Lb),...Ty(C3),stroked:!0,filled:!0,extruded:!1,wireframe:!1,_full3d:!1,iconAtlas:{type:"object",value:null},iconMapping:{type:"object",value:{}},getIcon:{type:"accessor",value:t=>t.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}},Ob=class extends bs{initializeState(){this.state={layerProps:{},features:{},featuresDiff:{}}}updateState({props:e,changeFlags:r}){if(!r.dataChanged)return;let{data:n}=this.props,i=n&&"points"in n&&"polygons"in n&&"lines"in n;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:r}):this._updateStateJSON({props:e,changeFlags:r})}_updateStateBinary({props:e,changeFlags:r}){let n=OX(e.data,this.encodePickingColor);this.setState({layerProps:n})}_updateStateJSON({props:e,changeFlags:r}){let n=IX(e.data),i=this.getSubLayerRow.bind(this),o={},s={};if(Array.isArray(r.dataChanged)){let l=this.state.features;for(let h in l)o[h]=l[h].slice(),s[h]=[];for(let h of r.dataChanged){let p=XD(n,i,h);for(let x in l)s[x].push(w3({data:o[x],getIndex:w=>w.__source.index,dataRange:h,replace:p[x]}))}}else o=XD(n,i);let c=LX(o,s);this.setState({features:o,featuresDiff:s,layerProps:c})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:n,sourceLayer:i}=r;return r.featureType=pbe.find(o=>i.id.startsWith(`${this.id}-${o}-`)),n>=0&&i.id.startsWith(`${this.id}-points-text`)&&this.state.binary&&(r.index=this.props.data.points.globalFeatureIds.value[n]),r}_updateAutoHighlight(e){let r=`${this.id}-points-`,n=e.featureType==="points";for(let i of this.getSubLayers())i.id.startsWith(r)===n&&i.updateAutoHighlight(e)}_renderPolygonLayer(){let{extruded:e,wireframe:r}=this.props,{layerProps:n}=this.state,i="polygons-fill",o=this.shouldRenderSubLayer(i,n.polygons?.data)&&this.getSubLayerClass(i,C3.type);if(o){let s=P3(this,C3.props),c=e&&r;return c||delete s.getLineColor,s.updateTriggers.lineColors=c,new o(s,this.getSubLayerProps({id:i,updateTriggers:s.updateTriggers}),n.polygons)}return null}_renderLineLayers(){let{extruded:e,stroked:r}=this.props,{layerProps:n}=this.state,i="polygons-stroke",o="linestrings",s=!e&&r&&this.shouldRenderSubLayer(i,n.polygonsOutline?.data)&&this.getSubLayerClass(i,Lb.type),c=this.shouldRenderSubLayer(o,n.lines?.data)&&this.getSubLayerClass(o,Lb.type);if(s||c){let l=P3(this,Lb.props);return[s&&new s(l,this.getSubLayerProps({id:i,updateTriggers:l.updateTriggers}),n.polygonsOutline),c&&new c(l,this.getSubLayerProps({id:o,updateTriggers:l.updateTriggers}),n.lines)]}return null}_renderPointLayers(){let{pointType:e}=this.props,{layerProps:r,binary:n}=this.state,{highlightedObjectIndex:i}=this.props;!n&&Number.isFinite(i)&&(i=r.points.data.findIndex(c=>c.__source.index===i));let o=new Set(e.split("+")),s=[];for(let c of o){let l=`points-${c}`,h=Rb[c],p=h&&this.shouldRenderSubLayer(l,r.points?.data)&&this.getSubLayerClass(l,h.type);if(p){let x=P3(this,h.props),w=r.points;if(c==="text"&&n){let{instancePickingColors:E,...C}=w.data.attributes;w={...w,data:{...w.data,attributes:C}}}s.push(new p(x,this.getSubLayerProps({id:l,updateTriggers:x.updateTriggers,highlightedObjectIndex:i}),w))}}return s}renderLayers(){let{extruded:e}=this.props,r=this._renderPolygonLayer(),n=this._renderLineLayers(),i=this._renderPointLayers();return[!e&&r,n,i,e&&r]}getSubLayerAccessor(e){let{binary:r}=this.state;return!r||typeof e!="function"?super.getSubLayerAccessor(e):(n,i)=>{let{data:o,index:s}=i,c=iX(o,s);return e(c,i)}}};Ob.layerName="GeoJsonLayer";Ob.defaultProps=dbe;var I0=Ob;function BX({pointCount:t,getBinId:e}){let r=new Map;for(let n=0;n<t;n++){let i=e(n);if(i===null)continue;let o=r.get(String(i));o?o.points.push(n):(o={id:i,index:r.size,points:[n]},r.set(String(i),o))}return Array.from(r.values())}function DX({bins:t,dimensions:e,target:r}){let n=t.length*e;(!r||r.length<n)&&(r=new Float32Array(n));for(let i=0;i<t.length;i++){let{id:o}=t[i];Array.isArray(o)?r.set(o,i*e):r[i]=o}return r}var mbe=t=>t.length,NX=(t,e)=>{let r=0;for(let n of t)r+=e(n);return r},Abe=(t,e)=>t.length===0?NaN:NX(t,e)/t.length,gbe=(t,e)=>{let r=1/0;for(let n of t){let i=e(n);i<r&&(r=i)}return r},_be=(t,e)=>{let r=-1/0;for(let n of t){let i=e(n);i>r&&(r=i)}return r},kX={COUNT:mbe,SUM:NX,MEAN:Abe,MIN:gbe,MAX:_be};function FX({bins:t,getValue:e,operation:r,target:n}){(!n||n.length<t.length)&&(n=new Float32Array(t.length));let i=1/0,o=-1/0;for(let s=0;s<t.length;s++){let{points:c}=t[s];n[s]=r(c,e),n[s]<i&&(i=n[s]),n[s]>o&&(o=n[s])}return{value:n,domain:[i,o]}}function YD(t,e,r){let n={};for(let o of t.sources||[]){let s=e[o];if(s)n[o]=ybe(s);else throw new Error(`Cannot find attribute ${o}`)}let i={};return o=>{for(let s in n)i[s]=n[s](o);return t.getValue(i,o,r)}}function ybe(t){let e=t.value,{offset:r=0,stride:n,size:i}=t.getAccessor(),o=e.BYTES_PER_ELEMENT,s=r/o,c=n?n/o:i;if(i===1)return t.isConstant?()=>e[0]:h=>{let p=s+c*h;return e[p]};let l;return t.isConstant?(l=Array.from(e),()=>l):(l=new Array(i),h=>{let p=s+c*h;for(let x=0;x<i;x++)l[x]=e[p+x];return l})}var ml=class{constructor(e){this.bins=[],this.binIds=null,this.results=[],this.dimensions=e.dimensions,this.channelCount=e.getValue.length,this.props={...e,binOptions:{},pointCount:0,operations:[],customOperations:[],attributes:{}},this.needsUpdate=!0,this.setProps(e)}destroy(){}get binCount(){return this.bins.length}setProps(e){let r=this.props;if(e.binOptions&&(Mi(e.binOptions,r.binOptions,2)||this.setNeedsUpdate()),e.operations)for(let n=0;n<this.channelCount;n++)e.operations[n]!==r.operations[n]&&this.setNeedsUpdate(n);if(e.customOperations)for(let n=0;n<this.channelCount;n++)Boolean(e.customOperations[n])!==Boolean(r.customOperations[n])&&this.setNeedsUpdate(n);e.pointCount!==void 0&&e.pointCount!==r.pointCount&&this.setNeedsUpdate(),e.attributes&&(e.attributes={...r.attributes,...e.attributes}),Object.assign(this.props,e)}setNeedsUpdate(e){e===void 0?this.needsUpdate=!0:this.needsUpdate!==!0&&(this.needsUpdate=this.needsUpdate||[],this.needsUpdate[e]=!0)}update(){if(this.needsUpdate===!0){this.bins=BX({pointCount:this.props.pointCount,getBinId:YD(this.props.getBin,this.props.attributes,this.props.binOptions)});let e=DX({bins:this.bins,dimensions:this.dimensions,target:this.binIds?.value});this.binIds={value:e,type:"float32",size:this.dimensions}}for(let e=0;e<this.channelCount;e++)if(this.needsUpdate===!0||this.needsUpdate[e]){let r=this.props.customOperations[e]||kX[this.props.operations[e]],{value:n,domain:i}=FX({bins:this.bins,getValue:YD(this.props.getValue[e],this.props.attributes,void 0),operation:r,target:this.results[e]?.value});this.results[e]={value:n,domain:i,type:"float32",size:1},this.props.onUpdate?.({channel:e})}this.needsUpdate=!1}preDraw(){}getBins(){return this.binIds}getResult(e){return this.results[e]}getResultDomain(e){return this.results[e]?.domain??[1/0,-1/0]}getBin(e){let r=this.bins[e];if(!r)return null;let n=new Array(this.channelCount);for(let i=0;i<n.length;i++){let o=this.results[i];n[i]=o?.value[e]}return{id:r.id,value:n,count:r.points.length,pointIndices:r.points}}};function R3(t,e,r){return t.createFramebuffer({width:e,height:r,colorAttachments:[t.createTexture({width:e,height:r,format:"rgba32float",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest"}})]})}var xbe=`uniform binSorterUniforms {
|
|
4308
4308
|
ivec4 binIdRange;
|
|
4309
4309
|
ivec2 targetSize;
|
|
4310
4310
|
} binSorter;
|