deck.gl 9.2.3 → 9.2.5
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/dist.dev.js +21 -6
- package/dist.min.js +4 -4
- package/package.json +17 -17
package/dist.min.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
7
|
"use strict";var __exports__=(()=>{var $G=Object.create;var Tf=Object.defineProperty;var XG=Object.getOwnPropertyDescriptor;var YG=Object.getOwnPropertyNames;var KG=Object.getPrototypeOf,ZG=Object.prototype.hasOwnProperty;var JG=(e,t,r)=>t in e?Tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var ew=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var W=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ge=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yt=(e,t)=>{for(var r in t)Tf(e,r,{get:t[r],enumerable:!0})},rw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of YG(t))!ZG.call(e,s)&&s!==r&&Tf(e,s,{get:()=>t[s],enumerable:!(n=XG(t,s))||n.enumerable});return e};var bs=(e,t,r)=>(r=e!=null?$G(KG(e)):{},rw(t||!e||!e.__esModule?Tf(r,"default",{value:e,enumerable:!0}):r,e)),QG=e=>rw(Tf({},"__esModule",{value:!0}),e);var X=(e,t,r)=>(JG(e,typeof t!="symbol"?t+"":t,r),r);var sm,ij,im,oj,sw,l2=W(()=>{sm=globalThis,ij=globalThis.document||{},im=globalThis.process||{},oj=globalThis.console,sw=globalThis.navigator||{}});function om(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return Boolean(r&&r.indexOf("Electron")>=0)}var f2=W(()=>{});function hr(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||om()}var h2=W(()=>{f2()});function u2(e){return!e&&!hr()?"Node":om(e)?"Electron":(e||sw.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var iw=W(()=>{h2();f2();l2()});var d2,hi=W(()=>{l2();h2();iw();d2="4.1.0"});function cj(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var am,ow=W(()=>{am=class{constructor(t,r,n="sessionStorage"){this.storage=cj(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function aw(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function cw(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var lw=W(()=>{});function fw(e){return typeof e!="string"?e:(e=e.toUpperCase(),cm[e]||cm.WHITE)}function hw(e,t,r){return!hr&&typeof e=="string"&&(t&&(e=`\x1B[${fw(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${fw(r)+lj}m${e}\x1B[49m`)),e}var cm,lj,uw=W(()=>{hi();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(cm||(cm={}));lj=10});function dw(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),s=e;for(let i of n){let o=s[i];typeof o=="function"&&(t.find(a=>i===a)||(s[i]=o.bind(e)))}}var pw=W(()=>{});function Mf(e,t){if(!e)throw new Error(t||"Assertion failed")}var mw=W(()=>{});function go(){let e;if(hr()&&sm.performance)e=sm?.performance?.now?.();else if("hrtime"in im){let t=im?.hrtime?.();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var gw=W(()=>{hi()});function Ya(){}function vw(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return Mf(Number.isFinite(t)&&t>=0),t}function yw(e){let{logLevel:t,message:r}=e;e.logLevel=vw(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let s=typeof e.message;return Mf(s==="string"||s==="object"),Object.assign(e,{args:n},e.opts)}function hj(e,t,r){if(typeof t=="string"){let n=r.time?cw(aw(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=hw(t,r.color,r.background)}return t}function uj(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Xa,fj,xw,_w,Mr,p2=W(()=>{hi();ow();lw();uw();pw();mw();gw();Xa={debug:hr()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},fj={enabled:!0,level:0};xw={},_w={once:!0},Mr=class{constructor({id:t}={id:""}){this.VERSION=d2,this._startTs=go(),this._deltaTs=go(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new am(`__probe-${this.id}__`,fj),this.timeStamp(`${this.id} started`),dw(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((go()-this._startTs).toPrecision(10))}getDelta(){return Number((go()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,r){this._storage.setConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t){return this._getLogFunction(0,t,Xa.warn,arguments,_w)}error(t){return this._getLogFunction(0,t,Xa.error,arguments)}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r){return this._getLogFunction(t,r,Xa.log,arguments,{time:!0,once:!0})}log(t,r){return this._getLogFunction(t,r,Xa.debug,arguments)}info(t,r){return this._getLogFunction(t,r,console.info,arguments)}once(t,r){return this._getLogFunction(t,r,Xa.debug||Xa.info,arguments,_w)}table(t,r,n){return r?this._getLogFunction(t,r,console.table||Ya,n&&[n],{tag:uj(r)}):Ya}time(t,r){return this._getLogFunction(t,r,console.time?console.time:console.info)}timeEnd(t,r){return this._getLogFunction(t,r,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,r){return this._getLogFunction(t,r,console.timeStamp||Ya)}group(t,r,n={collapsed:!1}){let s=yw({logLevel:t,message:r,opts:n}),{collapsed:i}=n;return s.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(s)}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Ya)}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=vw(t)}_getLogFunction(t,r,n,s,i){if(this._shouldLog(t)){i=yw({logLevel:t,message:r,args:s,opts:i}),n=n||i.method,Mf(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=go();let o=i.tag||i.message;if(i.once&&o)if(!xw[o])xw[o]=go();else return Ya;return r=hj(this.id,i.message,i),n.bind(console,r,...i.args)}return Ya}};Mr.VERSION=d2});var Aw=W(()=>{globalThis.probe={}});var m2,Ka=W(()=>{p2();p2();Aw();m2=new Mr({id:"@probe.gl/log"})});function Rf(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var R2=W(()=>{});var yo,O2=W(()=>{R2();yo=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Rf(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Rf()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Ze,Lw=W(()=>{O2();Ze=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,s=this.stats[r];return s||(t instanceof yo?s=t:s=new yo(r,n),this.stats[r]=s),s}}});var vo=W(()=>{Lw();O2();R2()});var iv,Tm,ov=W(()=>{vo();iv=class{stats=new Map;getStats(t){return this.get(t)}get(t){return this.stats.has(t)||this.stats.set(t,new Ze({id:t})),this.stats.get(t)}},Tm=new iv});var U,Es=W(()=>{Ka();U=new Mr({id:"luma.gl"})});function _i(e="id"){av[e]=av[e]||1;let t=av[e]++;return`${e}-${t}`}var av,Gf=W(()=>{av={}});function Q7(e,t){let r={...t};for(let n in e)e[n]!==void 0&&(r[n]=e[n]);return r}var lt,ur=W(()=>{Gf();lt=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(t,r,n){if(!t)throw new Error("no device");this._device=t,this.props=Q7(r,n);let s=this.props.id!=="undefined"?this.props.id:_i(this[Symbol.toStringTag]);this.props.id=s,this.id=s,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(t){this._attachedResources.add(t)}detachResource(t){this._attachedResources.delete(t)}destroyAttachedResource(t){this._attachedResources.delete(t)&&t.destroy()}destroyAttachedResources(){for(let t of Object.values(this._attachedResources))t.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(t,r=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(t),n.get(`${r} Memory`).addCount(t),this.allocatedBytes=t}trackDeallocatedMemory(t=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${t} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let t=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];t.get("Resources Created").incrementCount(),t.get(`${r}s Created`).incrementCount(),t.get(`${r}s Active`).incrementCount()}};X(lt,"defaultProps",{id:"undefined",handle:void 0,userData:void 0})});var jf,at,Mm=W(()=>{ur();jf=class extends lt{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(t,r){let n={...r};(r.usage||0)&jf.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?n.indexType="uint32":r.data instanceof Uint16Array&&(n.indexType="uint16")),delete n.data,super(t,n,jf.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=t.incrementTimestamp()}clone(t){return this.device.createBuffer({...this.props,...t})}debugData=new ArrayBuffer(0);_setDebugData(t,r,n){let s=ArrayBuffer.isView(t)?t.buffer:t,i=Math.min(t?t.byteLength:n,jf.DEBUG_DATA_MAX_LENGTH);s===null?this.debugData=new ArrayBuffer(i):r===0&&n===s.byteLength?this.debugData=s.slice(0,i):this.debugData=s.slice(r,r+i)}},at=jf;X(at,"INDEX",16),X(at,"VERTEX",32),X(at,"UNIFORM",64),X(at,"STORAGE",128),X(at,"INDIRECT",256),X(at,"QUERY_RESOLVE",512),X(at,"MAP_READ",1),X(at,"MAP_WRITE",2),X(at,"COPY_SRC",4),X(at,"COPY_DST",8),X(at,"DEBUG_DATA_MAX_LENGTH",32),X(at,"defaultProps",{...lt.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0})});function qf(e){let[t,r,n]=lv[e],s=e.includes("norm"),i=!s&&!e.startsWith("float"),o=e.startsWith("s");return{signedType:t,primitiveType:r,byteLength:n,normalized:s,integer:i,signed:o}}function cv(e){let t=e;switch(t){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return t}}function $C(e,t){switch(t){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}function Eo(e){let t=ArrayBuffer.isView(e)?e.constructor:e;if(t===Uint8ClampedArray)return"uint8";let r=Object.values(lv).find(n=>t===n[4]);if(!r)throw new Error(t.name);return r[0]}function So(e){let[,,,,t]=lv[e];return t}var lv,$f=W(()=>{lv={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]}});function rc(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[r,n]=e.split("x"),s=r,i=n?parseInt(n):1,o=qf(s),a={type:s,components:i,byteLength:o.byteLength*i,integer:o.integer,signed:o.signed,normalized:o.normalized};return t&&(a.webglOnly=!0),a}function XC(e,t,r){let n=r?cv(e):e;switch(n){case"unorm8":return t===1?"unorm8":t===3?"unorm8x3-webgl":`${n}x${t}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(t===1||t===3)throw new Error(`size: ${t}`);return`${n}x${t}`;default:return t===1?n:`${n}x${t}`}}function fv(e,t,r){if(!t||t>4)throw new Error(`size ${t}`);let n=t,s=Eo(e);return XC(s,n,r)}function YC(e){let t;switch(e.primitiveType){case"f32":t="float32";break;case"i32":t="sint32";break;case"u32":t="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return e.components===1?t:`${t}x${e.components}`}var Em=W(()=>{$f()});function mv(e){let t=sq[e];if(!t)throw new Error(`Unsupported texture format ${e}`);return t}var Je,kt,$n,tq,Sm,hv,wm,uv,eq,dv,Xf,pv,Cm,KC,rq,nq,sq,ZC=W(()=>{Je="texture-compression-bc",kt="texture-compression-astc",$n="texture-compression-etc2",tq="texture-compression-etc1-webgl",Sm="texture-compression-pvrtc-webgl",hv="texture-compression-atc-webgl",wm="float32-renderable-webgl",uv="float16-renderable-webgl",eq="rgb9e5ufloat-renderable-webgl",dv="snorm8-renderable-webgl",Xf="norm16-renderable-webgl",pv="snorm16-renderable-webgl",Cm="float32-filterable",KC="float16-filterable-webgl";rq={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:dv},rg8snorm:{render:dv},"rgb8snorm-webgl":{},rgba8snorm:{render:dv},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:Xf},rg16unorm:{render:Xf},"rgb16unorm-webgl":{f:Xf},rgba16unorm:{render:Xf},r16snorm:{f:pv},rg16snorm:{render:pv},"rgb16snorm-webgl":{f:Xf},rgba16snorm:{render:pv},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:uv,filter:"float16-filterable-webgl"},rg16float:{render:uv,filter:KC},rgba16float:{render:uv,filter:KC},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:wm,filter:Cm},rg32float:{render:!1,filter:Cm},"rgb32float-webgl":{render:wm,filter:Cm},rgba32float:{render:wm,filter:Cm},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:eq},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:wm},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}},nq={"bc1-rgb-unorm-webgl":{f:Je},"bc1-rgb-unorm-srgb-webgl":{f:Je},"bc1-rgba-unorm":{f:Je},"bc1-rgba-unorm-srgb":{f:Je},"bc2-rgba-unorm":{f:Je},"bc2-rgba-unorm-srgb":{f:Je},"bc3-rgba-unorm":{f:Je},"bc3-rgba-unorm-srgb":{f:Je},"bc4-r-unorm":{f:Je},"bc4-r-snorm":{f:Je},"bc5-rg-unorm":{f:Je},"bc5-rg-snorm":{f:Je},"bc6h-rgb-ufloat":{f:Je},"bc6h-rgb-float":{f:Je},"bc7-rgba-unorm":{f:Je},"bc7-rgba-unorm-srgb":{f:Je},"etc2-rgb8unorm":{f:$n},"etc2-rgb8unorm-srgb":{f:$n},"etc2-rgb8a1unorm":{f:$n},"etc2-rgb8a1unorm-srgb":{f:$n},"etc2-rgba8unorm":{f:$n},"etc2-rgba8unorm-srgb":{f:$n},"eac-r11unorm":{f:$n},"eac-r11snorm":{f:$n},"eac-rg11unorm":{f:$n},"eac-rg11snorm":{f:$n},"astc-4x4-unorm":{f:kt},"astc-4x4-unorm-srgb":{f:kt},"astc-5x4-unorm":{f:kt},"astc-5x4-unorm-srgb":{f:kt},"astc-5x5-unorm":{f:kt},"astc-5x5-unorm-srgb":{f:kt},"astc-6x5-unorm":{f:kt},"astc-6x5-unorm-srgb":{f:kt},"astc-6x6-unorm":{f:kt},"astc-6x6-unorm-srgb":{f:kt},"astc-8x5-unorm":{f:kt},"astc-8x5-unorm-srgb":{f:kt},"astc-8x6-unorm":{f:kt},"astc-8x6-unorm-srgb":{f:kt},"astc-8x8-unorm":{f:kt},"astc-8x8-unorm-srgb":{f:kt},"astc-10x5-unorm":{f:kt},"astc-10x5-unorm-srgb":{f:kt},"astc-10x6-unorm":{f:kt},"astc-10x6-unorm-srgb":{f:kt},"astc-10x8-unorm":{f:kt},"astc-10x8-unorm-srgb":{f:kt},"astc-10x10-unorm":{f:kt},"astc-10x10-unorm-srgb":{f:kt},"astc-12x10-unorm":{f:kt},"astc-12x10-unorm-srgb":{f:kt},"astc-12x12-unorm":{f:kt},"astc-12x12-unorm-srgb":{f:kt},"pvrtc-rgb4unorm-webgl":{f:Sm},"pvrtc-rgba4unorm-webgl":{f:Sm},"pvrtc-rbg2unorm-webgl":{f:Sm},"pvrtc-rgba2unorm-webgl":{f:Sm},"etc1-rbg-unorm-webgl":{f:tq},"atc-rgb-unorm-webgl":{f:hv},"atc-rgba-unorm-webgl":{f:hv},"atc-rgbai-unorm-webgl":{f:hv}},sq={...rq,...nq}});function JC(e){let t=aq(e);if(Ss.isCompressed(e)){t.channels="rgb",t.components=3,t.bytesPerPixel=1,t.srgb=!1,t.compressed=!0;let n=cq(e);n&&(t.blockWidth=n.blockWidth,t.blockHeight=n.blockHeight)}let r=oq.exec(e);if(r){let[,n,s,i,o,a]=r,c=`${i}${s}`,l=qf(c),f=l.byteLength*8,h=n.length,u=[f,h>=2?f:0,h>=3?f:0,h>=4?f:0];t={format:e,attachment:t.attachment,dataType:l.signedType,components:h,channels:n,integer:l.integer,signed:l.signed,normalized:l.normalized,bitsPerChannel:u,bytesPerPixel:l.byteLength*n.length,packed:t.packed,srgb:t.srgb},a==="-webgl"&&(t.webgl=!0),o==="-srgb"&&(t.srgb=!0)}return e.endsWith("-webgl")&&(t.webgl=!0),e.endsWith("-srgb")&&(t.srgb=!0),t}function aq(e){let t=mv(e),r=t.bytesPerPixel||1,n=t.bitsPerChannel||[8,8,8,8];return delete t.bitsPerChannel,delete t.bytesPerPixel,delete t.f,delete t.render,delete t.filter,delete t.blend,delete t.store,{...t,format:e,attachment:t.attachment||"color",channels:t.channels||"r",components:t.components||t.channels?.length||1,bytesPerPixel:r,bitsPerChannel:n,dataType:t.dataType||"uint8",srgb:t.srgb??!1,packed:t.packed??!1,webgl:t.webgl??!1,integer:t.integer??!1,signed:t.signed??!1,normalized:t.normalized??!1,compressed:t.compressed??!1}}function cq(e){let r=/.*-(\d+)x(\d+)-.*/.exec(e);if(r){let[,n,s]=r;return{blockWidth:Number(n),blockHeight:Number(s)}}return null}var iq,oq,Pm,Ss,gv=W(()=>{$f();ZC();iq=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],oq=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,Pm=class{getInfo(t){return JC(t)}isColor(t){return t.startsWith("rgba")||t.startsWith("bgra")||t.startsWith("rgb")}isDepthStencil(t){return t.startsWith("depth")||t.startsWith("stencil")}isCompressed(t){return iq.some(r=>t.startsWith(r))}getCapabilities(t){let r=mv(t),n={format:t,create:r.f??!0,render:r.render??!0,filter:r.filter??!0,blend:r.blend??!0,store:r.store??!0},s=JC(t),i=t.startsWith("depth")||t.startsWith("stencil"),o=s?.signed,a=s?.integer,c=s?.webgl;return n.render&&=!o,n.filter&&=!i&&!o&&!a&&!c,n}},Ss=new Pm});function QC(e){return typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement||typeof VideoFrame<"u"&&e instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}function tP(e){if(typeof ImageData<"u"&&e instanceof ImageData||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if(typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if(typeof VideoFrame<"u"&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw new Error("Unknown image type")}var eP=W(()=>{});var Yf,Kf,xv,Er,_v=W(()=>{ov();Es();Gf();Mm();Em();gv();eP();Yf=class{},Kf=class{features;disabledFeatures;constructor(t=[],r){this.features=new Set(t),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(t){return!this.disabledFeatures?.[t]&&this.features.has(t)}},xv=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=Tm;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(t){this.props={...xv.defaultProps,...t},this.id=this.props.id||_i(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(t){return rc(t)}isVertexFormatSupported(t){return!0}getTextureFormatInfo(t){return Ss.getInfo(t)}getTextureFormatCapabilities(t){let r=this._textureCaps[t];if(!r){let n=this._getDeviceTextureFormatCapabilities(t);r=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[t]=r}return r}getMipLevelCount(t,r,n=1){let s=Math.max(t,r,n);return 1+Math.floor(Math.log2(s))}isExternalImage(t){return QC(t)}getExternalImageSize(t){return tP(t)}isTextureFormatSupported(t){return this.getTextureFormatCapabilities(t).create}isTextureFormatFilterable(t){return this.getTextureFormatCapabilities(t).filter}isTextureFormatRenderable(t){return this.getTextureFormatCapabilities(t).render}isTextureFormatCompressed(t){return Ss.isCompressed(t)}pushDebugGroup(t){this.commandEncoder.pushDebugGroup(t)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(t){this.commandEncoder?.insertDebugMarker(t)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(t,r,...n){return this.props.onError(t,r)?()=>{}:U.error(t.message,r,...n)}debug(){if(this.props.debug)debugger;else{let t=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
|
|
8
|
-
or create a device with the 'debug: true' prop.`;U.once(0,t)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(t){return this.commandEncoder.beginRenderPass(t)}beginComputePass(t){return this.commandEncoder.beginComputePass(t)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(t,r){throw new Error("not implemented")}readPixelsToBufferWebGL(t,r){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,r){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(t){return t.createCanvasContext===!0?{}:t.createCanvasContext}_getDeviceTextureFormatCapabilities(t){let r=Ss.getCapabilities(t),n=i=>(typeof i=="string"?this.features.has(i):i)??!0,s=n(r.create);return{format:t,create:s,render:s&&n(r.render),filter:s&&n(r.filter),blend:s&&n(r.blend),store:s&&n(r.store)}}_normalizeBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let r={...t};if((t.usage||0)&at.INDEX&&(t.indexType||(t.data instanceof Uint32Array?r.indexType="uint32":t.data instanceof Uint16Array&&(r.indexType="uint16")),!r.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return r}},Er=xv;X(Er,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(t,r)=>{},onResize:(t,r)=>{let[n,s]=t.getDevicePixelSize();U.log(1,`${t} resized => ${n}x${s}px`)()},onPositionChange:(t,r)=>{let[n,s]=t.getPosition();U.log(1,`${t} repositioned => ${n},${s}`)()},onVisibilityChange:t=>U.log(1,`${t} Visibility changed ${t.isVisible}`)(),onDevicePixelRatioChange:(t,r)=>U.log(1,`${t} DPR changed ${r.oldRatio} => ${t.devicePixelRatio}`)(),debug:U.get("debug")||void 0,debugShaders:U.get("debug-shaders")||void 0,debugFramebuffers:Boolean(U.get("debug-framebuffers")),debugFactories:Boolean(U.get("debug-factories")),debugWebGL:Boolean(U.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0})});var lq,rP,Rm,Im,Xn,nP=W(()=>{_v();ov();Es();lq="set luma.log.level=1 (or higher) to trace rendering",rP="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Rm=class{stats=Tm;log=U;VERSION="9.2.2";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw U.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),U.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");U.error("This version of luma.gl has already been initialized")()}U.log(1,`${this.VERSION} - ${lq}`)(),globalThis.luma=this}async createDevice(t={}){let r={...Rm.defaultProps,...t},n=this.selectAdapter(r.type,r.adapters);if(!n)throw new Error(rP);return r.waitForPageLoad&&await n.pageLoaded,await n.create(r)}async attachDevice(t,r){let n=this._getTypeFromHandle(t,r.adapters),s=n&&this.selectAdapter(n,r.adapters);if(!s)throw new Error(rP);return await s?.attach?.(t,r)}registerAdapters(t){for(let r of t)this.preregisteredAdapters.set(r.type,r)}getSupportedAdapters(t=[]){let r=this._getAdapterMap(t);return Array.from(r).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(t=[]){let r=["webgpu","webgl","null"],n=this._getAdapterMap(t);for(let s of r)if(n.get(s)?.isSupported?.())return s;return null}selectAdapter(t,r=[]){let n=t;t==="best-available"&&(n=this.getBestAvailableAdapterType(r));let s=this._getAdapterMap(r);return n&&s.get(n)||null}enforceWebGL2(t=!0,r=[]){let s=this._getAdapterMap(r).get("webgl");s||U.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(t)}setDefaultDeviceProps(t){Object.assign(Rm.defaultProps,t)}_getAdapterMap(t=[]){let r=new Map(this.preregisteredAdapters);for(let n of t)r.set(n.type,n);return r}_getTypeFromHandle(t,r=[]){return t instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&t instanceof GPUDevice||t?.queue?"webgpu":t===null?"null":(t instanceof WebGLRenderingContext?U.warn("WebGL1 is not supported",t)():U.warn("Unknown handle type",t)(),null)}},Im=Rm;X(Im,"defaultProps",{...Er.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});Xn=new Im});function uq(){return Om||(hq()||typeof window>"u"?Om=Promise.resolve():Om=new Promise(e=>window.addEventListener("load",()=>e()))),Om}var Zf,fq,hq,Om,sP=W(()=>{hi();Zf=class{get pageLoaded(){return uq()}},fq=hr()&&typeof document<"u",hq=()=>fq&&document.readyState==="complete",Om=null});function iP(){let e,t;return{promise:new Promise((n,s)=>{e=n,t=s}),resolve:e,reject:t}}var oP=W(()=>{});function dq(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw new Error(`${e} is not an HTML element`);return t}return e||document.body}function pq(e){let t=document.getElementById(e);if(!wo.isHTMLCanvas(t))throw new Error("Object is not a canvas element");return t}function mq(e){let{width:t,height:r}=e,n=document.createElement("canvas");n.id=_i("lumagl-auto-created-canvas"),n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(r)?`${r}px`:"100%",e?.visible||(n.style.visibility="hidden");let s=dq(e?.container||null);return s.insertBefore(n,s.firstChild),n}function gq(e,t,r,n,s){let i=e,o=aP(i[0],t,r),a=cP(i[1],t,n,s),c=aP(i[0]+1,t,r),l=c===r-1?c:c-1;c=cP(i[1]+1,t,n,s);let f;return s?(c=c===0?c:c+1,f=a,a=c):f=c===n-1?c:c-1,{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(f-a+1,1)}}function aP(e,t,r){return Math.min(Math.round(e*t),r-1)}function cP(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var nc,wo,lP=W(()=>{hi();Gf();oP();nc=class{static isHTMLCanvas(t){return typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement}static isOffscreenCanvas(t){return typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=iP();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(t){if(this.props={...nc.defaultProps,...t},t=this.props,this.initialized=this._initializedResolvers.promise,hr()?t.canvas?typeof t.canvas=="string"?this.canvas=pq(t.canvas):this.canvas=t.canvas:this.canvas=mq(t):this.canvas={width:t.width||1,height:t.height||1},nc.isHTMLCanvas(this.canvas)?(this.id=t.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):nc.isOffscreenCanvas(this.canvas)?(this.id=t.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=t.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],nc.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(r=>this._handleIntersection(r)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(r=>this._handleResize(r));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(t){return"useDevicePixels"in t&&(this.props.useDevicePixels=t.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let t=this.device.limits.maxTextureDimension2D;return[t,t]}setDrawingBufferSize(t,r){this.canvas.width=t,this.canvas.height=r,this.drawingBufferWidth=t,this.drawingBufferHeight=r}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(t,r=!0){let n=this.cssToDeviceRatio(),[s,i]=this.getDrawingBufferSize();return gq(t,n,s,i,r)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[t,r]=this.getDevicePixelSize();return t/r}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),[r]=this.getCSSSize();return r?t/r:1}catch{return 1}}resize(t){this.setDrawingBufferSize(t.width,t.height)}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}_handleIntersection(t){let r=t.find(s=>s.target===this.canvas);if(!r)return;let n=r.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(t){let r=t.find(c=>c.target===this.canvas);if(!r)return;this.cssWidth=r.contentBoxSize[0].inlineSize,this.cssHeight=r.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),s=r.devicePixelContentBoxSize?.[0].inlineSize||r.contentBoxSize[0].inlineSize*devicePixelRatio,i=r.devicePixelContentBoxSize?.[0].blockSize||r.contentBoxSize[0].blockSize*devicePixelRatio,[o,a]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(s,o)),this.devicePixelHeight=Math.max(1,Math.min(i,a)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:n})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let t=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*t,this.cssHeight*t)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let t=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:t}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(t=100){let r=setInterval(()=>{this.destroyed?clearInterval(r):this.updatePosition()},t)}updatePosition(){let t=this.htmlCanvas?.getBoundingClientRect();if(t){let r=[t.left,t.top];if(this._position??=r,r[0]!==this._position[0]||r[1]!==this._position[1]){let s=this._position;this._position=r,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},wo=nc;X(wo,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1})});var Lm,Yr,yv=W(()=>{ur();Lm=class extends lt{get[Symbol.toStringTag](){return"Sampler"}constructor(t,r){r=Lm.normalizeProps(t,r),super(t,r,Lm.defaultProps)}static normalizeProps(t,r){return r}},Yr=Lm;X(Yr,"defaultProps",{...lt.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 xq,ws,vt,vv=W(()=>{ur();yv();Es();xq={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},ws=class extends lt{dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(t,r){if(r=ws.normalizeProps(t,r),super(t,r,ws.defaultProps),this.dimension=this.props.dimension,this.baseDimension=xq[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(t.isExternalImage(r.data)){let n=t.getExternalImageSize(r.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&U.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=t.incrementTimestamp()}setSampler(t){this.sampler=t instanceof Yr?t:this.device.createSampler(t)}clone(t){return this.device.createTexture({...this.props,...t})}static normalizeProps(t,r){let n={...r},{width:s,height:i}=n;return typeof s=="number"&&(n.width=Math.max(1,Math.ceil(s))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}_initializeData(t){this.device.isExternalImage(t)?this.copyExternalImage({image:t,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):t&&this.copyImageData({data:t,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(t){let{width:r,height:n,depth:s}=this,i={...ws.defaultCopyDataOptions,width:r,height:n,depth:s,...t},o=this.device.getTextureFormatInfo(this.format);if(!t.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return i.bytesPerRow=t.bytesPerRow||r*(o.bytesPerPixel||4),i.rowsPerImage=t.rowsPerImage||n,i}_normalizeCopyExternalImageOptions(t){let r=this.device.getExternalImageSize(t.image),n={...ws.defaultCopyExternalImageOptions,...r,...t};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},vt=ws;X(vt,"SAMPLE",4),X(vt,"STORAGE",8),X(vt,"RENDER",16),X(vt,"COPY_SRC",1),X(vt,"COPY_DST",2),X(vt,"TEXTURE",4),X(vt,"RENDER_ATTACHMENT",16),X(vt,"defaultProps",{...lt.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:ws.TEXTURE|ws.RENDER_ATTACHMENT|ws.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),X(vt,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),X(vt,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1})});var Av,yi,fP=W(()=>{ur();Av=class extends lt{get[Symbol.toStringTag](){return"TextureView"}constructor(t,r){super(t,r,Av.defaultProps)}},yi=Av;X(yi,"defaultProps",{...lt.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function hP(e,t,r){let n="",s=t.split(/\r?\n/),i=e.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(r?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++)for(n+=uP(s[a-1],a,r);i.length>o&&i[o].lineNum===a;){let c=i[o++];n+=bv(c,s,c.lineNum,{...r,inlineSource:!1})}for(;i.length>o;){let a=i[o++];n+=bv(a,[],0,{...r,inlineSource:!1})}return n;case"issues":case"no":for(let a of e)n+=bv(a,s,a.lineNum,{inlineSource:r?.showSourceCode!=="no"});return n}}function bv(e,t,r,n){if(n?.inlineSource){let i=_q(t,r),o=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^
|
|
8
|
+
or create a device with the 'debug: true' prop.`;U.once(0,t)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(t){return this.commandEncoder.beginRenderPass(t)}beginComputePass(t){return this.commandEncoder.beginComputePass(t)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(t,r){throw new Error("not implemented")}readPixelsToBufferWebGL(t,r){throw new Error("not implemented")}setParametersWebGL(t){throw new Error("not implemented")}getParametersWebGL(t){throw new Error("not implemented")}withParametersWebGL(t,r){throw new Error("not implemented")}clearWebGL(t){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(t){return t.createCanvasContext===!0?{}:t.createCanvasContext}_getDeviceTextureFormatCapabilities(t){let r=Ss.getCapabilities(t),n=i=>(typeof i=="string"?this.features.has(i):i)??!0,s=n(r.create);return{format:t,create:s,render:s&&n(r.render),filter:s&&n(r.filter),blend:s&&n(r.blend),store:s&&n(r.store)}}_normalizeBufferProps(t){(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let r={...t};if((t.usage||0)&at.INDEX&&(t.indexType||(t.data instanceof Uint32Array?r.indexType="uint32":t.data instanceof Uint16Array&&(r.indexType="uint16")),!r.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return r}},Er=xv;X(Er,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(t,r)=>{},onResize:(t,r)=>{let[n,s]=t.getDevicePixelSize();U.log(1,`${t} resized => ${n}x${s}px`)()},onPositionChange:(t,r)=>{let[n,s]=t.getPosition();U.log(1,`${t} repositioned => ${n},${s}`)()},onVisibilityChange:t=>U.log(1,`${t} Visibility changed ${t.isVisible}`)(),onDevicePixelRatioChange:(t,r)=>U.log(1,`${t} DPR changed ${r.oldRatio} => ${t.devicePixelRatio}`)(),debug:U.get("debug")||void 0,debugShaders:U.get("debug-shaders")||void 0,debugFramebuffers:Boolean(U.get("debug-framebuffers")),debugFactories:Boolean(U.get("debug-factories")),debugWebGL:Boolean(U.get("debug-webgl")),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!1,_cachePipelines:!1,_cacheDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0})});var lq,rP,Rm,Im,Xn,nP=W(()=>{_v();ov();Es();lq="set luma.log.level=1 (or higher) to trace rendering",rP="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Rm=class{stats=Tm;log=U;VERSION="9.2.4";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw U.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),U.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");U.error("This version of luma.gl has already been initialized")()}U.log(1,`${this.VERSION} - ${lq}`)(),globalThis.luma=this}async createDevice(t={}){let r={...Rm.defaultProps,...t},n=this.selectAdapter(r.type,r.adapters);if(!n)throw new Error(rP);return r.waitForPageLoad&&await n.pageLoaded,await n.create(r)}async attachDevice(t,r){let n=this._getTypeFromHandle(t,r.adapters),s=n&&this.selectAdapter(n,r.adapters);if(!s)throw new Error(rP);return await s?.attach?.(t,r)}registerAdapters(t){for(let r of t)this.preregisteredAdapters.set(r.type,r)}getSupportedAdapters(t=[]){let r=this._getAdapterMap(t);return Array.from(r).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(t=[]){let r=["webgpu","webgl","null"],n=this._getAdapterMap(t);for(let s of r)if(n.get(s)?.isSupported?.())return s;return null}selectAdapter(t,r=[]){let n=t;t==="best-available"&&(n=this.getBestAvailableAdapterType(r));let s=this._getAdapterMap(r);return n&&s.get(n)||null}enforceWebGL2(t=!0,r=[]){let s=this._getAdapterMap(r).get("webgl");s||U.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(t)}setDefaultDeviceProps(t){Object.assign(Rm.defaultProps,t)}_getAdapterMap(t=[]){let r=new Map(this.preregisteredAdapters);for(let n of t)r.set(n.type,n);return r}_getTypeFromHandle(t,r=[]){return t instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&t instanceof GPUDevice||t?.queue?"webgpu":t===null?"null":(t instanceof WebGLRenderingContext?U.warn("WebGL1 is not supported",t)():U.warn("Unknown handle type",t)(),null)}},Im=Rm;X(Im,"defaultProps",{...Er.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});Xn=new Im});function uq(){return Om||(hq()||typeof window>"u"?Om=Promise.resolve():Om=new Promise(e=>window.addEventListener("load",()=>e()))),Om}var Zf,fq,hq,Om,sP=W(()=>{hi();Zf=class{get pageLoaded(){return uq()}},fq=hr()&&typeof document<"u",hq=()=>fq&&document.readyState==="complete",Om=null});function iP(){let e,t;return{promise:new Promise((n,s)=>{e=n,t=s}),resolve:e,reject:t}}var oP=W(()=>{});function dq(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw new Error(`${e} is not an HTML element`);return t}return e||document.body}function pq(e){let t=document.getElementById(e);if(!wo.isHTMLCanvas(t))throw new Error("Object is not a canvas element");return t}function mq(e){let{width:t,height:r}=e,n=document.createElement("canvas");n.id=_i("lumagl-auto-created-canvas"),n.width=t||1,n.height=r||1,n.style.width=Number.isFinite(t)?`${t}px`:"100%",n.style.height=Number.isFinite(r)?`${r}px`:"100%",e?.visible||(n.style.visibility="hidden");let s=dq(e?.container||null);return s.insertBefore(n,s.firstChild),n}function gq(e,t,r,n,s){let i=e,o=aP(i[0],t,r),a=cP(i[1],t,n,s),c=aP(i[0]+1,t,r),l=c===r-1?c:c-1;c=cP(i[1]+1,t,n,s);let f;return s?(c=c===0?c:c+1,f=a,a=c):f=c===n-1?c:c-1,{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(f-a+1,1)}}function aP(e,t,r){return Math.min(Math.round(e*t),r-1)}function cP(e,t,r,n){return n?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var nc,wo,lP=W(()=>{hi();Gf();oP();nc=class{static isHTMLCanvas(t){return typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement}static isOffscreenCanvas(t){return typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=iP();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(t){if(this.props={...nc.defaultProps,...t},t=this.props,this.initialized=this._initializedResolvers.promise,hr()?t.canvas?typeof t.canvas=="string"?this.canvas=pq(t.canvas):this.canvas=t.canvas:this.canvas=mq(t):this.canvas={width:t.width||1,height:t.height||1},nc.isHTMLCanvas(this.canvas)?(this.id=t.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):nc.isOffscreenCanvas(this.canvas)?(this.id=t.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=t.id||"node-canvas-context",this.type="node"),this.cssWidth=this.htmlCanvas?.clientWidth||this.canvas.width,this.cssHeight=this.htmlCanvas?.clientHeight||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],nc.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(r=>this._handleIntersection(r)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(r=>this._handleResize(r));try{this._resizeObserver.observe(this.canvas,{box:"device-pixel-content-box"})}catch{this._resizeObserver.observe(this.canvas,{box:"content-box"})}setTimeout(()=>this._observeDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}}destroy(){this.destroyed=!0}setProps(t){return"useDevicePixels"in t&&(this.props.useDevicePixels=t.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){let t=this.device.limits.maxTextureDimension2D;return[t,t]}setDrawingBufferSize(t,r){this.canvas.width=t,this.canvas.height=r,this.drawingBufferWidth=t,this.drawingBufferHeight=r}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(t,r=!0){let n=this.cssToDeviceRatio(),[s,i]=this.getDrawingBufferSize();return gq(t,n,s,i,r)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[t,r]=this.getDevicePixelSize();return t/r}cssToDeviceRatio(){try{let[t]=this.getDrawingBufferSize(),[r]=this.getCSSSize();return r?t/r:1}catch{return 1}}resize(t){this.setDrawingBufferSize(t.width,t.height)}_setAutoCreatedCanvasId(t){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=t)}_handleIntersection(t){let r=t.find(s=>s.target===this.canvas);if(!r)return;let n=r.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(t){let r=t.find(c=>c.target===this.canvas);if(!r)return;this.cssWidth=r.contentBoxSize[0].inlineSize,this.cssHeight=r.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),s=r.devicePixelContentBoxSize?.[0].inlineSize||r.contentBoxSize[0].inlineSize*devicePixelRatio,i=r.devicePixelContentBoxSize?.[0].blockSize||r.contentBoxSize[0].blockSize*devicePixelRatio,[o,a]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(s,o)),this.devicePixelHeight=Math.max(1,Math.min(i,a)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:n})}_updateDrawingBufferSize(){if(this.props.autoResize){if(typeof this.props.useDevicePixels=="number"){let t=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*t,this.cssHeight*t)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._updateDevice()}this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_observeDevicePixelRatio(){let t=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:t}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(t=100){let r=setInterval(()=>{this.destroyed?clearInterval(r):this.updatePosition()},t)}updatePosition(){let t=this.htmlCanvas?.getBoundingClientRect();if(t){let r=[t.left,t.top];if(this._position??=r,r[0]!==this._position[0]||r[1]!==this._position[1]){let s=this._position;this._position=r,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},wo=nc;X(wo,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1})});var Lm,Yr,yv=W(()=>{ur();Lm=class extends lt{get[Symbol.toStringTag](){return"Sampler"}constructor(t,r){r=Lm.normalizeProps(t,r),super(t,r,Lm.defaultProps)}static normalizeProps(t,r){return r}},Yr=Lm;X(Yr,"defaultProps",{...lt.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 xq,ws,vt,vv=W(()=>{ur();yv();Es();xq={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},ws=class extends lt{dimension;baseDimension;format;width;height;depth;mipLevels;updateTimestamp;get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}constructor(t,r){if(r=ws.normalizeProps(t,r),super(t,r,ws.defaultProps),this.dimension=this.props.dimension,this.baseDimension=xq[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.props.width===void 0||this.props.height===void 0)if(t.isExternalImage(r.data)){let n=t.getExternalImageSize(r.data);this.width=n?.width||1,this.height=n?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&U.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=t.incrementTimestamp()}setSampler(t){this.sampler=t instanceof Yr?t:this.device.createSampler(t)}clone(t){return this.device.createTexture({...this.props,...t})}static normalizeProps(t,r){let n={...r},{width:s,height:i}=n;return typeof s=="number"&&(n.width=Math.max(1,Math.ceil(s))),typeof i=="number"&&(n.height=Math.max(1,Math.ceil(i))),n}_initializeData(t){this.device.isExternalImage(t)?this.copyExternalImage({image:t,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):t&&this.copyImageData({data:t,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(t){let{width:r,height:n,depth:s}=this,i={...ws.defaultCopyDataOptions,width:r,height:n,depth:s,...t},o=this.device.getTextureFormatInfo(this.format);if(!t.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return i.bytesPerRow=t.bytesPerRow||r*(o.bytesPerPixel||4),i.rowsPerImage=t.rowsPerImage||n,i}_normalizeCopyExternalImageOptions(t){let r=this.device.getExternalImageSize(t.image),n={...ws.defaultCopyExternalImageOptions,...r,...t};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},vt=ws;X(vt,"SAMPLE",4),X(vt,"STORAGE",8),X(vt,"RENDER",16),X(vt,"COPY_SRC",1),X(vt,"COPY_DST",2),X(vt,"TEXTURE",4),X(vt,"RENDER_ATTACHMENT",16),X(vt,"defaultProps",{...lt.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:ws.TEXTURE|ws.RENDER_ATTACHMENT|ws.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),X(vt,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),X(vt,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1})});var Av,yi,fP=W(()=>{ur();Av=class extends lt{get[Symbol.toStringTag](){return"TextureView"}constructor(t,r){super(t,r,Av.defaultProps)}},yi=Av;X(yi,"defaultProps",{...lt.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function hP(e,t,r){let n="",s=t.split(/\r?\n/),i=e.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(r?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++)for(n+=uP(s[a-1],a,r);i.length>o&&i[o].lineNum===a;){let c=i[o++];n+=bv(c,s,c.lineNum,{...r,inlineSource:!1})}for(;i.length>o;){let a=i[o++];n+=bv(a,[],0,{...r,inlineSource:!1})}return n;case"issues":case"no":for(let a of e)n+=bv(a,s,a.lineNum,{inlineSource:r?.showSourceCode!=="no"});return n}}function bv(e,t,r,n){if(n?.inlineSource){let i=_q(t,r),o=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^
|
|
9
9
|
`:"";return`
|
|
10
10
|
${i}${o}${e.type.toUpperCase()}: ${e.message}
|
|
11
11
|
|
|
@@ -15,7 +15,7 @@ ${i}${o}${e.type.toUpperCase()}: ${e.message}
|
|
|
15
15
|
<code style="user-select:text;"><pre>
|
|
16
16
|
${i}
|
|
17
17
|
</pre></code>`,a.style.top="10px",a.style.left="10px",a.style.position="absolute",a.style.zIndex="9999",a.style.width="100%",a.style.textAlign="left",document.body.appendChild(a),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),a.onclick=()=>{let l=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(l)}}},vi=Tv;X(vi,"defaultProps",{...lt.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0})});var Mv,Yn,mP=W(()=>{ur();vv();Es();Mv=class extends lt{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(t,r={}){super(t,r,Mv.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(t){let r=this.colorAttachments.map(s=>s.texture.clone(t)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(t);return this.device.createFramebuffer({...this.props,colorAttachments:r,depthStencilAttachment:n})}resize(t){let r=!t;if(t){let[n,s]=Array.isArray(t)?t:[t.width,t.height];r=r||s!==this.height||n!==this.width,this.width=n,this.height=s}r&&(U.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 s=this.createColorTexture(r,n);return this.attachResource(s),s.view}return r instanceof vt?r.view:r});let t=this.props.depthStencilAttachment;if(t)if(typeof t=="string"){let r=this.createDepthStencilTexture(t);this.attachResource(r),this.depthStencilAttachment=r.view}else t instanceof vt?this.depthStencilAttachment=t.view:this.depthStencilAttachment=t}createColorTexture(t,r){return this.device.createTexture({id:`${this.id}-color-attachment-${r}`,usage:vt.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(t){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:vt.RENDER_ATTACHMENT,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let s=this.colorAttachments[n].texture.clone({width:t,height:r});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=s.view,this.attachResource(s.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:t,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},Yn=Mv;X(Yn,"defaultProps",{...lt.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null})});var Ev,Kr,gP=W(()=>{ur();Ev=class extends lt{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(t,r){super(t,r,Ev.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},Kr=Ev;X(Kr,"defaultProps",{...lt.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},bindings:{},uniforms:{}})});var Co,Cs,xP=W(()=>{ur();Co=class extends lt{get[Symbol.toStringTag](){return"RenderPass"}constructor(t,r){r=Co.normalizeProps(t,r),super(t,r,Co.defaultProps)}static normalizeProps(t,r){return r}},Cs=Co;X(Cs,"defaultClearColor",[0,0,0,1]),X(Cs,"defaultClearDepth",1),X(Cs,"defaultClearStencil",0),X(Cs,"defaultProps",{...lt.defaultProps,framebuffer:null,parameters:void 0,clearColor:Co.defaultClearColor,clearColors:void 0,clearDepth:Co.defaultClearDepth,clearStencil:Co.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0})});var Sv,Po,_P=W(()=>{ur();Sv=class extends lt{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(t,r){super(t,r,Sv.defaultProps),this.shaderLayout=r.shaderLayout}},Po=Sv;X(Po,"defaultProps",{...lt.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0})});var wv,sc,yP=W(()=>{ur();wv=class extends lt{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(t,r){super(t,r,wv.defaultProps)}},sc=wv;X(sc,"defaultProps",{...lt.defaultProps,measureExecutionTime:void 0})});var Cv,ic,vP=W(()=>{ur();Cv=class extends lt{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(t,r){super(t,r,Cv.defaultProps)}},ic=Cv;X(ic,"defaultProps",{...lt.defaultProps})});function Jf(e){return Eq[e]}function Pv(e){let[t,r]=Mq[e],n=t==="i32"||t==="u32",s=t!=="u32",i=Tq[t]*r;return{primitiveType:t,components:r,byteLength:i,integer:n,signed:s}}var Tq,Mq,Eq,Sq,_Et,Bm=W(()=>{Tq={f32:4,f16:2,i32:4,u32:4},Mq={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]},Eq={f32:{type:"f32",components:1},f16:{type:"f16",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<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",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},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},Sq={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},_Et={...Sq,mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"}});function Nm(e,t){let r={};for(let n of e.attributes){let s=wq(e,t,n.name);s&&(r[n.name]=s)}return r}function AP(e,t,r=16){let n=Nm(e,t),s=new Array(r).fill(null);for(let i of Object.values(n))s[i.location]=i;return s}function wq(e,t,r){let n=Cq(e,r),s=Pq(t,r);if(!n)return null;let i=Pv(n.type),o=YC(i),a=s?.vertexFormat||o,c=rc(a);return{attributeName:s?.attributeName||n.name,bufferName:s?.bufferName||n.name,location:n.location,shaderType:n.type,primitiveType:i.primitiveType,shaderComponents:i.components,vertexFormat:a,bufferDataType:c.type,bufferComponents:c.components,normalized:c.normalized,integer:i.integer,stepMode:s?.stepMode||n.stepMode||"vertex",byteOffset:s?.byteOffset||0,byteStride:s?.byteStride||0}}function Cq(e,t){let r=e.attributes.find(n=>n.name===t);return r||U.warn(`shader layout attribute "${t}" not present in shader`),r||null}function Pq(e,t){Iq(e);let r=Rq(e,t);return r||(r=Oq(e,t),r)?r:(U.warn(`layout for attribute "${t}" not present in buffer layout`),null)}function Iq(e){for(let t of e)(t.attributes&&t.format||!t.attributes&&!t.format)&&U.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Rq(e,t){for(let r of e)if(r.format&&r.name===t)return{attributeName:r.name,bufferName:t,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function Oq(e,t){for(let r of e){let n=r.byteStride;if(typeof r.byteStride!="number")for(let i of r.attributes||[]){let o=rc(i.format);n+=o.byteLength}let s=r.attributes?.find(i=>i.attribute===t);if(s)return{attributeName:s.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:s.format,byteOffset:s.byteOffset,byteStride:n}}return null}var Iv=W(()=>{Es();Bm();Em()});var Rv,oc,bP=W(()=>{Iv();ur();Rv=class extends lt{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(t,r){super(t,r,Rv.defaultProps),this.maxVertexAttributes=t.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=AP(r.shaderLayout,r.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(t,r){this.device.reportError(new Error("constant attributes not supported"),this)()}},oc=Rv;X(oc,"defaultProps",{...lt.defaultProps,shaderLayout:void 0,bufferLayout:[]})});var Ov,ac,TP=W(()=>{ur();Ov=class extends lt{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(t,r){super(t,r,Ov.defaultProps)}},ac=Ov;X(ac,"defaultProps",{...lt.defaultProps,layout:void 0,buffers:{}})});var Lv,cc,MP=W(()=>{ur();Lv=class extends lt{get[Symbol.toStringTag](){return"QuerySet"}constructor(t,r){super(t,r,Lv.defaultProps)}},cc=Lv;X(cc,"defaultProps",{...lt.defaultProps,type:void 0,count:void 0})});function Bv(e){return(!Fm||Fm.byteLength<e)&&(Fm=new ArrayBuffer(e)),Fm}function Nv(e,t){let r=Bv(e.BYTES_PER_ELEMENT*t);return new e(r,0,t)}var Fm,Fv=W(()=>{});function Lq(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function lc(e){return Array.isArray(e)?e.length===0||typeof e[0]=="number":Lq(e)}var Dv=W(()=>{});var Bq,Dm,EP=W(()=>{$f();Bm();Fv();Dv();Es();Bq=1024,Dm=class{layout={};byteLength;constructor(t,r={}){let n=0;for(let[i,o]of Object.entries(t)){let a=Jf(o),{type:c,components:l}=a,f=l*(r?.[i]??1);n=$C(n,f);let h=n;n+=f,this.layout[i]={type:c,size:f,offset:h}}n+=(4-n%4)%4;let s=n*4;this.byteLength=Math.max(s,Bq)}getData(t){let r=Bv(this.byteLength),n={i32:new Int32Array(r),u32:new Uint32Array(r),f32:new Float32Array(r),f16:new Uint16Array(r)};for(let[s,i]of Object.entries(t)){let o=this.layout[s];if(!o){U.warn(`Supplied uniform value ${s} not present in uniform block layout`)();continue}let{type:a,size:c,offset:l}=o,f=n[a];if(c===1){if(typeof i!="number"&&typeof i!="boolean"){U.warn(`Supplied value for single component uniform ${s} is not a number: ${i}`)();continue}f[l]=Number(i)}else{if(!lc(i)){U.warn(`Supplied value for multi component / array uniform ${s} is not a numeric array: ${i}`)();continue}f.set(i,l)}}return new Uint8Array(r,0,this.byteLength)}has(t){return Boolean(this.layout[t])}get(t){return this.layout[t]}}});function SP(e,t,r=16){if(e!==t)return!1;let n=e,s=t;if(!lc(n))return!1;if(lc(s)&&n.length===s.length){for(let i=0;i<n.length;++i)if(s[i]!==n[i])return!1}return!0}function wP(e){return lc(e)?e.slice():e}var CP=W(()=>{Dv()});var km,PP=W(()=>{CP();km=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(t){if(this.name=t?.name||"unnamed",t?.name&&t?.shaderLayout){let r=t?.shaderLayout.bindings?.find(s=>s.type==="uniform"&&s.name===t?.name);if(!r)throw new Error(t?.name);let n=r;for(let s of n.uniforms||[])this.bindingLayout[s.name]=s}}setUniforms(t){for(let[r,n]of Object.entries(t))this._setUniform(r,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${n}`)}setNeedsRedraw(t){this.needsRedraw=this.needsRedraw||t}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(t,r){SP(this.uniforms[t],r)||(this.uniforms[t]=wP(r),this.modifiedUniforms[t]=!0,this.modified=!0)}}});var Qf,IP=W(()=>{Mm();Es();PP();EP();Qf=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(t){for(let[r,n]of Object.entries(t)){let s=r,i=new Dm(n.uniformTypes??{},n.uniformSizes??{});this.uniformBufferLayouts.set(s,i);let o=new km({name:r});o.setUniforms(n.defaultUniforms||{}),this.uniformBlocks.set(s,o)}}destroy(){for(let t of this.uniformBuffers.values())t.destroy()}setUniforms(t){for(let[r,n]of Object.entries(t))this.uniformBlocks.get(r)?.setUniforms(n);this.updateUniformBuffers()}getUniformBufferByteLength(t){return this.uniformBufferLayouts.get(t)?.byteLength||0}getUniformBufferData(t){let r=this.uniformBlocks.get(t)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(t)?.getData(r)}createUniformBuffer(t,r,n){n&&this.setUniforms(n);let s=this.getUniformBufferByteLength(r),i=t.createBuffer({usage:at.UNIFORM|at.COPY_DST,byteLength:s}),o=this.getUniformBufferData(r);return i.write(o),i}getManagedUniformBuffer(t,r){if(!this.uniformBuffers.get(r)){let n=this.getUniformBufferByteLength(r),s=t.createBuffer({usage:at.UNIFORM|at.COPY_DST,byteLength:n});this.uniformBuffers.set(r,s)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let t=!1;for(let r of this.uniformBlocks.keys()){let n=this.updateUniformBuffer(r);t||=n}return t&&U.log(3,`UniformStore.updateUniformBuffers(): ${t}`)(),t}updateUniformBuffer(t){let r=this.uniformBlocks.get(t),n=this.uniformBuffers.get(t),s=!1;if(n&&r?.needsRedraw){s||=r.needsRedraw;let i=this.getUniformBufferData(t);n=this.uniformBuffers.get(t),n?.write(i);let o=this.uniformBlocks.get(t)?.getAllUniforms();U.log(4,`Writing to uniform buffer ${String(t)}`,i,o)()}return s}}});var it=W(()=>{nP();sP();_v();lP();Mm();vv();fP();pP();yv();mP();gP();xP();_P();yP();vP();bP();TP();MP();IP();$f();Bm();Em();gv();Es();Fv();Iv()});var Ni,iO=W(()=>{(function(e){e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e[e.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",e[e.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",e[e.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",e[e.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",e[e.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",e[e.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",e[e.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",e[e.LINE_WEBGL=6913]="LINE_WEBGL",e[e.FILL_WEBGL=6914]="FILL_WEBGL",e[e.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",e[e.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",e[e.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",e[e.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",e[e.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",e[e.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",e[e.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",e[e.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",e[e.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",e[e.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",e[e.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",e[e.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",e[e.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",e[e.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",e[e.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",e[e.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",e[e.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",e[e.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",e[e.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",e[e.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",e[e.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",e[e.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",e[e.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",e[e.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(Ni||(Ni={}))});var oO=W(()=>{iO()});function aO(e=!0){let t=HTMLCanvasElement.prototype;if(!e&&t.originalGetContext){t.getContext=t.originalGetContext,t.originalGetContext=void 0;return}t.originalGetContext=t.getContext,t.getContext=function(r,n){if(r==="webgl"||r==="experimental-webgl"){let s=this.originalGetContext("webgl2",n);return s instanceof HTMLElement&&$J(s),s}return this.originalGetContext(r,n)}}function $J(e){e.getExtension("EXT_color_buffer_float");let t={...HJ,WEBGL_disjoint_timer_query:e.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:GJ(e),OES_vertex_array_object:jJ(e),ANGLE_instanced_arrays:qJ(e)},r=e.getExtension;e.getExtension=function(s){let i=r.call(e,s);return i||(s in t?t[s]:null)};let n=e.getSupportedExtensions;e.getSupportedExtensions=function(){return(n.apply(e)||[])?.concat(Object.keys(t))}}var HJ,GJ,jJ,qJ,cO=W(()=>{HJ={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:{}},GJ=e=>({drawBuffersWEBGL(t){return e.drawBuffers(t)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),jJ=e=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return e.createVertexArray()},deleteVertexArrayOES(t){return e.deleteVertexArray(t)},isVertexArrayOES(t){return e.isVertexArray(t)},bindVertexArrayOES(t){return e.bindVertexArray(t)}}),qJ=e=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...t){return e.drawArraysInstanced(...t)},drawElementsInstancedANGLE(...t){return e.drawElementsInstanced(...t)},vertexAttribDivisorANGLE(...t){return e.vertexAttribDivisor(...t)}})});async function m0(e,t){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",e),t&&(n.id=t),new Promise((s,i)=>{n.onload=s,n.onerror=o=>i(new Error(`Unable to load script '${e}': ${o}`)),r.appendChild(n)})}var Cb=W(()=>{});async function fO(e){if(!globalThis.SPECTOR)try{await m0(e.debugSpectorJSUrl||g0.debugSpectorJSUrl)}catch(t){U.warn(String(t))}}function hO(e){if(e={...g0,...e},!e.debugSpectorJS)return null;if(!zr&&globalThis.SPECTOR&&!globalThis.luma?.spector){U.probe(XJ,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();let{Spector:t}=globalThis.SPECTOR;zr=new t,globalThis.luma&&(globalThis.luma.spector=zr)}if(!zr)return null;if(lO||(lO=!0,zr.spyCanvases(),zr?.onCaptureStarted.add(t=>U.info("Spector capture started:",t)()),zr?.onCapture.add(t=>{U.info("Spector capture complete:",t)(),zr?.getResultUI(),zr?.resultView.display(),zr?.resultView.addCapture(t)})),e.gl){let t=e.gl,r=t.device;zr?.startCapture(e.gl,500),t.device=r,new Promise(n=>setTimeout(n,2e3)).then(n=>{U.info("Spector capture stopped after 2 seconds")(),zr?.stopCapture()})}return zr}var XJ,zr,lO,g0,Pb=W(()=>{it();Cb();XJ=1,zr=null,lO=!1,g0={debugSpectorJS:U.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/spectorjs@0.9.30/dist/spector.bundle.js",gl:void 0}});function dO(e){return e.luma=e.luma||{},e.luma}async function pO(){hr()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await m0(YJ))}function mO(e,t={}){return t.debugWebGL||t.traceWebGL?ZJ(e,t):KJ(e)}function KJ(e){let t=dO(e);return t.realContext?t.realContext:e}function ZJ(e,t){if(!globalThis.WebGLDebugUtils)return U.warn("webgl-debug not loaded")(),e;let r=dO(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...Ni,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,JJ.bind(null,t),QJ.bind(null,t));for(let o in Ni)!(o in n)&&typeof Ni[o]=="number"&&(n[o]=Ni[o]);class s{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(s,n);let i=Object.create(s);return r.realContext=e,r.debugContext=i,i.debug=!0,i}function uO(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function JJ(e,t,r,n){n=Array.from(n).map(a=>a===void 0?"undefined":a);let s=globalThis.WebGLDebugUtils.glEnumToString(t),i=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),o=`${s} in gl.${r}(${i})`;U.error(o)();debugger}function QJ(e,t,r){let n="";U.level>=1&&(n=uO(t,r),e.traceWebGL&&U.log(1,n)());for(let s of r)if(s===void 0){n=n||uO(t,r);debugger}}var YJ,Ib=W(()=>{it();oO();hi();Cb();YJ="https://unpkg.com/webgl-debug@2.0.1/index.js"});function Rb(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function he(e,t,r){return t[e]!==void 0?t[e]:r[e]}var tu,Ce,gO,Wr,xO,Qh,_O,yO,Ob,ns,Lb,vO,Bb=W(()=>{tu={[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},Ce=(e,t,r)=>t?e.enable(r):e.disable(r),gO=(e,t,r)=>e.hint(r,t),Wr=(e,t,r)=>e.pixelStorei(r,t),xO=(e,t,r)=>{let n=r===36006?36009:36008;return e.bindFramebuffer(n,t)},Qh=(e,t,r)=>{let s={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(s,t)};_O={[3042]:Ce,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:Ce,[2885]:(e,t)=>e.cullFace(t),[2929]:Ce,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:Ce,[35723]:gO,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>e.bindTransformFeedback?.(36386,t),[34229]:(e,t)=>e.bindVertexArray(t),[36006]:xO,[36010]:xO,[34964]:Qh,[36662]:Qh,[36663]:Qh,[35053]:Qh,[35055]:Qh,[2886]:(e,t)=>e.frontFace(t),[33170]:gO,[2849]:(e,t)=>e.lineWidth(t),[32823]:Ce,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:Ce,[32926]:Ce,[32928]:Ce,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:Ce,[3088]:(e,t)=>e.scissor(...t),[2960]:Ce,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[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]:(e,t)=>e.viewport(...t),[34383]:Ce,[10754]:Ce,[12288]:Ce,[12289]:Ce,[12290]:Ce,[12291]:Ce,[12292]:Ce,[12293]:Ce,[12294]:Ce,[12295]:Ce,[3333]:Wr,[3317]:Wr,[37440]:Wr,[37441]:Wr,[37443]:Wr,[3330]:Wr,[3332]:Wr,[3331]:Wr,[3314]:Wr,[32878]:Wr,[3316]:Wr,[3315]:Wr,[32877]:Wr,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(t[0],t[1]||!1),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=Rb(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=Rb(t)&&t.length===3?[...t,...t]:t;let[r,n,s,i,o,a]=t;e.stencilFuncSeparate(1028,r,n,s),e.stencilFuncSeparate(1029,i,o,a)},stencilOp:(e,t)=>{t=Rb(t)&&t.length===3?[...t,...t]:t;let[r,n,s,i,o,a]=t;e.stencilOpSeparate(1028,r,n,s),e.stencilOpSeparate(1029,i,o,a)},viewport:(e,t)=>e.viewport(...t)};yO={blendEquation:(e,t,r)=>e.blendEquationSeparate(he(32777,t,r),he(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(he(32969,t,r),he(32968,t,r),he(32971,t,r),he(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(he(32824,t,r),he(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(he(32938,t,r),he(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,he(2962,t,r),he(2967,t,r),he(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,he(34816,t,r),he(36003,t,r),he(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,he(2964,t,r),he(2965,t,r),he(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,he(34817,t,r),he(34818,t,r),he(34819,t,r))},Ob={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,s)=>e({[32773]:new Float32Array([t,r,n,s])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,s)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:s}),clearColor:(e,t,r,n,s)=>e({[3106]:new Float32Array([t,r,n,s])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,s)=>e({[3107]:[t,r,n,s]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,s)=>e({[3088]:new Int32Array([t,r,n,s])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,s)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:s}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,s)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:s}),viewport:(e,t,r,n,s)=>e({[2978]:[t,r,n,s]})},ns=(e,t)=>e.isEnabled(t),Lb={[3042]:ns,[2884]:ns,[2929]:ns,[3024]:ns,[32823]:ns,[32926]:ns,[32928]:ns,[3089]:ns,[2960]:ns,[35977]:ns},vO=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 wn(e,t){if(tQ(t))return;let r={};for(let s in t){let i=Number(s),o=_O[s];o&&(typeof o=="string"?r[o]=!0:o(e,t[s],i))}let n=e.state&&e.state.cache;if(n)for(let s in r){let i=yO[s];i(e,t,n)}}function x0(e,t=tu){if(typeof t=="number"){let s=t,i=Lb[s];return i?i(e,s):e.getParameter(s)}let r=Array.isArray(t)?t:Object.keys(t),n={};for(let s of r){let i=Lb[s];n[s]=i?i(e,Number(s)):e.getParameter(Number(s))}return n}function AO(e){wn(e,tu)}function tQ(e){for(let t in e)return!1;return!0}var Uc=W(()=>{Bb()});function TO(e,t){if(e===t)return!0;if(bO(e)&&bO(t)&&e.length===t.length){for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}return!1}function bO(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var MO=W(()=>{});function EO(e,t){let r=e[t].bind(e);e[t]=function(s){if(s===void 0||vO.has(s))return r(s);let i=Cn.get(e);return s in i.cache||(i.cache[s]=r(s)),i.enable?i.cache[s]:r(s)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function eQ(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(...i){let o=Cn.get(e),{valueChanged:a,oldValue:c}=r(o._updateCache,...i);return a&&n(...i),c},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function rQ(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let s=Cn.get(e);s.program!==n&&(t(n),s.program=n)}}var Cn,Nb=W(()=>{Uc();MO();Bb();Cn=class{static get(t){return t.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(t,r){this.gl=t,this.log=r?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(t={}){this.stateStack.push({})}pop(){let t=this.stateStack[this.stateStack.length-1];wn(this.gl,t),this.stateStack.pop()}trackState(t,r){if(this.cache=r?.copyState?x0(t):Object.assign({},tu),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.state=this,rQ(t);for(let n in Ob){let s=Ob[n];eQ(t,n,s)}EO(t,"getParameter"),EO(t,"isEnabled")}_updateCache(t){let r=!1,n,s=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let i in t){let o=t[i],a=this.cache[i];TO(o,a)||(r=!0,n=a,s&&!(i in s)&&(s[i]=a),this.cache[i]=o)}return{valueChanged:r,oldValue:n}}}});function SO(e,t,r){let n="",s={preserveDrawingBuffer:!0,...r},i=null;if(i||=e.getContext("webgl2",s),s.failIfMajorPerformanceCaveat&&(n||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),!i&&!r.failIfMajorPerformanceCaveat&&(s.failIfMajorPerformanceCaveat=!1,i=e.getContext("webgl2",s),i.luma||={},i.luma.softwareRenderer=!0),i||(i=e.getContext("webgl",{}),i&&(i=null,n||="Your browser only supports WebGL1")),!i)throw n||="Your browser does not support WebGL",new Error(`Failed to create WebGL context: ${n}`);let{onContextLost:o,onContextRestored:a}=t;return e.addEventListener("webglcontextlost",c=>o(c),!1),e.addEventListener("webglcontextrestored",c=>a(c),!1),i.luma||={},i}var wO=W(()=>{});function ss(e,t,r){return r[t]===void 0&&(r[t]=e.getExtension(t)||null),r[t]}var eu=W(()=>{});function CO(e,t){let r=e.getParameter(7936),n=e.getParameter(7937);ss(e,"WEBGL_debug_renderer_info",t);let s=t.WEBGL_debug_renderer_info,i=e.getParameter(s?s.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(s?s.UNMASKED_RENDERER_WEBGL:7937),a=i||r,c=o||n,l=e.getParameter(7938),f=PO(a,c),h=nQ(a,c),u=sQ(a,c);return{type:"webgl",gpu:f,gpuType:u,gpuBackend:h,vendor:a,renderer:c,version:l,shadingLanguage:"glsl",shadingLanguageVersion:300}}function PO(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function nQ(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function sQ(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(PO(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}var IO=W(()=>{eu()});function _0(e){switch(e){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(e))}var Fb=W(()=>{});function LO(e){return e in y0}function BO(e,t,r){return(y0[t]||[]).every(s=>ss(e,s,r))}function NO(e,t,r){let n=t.create,s=Db[t.format];return s?.gl===void 0&&(n=!1),s?.x&&(n=n&&Boolean(ss(e,s.x,r))),{format:t.format,create:n&&t.create,render:n&&t.render,filter:n&&t.filter,blend:n&&t.blend,store:n&&t.store}}function v0(e){let t=Db[e],r=uQ(e),n=Ss.getInfo(e);return n.compressed&&(t.dataFormat=r),{internalFormat:r,format:t?.dataFormat||hQ(n.channels,n.integer,n.normalized,r),type:n.dataType?_0(n.dataType):t?.types?.[0]||5121,compressed:n.compressed||!1}}function FO(e){switch(Ss.getInfo(e).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${e}`)}}function hQ(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function uQ(e){let r=Db[e]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${e}`);return r}var ru,nu,Vc,zc,iQ,oQ,aQ,cQ,lQ,RO,OO,fQ,y0,Db,Wc=W(()=>{it();eu();Fb();ru="WEBGL_compressed_texture_s3tc",nu="WEBGL_compressed_texture_s3tc_srgb",Vc="EXT_texture_compression_rgtc",zc="EXT_texture_compression_bptc",iQ="WEBGL_compressed_texture_etc",oQ="WEBGL_compressed_texture_astc",aQ="WEBGL_compressed_texture_etc1",cQ="WEBGL_compressed_texture_pvrtc",lQ="WEBGL_compressed_texture_atc",RO="EXT_texture_norm16",OO="EXT_render_snorm",fQ="EXT_color_buffer_float",y0={"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":[OO],"norm16-renderable-webgl":[RO],"snorm16-renderable-webgl":[RO,OO],"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":[ru,nu,Vc,zc],"texture-compression-bc5-webgl":[Vc],"texture-compression-bc7-webgl":[zc],"texture-compression-etc2":[iQ],"texture-compression-astc":[oQ],"texture-compression-etc1-webgl":[aQ],"texture-compression-pvrtc-webgl":[cQ],"texture-compression-atc-webgl":[lQ]};Db={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:{gl:33322,rb:!0},r16snorm:{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:{gl:33324},rg16snorm:{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:{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:{gl:32859,rb:!0},rgba16snorm:{gl:36763},"rgb32float-webgl":{gl:34837,x:fQ,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:ru},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:nu},"bc1-rgba-unorm":{gl:33777,x:ru},"bc1-rgba-unorm-srgb":{gl:35916,x:nu},"bc2-rgba-unorm":{gl:33778,x:ru},"bc2-rgba-unorm-srgb":{gl:35918,x:nu},"bc3-rgba-unorm":{gl:33779,x:ru},"bc3-rgba-unorm-srgb":{gl:35919,x:nu},"bc4-r-unorm":{gl:36283,x:Vc},"bc4-r-snorm":{gl:36284,x:Vc},"bc5-rg-unorm":{gl:36285,x:Vc},"bc5-rg-snorm":{gl:36286,x:Vc},"bc6h-rgb-ufloat":{gl:36495,x:zc},"bc6h-rgb-float":{gl:36494,x:zc},"bc7-rgba-unorm":{gl:36492,x:zc},"bc7-rgba-unorm-srgb":{gl:36493,x:zc},"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}}});var DO,A0,kO=W(()=>{it();eu();Wc();DO={"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"},A0=class extends Kf{gl;extensions;testedFeatures=new Set;constructor(t,r,n){super([],n),this.gl=t,this.extensions=r,ss(t,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let t=this.getFeatures();for(let r of t)this.has(r)&&(yield r);return[]}has(t){return this.disabledFeatures?.[t]?!1:(this.testedFeatures.has(t)||(this.testedFeatures.add(t),LO(t)&&BO(this.gl,t,this.extensions)&&this.features.add(t),this.getWebGLFeature(t)&&this.features.add(t)),this.features.has(t))}initializeFeatures(){let t=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of t)this.has(r)}getFeatures(){return[...Object.keys(DO),...Object.keys(y0)]}getWebGLFeature(t){let r=DO[t];return Boolean(typeof r=="string"?ss(this.gl,r,this.extensions):r)}}});var b0,UO=W(()=>{it();b0=class extends Yf{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 maxInterStageShaderVariables(){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(t){super(),this.gl=t}getParameter(t){return this.limits[t]===void 0&&(this.limits[t]=this.gl.getParameter(t)),this.limits[t]||0}}});function dQ(e){return e<34069?e+34069:e}function pQ(e){switch(e){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`${e}`}}var is,T0=W(()=>{it();Wc();is=class extends Yn{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(t,r){super(t,r);let n=r.handle===null;this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),n||(t._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let t=this.gl.bindFramebuffer(36160,this.handle);for(let r=0;r<this.colorAttachments.length;++r){let n=this.colorAttachments[r];if(n){let s=36064+r;this._attachTextureView(s,n)}}if(this.depthStencilAttachment){let r=FO(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 ${pQ(r)}`)}this.gl.bindFramebuffer(36160,t)}_attachTextureView(t,r){let{gl:n}=this.device,{texture:s}=r,i=r.props.baseMipLevel,o=r.props.baseArrayLayer;switch(n.bindTexture(s.glTarget,s.handle),s.glTarget){case 35866:case 32879:n.framebufferTextureLayer(36160,t,s.handle,i,o);break;case 34067:let a=dQ(o);n.framebufferTexture2D(36160,t,a,s.handle,i);break;case 3553:n.framebufferTexture2D(36160,t,3553,s.handle,i);break;default:throw new Error("Illegal texture type")}n.bindTexture(s.glTarget,null)}}});var M0,VO=W(()=>{it();T0();M0=class extends wo{device;handle=null;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(t,r){super(r),this.device=t,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this._updateDevice()}getCurrentFramebuffer(){return this._framebuffer=this._framebuffer||new is(this.device,{handle:null}),this._framebuffer}_updateDevice(){}}});function zO(e="id"){kb[e]=kb[e]||1;let t=kb[e]++;return`${e}-${t}`}var kb,WO=W(()=>{kb={}});function mQ(e){return e&at.INDEX?34963:e&at.VERTEX?34962:e&at.UNIFORM?35345:34962}function gQ(e){return e&at.INDEX||e&at.VERTEX?35044:e&at.UNIFORM?35048:35044}var Pn,E0=W(()=>{it();Pn=class extends at{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength=0;bytesUsed=0;constructor(t,r={}){super(t,r),this.device=t,this.gl=this.device.gl;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t._setWebGLDebugMetadata(this.handle,this,{spector:{...this.props,data:typeof this.props.data}}),this.glTarget=mQ(this.props.usage),this.glUsage=gQ(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)}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}_initWithData(t,r=0,n=t.byteLength+r){let s=this.glTarget;this.gl.bindBuffer(s,this.handle),this.gl.bufferData(s,n,this.glUsage),this.gl.bufferSubData(s,r,t),this.gl.bindBuffer(s,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){let r=t;t===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=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}write(t,r=0){let n=ArrayBuffer.isView(t)?t:new Uint8Array(t),s=0,i=void 0,o=36663;this.gl.bindBuffer(o,this.handle),s!==0||i!==void 0?this.gl.bufferSubData(o,r,n,s,i):this.gl.bufferSubData(o,r,n),this.gl.bindBuffer(o,null),this._setDebugData(t,r,t.byteLength)}async mapAndWriteAsync(t,r=0,n=this.byteLength-r){let s=new ArrayBuffer(n);await t(s,"copied"),this.write(s,r)}async readAsync(t=0,r){return this.readSyncWebGL(t,r)}async mapAndReadAsync(t,r=0,n){let s=await this.readAsync(r,n);return await t(s.buffer,"copied")}readSyncWebGL(t=0,r){r=r??this.byteLength-t;let n=new Uint8Array(r),s=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,t,n,s,r),this.gl.bindBuffer(36662,null),this._setDebugData(n,t,r),n}}});function GO(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let s=n.split(":");if(s.length===2){let[h,u]=s;r.push({message:u.trim(),type:HO(h),lineNum:0,linePos:0});continue}let[i,o,a,...c]=s,l=parseInt(a,10);isNaN(l)&&(l=0);let f=parseInt(o,10);isNaN(f)&&(f=0),r.push({message:c.join(":").trim(),type:HO(i),lineNum:l,linePos:f})}return r}function HO(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var jO=W(()=>{});var S0,qO=W(()=>{it();jO();S0=class extends vi{device;handle;constructor(t,r){switch(super(t,r),this.device=t,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)}t._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0,this.handle.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>(this._getCompilationStatus(),this.compilationStatus))}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return t?GO(t):[]}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)||null}async _compile(t){t=t.startsWith("#version ")?t:`#version 300 es
|
|
18
|
-
${t}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,t),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}U.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),U.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let t=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}});function XO(e,t,r,n){if(vQ(t))return n(e);let s=e;s.pushState();try{return xQ(e,t),wn(s.gl,r),n(e)}finally{s.popState()}}function xQ(e,t){let r=e,{gl:n}=r;if(t.cullMode)switch(t.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(t.frontFace&&n.frontFace(Qo("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&n.enable(34383),t.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let i=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=Qo("provokingVertex",t.provokingVertex,{first:36429,last:36430});i?.provokingVertexWEBGL(o)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let i=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=Qo("polygonMode",t.polygonMode,{fill:6914,line:6913});i?.polygonModeWEBGL(1028,o),i?.polygonModeWEBGL(1029,o)}t.polygonOffsetLine&&n.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&n.enable(12288),t.clipDistance1&&n.enable(12289),t.clipDistance2&&n.enable(12290),t.clipDistance3&&n.enable(12291),t.clipDistance4&&n.enable(12292),t.clipDistance5&&n.enable(12293),t.clipDistance6&&n.enable(12294),t.clipDistance7&&n.enable(12295)),t.depthWriteEnabled!==void 0&&n.depthMask(yQ("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(C0("depthCompare",t.depthCompare))),t.stencilWriteMask){let s=t.stencilWriteMask;n.stencilMaskSeparate(1028,s),n.stencilMaskSeparate(1029,s)}if(t.stencilReadMask&&U.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let s=t.stencilReadMask||4294967295,i=C0("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,i,0,s),n.stencilFuncSeparate(1029,i,0,s)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let s=Ub("stencilPassOperation",t.stencilPassOperation),i=Ub("stencilFailOperation",t.stencilFailOperation),o=Ub("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,i,o,s),n.stencilOpSeparate(1029,i,o,s)}switch(t.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(t.blendColorOperation||t.blendAlphaOperation){let s=$O("blendColorOperation",t.blendColorOperation||"add"),i=$O("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(s,i);let o=w0("blendColorSrcFactor",t.blendColorSrcFactor||"one"),a=w0("blendColorDstFactor",t.blendColorDstFactor||"zero"),c=w0("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),l=w0("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,a,c,l)}}function C0(e,t){return Qo(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Ub(e,t){return Qo(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function $O(e,t){return Qo(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function w0(e,t,r="color"){return Qo(e,t,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:r==="color"?32769:32771,"one-minus-constant":r==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function _Q(e,t){return`Illegal parameter ${t} for ${e}`}function Qo(e,t,r){if(!(t in r))throw new Error(_Q(e,t));return r[t]}function yQ(e,t){return t}function vQ(e){let t=!0;for(let r in e){t=!1;break}return t}var Vb=W(()=>{it();Uc()});function P0(e){let t={};return e.addressModeU&&(t[10242]=zb(e.addressModeU)),e.addressModeV&&(t[10243]=zb(e.addressModeV)),e.addressModeW&&(t[32882]=zb(e.addressModeW)),e.magFilter&&(t[10240]=Wb(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=AQ(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=C0("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function zb(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Wb(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function AQ(e,t="none"){if(!t)return Wb(e);switch(t){case"none":return Wb(e);case"nearest":switch(e){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(e){case"nearest":return 9986;case"linear":return 9987}}}var Hb=W(()=>{Vb()});var I0,YO=W(()=>{it();Hb();I0=class extends Yr{device;handle;parameters;constructor(t,r){super(t,r),this.device=t,this.parameters=P0(r),this.handle=r.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(t){for(let[r,n]of Object.entries(t)){let s=Number(r);switch(s){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,s,n);break;default:this.device.gl.samplerParameteri(this.handle,s,n);break}}}}});function Fi(e,t,r){if(bQ(t))return r(e);let{nocatch:n=!0}=t,s=Cn.get(e);s.push(),wn(e,t);let i;if(n)i=r(e),s.pop();else try{i=r(e)}finally{s.pop()}return i}function bQ(e){for(let t in e)return!1;return!0}var R0=W(()=>{Uc();Nb()});var os,Gb=W(()=>{it();os=class extends yi{device;gl;handle;texture;constructor(t,r){super(t,{...vt.defaultProps,...r}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}}});function TQ(e){switch(e){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(e)}function KO(e,t,r){return t==="cube"?34069+r:e}var as,O0=W(()=>{it();Wc();Hb();R0();Gb();as=class extends vt{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;constructor(t,r){super(t,r),this.device=t,this.gl=this.device.gl;let n=v0(this.props.format);this.glTarget=TQ(this.props.dimension),this.glInternalFormat=n.internalFormat,this.glFormat=n.format,this.glType=n.type,this.compressed=n.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:s,width:i,height:o,depth:a,mipLevels:c,glTarget:l,glInternalFormat:f}=this;switch(s){case"2d":case"cube":this.gl.texStorage2D(l,c,f,i,o);break;case"2d-array":case"3d":this.gl.texStorage3D(l,c,f,i,o,a);break;default:throw new Error(s)}this.gl.bindTexture(this.glTarget,null),this._initializeData(r.data),this.setSampler(this.props.sampler),this.view=new os(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(t){return new os(this.device,{...t,texture:this})}setSampler(t={}){super.setSampler(t);let r=P0(this.sampler.props);this._setSamplerParameters(r)}copyImageData(t){let r=this._normalizeCopyImageDataOptions(t),n=r.data,{width:s,height:i,depth:o}=this,{mipLevel:a=0,byteOffset:c=0,x:l=0,y:f=0,z:h=0}=r,{glFormat:u,glType:d,compressed:p}=this,m=KO(this.glTarget,this.dimension,o),g=this.compressed?{}:{[3314]:r.bytesPerRow,[32878]:r.rowsPerImage};this.gl.bindTexture(m,this.handle),Fi(this.gl,g,()=>{switch(this.dimension){case"2d":case"cube":p?this.gl.compressedTexSubImage2D(m,a,l,f,s,i,u,n,c):this.gl.texSubImage2D(m,a,l,f,s,i,u,d,n,c);break;case"2d-array":case"3d":p?this.gl.compressedTexSubImage3D(m,a,l,f,h,s,i,o,u,n,c):this.gl.texSubImage3D(m,a,l,f,h,s,i,o,u,d,n,c);break;default:}}),this.gl.bindTexture(m,null)}copyExternalImage(t){let r=this._normalizeCopyExternalImageOptions(t);if(r.sourceX||r.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");let{glFormat:n,glType:s}=this,{image:i,depth:o,mipLevel:a,x:c,y:l,z:f,width:h,height:u}=r,d=KO(this.glTarget,this.dimension,o),p=r.flipY?{[37440]:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),Fi(this.gl,p,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(d,a,c,l,h,u,n,s,i);break;case"2d-array":case"3d":this.gl.texSubImage3D(d,a,c,l,f,h,u,o,n,s,i);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:r.width,height:r.height}}generateMipmapsWebGL(t){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(U.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!t?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){U.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(t){U.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(t))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(t)){let s=Number(r),i=n;switch(s){case 33082:case 33083:this.gl.texParameterf(this.glTarget,s,i);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,s,i);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,s,i);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,s,i);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,s,i);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(t){let{gl:r}=this;return t!==void 0&&(this._textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,this.handle),t}_unbind(t){let{gl:r}=this;return t!==void 0&&(this._textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,null),t}}});function ZO(e){return EQ[e]}function L0(e){return MQ[e]}function JO(e){return Boolean(tL[e])}function QO(e){return tL[e]}var MQ,tL,EQ,jb=W(()=>{MQ={[5126]:"f32",[35664]:"vec2<f32>",[35665]:"vec3<f32>",[35666]:"vec4<f32>",[5124]:"i32",[35667]:"vec2<i32>",[35668]:"vec3<i32>",[35669]:"vec4<i32>",[5125]:"u32",[36294]:"vec2<u32>",[36295]:"vec3<u32>",[36296]:"vec4<u32>",[35670]:"f32",[35671]:"vec2<f32>",[35672]:"vec3<f32>",[35673]:"vec4<f32>",[35674]:"mat2x2<f32>",[35685]:"mat2x3<f32>",[35686]:"mat2x4<f32>",[35687]:"mat3x2<f32>",[35675]:"mat3x3<f32>",[35688]:"mat3x4<f32>",[35689]:"mat4x2<f32>",[35690]:"mat4x3<f32>",[35676]:"mat4x4<f32>"},tL={[35678]:{viewDimension:"2d",sampleType:"float"},[35680]:{viewDimension:"cube",sampleType:"float"},[35679]:{viewDimension:"3d",sampleType:"float"},[35682]:{viewDimension:"3d",sampleType:"depth"},[36289]:{viewDimension:"2d-array",sampleType:"float"},[36292]:{viewDimension:"2d-array",sampleType:"depth"},[36293]:{viewDimension:"cube",sampleType:"float"},[36298]:{viewDimension:"2d",sampleType:"sint"},[36299]:{viewDimension:"3d",sampleType:"sint"},[36300]:{viewDimension:"cube",sampleType:"sint"},[36303]:{viewDimension:"2d-array",sampleType:"uint"},[36306]:{viewDimension:"2d",sampleType:"uint"},[36307]:{viewDimension:"3d",sampleType:"uint"},[36308]:{viewDimension:"cube",sampleType:"uint"},[36311]:{viewDimension:"2d-array",sampleType:"uint"}},EQ={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126}});function eL(e,t){let r={attributes:[],bindings:[]};r.attributes=SQ(e,t);let n=PQ(e,t);for(let a of n){let c=a.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.arrayLength}));r.bindings.push({type:"uniform",name:a.name,group:0,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:c})}let s=CQ(e,t),i=0;for(let a of s)if(JO(a.type)){let{viewDimension:c,sampleType:l}=QO(a.type);r.bindings.push({type:"texture",name:a.name,group:0,location:i,viewDimension:c,sampleType:l}),a.textureUnit=i,i+=1}s.length&&(r.uniforms=s);let o=wQ(e,t);return o?.length&&(r.varyings=o),r}function SQ(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let s=0;s<n;s++){let i=e.getActiveAttrib(t,s);if(!i)throw new Error("activeInfo");let{name:o,type:a}=i,c=e.getAttribLocation(t,o);if(c>=0){let l=L0(a),f=/instance/i.test(o)?"instance":"vertex";r.push({name:o,location:c,stepMode:f,type:l})}}return r.sort((s,i)=>s.location-i.location),r}function wQ(e,t){let r=[],n=e.getProgramParameter(t,35971);for(let s=0;s<n;s++){let i=e.getTransformFeedbackVarying(t,s);if(!i)throw new Error("activeInfo");let{name:o,type:a,size:c}=i,l=L0(a),{type:f,components:h}=Jf(l);r.push({location:s,name:o,type:f,size:c*h})}return r.sort((s,i)=>s.location-i.location),r}function CQ(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let s=0;s<n;s++){let i=e.getActiveUniform(t,s);if(!i)throw new Error("activeInfo");let{name:o,size:a,type:c}=i,{name:l,isArray:f}=IQ(o),h=e.getUniformLocation(t,l),u={location:h,name:l,size:a,type:c,isArray:f};if(r.push(u),u.size>1)for(let d=0;d<u.size;d++){let p=`${l}[${d}]`;h=e.getUniformLocation(t,p);let m={...u,name:p,location:h};r.push(m)}}return r}function PQ(e,t){let r=(i,o)=>e.getActiveUniformBlockParameter(t,i,o),n=[],s=e.getProgramParameter(t,35382);for(let i=0;i<s;i++){let o={name:e.getActiveUniformBlockName(t,i)||"",location:r(i,35391),byteLength:r(i,35392),vertex:r(i,35396),fragment:r(i,35398),uniformCount:r(i,35394),uniforms:[]},a=r(i,35395)||[],c=e.getActiveUniforms(t,a,35383),l=e.getActiveUniforms(t,a,35384),f=e.getActiveUniforms(t,a,35387),h=e.getActiveUniforms(t,a,35388);for(let u=0;u<o.uniformCount;++u){let d=e.getActiveUniform(t,a[u]);if(!d)throw new Error("activeInfo");let p=L0(c[u]);o.uniforms.push({name:d.name,format:p,type:c[u],arrayLength:l[u],byteOffset:f[u],byteStride:h[u]})}n.push(o)}return n.sort((i,o)=>i.location-o.location),n}function IQ(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}var rL=W(()=>{it();jb()});function nL(e,t,r,n){let s=e,i=n;i===!0&&(i=1),i===!1&&(i=0);let o=typeof i=="number"?[i]:i;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 e.uniform1i(t,n);case 5126:return e.uniform1fv(t,o);case 35664:return e.uniform2fv(t,o);case 35665:return e.uniform3fv(t,o);case 35666:return e.uniform4fv(t,o);case 5124:return e.uniform1iv(t,o);case 35667:return e.uniform2iv(t,o);case 35668:return e.uniform3iv(t,o);case 35669:return e.uniform4iv(t,o);case 35670:return e.uniform1iv(t,o);case 35671:return e.uniform2iv(t,o);case 35672:return e.uniform3iv(t,o);case 35673:return e.uniform4iv(t,o);case 5125:return s.uniform1uiv(t,o,1);case 36294:return s.uniform2uiv(t,o,2);case 36295:return s.uniform3uiv(t,o,3);case 36296:return s.uniform4uiv(t,o,4);case 35674:return e.uniformMatrix2fv(t,!1,o);case 35675:return e.uniformMatrix3fv(t,!1,o);case 35676:return e.uniformMatrix4fv(t,!1,o);case 35685:return s.uniformMatrix2x3fv(t,!1,o);case 35686:return s.uniformMatrix2x4fv(t,!1,o);case 35687:return s.uniformMatrix3x2fv(t,!1,o);case 35688:return s.uniformMatrix3x4fv(t,!1,o);case 35689:return s.uniformMatrix4x2fv(t,!1,o);case 35690:return s.uniformMatrix4x3fv(t,!1,o)}throw new Error("Illegal uniform")}var sL=W(()=>{});function iL(e){switch(e){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(e)}}function oL(e){switch(e){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(e)}}var qb=W(()=>{});function RQ(e,t){let r={...e,attributes:e.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let s=r.attributes.find(i=>i.name===n.name);s?(s.type=n.type||s.type,s.stepMode=n.stepMode||s.stepMode):U.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var aL,B0,cL=W(()=>{it();rL();Vb();sL();E0();T0();O0();Gb();qb();aL=4,B0=class extends Kr{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(t,r){super(t,r),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:s=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,s)),this._linkShaders(),U.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=eL(this.device.gl,this.handle),U.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=r.shaderLayout?RQ(this.introspectedLayout,r.shaderLayout):this.introspectedLayout}destroy(){this.handle&&(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.destroyed=!0,this.handle.destroyed=!0,this.handle=null)}setBindings(t,r){for(let[n,s]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===n)||this.shaderLayout.bindings.find(o=>o.name===`${n}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");r?.disableWarnings||U.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,s)();continue}switch(s||U.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(s instanceof Pn)&&!(s.buffer instanceof Pn))throw new Error("buffer value");break;case"texture":if(!(s instanceof os||s instanceof as||s instanceof is))throw new Error(`${this} Bad texture binding for ${n}`);break;case"sampler":U.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(i.type)}this.bindings[n]=s}}draw(t){let{renderPass:r,parameters:n=this.props.parameters,topology:s=this.props.topology,vertexArray:i,vertexCount:o,instanceCount:a,isInstanced:c=!1,firstVertex:l=0,transformFeedback:f}=t,h=iL(s),u=Boolean(i.indexBuffer),d=i.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return U.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return U.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(r),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let p=r;return XO(this.device,n,p.glParameters,()=>{u&&c?this.device.gl.drawElementsInstanced(h,o||0,d,l,a||0):u?this.device.gl.drawElements(h,o||0,d,l):c?this.device.gl.drawArraysInstanced(h,l,o||0,a||0):this.device.gl.drawArrays(h,l,o||0),f&&f.end()}),i.unbindAfterRender(r),!0}async _linkShaders(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),U.time(aL,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),U.timeEnd(aL,`linkProgram for ${this.id}`)(),U.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}U.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),U.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(t){switch(t){case"success":return;default:let r=t==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${r} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${r} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break;case"success":break}let n=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${r} during ${t}: ${n}`),this)(),this.device.debug()}}_getLinkStatus(){let{gl:t}=this.device;return t.getProgramParameter(this.handle,35714)?(t.validateProgram(this.handle),t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation-error")):(this.linkStatus="error","link-error")}async _waitForLinkComplete(){let t=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(U.warn(`Binding ${r.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:t}=this.device;t.useProgram(this.handle);let r=0,n=0;for(let s of this.shaderLayout.bindings){let i=this.bindings[s.name]||this.bindings[s.name.replace(/Uniforms$/,"")];if(!i)throw new Error(`No value for binding ${s.name} in ${this.id}`);switch(s.type){case"uniform":let{name:o}=s,a=t.getUniformBlockIndex(this.handle,o);if(a===4294967295)throw new Error(`Invalid uniform block name ${o}`);t.uniformBlockBinding(this.handle,n,a),i instanceof Pn?t.bindBufferBase(35345,n,i.handle):t.bindBufferRange(35345,n,i.buffer.handle,i.offset||0,i.size||i.buffer.byteLength-i.offset),n+=1;break;case"texture":if(!(i instanceof os||i instanceof as||i instanceof is))throw new Error("texture");let c;if(i instanceof os)c=i.texture;else if(i instanceof as)c=i;else if(i instanceof is&&i.colorAttachments[0]instanceof os)U.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),c=i.colorAttachments[0].texture;else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(c.glTarget,c.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${s.type}' not supported in WebGL`)}}}_applyUniforms(){for(let t of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:s,textureUnit:i}=t,o=this.uniforms[r]??i;o!==void 0&&nL(this.device.gl,n,s,o)}}}});function OQ(e,t){let r=t.sourceBuffer,n=t.destinationBuffer;e.gl.bindBuffer(36662,r.handle),e.gl.bindBuffer(36663,n.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}function LQ(e,t){throw new Error("Not implemented")}function BQ(e,t){let{sourceTexture:r,mipLevel:n=0,aspect:s="all",width:i=t.sourceTexture.width,height:o=t.sourceTexture.height,depthOrArrayLayers:a=0,origin:c=[0,0],destinationBuffer:l,byteOffset:f=0,bytesPerRow:h,rowsPerImage:u}=t;if(s!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||a!==0||h||u)throw new Error("not implemented");let{framebuffer:d,destroyFramebuffer:p}=lL(r),m;try{let g=l,x=i||d.width,v=o||d.height,_=v0(d.colorAttachments[0].texture.props.format),y=_.format,b=_.type;e.gl.bindBuffer(35051,g.handle),m=e.gl.bindFramebuffer(36160,d.handle),e.gl.readPixels(c[0],c[1],x,v,y,b,f)}finally{e.gl.bindBuffer(35051,null),m!==void 0&&e.gl.bindFramebuffer(36160,m),p&&d.destroy()}}function NQ(e,t){let{sourceTexture:r,destinationMipLevel:n=0,origin:s=[0,0],destinationOrigin:i=[0,0],destinationTexture:o}=t,{width:a=t.destinationTexture.width,height:c=t.destinationTexture.height}=t,{framebuffer:l,destroyFramebuffer:f}=lL(r),[h,u]=s,[d,p,m]=i,g=e.gl.bindFramebuffer(36160,l.handle),x,v;if(o instanceof as)x=o,a=Number.isFinite(a)?a:x.width,c=Number.isFinite(c)?c:x.height,x._bind(0),v=x.glTarget;else throw new Error("invalid destination");switch(v){case 3553:case 34067:e.gl.copyTexSubImage2D(v,n,d,p,h,u,a,c);break;case 35866:case 32879:e.gl.copyTexSubImage3D(v,n,d,p,m,h,u,a,c);break;default:}x&&x._unbind(),e.gl.bindFramebuffer(36160,g),f&&l.destroy()}function lL(e){if(e instanceof vt){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var N0,fL=W(()=>{it();O0();Wc();N0=class extends ic{device;handle=null;commands=[];constructor(t){super(t,{}),this.device=t}_executeCommands(t=this.commands){for(let r of t)switch(r.name){case"copy-buffer-to-buffer":OQ(this.device,r.options);break;case"copy-buffer-to-texture":LQ(this.device,r.options);break;case"copy-texture-to-buffer":BQ(this.device,r.options);break;case"copy-texture-to-texture":NQ(this.device,r.options);break;default:throw new Error(r.name)}}}});var FQ,F0,hL=W(()=>{it();R0();Uc();FQ=[1,2,4,8],F0=class extends Cs{device;handle=null;glParameters={};constructor(t,r){super(t,r),this.device=t;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:i,height:o}=r.framebuffer;n=[0,0,i,o]}else{let[i,o]=t.getDefaultCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters});let s=this.props.framebuffer;if(this.props.framebuffer&&s?.handle){let i=this.props.framebuffer.colorAttachments.map((o,a)=>36064+a);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(t={}){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,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),t.scissorRect&&(r.scissorTest=!0,r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),r[2967]=t.stencilReference),"colorMask"in t&&(r.colorMask=FQ.map(n=>Boolean(n&t.colorMask))),this.glParameters=r,wn(this.device.gl,r)}beginOcclusionQuery(t){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let t={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,s)=>{n&&this.clearColorBuffer(s,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,t.clearStencil=this.props.clearStencil),r!==0&&Fi(this.device.gl,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(t=0,r=[0,0,0,0]){Fi(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,t,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,t,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,t,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}});var su,uL=W(()=>{it();fL();hL();su=class extends sc{device;handle=null;commandBuffer;constructor(t,r){super(t,r),this.device=t,this.commandBuffer=new N0(t)}destroy(){}finish(){return this.commandBuffer}beginRenderPass(t){return new F0(this.device,t)}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}resolveQuerySet(t,r,n){}}});function dL(e){let{target:t,source:r,start:n=0,count:s=1}=e,i=r.length,o=s*i,a=0;for(let c=n;a<i;a++)t[c++]=r[a];for(;a<o;)a<o-a?(t.copyWithin(n+a,n,n+a),a*=2):(t.copyWithin(n+a,n,n+o-a),a=o);return e.target}var pL=W(()=>{});function DQ(e){return Array.isArray(e)?new Float32Array(e):e}function kQ(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Hc,mL=W(()=>{it();hi();Fb();pL();Hc=class extends oc{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return u2()==="Chrome"}constructor(t,r){super(t,r),this.device=t,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(t){let r=t;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(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:s,type:i,stride:o,offset:a,normalized:c,integer:l,divisor:f}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?this.device.gl.vertexAttribIPointer(t,s,i,o,a):this.device.gl.vertexAttribPointer(t,s,i,c,o,a),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,f||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=_0(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(t,r=!0){let s=Hc.isConstantAttributeZeroSupported(this.device)||t!==0;(r||s)&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,r){let n=DQ(r),s=n.byteLength*t,i=n.length*t;if(this.buffer&&s!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${s} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:s}),o||=!kQ(n,this.bufferValue),o){let a=Nv(r.constructor,i);dL({target:a,source:n,start:0,count:i}),this.buffer.write(a),this.bufferValue=r}return this.buffer}}});function gL(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var D0,xL=W(()=>{it();iu();qb();D0=class extends ac{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,r){super(t,r),this.device=t,this.gl=t.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(t="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(oL(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:s,byteLength:i,byteOffset:o}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=s,U.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:s,byteLength:i,byteOffset:o},this.bindOnUse||this._bindBuffer(n,s,o,i)}getBuffer(t){if(gL(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(t=this.handle){if(typeof t!="function")return this.gl.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof Pn)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:s=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:s}}_getVaryingIndex(t){if(gL(t))return Number(t);for(let r of this.layout.varyings||[])if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:s}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,s,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r,n=0,s){let i=r&&r.handle;!i||s===void 0?this.gl.bindBufferBase(35982,t,i):this.gl.bindBufferRange(35982,t,i,n,s)}}});var k0,_L=W(()=>{it();k0=class extends cc{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,r){if(super(t,r),this.device=t,r.count>1)throw new Error("WebGL QuerySet can only have one value");let n=this.device.gl.createQuery();if(!n)throw new Error("WebGL query not supported");this.handle=n,Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(t){return this._begin(t?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(t){this._queryPending||(this.target=t,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 t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,s)=>{let i=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>t?(s("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)}),this._pollingPromise}}});function $b(e){switch(e){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 yL(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}var vL=W(()=>{});function AL(e){return UQ[e]}var UQ,bL=W(()=>{UQ={[5124]:"sint32",[5125]:"uint32",[5122]:"sint16",[5123]:"uint16",[5120]:"sint8",[5121]:"uint8",[5126]:"float32",[5131]:"float16",[33635]:"uint16",[32819]:"uint16",[32820]:"uint16",[33640]:"uint32",[35899]:"uint32",[35902]:"uint32",[34042]:"uint32",[36269]:"uint32"}});function TL(e,t){let{sourceX:r=0,sourceY:n=0,sourceAttachment:s=0}=t||{},{target:i=null,sourceWidth:o,sourceHeight:a,sourceDepth:c,sourceFormat:l,sourceType:f}=t||{},{framebuffer:h,deleteFramebuffer:u}=EL(e),{gl:d,handle:p}=h;o||=h.width,a||=h.height;let m=h.colorAttachments[s]?.texture;if(!m)throw new Error(`Invalid framebuffer attachment ${s}`);c=m?.depth||1,l||=m?.glFormat||6408,f||=m?.glType||5121,i=zQ(i,f,l,o,a,c);let g=Eo(i);f=f||ZO(g);let x=d.bindFramebuffer(36160,p);return d.readBuffer(36064+s),d.readPixels(r,n,o,a,l,f,i),d.readBuffer(36064),d.bindFramebuffer(36160,x||null),u&&h.destroy(),i}function ML(e,t){let{target:r,sourceX:n=0,sourceY:s=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{sourceWidth:a,sourceHeight:c,sourceType:l}=t||{},{framebuffer:f,deleteFramebuffer:h}=EL(e);a=a||f.width,c=c||f.height;let u=f;l=l||5121;let d=r;if(!d){let m=$b(i),g=yL(l),x=o+a*c*m*g;d=u.device.createBuffer({byteLength:x})}let p=e.device.createCommandEncoder();return p.copyTextureToBuffer({sourceTexture:e,width:a,height:c,origin:[n,s],destinationBuffer:d,byteOffset:o}),p.destroy(),h&&f.destroy(),d}function EL(e){return e instanceof Yn?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:VQ(e),deleteFramebuffer:!0}}function VQ(e,t){let{device:r,width:n,height:s,id:i}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${i}`,width:n,height:s,colorAttachments:[e]})}function zQ(e,t,r,n,s,i){if(e)return e;t||=5121;let o=AL(t),a=So(o),c=$b(r);return new a(n*s*c)}var SL=W(()=>{it();jb();vL();bL()});var Xb={};Yt(Xb,{WebGLDevice:()=>cs});function WQ(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:}}function HQ(e,t,r){e.gl.vertexAttribI4iv(t,r)}function GQ(e,t,r){e.gl.vertexAttribI4uiv(t,r)}function jQ(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var cs,U0=W(()=>{it();Nb();wO();IO();kO();UO();VO();Pb();Ib();Wc();WO();E0();qO();YO();O0();T0();cL();uL();mL();xL();_L();SL();Uc();R0();eu();cs=class extends Er{type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;_extensions={};_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(t){switch(t){case"unorm8x4-bgra":return!1;default:return!0}}constructor(t){super({...t,id:t.id||zO("webgl-device")});let r=Er._getCanvasContextProps(t);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 M0(this,r),this.lost=new Promise(f=>{this._resolveContextLost=f});let s={...t.webgl};r.alphaMode==="premultiplied"&&(s.premultipliedAlpha=!0),t.powerPreference!==void 0&&(s.powerPreference=t.powerPreference);let o=this.props._handle||SO(this.canvasContext.canvas,{onContextLost:f=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:f=>console.log("WebGL context restored")},s);if(!o)throw new Error("WebGL context creation failed");if(n=o.device,n){if(t._reuseDevices)return U.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=o,this.gl=o,this.spectorJS=hO({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=CO(this.gl,this._extensions),this.limits=new b0(this.gl),this.features=new A0(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new Cn(this.gl,{log:(...f)=>U.log(1,...f)()}).trackState(this.gl,{copyState:!1});let c=t.debugWebGL||t.debug,l=t.debugWebGL;c&&(this.gl=mO(this.gl,{debugWebGL:c,traceWebGL:l}),U.warn("WebGL debug mode activated. Performance reduced.")(),t.debugWebGL&&(U.level=Math.max(U.level,1))),this.commandEncoder=new su(this,{id:`${this}-command-encoder`})}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}getTextureByteAlignment(){return 4}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._normalizeBufferProps(t);return new Pn(this,r)}createTexture(t){return new as(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new I0(this,t)}createShader(t){return new S0(this,t)}createFramebuffer(t){return new is(this,t)}createVertexArray(t){return new Hc(this,t)}createTransformFeedback(t){return new D0(this,t)}createQuerySet(t){return new k0(this,t)}createRenderPipeline(t){return new B0(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(t={}){return new su(this,t)}submit(t){t||(t=this.commandEncoder.finish(),this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:`${this.id}-default-encoder`})),t._executeCommands()}readPixelsToArrayWebGL(t,r){return TL(t,r)}readPixelsToBufferWebGL(t,r){return ML(t,r)}setParametersWebGL(t){wn(this.gl,t)}getParametersWebGL(t){return x0(this.gl,t)}withParametersWebGL(t,r){return Fi(this.gl,t,r)}resetWebGL(){U.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),AO(this.gl)}_getDeviceSpecificTextureFormatCapabilities(t){return NO(this.gl,t,this._extensions)}loseDevice(){let t=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(t=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){Cn.get(this.gl).push()}popState(){Cn.get(this.gl).pop()}getGLKey(t,r){let n=Number(t);for(let s in this.gl)if(this.gl[s]===n)return`GL.${s}`;return r?.emptyIfUnknown?"":String(t)}getGLKeys(t){let r={emptyIfUnknown:!0};return Object.entries(t).reduce((n,[s,i])=>(n[`${s}:${this.getGLKey(s,r)}`]=`${i}:${this.getGLKey(i,r)}`,n),{})}setConstantAttributeWebGL(t,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let s=this._constants[t];switch(s&&jQ(s,r)&&U.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:WQ(this,t,r);break;case Int32Array:HQ(this,t,r);break;case Uint32Array:GQ(this,t,r);break;default:throw new Error("constant")}}getExtension(t){return ss(this.gl,t,this._extensions),this._extensions}_setWebGLDebugMetadata(t,r,n){t.luma=r;let s={props:n.spector,id:n.spector.id};t.__SPECTOR_Metadata=s}}});function qQ(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}var V0,Yb,ou,wL=W(()=>{it();cO();Pb();Ib();V0=1,Yb=class extends Zf{type="webgl";constructor(){super(),Er.defaultProps={...Er.defaultProps,...g0}}enforceWebGL2(t){aO(t)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&t instanceof WebGLRenderingContext&&U.warn("WebGL1 is not supported",t)(),!1)}async attach(t,r={}){let{WebGLDevice:n}=await Promise.resolve().then(()=>(U0(),Xb));if(t instanceof n)return t;if(t?.device instanceof n)return t.device;if(!qQ(t))throw new Error("Invalid WebGL2RenderingContext");let s=r.createCanvasContext===!0?{}:r.createCanvasContext;return new n({...r,_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1,...s}})}async create(t={}){let{WebGLDevice:r}=await Promise.resolve().then(()=>(U0(),Xb));U.groupCollapsed(V0,"WebGLDevice created")();try{let n=[];(t.debugWebGL||t.debug)&&n.push(pO()),t.debugSpectorJS&&n.push(fO(t));let s=await Promise.allSettled(n);for(let a of s)a.status==="rejected"&&U.error(`Failed to initialize debug libraries ${a.reason}`)();let i=new r(t),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return U.probe(V0,o)(),U.table(V0,i.info)(),i}finally{U.groupEnd(V0)()}}};ou=new Yb});var iu=W(()=>{wL();U0();E0()});var fB=Ge((iWt,x3)=>{"use strict";x3.exports=g1;x3.exports.default=g1;function g1(e,t,r){r=r||2;var n=t&&t.length,s=n?t[0]*r:e.length,i=aB(e,0,s,r,!0),o=[];if(!i||i.next===i.prev)return o;var a,c,l,f,h,u,d;if(n&&(i=zet(e,t,i,r)),e.length>80*r){a=l=e[0],c=f=e[1];for(var p=r;p<s;p+=r)h=e[p],u=e[p+1],h<a&&(a=h),u<c&&(c=u),h>l&&(l=h),u>f&&(f=u);d=Math.max(l-a,f-c),d=d!==0?32767/d:0}return zu(i,o,r,a,c,d,0),o}function aB(e,t,r,n,s){var i,o;if(s===g3(e,t,r,n)>0)for(i=t;i<r;i+=n)o=oB(i,e[i],e[i+1],o);else for(i=r-n;i>=t;i-=n)o=oB(i,e[i],e[i+1],o);return o&&x1(o,o.next)&&(Hu(o),o=o.next),o}function la(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(x1(r,r.next)||ne(r.prev,r,r.next)===0)){if(Hu(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function zu(e,t,r,n,s,i,o){if(e){!o&&i&&qet(e,n,s,i);for(var a=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,i?ket(e,n,s,i):Det(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),Hu(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=Uet(la(e),t,r),zu(e,t,r,n,s,i,2)):o===2&&Vet(e,t,r,n,s,i):zu(la(e),t,r,n,s,i,1);break}}}}function Det(e){var t=e.prev,r=e,n=e.next;if(ne(t,r,n)>=0)return!1;for(var s=t.x,i=r.x,o=n.x,a=t.y,c=r.y,l=n.y,f=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,u=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=n.next;p!==t;){if(p.x>=f&&p.x<=u&&p.y>=h&&p.y<=d&&Kc(s,a,i,c,o,l,p.x,p.y)&&ne(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ket(e,t,r,n){var s=e.prev,i=e,o=e.next;if(ne(s,i,o)>=0)return!1;for(var a=s.x,c=i.x,l=o.x,f=s.y,h=i.y,u=o.y,d=a<c?a<l?a:l:c<l?c:l,p=f<h?f<u?f:u:h<u?h:u,m=a>c?a>l?a:l:c>l?c:l,g=f>h?f>u?f:u:h>u?h:u,x=p3(d,p,t,r,n),v=p3(m,g,t,r,n),_=e.prevZ,y=e.nextZ;_&&_.z>=x&&y&&y.z<=v;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Kc(a,f,c,h,l,u,_.x,_.y)&&ne(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=d&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==o&&Kc(a,f,c,h,l,u,y.x,y.y)&&ne(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=x;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Kc(a,f,c,h,l,u,_.x,_.y)&&ne(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=v;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==o&&Kc(a,f,c,h,l,u,y.x,y.y)&&ne(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Uet(e,t,r){var n=e;do{var s=n.prev,i=n.next.next;!x1(s,i)&&cB(s,n,n.next,i)&&Wu(s,i)&&Wu(i,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),Hu(n),Hu(n.next),n=e=i),n=n.next}while(n!==e);return la(n)}function Vet(e,t,r,n,s,i){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Yet(o,a)){var c=lB(o,a);o=la(o,o.next),c=la(c,c.next),zu(o,t,r,n,s,i,0),zu(c,t,r,n,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function zet(e,t,r,n){var s=[],i,o,a,c,l;for(i=0,o=t.length;i<o;i++)a=t[i]*n,c=i<o-1?t[i+1]*n:e.length,l=aB(e,a,c,n,!1),l===l.next&&(l.steiner=!0),s.push(Xet(l));for(s.sort(Wet),i=0;i<s.length;i++)r=Het(s[i],r);return r}function Wet(e,t){return e.x-t.x}function Het(e,t){var r=Get(e,t);if(!r)return t;var n=lB(r,e);return la(n,n.next),la(r,r.next)}function Get(e,t){var r=t,n=e.x,s=e.y,i=-1/0,o;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>i&&(i=a,o=r.x<r.next.x?r:r.next,a===n))return o}r=r.next}while(r!==t);if(!o)return null;var c=o,l=o.x,f=o.y,h=1/0,u;r=o;do n>=r.x&&r.x>=l&&n!==r.x&&Kc(s<f?n:i,s,l,f,s<f?i:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),Wu(r,e)&&(u<h||u===h&&(r.x>o.x||r.x===o.x&&jet(o,r)))&&(o=r,h=u)),r=r.next;while(r!==c);return o}function jet(e,t){return ne(e.prev,e,t.prev)<0&&ne(t.next,e,e.next)<0}function qet(e,t,r,n){var s=e;do s.z===0&&(s.z=p3(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,$et(s)}function $et(e){var t,r,n,s,i,o,a,c,l=1;do{for(r=e,e=null,i=null,o=0;r;){for(o++,n=r,a=0,t=0;t<l&&(a++,n=n.nextZ,!!n);t++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,c--),i?i.nextZ=s:e=s,s.prevZ=i,i=s;r=n}i.nextZ=null,l*=2}while(o>1);return e}function p3(e,t,r,n,s){return e=(e-r)*s|0,t=(t-n)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Xet(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Kc(e,t,r,n,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(n-a)>=(r-o)*(t-a)&&(r-o)*(i-a)>=(s-o)*(n-a)}function Yet(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Ket(e,t)&&(Wu(e,t)&&Wu(t,e)&&Zet(e,t)&&(ne(e.prev,e,t.prev)||ne(e,t.prev,t))||x1(e,t)&&ne(e.prev,e,e.next)>0&&ne(t.prev,t,t.next)>0)}function ne(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function x1(e,t){return e.x===t.x&&e.y===t.y}function cB(e,t,r,n){var s=m1(ne(e,t,r)),i=m1(ne(e,t,n)),o=m1(ne(r,n,e)),a=m1(ne(r,n,t));return!!(s!==i&&o!==a||s===0&&p1(e,r,t)||i===0&&p1(e,n,t)||o===0&&p1(r,e,n)||a===0&&p1(r,t,n))}function p1(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function m1(e){return e>0?1:e<0?-1:0}function Ket(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&cB(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Wu(e,t){return ne(e.prev,e,e.next)<0?ne(e,t,e.next)>=0&&ne(e,e.prev,t)>=0:ne(e,t,e.prev)<0||ne(e,e.next,t)<0}function Zet(e,t){var r=e,n=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&s<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function lB(e,t){var r=new m3(e.i,e.x,e.y),n=new m3(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function oB(e,t,r,n){var s=new m3(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Hu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function m3(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}g1.deviation=function(e,t,r,n){var s=t&&t.length,i=s?t[0]*r:e.length,o=Math.abs(g3(e,0,i,r));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*r,f=a<c-1?t[a+1]*r:e.length;o-=Math.abs(g3(e,l,f,r))}var h=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,d=n[a+1]*r,p=n[a+2]*r;h+=Math.abs((e[u]-e[p])*(e[d+1]-e[u+1])-(e[u]-e[d])*(e[p+1]-e[u+1]))}return o===0&&h===0?0:Math.abs((h-o)/o)};function g3(e,t,r,n){for(var s=0,i=t,o=r-n;i<r;i+=n)s+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return s}g1.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,s=0;s<e.length;s++){for(var i=0;i<e[s].length;i++)for(var o=0;o<t;o++)r.vertices.push(e[s][i][o]);s>0&&(n+=e[s-1].length,r.holes.push(n))}return r}});var ad=Ge((fGt,mF)=>{mF.exports=globalThis.h3||{}});var Z1=Ge(Ys=>{"use strict";var _F=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",rot=_F+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",yF="["+_F+"]["+rot+"]*",not=new RegExp("^"+yF+"$"),sot=function(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let i=n.length;for(let o=0;o<i;o++)s.push(n[o]);r.push(s),n=t.exec(e)}return r},iot=function(e){let t=not.exec(e);return!(t===null||typeof t>"u")};Ys.isExist=function(e){return typeof e<"u"};Ys.isEmptyObject=function(e){return Object.keys(e).length===0};Ys.merge=function(e,t,r){if(t){let n=Object.keys(t),s=n.length;for(let i=0;i<s;i++)r==="strict"?e[n[i]]=[t[n[i]]]:e[n[i]]=t[n[i]]}};Ys.getValue=function(e){return Ys.isExist(e)?e:""};Ys.isName=iot;Ys.getAllMatches=sot;Ys.nameRegexp=yF});var z3=Ge(MF=>{"use strict";var V3=Z1(),oot={allowBooleanAttributes:!1,unpairedTags:[]};MF.validate=function(e,t){t=Object.assign({},oot,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=AF(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=bF(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
|
|
18
|
+
${t}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,t),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}U.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),U.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let t=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getShaderParameter(this.handle,37297))return;await t(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}});function XO(e,t,r,n){if(vQ(t))return n(e);let s=e;s.pushState();try{return xQ(e,t),wn(s.gl,r),n(e)}finally{s.popState()}}function xQ(e,t){let r=e,{gl:n}=r;if(t.cullMode)switch(t.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(t.frontFace&&n.frontFace(Qo("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&n.enable(34383),t.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let i=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,o=Qo("provokingVertex",t.provokingVertex,{first:36429,last:36430});i?.provokingVertexWEBGL(o)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let i=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,o=Qo("polygonMode",t.polygonMode,{fill:6914,line:6913});i?.polygonModeWEBGL(1028,o),i?.polygonModeWEBGL(1029,o)}t.polygonOffsetLine&&n.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&n.enable(12288),t.clipDistance1&&n.enable(12289),t.clipDistance2&&n.enable(12290),t.clipDistance3&&n.enable(12291),t.clipDistance4&&n.enable(12292),t.clipDistance5&&n.enable(12293),t.clipDistance6&&n.enable(12294),t.clipDistance7&&n.enable(12295)),t.depthWriteEnabled!==void 0&&n.depthMask(yQ("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(C0("depthCompare",t.depthCompare))),t.stencilWriteMask){let s=t.stencilWriteMask;n.stencilMaskSeparate(1028,s),n.stencilMaskSeparate(1029,s)}if(t.stencilReadMask&&U.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let s=t.stencilReadMask||4294967295,i=C0("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,i,0,s),n.stencilFuncSeparate(1029,i,0,s)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let s=Ub("stencilPassOperation",t.stencilPassOperation),i=Ub("stencilFailOperation",t.stencilFailOperation),o=Ub("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,i,o,s),n.stencilOpSeparate(1029,i,o,s)}switch(t.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break;default:}if(t.blendColorOperation||t.blendAlphaOperation){let s=$O("blendColorOperation",t.blendColorOperation||"add"),i=$O("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(s,i);let o=w0("blendColorSrcFactor",t.blendColorSrcFactor||"one"),a=w0("blendColorDstFactor",t.blendColorDstFactor||"zero"),c=w0("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),l=w0("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(o,a,c,l)}}function C0(e,t){return Qo(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Ub(e,t){return Qo(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function $O(e,t){return Qo(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function w0(e,t,r="color"){return Qo(e,t,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:r==="color"?32769:32771,"one-minus-constant":r==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function _Q(e,t){return`Illegal parameter ${t} for ${e}`}function Qo(e,t,r){if(!(t in r))throw new Error(_Q(e,t));return r[t]}function yQ(e,t){return t}function vQ(e){let t=!0;for(let r in e){t=!1;break}return t}var Vb=W(()=>{it();Uc()});function P0(e){let t={};return e.addressModeU&&(t[10242]=zb(e.addressModeU)),e.addressModeV&&(t[10243]=zb(e.addressModeV)),e.addressModeW&&(t[32882]=zb(e.addressModeW)),e.magFilter&&(t[10240]=Wb(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=AQ(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=C0("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function zb(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Wb(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function AQ(e,t="none"){if(!t)return Wb(e);switch(t){case"none":return Wb(e);case"nearest":switch(e){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(e){case"nearest":return 9986;case"linear":return 9987}}}var Hb=W(()=>{Vb()});var I0,YO=W(()=>{it();Hb();I0=class extends Yr{device;handle;parameters;constructor(t,r){super(t,r),this.device=t,this.parameters=P0(r),this.handle=r.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(t){for(let[r,n]of Object.entries(t)){let s=Number(r);switch(s){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,s,n);break;default:this.device.gl.samplerParameteri(this.handle,s,n);break}}}}});function Fi(e,t,r){if(bQ(t))return r(e);let{nocatch:n=!0}=t,s=Cn.get(e);s.push(),wn(e,t);let i;if(n)i=r(e),s.pop();else try{i=r(e)}finally{s.pop()}return i}function bQ(e){for(let t in e)return!1;return!0}var R0=W(()=>{Uc();Nb()});var os,Gb=W(()=>{it();os=class extends yi{device;gl;handle;texture;constructor(t,r){super(t,{...vt.defaultProps,...r}),this.device=t,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}}});function TQ(e){switch(e){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(e)}function KO(e,t,r){return t==="cube"?34069+r:e}var as,O0=W(()=>{it();Wc();Hb();R0();Gb();as=class extends vt{device;gl;handle;sampler=void 0;view;glTarget;glFormat;glType;glInternalFormat;compressed;_textureUnit=0;constructor(t,r){super(t,r),this.device=t,this.gl=this.device.gl;let n=v0(this.props.format);this.glTarget=TQ(this.props.dimension),this.glInternalFormat=n.internalFormat,this.glFormat=n.format,this.glType=n.type,this.compressed=n.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);let{dimension:s,width:i,height:o,depth:a,mipLevels:c,glTarget:l,glInternalFormat:f}=this;switch(s){case"2d":case"cube":this.gl.texStorage2D(l,c,f,i,o);break;case"2d-array":case"3d":this.gl.texStorage3D(l,c,f,i,o,a);break;default:throw new Error(s)}this.gl.bindTexture(this.glTarget,null),this._initializeData(r.data),this.setSampler(this.props.sampler),this.view=new os(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(t){return new os(this.device,{...t,texture:this})}setSampler(t={}){super.setSampler(t);let r=P0(this.sampler.props);this._setSamplerParameters(r)}copyImageData(t){let r=this._normalizeCopyImageDataOptions(t),n=r.data,{width:s,height:i,depth:o}=this,{mipLevel:a=0,byteOffset:c=0,x:l=0,y:f=0,z:h=0}=r,{glFormat:u,glType:d,compressed:p}=this,m=KO(this.glTarget,this.dimension,h),g;if(!this.compressed){let{bytesPerPixel:v}=this.device.getTextureFormatInfo(this.format);if(v){if(r.bytesPerRow%v!==0)throw new Error(`bytesPerRow (${r.bytesPerRow}) must be a multiple of bytesPerPixel (${v}) for ${this.format}`);g=r.bytesPerRow/v}}let x=this.compressed?{}:{...g!==void 0?{[3314]:g}:{},[32878]:r.rowsPerImage};this.gl.bindTexture(m,this.handle),Fi(this.gl,x,()=>{switch(this.dimension){case"2d":case"cube":p?this.gl.compressedTexSubImage2D(m,a,l,f,s,i,u,n,c):this.gl.texSubImage2D(m,a,l,f,s,i,u,d,n,c);break;case"2d-array":case"3d":p?this.gl.compressedTexSubImage3D(m,a,l,f,h,s,i,o,u,n,c):this.gl.texSubImage3D(m,a,l,f,h,s,i,o,u,d,n,c);break;default:}}),this.gl.bindTexture(m,null)}copyExternalImage(t){let r=this._normalizeCopyExternalImageOptions(t);if(r.sourceX||r.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");let{glFormat:n,glType:s}=this,{image:i,depth:o,mipLevel:a,x:c,y:l,z:f,width:h,height:u}=r,d=KO(this.glTarget,this.dimension,o),p=r.flipY?{[37440]:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),Fi(this.gl,p,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(d,a,c,l,h,u,n,s,i);break;case"2d-array":case"3d":this.gl.texSubImage3D(d,a,c,l,f,h,u,o,n,s,i);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:r.width,height:r.height}}generateMipmapsWebGL(t){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(U.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!t?.force)))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(n){U.warn(`Error generating mipmap for ${this}: ${n.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(t){U.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(t))(),this.gl.bindTexture(this.glTarget,this.handle);for(let[r,n]of Object.entries(t)){let s=Number(r),i=n;switch(s){case 33082:case 33083:this.gl.texParameterf(this.glTarget,s,i);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,s,i);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,s,i);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,s,i);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,s,i);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(t){let{gl:r}=this;return t!==void 0&&(this._textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,this.handle),t}_unbind(t){let{gl:r}=this;return t!==void 0&&(this._textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.glTarget,null),t}}});function ZO(e){return EQ[e]}function L0(e){return MQ[e]}function JO(e){return Boolean(tL[e])}function QO(e){return tL[e]}var MQ,tL,EQ,jb=W(()=>{MQ={[5126]:"f32",[35664]:"vec2<f32>",[35665]:"vec3<f32>",[35666]:"vec4<f32>",[5124]:"i32",[35667]:"vec2<i32>",[35668]:"vec3<i32>",[35669]:"vec4<i32>",[5125]:"u32",[36294]:"vec2<u32>",[36295]:"vec3<u32>",[36296]:"vec4<u32>",[35670]:"f32",[35671]:"vec2<f32>",[35672]:"vec3<f32>",[35673]:"vec4<f32>",[35674]:"mat2x2<f32>",[35685]:"mat2x3<f32>",[35686]:"mat2x4<f32>",[35687]:"mat3x2<f32>",[35675]:"mat3x3<f32>",[35688]:"mat3x4<f32>",[35689]:"mat4x2<f32>",[35690]:"mat4x3<f32>",[35676]:"mat4x4<f32>"},tL={[35678]:{viewDimension:"2d",sampleType:"float"},[35680]:{viewDimension:"cube",sampleType:"float"},[35679]:{viewDimension:"3d",sampleType:"float"},[35682]:{viewDimension:"3d",sampleType:"depth"},[36289]:{viewDimension:"2d-array",sampleType:"float"},[36292]:{viewDimension:"2d-array",sampleType:"depth"},[36293]:{viewDimension:"cube",sampleType:"float"},[36298]:{viewDimension:"2d",sampleType:"sint"},[36299]:{viewDimension:"3d",sampleType:"sint"},[36300]:{viewDimension:"cube",sampleType:"sint"},[36303]:{viewDimension:"2d-array",sampleType:"uint"},[36306]:{viewDimension:"2d",sampleType:"uint"},[36307]:{viewDimension:"3d",sampleType:"uint"},[36308]:{viewDimension:"cube",sampleType:"uint"},[36311]:{viewDimension:"2d-array",sampleType:"uint"}},EQ={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126}});function eL(e,t){let r={attributes:[],bindings:[]};r.attributes=SQ(e,t);let n=PQ(e,t);for(let a of n){let c=a.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.arrayLength}));r.bindings.push({type:"uniform",name:a.name,group:0,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:c})}let s=CQ(e,t),i=0;for(let a of s)if(JO(a.type)){let{viewDimension:c,sampleType:l}=QO(a.type);r.bindings.push({type:"texture",name:a.name,group:0,location:i,viewDimension:c,sampleType:l}),a.textureUnit=i,i+=1}s.length&&(r.uniforms=s);let o=wQ(e,t);return o?.length&&(r.varyings=o),r}function SQ(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let s=0;s<n;s++){let i=e.getActiveAttrib(t,s);if(!i)throw new Error("activeInfo");let{name:o,type:a}=i,c=e.getAttribLocation(t,o);if(c>=0){let l=L0(a),f=/instance/i.test(o)?"instance":"vertex";r.push({name:o,location:c,stepMode:f,type:l})}}return r.sort((s,i)=>s.location-i.location),r}function wQ(e,t){let r=[],n=e.getProgramParameter(t,35971);for(let s=0;s<n;s++){let i=e.getTransformFeedbackVarying(t,s);if(!i)throw new Error("activeInfo");let{name:o,type:a,size:c}=i,l=L0(a),{type:f,components:h}=Jf(l);r.push({location:s,name:o,type:f,size:c*h})}return r.sort((s,i)=>s.location-i.location),r}function CQ(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let s=0;s<n;s++){let i=e.getActiveUniform(t,s);if(!i)throw new Error("activeInfo");let{name:o,size:a,type:c}=i,{name:l,isArray:f}=IQ(o),h=e.getUniformLocation(t,l),u={location:h,name:l,size:a,type:c,isArray:f};if(r.push(u),u.size>1)for(let d=0;d<u.size;d++){let p=`${l}[${d}]`;h=e.getUniformLocation(t,p);let m={...u,name:p,location:h};r.push(m)}}return r}function PQ(e,t){let r=(i,o)=>e.getActiveUniformBlockParameter(t,i,o),n=[],s=e.getProgramParameter(t,35382);for(let i=0;i<s;i++){let o={name:e.getActiveUniformBlockName(t,i)||"",location:r(i,35391),byteLength:r(i,35392),vertex:r(i,35396),fragment:r(i,35398),uniformCount:r(i,35394),uniforms:[]},a=r(i,35395)||[],c=e.getActiveUniforms(t,a,35383),l=e.getActiveUniforms(t,a,35384),f=e.getActiveUniforms(t,a,35387),h=e.getActiveUniforms(t,a,35388);for(let u=0;u<o.uniformCount;++u){let d=e.getActiveUniform(t,a[u]);if(!d)throw new Error("activeInfo");let p=L0(c[u]);o.uniforms.push({name:d.name,format:p,type:c[u],arrayLength:l[u],byteOffset:f[u],byteStride:h[u]})}n.push(o)}return n.sort((i,o)=>i.location-o.location),n}function IQ(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}var rL=W(()=>{it();jb()});function nL(e,t,r,n){let s=e,i=n;i===!0&&(i=1),i===!1&&(i=0);let o=typeof i=="number"?[i]:i;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 e.uniform1i(t,n);case 5126:return e.uniform1fv(t,o);case 35664:return e.uniform2fv(t,o);case 35665:return e.uniform3fv(t,o);case 35666:return e.uniform4fv(t,o);case 5124:return e.uniform1iv(t,o);case 35667:return e.uniform2iv(t,o);case 35668:return e.uniform3iv(t,o);case 35669:return e.uniform4iv(t,o);case 35670:return e.uniform1iv(t,o);case 35671:return e.uniform2iv(t,o);case 35672:return e.uniform3iv(t,o);case 35673:return e.uniform4iv(t,o);case 5125:return s.uniform1uiv(t,o,1);case 36294:return s.uniform2uiv(t,o,2);case 36295:return s.uniform3uiv(t,o,3);case 36296:return s.uniform4uiv(t,o,4);case 35674:return e.uniformMatrix2fv(t,!1,o);case 35675:return e.uniformMatrix3fv(t,!1,o);case 35676:return e.uniformMatrix4fv(t,!1,o);case 35685:return s.uniformMatrix2x3fv(t,!1,o);case 35686:return s.uniformMatrix2x4fv(t,!1,o);case 35687:return s.uniformMatrix3x2fv(t,!1,o);case 35688:return s.uniformMatrix3x4fv(t,!1,o);case 35689:return s.uniformMatrix4x2fv(t,!1,o);case 35690:return s.uniformMatrix4x3fv(t,!1,o)}throw new Error("Illegal uniform")}var sL=W(()=>{});function iL(e){switch(e){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(e)}}function oL(e){switch(e){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(e)}}var qb=W(()=>{});function RQ(e,t){let r={...e,attributes:e.attributes.map(n=>({...n}))};for(let n of t?.attributes||[]){let s=r.attributes.find(i=>i.name===n.name);s?(s.type=n.type||s.type,s.stepMode=n.stepMode||s.stepMode):U.warn(`shader layout attribute ${n.name} not present in shader`)}return r}var aL,B0,cL=W(()=>{it();rL();Vb();sL();E0();T0();O0();Gb();qb();aL=4,B0=class extends Kr{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}constructor(t,r){super(t,r),this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.vs=r.vs,this.fs=r.fs;let{varyings:n,bufferMode:s=35981}=r;n&&n.length>0&&(this.varyings=n,this.device.gl.transformFeedbackVaryings(this.handle,n,s)),this._linkShaders(),U.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=eL(this.device.gl,this.handle),U.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=r.shaderLayout?RQ(this.introspectedLayout,r.shaderLayout):this.introspectedLayout}destroy(){this.handle&&(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.destroyed=!0,this.handle.destroyed=!0,this.handle=null)}setBindings(t,r){for(let[n,s]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===n)||this.shaderLayout.bindings.find(o=>o.name===`${n}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");r?.disableWarnings||U.warn(`No binding "${n}" in render pipeline "${this.id}", expected one of ${o}`,s)();continue}switch(s||U.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(s instanceof Pn)&&!(s.buffer instanceof Pn))throw new Error("buffer value");break;case"texture":if(!(s instanceof os||s instanceof as||s instanceof is))throw new Error(`${this} Bad texture binding for ${n}`);break;case"sampler":U.warn(`Ignoring sampler ${n}`)();break;default:throw new Error(i.type)}this.bindings[n]=s}}draw(t){let{renderPass:r,parameters:n=this.props.parameters,topology:s=this.props.topology,vertexArray:i,vertexCount:o,instanceCount:a,isInstanced:c=!1,firstVertex:l=0,transformFeedback:f}=t,h=iL(s),u=Boolean(i.indexBuffer),d=i.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return U.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable())return U.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(r),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let p=r;return XO(this.device,n,p.glParameters,()=>{u&&c?this.device.gl.drawElementsInstanced(h,o||0,d,l,a||0):u?this.device.gl.drawElements(h,o||0,d,l):c?this.device.gl.drawArraysInstanced(h,l,o||0,a||0):this.device.gl.drawArrays(h,l,o||0),f&&f.end()}),i.unbindAfterRender(r),!0}async _linkShaders(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),U.time(aL,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),U.timeEnd(aL,`linkProgram for ${this.id}`)(),U.level,!this.device.features.has("compilation-status-async-webgl")){let n=this._getLinkStatus();this._reportLinkStatus(n);return}U.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),U.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}async _reportLinkStatus(t){switch(t){case"success":return;default:let r=t==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${r} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break;case"success":break}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${r} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break;case"success":break}let n=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${r} during ${t}: ${n}`),this)(),this.device.debug()}}_getLinkStatus(){let{gl:t}=this.device;return t.getProgramParameter(this.handle,35714)?(t.validateProgram(this.handle),t.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation-error")):(this.linkStatus="error","link-error")}async _waitForLinkComplete(){let t=async s=>await new Promise(i=>setTimeout(i,s));if(!this.device.features.has("compilation-status-async-webgl")){await t(10);return}let{gl:n}=this.device;for(;;){if(n.getProgramParameter(this.handle,37297))return;await t(10)}}_areTexturesRenderable(){let t=!0;for(let r of this.shaderLayout.bindings)!this.bindings[r.name]&&!this.bindings[r.name.replace(/Uniforms$/,"")]&&(U.warn(`Binding ${r.name} not found in ${this.id}`)(),t=!1);return t}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:t}=this.device;t.useProgram(this.handle);let r=0,n=0;for(let s of this.shaderLayout.bindings){let i=this.bindings[s.name]||this.bindings[s.name.replace(/Uniforms$/,"")];if(!i)throw new Error(`No value for binding ${s.name} in ${this.id}`);switch(s.type){case"uniform":let{name:o}=s,a=t.getUniformBlockIndex(this.handle,o);if(a===4294967295)throw new Error(`Invalid uniform block name ${o}`);t.uniformBlockBinding(this.handle,n,a),i instanceof Pn?t.bindBufferBase(35345,n,i.handle):t.bindBufferRange(35345,n,i.buffer.handle,i.offset||0,i.size||i.buffer.byteLength-i.offset),n+=1;break;case"texture":if(!(i instanceof os||i instanceof as||i instanceof is))throw new Error("texture");let c;if(i instanceof os)c=i.texture;else if(i instanceof as)c=i;else if(i instanceof is&&i.colorAttachments[0]instanceof os)U.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),c=i.colorAttachments[0].texture;else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(c.glTarget,c.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${s.type}' not supported in WebGL`)}}}_applyUniforms(){for(let t of this.shaderLayout.uniforms||[]){let{name:r,location:n,type:s,textureUnit:i}=t,o=this.uniforms[r]??i;o!==void 0&&nL(this.device.gl,n,s,o)}}}});function OQ(e,t){let r=t.sourceBuffer,n=t.destinationBuffer;e.gl.bindBuffer(36662,r.handle),e.gl.bindBuffer(36663,n.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}function LQ(e,t){throw new Error("Not implemented")}function BQ(e,t){let{sourceTexture:r,mipLevel:n=0,aspect:s="all",width:i=t.sourceTexture.width,height:o=t.sourceTexture.height,depthOrArrayLayers:a=0,origin:c=[0,0],destinationBuffer:l,byteOffset:f=0,bytesPerRow:h,rowsPerImage:u}=t;if(s!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||a!==0||h||u)throw new Error("not implemented");let{framebuffer:d,destroyFramebuffer:p}=lL(r),m;try{let g=l,x=i||d.width,v=o||d.height,_=v0(d.colorAttachments[0].texture.props.format),y=_.format,b=_.type;e.gl.bindBuffer(35051,g.handle),m=e.gl.bindFramebuffer(36160,d.handle),e.gl.readPixels(c[0],c[1],x,v,y,b,f)}finally{e.gl.bindBuffer(35051,null),m!==void 0&&e.gl.bindFramebuffer(36160,m),p&&d.destroy()}}function NQ(e,t){let{sourceTexture:r,destinationMipLevel:n=0,origin:s=[0,0],destinationOrigin:i=[0,0],destinationTexture:o}=t,{width:a=t.destinationTexture.width,height:c=t.destinationTexture.height}=t,{framebuffer:l,destroyFramebuffer:f}=lL(r),[h,u]=s,[d,p,m]=i,g=e.gl.bindFramebuffer(36160,l.handle),x,v;if(o instanceof as)x=o,a=Number.isFinite(a)?a:x.width,c=Number.isFinite(c)?c:x.height,x._bind(0),v=x.glTarget;else throw new Error("invalid destination");switch(v){case 3553:case 34067:e.gl.copyTexSubImage2D(v,n,d,p,h,u,a,c);break;case 35866:case 32879:e.gl.copyTexSubImage3D(v,n,d,p,m,h,u,a,c);break;default:}x&&x._unbind(),e.gl.bindFramebuffer(36160,g),f&&l.destroy()}function lL(e){if(e instanceof vt){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var N0,fL=W(()=>{it();O0();Wc();N0=class extends ic{device;handle=null;commands=[];constructor(t){super(t,{}),this.device=t}_executeCommands(t=this.commands){for(let r of t)switch(r.name){case"copy-buffer-to-buffer":OQ(this.device,r.options);break;case"copy-buffer-to-texture":LQ(this.device,r.options);break;case"copy-texture-to-buffer":BQ(this.device,r.options);break;case"copy-texture-to-texture":NQ(this.device,r.options);break;default:throw new Error(r.name)}}}});var FQ,F0,hL=W(()=>{it();R0();Uc();FQ=[1,2,4,8],F0=class extends Cs{device;handle=null;glParameters={};constructor(t,r){super(t,r),this.device=t;let n;if(!r?.parameters?.viewport)if(r?.framebuffer){let{width:i,height:o}=r.framebuffer;n=[0,0,i,o]}else{let[i,o]=t.getDefaultCanvasContext().getDrawingBufferSize();n=[0,0,i,o]}this.device.pushState(),this.setParameters({viewport:n,...this.props.parameters});let s=this.props.framebuffer;if(this.props.framebuffer&&s?.handle){let i=this.props.framebuffer.colorAttachments.map((o,a)=>36064+a);this.device.gl.drawBuffers(i)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(t={}){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,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),t.scissorRect&&(r.scissorTest=!0,r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),r[2967]=t.stencilReference),"colorMask"in t&&(r.colorMask=FQ.map(n=>Boolean(n&t.colorMask))),this.glParameters=r,wn(this.device.gl,r)}beginOcclusionQuery(t){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let t={...this.glParameters},r=0;this.props.clearColors&&this.props.clearColors.forEach((n,s)=>{n&&this.clearColorBuffer(s,n)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(r|=16384,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=256,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=1024,t.clearStencil=this.props.clearStencil),r!==0&&Fi(this.device.gl,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(t=0,r=[0,0,0,0]){Fi(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,t,r);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,t,r);break;case Float32Array:this.device.gl.clearBufferfv(6144,t,r);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}});var su,uL=W(()=>{it();fL();hL();su=class extends sc{device;handle=null;commandBuffer;constructor(t,r){super(t,r),this.device=t,this.commandBuffer=new N0(t)}destroy(){}finish(){return this.commandBuffer}beginRenderPass(t){return new F0(this.device,t)}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}resolveQuerySet(t,r,n){}}});function dL(e){let{target:t,source:r,start:n=0,count:s=1}=e,i=r.length,o=s*i,a=0;for(let c=n;a<i;a++)t[c++]=r[a];for(;a<o;)a<o-a?(t.copyWithin(n+a,n,n+a),a*=2):(t.copyWithin(n+a,n,n+o-a),a=o);return e.target}var pL=W(()=>{});function DQ(e){return Array.isArray(e)?new Float32Array(e):e}function kQ(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Hc,mL=W(()=>{it();hi();Fb();pL();Hc=class extends oc{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(t){return u2()==="Chrome"}constructor(t,r){super(t,r),this.device=t,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(t){let r=t;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(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:s,type:i,stride:o,offset:a,normalized:c,integer:l,divisor:f}=this._getAccessor(t);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?this.device.gl.vertexAttribIPointer(t,s,i,o,a):this.device.gl.vertexAttribPointer(t,s,i,c,o,a),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(t),this.device.gl.vertexAttribDivisor(t,f||0),this.attributes[t]=n,this.device.gl.bindVertexArray(null)}setConstantWebGL(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=_0(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(t,r=!0){let s=Hc.isConstantAttributeZeroSupported(this.device)||t!==0;(r||s)&&(t=Number(t),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl.bindVertexArray(null))}getConstantBuffer(t,r){let n=DQ(r),s=n.byteLength*t,i=n.length*t;if(this.buffer&&s!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${s} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:s}),o||=!kQ(n,this.bufferValue),o){let a=Nv(r.constructor,i);dL({target:a,source:n,start:0,count:i}),this.buffer.write(a),this.bufferValue=r}return this.buffer}}});function gL(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var D0,xL=W(()=>{it();iu();qb();D0=class extends ac{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(t,r){super(t,r),this.device=t,this.gl=t.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(t="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(oL(t))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:s,byteLength:i,byteOffset:o}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=s,U.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:s,byteLength:i,byteOffset:o},this.bindOnUse||this._bindBuffer(n,s,o,i)}getBuffer(t){if(gL(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(t=this.handle){if(typeof t!="function")return this.gl.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof Pn)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:s=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:s}}_getVaryingIndex(t){if(gL(t))return Number(t);for(let r of this.layout.varyings||[])if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:s}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,s,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r,n=0,s){let i=r&&r.handle;!i||s===void 0?this.gl.bindBufferBase(35982,t,i):this.gl.bindBufferRange(35982,t,i,n,s)}}});var k0,_L=W(()=>{it();k0=class extends cc{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(t,r){if(super(t,r),this.device=t,r.count>1)throw new Error("WebGL QuerySet can only have one value");let n=this.device.gl.createQuery();if(!n)throw new Error("WebGL query not supported");this.handle=n,Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(t){return this._begin(t?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(t){this._queryPending||(this.target=t,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 t=this.device.gl.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(t=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((n,s)=>{let i=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):r++>t?(s("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)}),this._pollingPromise}}});function $b(e){switch(e){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 yL(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}var vL=W(()=>{});function AL(e){return UQ[e]}var UQ,bL=W(()=>{UQ={[5124]:"sint32",[5125]:"uint32",[5122]:"sint16",[5123]:"uint16",[5120]:"sint8",[5121]:"uint8",[5126]:"float32",[5131]:"float16",[33635]:"uint16",[32819]:"uint16",[32820]:"uint16",[33640]:"uint32",[35899]:"uint32",[35902]:"uint32",[34042]:"uint32",[36269]:"uint32"}});function TL(e,t){let{sourceX:r=0,sourceY:n=0,sourceAttachment:s=0}=t||{},{target:i=null,sourceWidth:o,sourceHeight:a,sourceDepth:c,sourceFormat:l,sourceType:f}=t||{},{framebuffer:h,deleteFramebuffer:u}=EL(e),{gl:d,handle:p}=h;o||=h.width,a||=h.height;let m=h.colorAttachments[s]?.texture;if(!m)throw new Error(`Invalid framebuffer attachment ${s}`);c=m?.depth||1,l||=m?.glFormat||6408,f||=m?.glType||5121,i=zQ(i,f,l,o,a,c);let g=Eo(i);f=f||ZO(g);let x=d.bindFramebuffer(36160,p);return d.readBuffer(36064+s),d.readPixels(r,n,o,a,l,f,i),d.readBuffer(36064),d.bindFramebuffer(36160,x||null),u&&h.destroy(),i}function ML(e,t){let{target:r,sourceX:n=0,sourceY:s=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{sourceWidth:a,sourceHeight:c,sourceType:l}=t||{},{framebuffer:f,deleteFramebuffer:h}=EL(e);a=a||f.width,c=c||f.height;let u=f;l=l||5121;let d=r;if(!d){let m=$b(i),g=yL(l),x=o+a*c*m*g;d=u.device.createBuffer({byteLength:x})}let p=e.device.createCommandEncoder();return p.copyTextureToBuffer({sourceTexture:e,width:a,height:c,origin:[n,s],destinationBuffer:d,byteOffset:o}),p.destroy(),h&&f.destroy(),d}function EL(e){return e instanceof Yn?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:VQ(e),deleteFramebuffer:!0}}function VQ(e,t){let{device:r,width:n,height:s,id:i}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${i}`,width:n,height:s,colorAttachments:[e]})}function zQ(e,t,r,n,s,i){if(e)return e;t||=5121;let o=AL(t),a=So(o),c=$b(r);return new a(n*s*c)}var SL=W(()=>{it();jb();vL();bL()});var Xb={};Yt(Xb,{WebGLDevice:()=>cs});function WQ(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:}}function HQ(e,t,r){e.gl.vertexAttribI4iv(t,r)}function GQ(e,t,r){e.gl.vertexAttribI4uiv(t,r)}function jQ(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var cs,U0=W(()=>{it();Nb();wO();IO();kO();UO();VO();Pb();Ib();Wc();WO();E0();qO();YO();O0();T0();cL();uL();mL();xL();_L();SL();Uc();R0();eu();cs=class extends Er{type="webgl";handle;features;limits;info;canvasContext;preferredColorFormat="rgba8unorm";preferredDepthFormat="depth24plus";commandEncoder;lost;_resolveContextLost;gl;_constants;_extensions={};_polyfilled=!1;spectorJS;get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(t){switch(t){case"unorm8x4-bgra":return!1;default:return!0}}constructor(t){super({...t,id:t.id||zO("webgl-device")});let r=Er._getCanvasContextProps(t);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 M0(this,r),this.lost=new Promise(f=>{this._resolveContextLost=f});let s={...t.webgl};r.alphaMode==="premultiplied"&&(s.premultipliedAlpha=!0),t.powerPreference!==void 0&&(s.powerPreference=t.powerPreference);let o=this.props._handle||SO(this.canvasContext.canvas,{onContextLost:f=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:f=>console.log("WebGL context restored")},s);if(!o)throw new Error("WebGL context creation failed");if(n=o.device,n){if(t._reuseDevices)return U.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=o,this.gl=o,this.spectorJS=hO({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=CO(this.gl,this._extensions),this.limits=new b0(this.gl),this.features=new A0(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new Cn(this.gl,{log:(...f)=>U.log(1,...f)()}).trackState(this.gl,{copyState:!1});let c=t.debugWebGL||t.debug,l=t.debugWebGL;c&&(this.gl=mO(this.gl,{debugWebGL:c,traceWebGL:l}),U.warn("WebGL debug mode activated. Performance reduced.")(),t.debugWebGL&&(U.level=Math.max(U.level,1))),this.commandEncoder=new su(this,{id:`${this}-command-encoder`})}destroy(){!this.props._reuseDevices&&!this._reused&&delete this.gl.device}get isLost(){return this.gl.isContextLost()}getTextureByteAlignment(){return 4}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._normalizeBufferProps(t);return new Pn(this,r)}createTexture(t){return new as(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new I0(this,t)}createShader(t){return new S0(this,t)}createFramebuffer(t){return new is(this,t)}createVertexArray(t){return new Hc(this,t)}createTransformFeedback(t){return new D0(this,t)}createQuerySet(t){return new k0(this,t)}createRenderPipeline(t){return new B0(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(t={}){return new su(this,t)}submit(t){t||(t=this.commandEncoder.finish(),this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:`${this.id}-default-encoder`})),t._executeCommands()}readPixelsToArrayWebGL(t,r){return TL(t,r)}readPixelsToBufferWebGL(t,r){return ML(t,r)}setParametersWebGL(t){wn(this.gl,t)}getParametersWebGL(t){return x0(this.gl,t)}withParametersWebGL(t,r){return Fi(this.gl,t,r)}resetWebGL(){U.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),AO(this.gl)}_getDeviceSpecificTextureFormatCapabilities(t){return NO(this.gl,t,this._extensions)}loseDevice(){let t=!1,n=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return n&&(t=!0,n.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),t}pushState(){Cn.get(this.gl).push()}popState(){Cn.get(this.gl).pop()}getGLKey(t,r){let n=Number(t);for(let s in this.gl)if(this.gl[s]===n)return`GL.${s}`;return r?.emptyIfUnknown?"":String(t)}getGLKeys(t){let r={emptyIfUnknown:!0};return Object.entries(t).reduce((n,[s,i])=>(n[`${s}:${this.getGLKey(s,r)}`]=`${i}:${this.getGLKey(i,r)}`,n),{})}setConstantAttributeWebGL(t,r){let n=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(n).fill(null);let s=this._constants[t];switch(s&&jQ(s,r)&&U.info(1,`setConstantAttributeWebGL(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:WQ(this,t,r);break;case Int32Array:HQ(this,t,r);break;case Uint32Array:GQ(this,t,r);break;default:throw new Error("constant")}}getExtension(t){return ss(this.gl,t,this._extensions),this._extensions}_setWebGLDebugMetadata(t,r,n){t.luma=r;let s={props:n.spector,id:n.spector.id};t.__SPECTOR_Metadata=s}}});function qQ(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}var V0,Yb,ou,wL=W(()=>{it();cO();Pb();Ib();V0=1,Yb=class extends Zf{type="webgl";constructor(){super(),Er.defaultProps={...Er.defaultProps,...g0}}enforceWebGL2(t){aO(t)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&t instanceof WebGLRenderingContext&&U.warn("WebGL1 is not supported",t)(),!1)}async attach(t,r={}){let{WebGLDevice:n}=await Promise.resolve().then(()=>(U0(),Xb));if(t instanceof n)return t;if(t?.device instanceof n)return t.device;if(!qQ(t))throw new Error("Invalid WebGL2RenderingContext");let s=r.createCanvasContext===!0?{}:r.createCanvasContext;return new n({...r,_handle:t,createCanvasContext:{canvas:t.canvas,autoResize:!1,...s}})}async create(t={}){let{WebGLDevice:r}=await Promise.resolve().then(()=>(U0(),Xb));U.groupCollapsed(V0,"WebGLDevice created")();try{let n=[];(t.debugWebGL||t.debug)&&n.push(pO()),t.debugSpectorJS&&n.push(fO(t));let s=await Promise.allSettled(n);for(let a of s)a.status==="rejected"&&U.error(`Failed to initialize debug libraries ${a.reason}`)();let i=new r(t),o=`${i._reused?"Reusing":"Created"} device with WebGL2 ${i.props.debug?"debug ":""}context: ${i.info.vendor}, ${i.info.renderer} for canvas: ${i.canvasContext.id}`;return U.probe(V0,o)(),U.table(V0,i.info)(),i}finally{U.groupEnd(V0)()}}};ou=new Yb});var iu=W(()=>{wL();U0();E0()});var fB=Ge((iWt,x3)=>{"use strict";x3.exports=g1;x3.exports.default=g1;function g1(e,t,r){r=r||2;var n=t&&t.length,s=n?t[0]*r:e.length,i=aB(e,0,s,r,!0),o=[];if(!i||i.next===i.prev)return o;var a,c,l,f,h,u,d;if(n&&(i=zet(e,t,i,r)),e.length>80*r){a=l=e[0],c=f=e[1];for(var p=r;p<s;p+=r)h=e[p],u=e[p+1],h<a&&(a=h),u<c&&(c=u),h>l&&(l=h),u>f&&(f=u);d=Math.max(l-a,f-c),d=d!==0?32767/d:0}return zu(i,o,r,a,c,d,0),o}function aB(e,t,r,n,s){var i,o;if(s===g3(e,t,r,n)>0)for(i=t;i<r;i+=n)o=oB(i,e[i],e[i+1],o);else for(i=r-n;i>=t;i-=n)o=oB(i,e[i],e[i+1],o);return o&&x1(o,o.next)&&(Hu(o),o=o.next),o}function la(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(x1(r,r.next)||ne(r.prev,r,r.next)===0)){if(Hu(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function zu(e,t,r,n,s,i,o){if(e){!o&&i&&qet(e,n,s,i);for(var a=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,i?ket(e,n,s,i):Det(e)){t.push(c.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),Hu(e),e=l.next,a=l.next;continue}if(e=l,e===a){o?o===1?(e=Uet(la(e),t,r),zu(e,t,r,n,s,i,2)):o===2&&Vet(e,t,r,n,s,i):zu(la(e),t,r,n,s,i,1);break}}}}function Det(e){var t=e.prev,r=e,n=e.next;if(ne(t,r,n)>=0)return!1;for(var s=t.x,i=r.x,o=n.x,a=t.y,c=r.y,l=n.y,f=s<i?s<o?s:o:i<o?i:o,h=a<c?a<l?a:l:c<l?c:l,u=s>i?s>o?s:o:i>o?i:o,d=a>c?a>l?a:l:c>l?c:l,p=n.next;p!==t;){if(p.x>=f&&p.x<=u&&p.y>=h&&p.y<=d&&Kc(s,a,i,c,o,l,p.x,p.y)&&ne(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function ket(e,t,r,n){var s=e.prev,i=e,o=e.next;if(ne(s,i,o)>=0)return!1;for(var a=s.x,c=i.x,l=o.x,f=s.y,h=i.y,u=o.y,d=a<c?a<l?a:l:c<l?c:l,p=f<h?f<u?f:u:h<u?h:u,m=a>c?a>l?a:l:c>l?c:l,g=f>h?f>u?f:u:h>u?h:u,x=p3(d,p,t,r,n),v=p3(m,g,t,r,n),_=e.prevZ,y=e.nextZ;_&&_.z>=x&&y&&y.z<=v;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Kc(a,f,c,h,l,u,_.x,_.y)&&ne(_.prev,_,_.next)>=0||(_=_.prevZ,y.x>=d&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==o&&Kc(a,f,c,h,l,u,y.x,y.y)&&ne(y.prev,y,y.next)>=0))return!1;y=y.nextZ}for(;_&&_.z>=x;){if(_.x>=d&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==o&&Kc(a,f,c,h,l,u,_.x,_.y)&&ne(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;y&&y.z<=v;){if(y.x>=d&&y.x<=m&&y.y>=p&&y.y<=g&&y!==s&&y!==o&&Kc(a,f,c,h,l,u,y.x,y.y)&&ne(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Uet(e,t,r){var n=e;do{var s=n.prev,i=n.next.next;!x1(s,i)&&cB(s,n,n.next,i)&&Wu(s,i)&&Wu(i,s)&&(t.push(s.i/r|0),t.push(n.i/r|0),t.push(i.i/r|0),Hu(n),Hu(n.next),n=e=i),n=n.next}while(n!==e);return la(n)}function Vet(e,t,r,n,s,i){var o=e;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Yet(o,a)){var c=lB(o,a);o=la(o,o.next),c=la(c,c.next),zu(o,t,r,n,s,i,0),zu(c,t,r,n,s,i,0);return}a=a.next}o=o.next}while(o!==e)}function zet(e,t,r,n){var s=[],i,o,a,c,l;for(i=0,o=t.length;i<o;i++)a=t[i]*n,c=i<o-1?t[i+1]*n:e.length,l=aB(e,a,c,n,!1),l===l.next&&(l.steiner=!0),s.push(Xet(l));for(s.sort(Wet),i=0;i<s.length;i++)r=Het(s[i],r);return r}function Wet(e,t){return e.x-t.x}function Het(e,t){var r=Get(e,t);if(!r)return t;var n=lB(r,e);return la(n,n.next),la(r,r.next)}function Get(e,t){var r=t,n=e.x,s=e.y,i=-1/0,o;do{if(s<=r.y&&s>=r.next.y&&r.next.y!==r.y){var a=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>i&&(i=a,o=r.x<r.next.x?r:r.next,a===n))return o}r=r.next}while(r!==t);if(!o)return null;var c=o,l=o.x,f=o.y,h=1/0,u;r=o;do n>=r.x&&r.x>=l&&n!==r.x&&Kc(s<f?n:i,s,l,f,s<f?i:n,s,r.x,r.y)&&(u=Math.abs(s-r.y)/(n-r.x),Wu(r,e)&&(u<h||u===h&&(r.x>o.x||r.x===o.x&&jet(o,r)))&&(o=r,h=u)),r=r.next;while(r!==c);return o}function jet(e,t){return ne(e.prev,e,t.prev)<0&&ne(t.next,e,e.next)<0}function qet(e,t,r,n){var s=e;do s.z===0&&(s.z=p3(s.x,s.y,t,r,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,$et(s)}function $et(e){var t,r,n,s,i,o,a,c,l=1;do{for(r=e,e=null,i=null,o=0;r;){for(o++,n=r,a=0,t=0;t<l&&(a++,n=n.nextZ,!!n);t++);for(c=l;a>0||c>0&&n;)a!==0&&(c===0||!n||r.z<=n.z)?(s=r,r=r.nextZ,a--):(s=n,n=n.nextZ,c--),i?i.nextZ=s:e=s,s.prevZ=i,i=s;r=n}i.nextZ=null,l*=2}while(o>1);return e}function p3(e,t,r,n,s){return e=(e-r)*s|0,t=(t-n)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Xet(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Kc(e,t,r,n,s,i,o,a){return(s-o)*(t-a)>=(e-o)*(i-a)&&(e-o)*(n-a)>=(r-o)*(t-a)&&(r-o)*(i-a)>=(s-o)*(n-a)}function Yet(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!Ket(e,t)&&(Wu(e,t)&&Wu(t,e)&&Zet(e,t)&&(ne(e.prev,e,t.prev)||ne(e,t.prev,t))||x1(e,t)&&ne(e.prev,e,e.next)>0&&ne(t.prev,t,t.next)>0)}function ne(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function x1(e,t){return e.x===t.x&&e.y===t.y}function cB(e,t,r,n){var s=m1(ne(e,t,r)),i=m1(ne(e,t,n)),o=m1(ne(r,n,e)),a=m1(ne(r,n,t));return!!(s!==i&&o!==a||s===0&&p1(e,r,t)||i===0&&p1(e,n,t)||o===0&&p1(r,e,n)||a===0&&p1(r,t,n))}function p1(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function m1(e){return e>0?1:e<0?-1:0}function Ket(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&cB(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Wu(e,t){return ne(e.prev,e,e.next)<0?ne(e,t,e.next)>=0&&ne(e,e.prev,t)>=0:ne(e,t,e.prev)<0||ne(e,e.next,t)<0}function Zet(e,t){var r=e,n=!1,s=(e.x+t.x)/2,i=(e.y+t.y)/2;do r.y>i!=r.next.y>i&&r.next.y!==r.y&&s<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function lB(e,t){var r=new m3(e.i,e.x,e.y),n=new m3(t.i,t.x,t.y),s=e.next,i=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function oB(e,t,r,n){var s=new m3(e,t,r);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Hu(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function m3(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}g1.deviation=function(e,t,r,n){var s=t&&t.length,i=s?t[0]*r:e.length,o=Math.abs(g3(e,0,i,r));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*r,f=a<c-1?t[a+1]*r:e.length;o-=Math.abs(g3(e,l,f,r))}var h=0;for(a=0;a<n.length;a+=3){var u=n[a]*r,d=n[a+1]*r,p=n[a+2]*r;h+=Math.abs((e[u]-e[p])*(e[d+1]-e[u+1])-(e[u]-e[d])*(e[p+1]-e[u+1]))}return o===0&&h===0?0:Math.abs((h-o)/o)};function g3(e,t,r,n){for(var s=0,i=t,o=r-n;i<r;i+=n)s+=(e[o]-e[i])*(e[i+1]+e[o+1]),o=i;return s}g1.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,s=0;s<e.length;s++){for(var i=0;i<e[s].length;i++)for(var o=0;o<t;o++)r.vertices.push(e[s][i][o]);s>0&&(n+=e[s-1].length,r.holes.push(n))}return r}});var ad=Ge((fGt,mF)=>{mF.exports=globalThis.h3||{}});var Z1=Ge(Ys=>{"use strict";var _F=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",rot=_F+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",yF="["+_F+"]["+rot+"]*",not=new RegExp("^"+yF+"$"),sot=function(e,t){let r=[],n=t.exec(e);for(;n;){let s=[];s.startIndex=t.lastIndex-n[0].length;let i=n.length;for(let o=0;o<i;o++)s.push(n[o]);r.push(s),n=t.exec(e)}return r},iot=function(e){let t=not.exec(e);return!(t===null||typeof t>"u")};Ys.isExist=function(e){return typeof e<"u"};Ys.isEmptyObject=function(e){return Object.keys(e).length===0};Ys.merge=function(e,t,r){if(t){let n=Object.keys(t),s=n.length;for(let i=0;i<s;i++)r==="strict"?e[n[i]]=[t[n[i]]]:e[n[i]]=t[n[i]]}};Ys.getValue=function(e){return Ys.isExist(e)?e:""};Ys.isName=iot;Ys.getAllMatches=sot;Ys.nameRegexp=yF});var z3=Ge(MF=>{"use strict";var V3=Z1(),oot={allowBooleanAttributes:!1,unpairedTags:[]};MF.validate=function(e,t){t=Object.assign({},oot,t);let r=[],n=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=AF(e,i),i.err)return i}else if(e[i]==="<"){let o=i;if(i++,e[i]==="!"){i=bF(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let c="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
|
|
19
19
|
`&&e[i]!=="\r";i++)c+=e[i];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),i--),!pot(c)){let h;return c.trim().length===0?h="Invalid space after '<'.":h="Tag '"+c+"' is an invalid name.",ge("InvalidTag",h,vr(e,i))}let l=lot(e,i);if(l===!1)return ge("InvalidAttr","Attributes for '"+c+"' have open quote.",vr(e,i));let f=l.value;if(i=l.index,f[f.length-1]==="/"){let h=i-f.length;f=f.substring(0,f.length-1);let u=TF(f,t);if(u===!0)n=!0;else return ge(u.err.code,u.err.msg,vr(e,h+u.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return ge("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",vr(e,o));if(r.length===0)return ge("InvalidTag","Closing tag '"+c+"' has not been opened.",vr(e,o));{let h=r.pop();if(c!==h.tagName){let u=vr(e,h.tagStartPos);return ge("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+u.line+", col "+u.col+") instead of closing tag '"+c+"'.",vr(e,o))}r.length==0&&(s=!0)}}else return ge("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",vr(e,i));else{let h=TF(f,t);if(h!==!0)return ge(h.err.code,h.err.msg,vr(e,i-f.length+h.err.line));if(s===!0)return ge("InvalidXml","Multiple possible root nodes found.",vr(e,i));t.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:o}),n=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=bF(e,i);continue}else if(e[i+1]==="?"){if(i=AF(e,++i),i.err)return i}else break;else if(e[i]==="&"){let h=uot(e,i);if(h==-1)return ge("InvalidChar","char '&' is not expected.",vr(e,i));i=h}else if(s===!0&&!vF(e[i]))return ge("InvalidXml","Extra text at the end",vr(e,i));e[i]==="<"&&i--}}else{if(vF(e[i]))continue;return ge("InvalidChar","char '"+e[i]+"' is not expected.",vr(e,i))}if(n){if(r.length==1)return ge("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",vr(e,r[0].tagStartPos));if(r.length>0)return ge("InvalidXml","Invalid '"+JSON.stringify(r.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ge("InvalidXml","Start tag expected.",1);return!0};function vF(e){return e===" "||e===" "||e===`
|
|
20
20
|
`||e==="\r"}function AF(e,t){let r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){let n=e.substr(r,t-r);if(t>5&&n==="xml")return ge("InvalidXml","XML declaration allowed only at the start of the document.",vr(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function bF(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}var aot='"',cot="'";function lot(e,t){let r="",n="",s=!1;for(;t<e.length;t++){if(e[t]===aot||e[t]===cot)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){s=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:s}}var fot=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function TF(e,t){let r=V3.getAllMatches(e,fot),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return ge("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",fd(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ge("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",fd(r[s]));if(r[s][3]===void 0&&!t.allowBooleanAttributes)return ge("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",fd(r[s]));let i=r[s][2];if(!dot(i))return ge("InvalidAttr","Attribute '"+i+"' is an invalid name.",fd(r[s]));if(!n.hasOwnProperty(i))n[i]=1;else return ge("InvalidAttr","Attribute '"+i+"' is repeated.",fd(r[s]))}return!0}function hot(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function uot(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,hot(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function ge(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function dot(e){return V3.isName(e)}function pot(e){return V3.isName(e)}function vr(e,t){let r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function fd(e){return e.startIndex+e[1].length}});var SF=Ge(W3=>{var EF={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e}},mot=function(e){return Object.assign({},EF,e)};W3.buildOptions=mot;W3.defaultOptions=EF});var CF=Ge((AGt,wF)=>{"use strict";var H3=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,[":@"]:t[":@"]}):this.child.push({[t.tagname]:t.child})}};wF.exports=H3});var IF=Ge((bGt,PF)=>{var got=Z1();function xot(e,t){let r={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let n=1,s=!1,i=!1,o="";for(;t<e.length;t++)if(e[t]==="<"&&!i){if(s&&vot(e,t))t+=7,[entityName,val,t]=_ot(e,t+1),val.indexOf("&")===-1&&(r[Mot(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(s&&Aot(e,t))t+=8;else if(s&&bot(e,t))t+=8;else if(s&&Tot(e,t))t+=9;else if(yot)i=!0;else throw new Error("Invalid DOCTYPE");n++,o=""}else if(e[t]===">"){if(i?e[t-1]==="-"&&e[t-2]==="-"&&(i=!1,n--):n--,n===0)break}else e[t]==="["?s=!0:o+=e[t];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:t}}function _ot(e,t){let r="";for(;t<e.length&&e[t]!=="'"&&e[t]!=='"';t++)r+=e[t];if(r=r.trim(),r.indexOf(" ")!==-1)throw new Error("External entites are not supported");let n=e[t++],s="";for(;t<e.length&&e[t]!==n;t++)s+=e[t];return[r,s,t]}function yot(e,t){return e[t+1]==="!"&&e[t+2]==="-"&&e[t+3]==="-"}function vot(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="N"&&e[t+4]==="T"&&e[t+5]==="I"&&e[t+6]==="T"&&e[t+7]==="Y"}function Aot(e,t){return e[t+1]==="!"&&e[t+2]==="E"&&e[t+3]==="L"&&e[t+4]==="E"&&e[t+5]==="M"&&e[t+6]==="E"&&e[t+7]==="N"&&e[t+8]==="T"}function bot(e,t){return e[t+1]==="!"&&e[t+2]==="A"&&e[t+3]==="T"&&e[t+4]==="T"&&e[t+5]==="L"&&e[t+6]==="I"&&e[t+7]==="S"&&e[t+8]==="T"}function Tot(e,t){return e[t+1]==="!"&&e[t+2]==="N"&&e[t+3]==="O"&&e[t+4]==="T"&&e[t+5]==="A"&&e[t+6]==="T"&&e[t+7]==="I"&&e[t+8]==="O"&&e[t+9]==="N"}function Mot(e){if(got.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}PF.exports=xot});var OF=Ge((TGt,RF)=>{var Eot=/^[-+]?0x[a-fA-F0-9]+$/,Sot=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var wot={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Cot(e,t={}){if(t=Object.assign({},wot,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(t.hex&&Eot.test(r))return Number.parseInt(r,16);{let n=Sot.exec(r);if(n){let s=n[1],i=n[2],o=Pot(n[3]),a=n[4]||n[6];if(!t.leadingZeros&&i.length>0&&s&&r[2]!==".")return e;if(!t.leadingZeros&&i.length>0&&!s&&r[1]!==".")return e;{let c=Number(r),l=""+c;return l.search(/[eE]/)!==-1||a?t.eNotation?c:e:r.indexOf(".")!==-1?l==="0"&&o===""||l===o||s&&l==="-"+o?c:e:i?o===l||s+o===l?c:e:r===l||r===s+l?c:e}}else return e}}function Pot(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}RF.exports=Cot});var NF=Ge((MGt,BF)=>{"use strict";var LF=Z1(),hd=CF(),Iot=IF(),Rot=OF(),G3=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=Oot,this.parseXml=Dot,this.parseTextData=Lot,this.resolveNameSpace=Bot,this.buildAttributesMap=Fot,this.isItStopNode=zot,this.replaceEntitiesValue=Uot,this.readStopNodeData=Hot,this.saveTextToParentTag=Vot,this.addChild=kot}};function Oot(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function Lot(e,t,r,n,s,i,o){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e));let a=this.options.tagValueProcessor(t,e,r,s,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?q3(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?q3(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Bot(e){if(this.options.removeNSPrefix){let t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}var Not=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Fot(e,t,r){if(!this.options.ignoreAttributes&&typeof e=="string"){let n=LF.getAllMatches(e,Not),s=n.length,i={};for(let o=0;o<s;o++){let a=this.resolveNameSpace(n[o][1]),c=n[o][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);let f=this.options.attributeValueProcessor(a,c,t);f==null?i[l]=c:typeof f!=typeof c||f!==c?i[l]=f:i[l]=q3(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){let o={};return o[this.options.attributesGroupName]=i,o}return i}}var Dot=function(e){e=e.replace(/\r\n?/g,`
|
|
21
21
|
`);let t=new hd("!xml"),r=t,n="",s="";for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){let a=ma(e,">",i,"Closing Tag is not closed."),c=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&(n=this.saveTextToParentTag(n,r,s));let l=s.substring(s.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let f=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(f=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=s.lastIndexOf("."),s=s.substring(0,f),r=this.tagsNodeStack.pop(),n="",i=a}else if(e[i+1]==="?"){let a=j3(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let c=new hd(a.tagName);c.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(c[":@"]=this.buildAttributesMap(a.tagExp,s,a.tagName)),this.addChild(r,c,s)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){let a=ma(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let c=e.substring(i+4,a-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}i=a}else if(e.substr(i+1,2)==="!D"){let a=Iot(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){let a=ma(e,"]]>",i,"CDATA is not closed.")-2,c=e.substring(i+9,a);n=this.saveTextToParentTag(n,r,s);let l=this.parseTextData(c,r.tagname,s,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):r.add(this.options.textNodeName,l),i=a+2}else{let a=j3(e,i,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,f=a.tagExp,h=a.attrExpPresent,u=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let d=r;if(d&&this.options.unpairedTags.indexOf(d.tagname)!==-1&&(r=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),c!==t.tagname&&(s+=s?"."+c:c),this.isItStopNode(this.options.stopNodes,s,c)){let p="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),i=a.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)i=a.closeIndex;else{let g=this.readStopNodeData(e,l,u+1);if(!g)throw new Error(`Unexpected end of ${l}`);i=g.i,p=g.tagContent}let m=new hd(c);c!==f&&h&&(m[":@"]=this.buildAttributesMap(f,s,c)),p&&(p=this.parseTextData(p,c,s,!0,h,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),m.add(this.options.textNodeName,p),this.addChild(r,m,s)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){c[c.length-1]==="/"?(c=c.substr(0,c.length-1),s=s.substr(0,s.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let p=new hd(c);c!==f&&h&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),s=s.substr(0,s.lastIndexOf("."))}else{let p=new hd(c);this.tagsNodeStack.push(r),c!==f&&h&&(p[":@"]=this.buildAttributesMap(f,s,c)),this.addChild(r,p,s),r=p}n="",i=u}}else n+=e[i];return t.child};function kot(e,t,r){let n=this.options.updateTag(t.tagname,r,t[":@"]);n===!1||(typeof n=="string"&&(t.tagname=n),e.addChild(t))}var Uot=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){let r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){let r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){let r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Vot(e,t,r,n){return e&&(n===void 0&&(n=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function zot(e,t,r){let n="*."+r;for(let s in e){let i=e[s];if(n===i||t===i)return!0}return!1}function Wot(e,t,r=">"){let n,s="";for(let i=t;i<e.length;i++){let o=e[i];if(n)o===n&&(n="");else if(o==='"'||o==="'")n=o;else if(o===r[0])if(r[1]){if(e[i+1]===r[1])return{data:s,index:i}}else return{data:s,index:i};else o===" "&&(o=" ");s+=o}}function ma(e,t,r,n){let s=e.indexOf(t,r);if(s===-1)throw new Error(n);return s+t.length-1}function j3(e,t,r,n=">"){let s=Wot(e,t+1,n);if(!s)return;let i=s.data,o=s.index,a=i.search(/\s/),c=i,l=!0;a!==-1&&(c=i.substring(0,a),i=i.substring(a+1).trimStart());let f=c;if(r){let h=c.indexOf(":");h!==-1&&(c=c.substr(h+1),l=c!==s.data.substr(h+1))}return{tagName:c,tagExp:i,closeIndex:o,attrExpPresent:l,rawTagName:f}}function Hot(e,t,r){let n=r,s=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){let i=ma(e,">",r,`${t} is not closed`);if(e.substring(r+2,i).trim()===t&&(s--,s===0))return{tagContent:e.substring(n,r),i};r=i}else if(e[r+1]==="?")r=ma(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=ma(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=ma(e,"]]>",r,"StopNode is not closed.")-2;else{let i=j3(e,r,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&s++,r=i.closeIndex)}}function q3(e,t,r){if(t&&typeof e=="string"){let n=e.trim();return n==="true"?!0:n==="false"?!1:Rot(e,r)}else return LF.isExist(e)?e:""}BF.exports=G3});var kF=Ge(DF=>{"use strict";function Got(e,t){return FF(e,t)}function FF(e,t,r){let n,s={};for(let i=0;i<e.length;i++){let o=e[i],a=jot(o),c="";if(r===void 0?c=a:c=r+"."+a,a===t.textNodeName)n===void 0?n=o[a]:n+=""+o[a];else{if(a===void 0)continue;if(o[a]){let l=FF(o[a],t,c),f=$ot(l,t);o[":@"]?qot(l,o[":@"],c,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(l)):t.isArray(a,c,f)?s[a]=[l]:s[a]=l}}}return typeof n=="string"?n.length>0&&(s[t.textNodeName]=n):n!==void 0&&(s[t.textNodeName]=n),s}function jot(e){let t=Object.keys(e);for(let r=0;r<t.length;r++){let n=t[r];if(n!==":@")return n}}function qot(e,t,r,n){if(t){let s=Object.keys(t),i=s.length;for(let o=0;o<i;o++){let a=s[o];n.isArray(a,r+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function $ot(e,t){let{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}DF.prettify=Got});var VF=Ge((SGt,UF)=>{var{buildOptions:Xot}=SF(),Yot=NF(),{prettify:Kot}=kF(),Zot=z3(),$3=class{constructor(t){this.externalEntities={},this.options=Xot(t)}parse(t,r){if(typeof t!="string")if(t.toString)t=t.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let i=Zot.validate(t,r);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}let n=new Yot(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(t);return this.options.preserveOrder||s===void 0?s:Kot(s,this.options)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}};UF.exports=$3});var jF=Ge((wGt,GF)=>{var Jot=`
|
|
@@ -26,7 +26,7 @@ ${t}`;let{gl:r}=this.device;if(r.shaderSource(this.handle,t),r.compileShader(thi
|
|
|
26
26
|
} catch (error) {
|
|
27
27
|
console.error(error);
|
|
28
28
|
throw error;
|
|
29
|
-
}`}function y2(e,t=!0,r){let n=r||new Set;if(e){if(Cw(e))n.add(e);else if(Cw(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let s in e)y2(e[s],t,n)}}return r===void 0?Array.from(n):[]}function Cw(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var v2=()=>{},ui=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Fe||typeof Za<"u"&&!Fe}constructor(t){let{name:r,source:n,url:s}=t;je(n||s),this.name=r,this.source=n,this.url=s,this.onMessage=v2,this.onError=i=>console.log(i),this.worker=Fe?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=v2,this.onError=v2,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||y2(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=Sw({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new Za(n,{eval:!1})}else if(this.source)t=new Za(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var Pf=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return ui.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(s,i,o)=>s.done(o),n=(s,i)=>s.error(i)){let s=new Promise(i=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:i}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let n=new Cf(r.name,t);t.onMessage=s=>r.onMessage(n,s.type,s.payload),t.onError=s=>r.onError(n,s),r.onStart(n);try{await n.result}catch(s){console.error(`Worker exception: ${s}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!Fe||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new ui({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ew?this.maxMobileConcurrency:this.maxConcurrency}};var gj={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},xo=class{props;workerPools=new Map;static isSupported(){return ui.isSupported()}static getWorkerFarm(t={}){return xo._workerFarm=xo._workerFarm||new xo({}),xo._workerFarm.setProps(t),xo._workerFarm}constructor(t){this.props={...gj},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:n,url:s}=t,i=this.workerPools.get(r);return i||(i=new Pf({name:r,source:n,url:s}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},di=xo;X(di,"_workerFarm");function A2(e,t={}){let r=t[e.id]||{},n=Fe?`${e.id}-worker.js`:`${e.id}-worker-node.js`,s=r.workerUrl;if(!s&&e.id==="compression"&&(s=t.workerUrl),t._workerType==="test"&&(Fe?s=`modules/${e.module}/dist/${n}`:s=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!s){let i=e.version;i==="latest"&&(i=Tw);let o=i?`@${i}`:"";s=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${n}`}return je(s),s}function b2(e,t=Sf){je(e,"no worker provided");let r=e.version;return!(!t||!r)}var T2={};async function Gn(e,t=null,r={},n=null){return t&&(e=Pw(e,t,r,n)),T2[e]=T2[e]||xj(e),await T2[e]}function Pw(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let s=r.modules||{};return s[n]?s[n]:Fe?r.CDN?(je(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Sf}/dist/libs/${n}`):wf?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function xj(e){if(e.endsWith("wasm"))return await yj(e);if(!Fe)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(wf)return importScripts(e);let t=await vj(e);return _j(t,e)}function _j(e,t){if(!Fe){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(wf)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function yj(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Fe||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function vj(e){let{readFileAsText:t}=globalThis.loaders||{};return Fe||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function M2(e,t){return!di.isSupported()||!Fe&&!t?._nodeWorkers?!1:e.worker&&t?.worker}async function E2(e,t,r,n,s){let i=e.id,o=A2(e,r),c=di.getWorkerFarm(r).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let l=await c.startJob("process-on-worker",Aj.bind(null,s));return l.postMessage("process",{input:t,options:r,context:n}),await(await l.result).result}async function Aj(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:s,input:i,options:o}=n;try{let a=await e(i,o);t.postMessage("done",{id:s,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:s,error:c})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function Rw(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Iw(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Iw(e,0,t):""}function Iw(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(t+i));return s}function S2(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Rw(e)}"`)}}function w2(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),s=new Uint8Array(t);for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0}function C2(...e){return Ow(e)}function Ow(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),s=0;for(let i of t)n.set(i,s),s+=i.byteLength;return n.buffer}function If(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((o,a)=>o+a.length,0),s=new r(n),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function _o(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function pi(e,t){return pt(e>=0),pt(t>0),e+(t-1)&~(t-1)}function P2(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(n,r),r+pi(n.byteLength,4)}async function I2(e){let t=[];for await(let r of e)t.push(r);return C2(...t)}vo();var bj="Queued Requests",Tj="Active Requests",Mj="Cancelled Requests",Ej="Queued Requests Ever",Sj="Active Requests Ever",wj={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},mi=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...wj,...t},this.stats=new Ze({id:this.props.id}),this.stats.get(bj),this.stats.get(Tj),this.stats.get(Mj),this.stats.get(Ej),this.stats.get(Sj)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(i=>(n.resolve=i,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Cj="",Bw={};function L2(e){for(let t in Bw)if(e.startsWith(t)){let r=Bw[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Cj}${e}`),e}function Nw(e){return e&&typeof e=="object"&&e.isBuffer}function lm(e){if(Nw(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var Fr={};Yt(Fr,{dirname:()=>Ij,filename:()=>Pj,join:()=>Rj,resolve:()=>Oj});function Fw(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Pj(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function Ij(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Rj(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function Oj(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let r="",n=!1,s;for(let i=t.length-1;i>=-1&&!n;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=Fw()),o=s),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===Of)}return r=Lj(r,!n),n?`/${r}`:r.length>0?r:"."}var Of=47,B2=46;function Lj(e,t){let r="",n=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===Of)break;i=Of}if(i===Of){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==B2||r.charCodeAt(r.length-2)!==B2){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Of;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,o=!1}n=a,s=0}else i===B2&&s!==-1?++s:s=-1}return r}var fm=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Bj(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Bj(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,s)=>t(n,s);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qr=class extends fm{};X(qr,"type","template"),X(qr,"testURL",t=>!1);var Nj=e=>typeof e=="boolean",Lf=e=>typeof e=="function",Ao=e=>e!==null&&typeof e=="object",N2=e=>Ao(e)&&e.constructor==={}.constructor;var Dw=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",kw=e=>e&&typeof e[Symbol.asyncIterator]=="function";var $r=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Xr=e=>typeof Blob<"u"&&e instanceof Blob,Uw=e=>e&&typeof e=="object"&&e.isBuffer;var Fj=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||Ao(e)&&Lf(e.tee)&&Lf(e.cancel)&&Lf(e.getReader);var Dj=e=>Ao(e)&&Lf(e.read)&&Lf(e.pipe)&&Nj(e.readable),hm=e=>Fj(e)||Dj(e);var um=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var kj=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Uj=/^([-\w.]+\/[-\w.+]+)/;function F2(e,t){return e.toLowerCase()===t.toLowerCase()}function Vw(e){let t=Uj.exec(e);return t?t[1]:e}function D2(e){let t=kj.exec(e);return t?t[1]:""}var zw=/\?.*/;function Ww(e){let t=e.match(zw);return t&&t[0]}function Ja(e){return e.replace(zw,"")}function Hw(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function bo(e){return $r(e)?e.url:Xr(e)?e.name||"":typeof e=="string"?e:""}function Bf(e){if($r(e)){let t=e,r=t.headers.get("content-type")||"",n=Ja(t.url);return Vw(r)||D2(n)}return Xr(e)?e.type||"":typeof e=="string"?D2(e):""}function Gw(e){return $r(e)?e.headers["content-length"]||-1:Xr(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function dm(e){if($r(e))return e;let t={},r=Gw(e);r>=0&&(t["content-length"]=String(r));let n=bo(e),s=Bf(e);s&&(t["content-type"]=s);let i=await zj(e);i&&(t["x-first-bytes"]=i),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function jw(e){if(!e.ok)throw await Vj(e)}async function Vj(e){let t=Hw(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let s=e.headers.get("Content-Type");n.reason=s?.includes("application/json")?await e.json():e.text()}catch{}return new um(r,n)}async function zj(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let s=new FileReader;s.onload=i=>n(i?.target?.result),s.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${Wj(r)}`}return null}function Wj(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Hj(e){return!Gj(e)&&!jj(e)}function Gj(e){return e.startsWith("http:")||e.startsWith("https:")}function jj(e){return e.startsWith("data:")}async function Qa(e,t){if(typeof e=="string"){let r=L2(e);return Hj(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,t):await fetch(r,t)}return await dm(e)}Ka();var k2=new Mr({id:"loaders.gl"}),pm=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},mm=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var U2={fetch:null,mimeType:void 0,nothrow:!1,log:new mm,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ts,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},qw={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function V2(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function z2(){let e=V2();return e.globalOptions=e.globalOptions||{...U2},e.globalOptions}function Yw(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],qj(e,r),Xj(t,e,n)}function qj(e,t){$w(e,null,U2,qw,t);for(let r of t){let n=e&&e[r.id]||{},s=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};$w(n,r.id,s,i,t)}}function $w(e,t,r,n,s){let i=t||"Top level",o=t?`${t}.`:"";for(let a in e){let c=!t&&Ao(e[a]),l=a==="baseUri"&&!t,f=a==="workerUrl"&&t;if(!(a in r)&&!l&&!f){if(a in n)k2.warn(`${i} loader option '${o}${a}' no longer supported, use '${n[a]}'`)();else if(!c){let h=$j(a,s);k2.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)()}}}}function $j(e,t){let r=e.toLowerCase(),n="";for(let s of t)for(let i in s.options){if(e===i)return`Did you mean '${s.id}.${i}'?`;let o=i.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${s.id}.${i}'?`)}return n}function Xj(e,t,r){let s={...e.options||{}};return Yj(s,r),s.log===null&&(s.log=new pm),Xw(s,z2()),Xw(s,t),s}function Xw(e,t){for(let r in t)if(r in t){let n=t[r];N2(n)&&N2(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function Yj(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function Nf(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function Ff(e){pt(e,"null loader"),pt(Nf(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var Kw=()=>{let e=V2();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Df(e){let t=Kw();e=Array.isArray(e)?e:[e];for(let r of e){let n=Ff(r);t.find(s=>n===s)||t.unshift(n)}}function Zw(){return Kw()}Ka();var Jw=new Mr({id:"loaders.gl"});var Kj=/\.([^.]+)$/;async function eC(e,t=[],r,n){if(!rC(e))return null;let s=Qw(e,t,{...r,nothrow:!0},n);if(s)return s;if(Xr(e)&&(e=await e.slice(0,10).arrayBuffer(),s=Qw(e,t,r,n)),!s&&!r?.nothrow)throw new Error(nC(e));return s}function Qw(e,t=[],r,n){if(!rC(e))return null;if(t&&!Array.isArray(t))return Ff(t);let s=[];t&&(s=s.concat(t)),r?.ignoreRegisteredLoaders||s.push(...Zw()),Jj(s);let i=Zj(e,s,r,n);if(!i&&!r?.nothrow)throw new Error(nC(e));return i}function Zj(e,t,r,n){let s=bo(e),i=Bf(e),o=Ja(s)||n?.url,a=null,c="";return r?.mimeType&&(a=W2(t,r?.mimeType),c=`match forced by supplied MIME type ${r?.mimeType}`),a=a||Qj(t,o),c=c||(a?`matched url ${o}`:""),a=a||W2(t,i),c=c||(a?`matched MIME type ${i}`:""),a=a||e7(t,e),c=c||(a?`matched initial data ${sC(e)}`:""),r?.fallbackMimeType&&(a=a||W2(t,r?.fallbackMimeType),c=c||(a?`matched fallback MIME type ${i}`:"")),c&&Jw.log(1,`selectLoader selected ${a?.name}: ${c}.`),a}function rC(e){return!(e instanceof Response&&e.status===204)}function nC(e){let t=bo(e),r=Bf(e),n="No valid loader found (";n+=t?`${Fr.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let s=e?sC(e):"";return n+=s?` first bytes: "${s}"`:"first bytes: not available",n+=")",n}function Jj(e){for(let t of e)Ff(t)}function Qj(e,t){let r=t&&Kj.exec(t),n=r&&r[1];return n?t7(e,n):null}function t7(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function W2(e,t){for(let r of e)if(r.mimeTypes?.some(n=>F2(t,n))||F2(t,`application/x.${r.id}`))return r;return null}function e7(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(r7(t,r))return r}else if(ArrayBuffer.isView(t)){if(tC(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&tC(t,0,r))return r;return null}function r7(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function tC(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(s=>n7(e,t,r,s))}function n7(e,t,r,n){if(n instanceof ArrayBuffer)return w2(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let s=H2(e,t,n.length);return n===s;default:return!1}}function sC(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?H2(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?H2(e,0,t):""}function H2(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(t+i));return s}function*iC(e,t){let r=t?.chunkSize||262144,n=0,s=new TextEncoder;for(;n<e.length;){let i=Math.min(e.length-n,r),o=e.slice(n,n+i);n+=i,yield s.encode(o)}}function*oC(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let s=Math.min(e.byteLength-n,r),i=new ArrayBuffer(s),o=new Uint8Array(e,n,s);new Uint8Array(i).set(o),n+=s,yield i}}async function*aC(e,t){let r=t?.chunkSize||1048576,n=0;for(;n<e.size;){let s=n+r,i=await e.slice(n,s).arrayBuffer();n=s,yield i}}function G2(e,t){return Ts?s7(e,t):i7(e,t)}async function*s7(e,t){let r=e.getReader(),n;try{for(;;){let s=n||r.read();t?._streamReadAhead&&(n=r.read());let{done:i,value:o}=await s;if(i)return;yield lm(o)}}catch{r.releaseLock()}}async function*i7(e,t){for await(let r of e)yield lm(r)}function cC(e,t){if(typeof e=="string")return iC(e,t);if(e instanceof ArrayBuffer)return oC(e,t);if(Xr(e))return aC(e,t);if(hm(e))return G2(e,t);if($r(e))return G2(e.body,t);throw new Error("makeIterator")}var lC="Cannot convert supplied data type";function o7(e,t,r){if(t.text&&typeof e=="string")return e;if(Uw(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,s=e.byteLength||e.length;return(e.byteOffset!==0||s!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+s)),n}throw new Error(lC)}async function fC(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return o7(e,t,r);if(Xr(e)&&(e=await dm(e)),$r(e)){let s=e;return await jw(s),t.binary?await s.arrayBuffer():await s.text()}if(hm(e)&&(e=cC(e,r)),Dw(e)||kw(e))return I2(e);throw new Error(lC)}function gm(e,t){let r=z2(),n=e||r;return typeof n.fetch=="function"?n.fetch:Ao(n.fetch)?s=>Qa(s,n.fetch):t?.fetch?t?.fetch:Qa}function hC(e,t,r){if(r)return r;let n={fetch:gm(t,e),...e};if(n.url){let s=Ja(n.url);n.baseUrl=s,n.queryString=Ww(n.url),n.filename=Fr.filename(s),n.baseUrl=Fr.dirname(s)}return Array.isArray(n.loaders)||(n.loaders=null),n}function uC(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function gi(e,t,r,n){t&&!Array.isArray(t)&&!Nf(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let s=bo(e),o=uC(t,n),a=await eC(e,o,r);return a?(r=Yw(r,a,o,s),n=hC({url:s,_parse:gi,loaders:o},r,n||null),await a7(a,e,r,n)):null}async function a7(e,t,r,n){if(b2(e),r=Ef(e.options,r),$r(t)){let i=t,{ok:o,redirected:a,status:c,statusText:l,type:f,url:h}=i,u=Object.fromEntries(i.headers.entries());n.response={headers:u,ok:o,redirected:a,status:c,statusText:l,type:f,url:h}}t=await fC(t,e,r);let s=e;if(s.parseTextSync&&typeof t=="string")return s.parseTextSync(t,r,n);if(M2(e,r))return await E2(e,t,r,n,gi);if(s.parseText&&typeof t=="string")return await s.parseText(t,r,n);if(s.parse)return await s.parse(t,r,n);throw je(!s.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function dC(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ms(e){let t=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let f=a[l],h=a[l+1],u=a[l+2];t=f<t?f:t,r=h<r?h:r,n=u<n?u:n,s=f>s?f:s,i=h>i?h:i,o=u>o?u:o}return[[t,r,n],[s,i,o]]}function j2(e,t,r){let n=dC(t.value),s=r||pC(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function pC(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}async function Me(e,t,r,n){let s,i;!Array.isArray(t)&&!Nf(t)?(s=[],i=t,n=void 0):(s=t,i=r);let o=gm(i),a=e;return typeof e=="string"&&(a=await o(e)),Xr(e)&&(a=await o(e)),Array.isArray(s)?await gi(a,s,i):await gi(a,s,i)}var mC="4.2.1";var c7=globalThis.loaders?.parseImageNode,q2=typeof Image<"u",$2=typeof ImageBitmap<"u",l7=Boolean(c7),X2=Ts?!0:l7;function gC(e){switch(e){case"auto":return $2||q2||X2;case"imagebitmap":return $2;case"image":return q2;case"data":return X2;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function xC(){if($2)return"imagebitmap";if(q2)return"image";if(X2)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function _C(e){let t=f7(e);if(!t)throw new Error("Not an image");return t}function kf(e){switch(_C(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function f7(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var h7=/^data:image\/svg\+xml/,u7=/\.svg((\?|#).*)?$/;function xm(e){return e&&(h7.test(e)||u7.test(e))}function yC(e,t){if(xm(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Y2(e,t)}function Y2(e,t){if(xm(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function _m(e,t,r){let n=yC(e,r),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await d7(i||n,t)}finally{i&&s.revokeObjectURL(i)}}async function d7(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var p7={},vC=!0;async function AC(e,t,r){let n;xm(r)?n=await _m(e,t,r):n=Y2(e,r);let s=t&&t.imagebitmap;return await m7(n,s)}async function m7(e,t=null){if((g7(t)||!vC)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),vC=!1}return await createImageBitmap(e)}function g7(e){for(let t in e||p7)return!1;return!0}function bC(e){return!v7(e,"ftyp",4)||!(e[8]&96)?null:x7(e)}function x7(e){switch(_7(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function _7(e,t,r){return String.fromCharCode(...e.slice(t,r))}function y7(e){return[...e].map(t=>t.charCodeAt(0))}function v7(e,t,r=0){let n=y7(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var jn=!1,Uf=!0;function To(e){let t=Vf(e);return b7(t)||E7(t)||T7(t)||M7(t)||A7(t)}function A7(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=bC(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function b7(e){let t=Vf(e);return t.byteLength>=24&&t.getUint32(0,jn)===2303741511?{mimeType:"image/png",width:t.getUint32(16,jn),height:t.getUint32(20,jn)}:null}function T7(e){let t=Vf(e);return t.byteLength>=10&&t.getUint32(0,jn)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Uf),height:t.getUint16(8,Uf)}:null}function M7(e){let t=Vf(e);return t.byteLength>=14&&t.getUint16(0,jn)===16973&&t.getUint32(2,Uf)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Uf),height:t.getUint32(22,Uf)}:null}function E7(e){let t=Vf(e);if(!(t.byteLength>=3&&t.getUint16(0,jn)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=S7(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,jn);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,jn),width:t.getUint16(i+7,jn)};if(!n.has(o))return null;i+=2,i+=t.getUint16(i,jn)}return null}function S7(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Vf(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function TC(e,t){let{mimeType:r}=To(e)||{},n=globalThis.loaders?.parseImageNode;return pt(n),await n(e,r)}async function MC(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=r||{},o=w7(s),a;switch(o){case"imagebitmap":a=await AC(e,t,i);break;case"image":a=await _m(e,t,i);break;case"data":a=await TC(e,t);break;default:pt(!1)}return s==="data"&&(a=kf(a)),a}function w7(e){switch(e){case"auto":case"data":return xC();default:return gC(e),e}}var C7=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],P7=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],I7={image:{type:"auto",decode:!0}},qn={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:mC,mimeTypes:P7,extensions:C7,parse:MC,tests:[e=>Boolean(To(new DataView(e)))],options:I7};var K2={};function Z2(e){if(K2[e]===void 0){let t=Ts?O7(e):R7(e);K2[e]=t}return K2[e]}function R7(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function O7(e){switch(e){case"image/avif":case"image/webp":return L7(e);default:return!0}}function L7(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}Ka();var B7=new Mr({id:"deck"}),H=B7;var J2={};function ym(e){J2=e}function ae(e,t,r,n){H.level>0&&J2[e]&&J2[e].call(null,t,r,n)}function N7(e){let t=e[0],r=e[e.length-1];return t==="{"&&r==="}"||t==="["&&r==="]"}var EC={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:N7,parseTextSync:JSON.parse};function F7(){let e="9.2.3",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(H.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:H,_registerLoggers:ym},Df([EC,[qn,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}var vm=F7();function Am(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Q2={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function wC(e){let t={};for(let[r,n]of Object.entries(e))t[r]=D7(n);return t}function D7(e){let t=SC(e);if(t!=="object")return{value:e,...Q2[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Q2[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=SC(e.value),{...e,...Q2[t],type:t}):{type:"object",value:null};throw new Error("props")}function SC(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var CC=`#ifdef MODULE_LOGDEPTH
|
|
29
|
+
}`}function y2(e,t=!0,r){let n=r||new Set;if(e){if(Cw(e))n.add(e);else if(Cw(e.buffer))n.add(e.buffer);else if(!ArrayBuffer.isView(e)){if(t&&typeof e=="object")for(let s in e)y2(e[s],t,n)}}return r===void 0?Array.from(n):[]}function Cw(e){return e?e instanceof ArrayBuffer||typeof MessagePort<"u"&&e instanceof MessagePort||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas:!1}var v2=()=>{},ui=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Fe||typeof Za<"u"&&!Fe}constructor(t){let{name:r,source:n,url:s}=t;je(n||s),this.name=r,this.source=n,this.url=s,this.onMessage=v2,this.onError=i=>console.log(i),this.worker=Fe?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=v2,this.onError=v2,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,r){r=r||y2(t),this.worker.postMessage(t,r)}_getErrorFromErrorEvent(t){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,t.message&&(r+=`${t.message} in `),t.lineno&&(r+=`:${t.lineno}:${t.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=Sw({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},t.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},t.onmessageerror=r=>console.error(r),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;t=new Za(n,{eval:!1})}else if(this.source)t=new Za(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",r=>{this.onMessage(r)}),t.on("error",r=>{this.onError(r)}),t.on("exit",r=>{}),t}};var Pf=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return ui.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,r=(s,i,o)=>s.done(o),n=(s,i)=>s.error(i)){let s=new Promise(i=>(this.jobQueue.push({name:t,onMessage:r,onError:n,onStart:i}),this));return this._startQueuedJob(),await s}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:t,backlog:this.jobQueue.length});let n=new Cf(r.name,t);t.onMessage=s=>r.onMessage(n,s.type,s.payload),t.onError=s=>r.onError(n,s),r.onStart(n);try{await n.result}catch(s){console.error(`Worker exception: ${s}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!Fe||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new ui({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Ew?this.maxMobileConcurrency:this.maxConcurrency}};var gj={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},xo=class{props;workerPools=new Map;static isSupported(){return ui.isSupported()}static getWorkerFarm(t={}){return xo._workerFarm=xo._workerFarm||new xo({}),xo._workerFarm.setProps(t),xo._workerFarm}constructor(t){this.props={...gj},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:r,source:n,url:s}=t,i=this.workerPools.get(r);return i||(i=new Pf({name:r,source:n,url:s}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},di=xo;X(di,"_workerFarm");function A2(e,t={}){let r=t[e.id]||{},n=Fe?`${e.id}-worker.js`:`${e.id}-worker-node.js`,s=r.workerUrl;if(!s&&e.id==="compression"&&(s=t.workerUrl),t._workerType==="test"&&(Fe?s=`modules/${e.module}/dist/${n}`:s=`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!s){let i=e.version;i==="latest"&&(i=Tw);let o=i?`@${i}`:"";s=`https://unpkg.com/@loaders.gl/${e.module}${o}/dist/${n}`}return je(s),s}function b2(e,t=Sf){je(e,"no worker provided");let r=e.version;return!(!t||!r)}var T2={};async function Gn(e,t=null,r={},n=null){return t&&(e=Pw(e,t,r,n)),T2[e]=T2[e]||xj(e),await T2[e]}function Pw(e,t,r={},n=null){if(!r.useLocalLibraries&&e.startsWith("http"))return e;n=n||e;let s=r.modules||{};return s[n]?s[n]:Fe?r.CDN?(je(r.CDN.startsWith("http")),`${r.CDN}/${t}@${Sf}/dist/libs/${n}`):wf?`../src/libs/${n}`:`modules/${t}/src/libs/${n}`:`modules/${t}/dist/libs/${n}`}async function xj(e){if(e.endsWith("wasm"))return await yj(e);if(!Fe)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(e)}catch(r){return console.error(r),null}if(wf)return importScripts(e);let t=await vj(e);return _j(t,e)}function _j(e,t){if(!Fe){let{requireFromString:n}=globalThis.loaders||{};return n?.(e,t)}if(wf)return eval.call(globalThis,e),null;let r=document.createElement("script");r.id=t;try{r.appendChild(document.createTextNode(e))}catch{r.text=e}return document.body.appendChild(r),null}async function yj(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return Fe||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function vj(e){let{readFileAsText:t}=globalThis.loaders||{};return Fe||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}function M2(e,t){return!di.isSupported()||!Fe&&!t?._nodeWorkers?!1:e.worker&&t?.worker}async function E2(e,t,r,n,s){let i=e.id,o=A2(e,r),c=di.getWorkerFarm(r).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r)),n=JSON.parse(JSON.stringify(n||{}));let l=await c.startJob("process-on-worker",Aj.bind(null,s));return l.postMessage("process",{input:t,options:r,context:n}),await(await l.result).result}async function Aj(e,t,r,n){switch(r){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:s,input:i,options:o}=n;try{let a=await e(i,o);t.postMessage("done",{id:s,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:s,error:c})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function Rw(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?Iw(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?Iw(e,0,t):""}function Iw(e,t,r){if(e.byteLength<=t+r)return"";let n=new DataView(e),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(t+i));return s}function S2(e){try{return JSON.parse(e)}catch{throw new Error(`Failed to parse JSON from data starting with "${Rw(e)}"`)}}function w2(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let n=new Uint8Array(e),s=new Uint8Array(t);for(let i=0;i<n.length;++i)if(n[i]!==s[i])return!1;return!0}function C2(...e){return Ow(e)}function Ow(e){let t=e.map(i=>i instanceof ArrayBuffer?new Uint8Array(i):i),r=t.reduce((i,o)=>i+o.byteLength,0),n=new Uint8Array(r),s=0;for(let i of t)n.set(i,s),s+=i.byteLength;return n.buffer}function If(...e){let t=e,r=t&&t.length>1&&t[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let n=t.reduce((o,a)=>o+a.length,0),s=new r(n),i=0;for(let o of t)s.set(o,i),i+=o.length;return s}function _o(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}function pi(e,t){return pt(e>=0),pt(t>0),e+(t-1)&~(t-1)}function P2(e,t,r){let n;if(e instanceof ArrayBuffer)n=new Uint8Array(e);else{let s=e.byteOffset,i=e.byteLength;n=new Uint8Array(e.buffer||e.arrayBuffer,s,i)}return t.set(n,r),r+pi(n.byteLength,4)}async function I2(e){let t=[];for await(let r of e)t.push(r);return C2(...t)}vo();var bj="Queued Requests",Tj="Active Requests",Mj="Cancelled Requests",Ej="Queued Requests Ever",Sj="Active Requests Ever",wj={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},mi=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...wj,...t},this.stats=new Ze({id:this.props.id}),this.stats.get(bj),this.stats.get(Tj),this.stats.get(Mj),this.stats.get(Ej),this.stats.get(Sj)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},s=new Promise(i=>(n.resolve=i,n));return this.requestQueue.push(n),this.requestMap.set(t,s),this._issueNewRequests(),s}_issueRequest(t){let{handle:r,resolve:n}=t,s=!1,i=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}};var Cj="",Bw={};function L2(e){for(let t in Bw)if(e.startsWith(t)){let r=Bw[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Cj}${e}`),e}function Nw(e){return e&&typeof e=="object"&&e.isBuffer}function lm(e){if(Nw(e))return e;if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}var Fr={};Yt(Fr,{dirname:()=>Ij,filename:()=>Pj,join:()=>Rj,resolve:()=>Oj});function Fw(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}function Pj(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):""}function Ij(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function Rj(...e){let t="/";return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp(`^${t}`),"")),n!==e.length-1&&(r=r.replace(new RegExp(`${t}$`),"")),r)),e.join(t)}function Oj(...e){let t=[];for(let i=0;i<e.length;i++)t[i]=e[i];let r="",n=!1,s;for(let i=t.length-1;i>=-1&&!n;i--){let o;i>=0?o=t[i]:(s===void 0&&(s=Fw()),o=s),o.length!==0&&(r=`${o}/${r}`,n=o.charCodeAt(0)===Of)}return r=Lj(r,!n),n?`/${r}`:r.length>0?r:"."}var Of=47,B2=46;function Lj(e,t){let r="",n=-1,s=0,i,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)i=e.charCodeAt(a);else{if(i===Of)break;i=Of}if(i===Of){if(!(n===a-1||s===1))if(n!==a-1&&s===2){if(r.length<2||!o||r.charCodeAt(r.length-1)!==B2||r.charCodeAt(r.length-2)!==B2){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Of;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,s=0,o=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,s=0,o=!1;continue}}t&&(r.length>0?r+="/..":r="..",o=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,o=!1}n=a,s=0}else i===B2&&s!==-1?++s:s=-1}return r}var fm=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(t){this.props={...t},this.loadOptions={...t.loadOptions},this.fetch=Bj(this.loadOptions)}setProps(t){this.props=Object.assign(this.props,t),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}};function Bj(e){let t=e?.fetch;if(t&&typeof t=="function")return(n,s)=>t(n,s);let r=e?.fetch;return r&&typeof r!="function"?n=>fetch(n,r):n=>fetch(n)}var qr=class extends fm{};X(qr,"type","template"),X(qr,"testURL",t=>!1);var Nj=e=>typeof e=="boolean",Lf=e=>typeof e=="function",Ao=e=>e!==null&&typeof e=="object",N2=e=>Ao(e)&&e.constructor==={}.constructor;var Dw=e=>Boolean(e)&&typeof e[Symbol.iterator]=="function",kw=e=>e&&typeof e[Symbol.asyncIterator]=="function";var $r=e=>typeof Response<"u"&&e instanceof Response||e&&e.arrayBuffer&&e.text&&e.json;var Xr=e=>typeof Blob<"u"&&e instanceof Blob,Uw=e=>e&&typeof e=="object"&&e.isBuffer;var Fj=e=>typeof ReadableStream<"u"&&e instanceof ReadableStream||Ao(e)&&Lf(e.tee)&&Lf(e.cancel)&&Lf(e.getReader);var Dj=e=>Ao(e)&&Lf(e.read)&&Lf(e.pipe)&&Nj(e.readable),hm=e=>Fj(e)||Dj(e);var um=class extends Error{constructor(t,r){super(t),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var kj=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Uj=/^([-\w.]+\/[-\w.+]+)/;function F2(e,t){return e.toLowerCase()===t.toLowerCase()}function Vw(e){let t=Uj.exec(e);return t?t[1]:e}function D2(e){let t=kj.exec(e);return t?t[1]:""}var zw=/\?.*/;function Ww(e){let t=e.match(zw);return t&&t[0]}function Ja(e){return e.replace(zw,"")}function Hw(e){if(e.length<50)return e;let t=e.slice(e.length-15);return`${e.substr(0,32)}...${t}`}function bo(e){return $r(e)?e.url:Xr(e)?e.name||"":typeof e=="string"?e:""}function Bf(e){if($r(e)){let t=e,r=t.headers.get("content-type")||"",n=Ja(t.url);return Vw(r)||D2(n)}return Xr(e)?e.type||"":typeof e=="string"?D2(e):""}function Gw(e){return $r(e)?e.headers["content-length"]||-1:Xr(e)?e.size:typeof e=="string"?e.length:e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e.byteLength:-1}async function dm(e){if($r(e))return e;let t={},r=Gw(e);r>=0&&(t["content-length"]=String(r));let n=bo(e),s=Bf(e);s&&(t["content-type"]=s);let i=await zj(e);i&&(t["x-first-bytes"]=i),typeof e=="string"&&(e=new TextEncoder().encode(e));let o=new Response(e,{headers:t});return Object.defineProperty(o,"url",{value:n}),o}async function jw(e){if(!e.ok)throw await Vj(e)}async function Vj(e){let t=Hw(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let n={reason:e.statusText,url:e.url,response:e};try{let s=e.headers.get("Content-Type");n.reason=s?.includes("application/json")?await e.json():e.text()}catch{}return new um(r,n)}async function zj(e){if(typeof e=="string")return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let r=e.slice(0,5);return await new Promise(n=>{let s=new FileReader;s.onload=i=>n(i?.target?.result),s.readAsDataURL(r)})}if(e instanceof ArrayBuffer){let r=e.slice(0,5);return`data:base64,${Wj(r)}`}return null}function Wj(e){let t="",r=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)t+=String.fromCharCode(r[n]);return btoa(t)}function Hj(e){return!Gj(e)&&!jj(e)}function Gj(e){return e.startsWith("http:")||e.startsWith("https:")}function jj(e){return e.startsWith("data:")}async function Qa(e,t){if(typeof e=="string"){let r=L2(e);return Hj(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,t):await fetch(r,t)}return await dm(e)}Ka();var k2=new Mr({id:"loaders.gl"}),pm=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},mm=class{console;constructor(){this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}};var U2={fetch:null,mimeType:void 0,nothrow:!1,log:new mm,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ts,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},qw={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function V2(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function z2(){let e=V2();return e.globalOptions=e.globalOptions||{...U2},e.globalOptions}function Yw(e,t,r,n){return r=r||[],r=Array.isArray(r)?r:[r],qj(e,r),Xj(t,e,n)}function qj(e,t){$w(e,null,U2,qw,t);for(let r of t){let n=e&&e[r.id]||{},s=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};$w(n,r.id,s,i,t)}}function $w(e,t,r,n,s){let i=t||"Top level",o=t?`${t}.`:"";for(let a in e){let c=!t&&Ao(e[a]),l=a==="baseUri"&&!t,f=a==="workerUrl"&&t;if(!(a in r)&&!l&&!f){if(a in n)k2.warn(`${i} loader option '${o}${a}' no longer supported, use '${n[a]}'`)();else if(!c){let h=$j(a,s);k2.warn(`${i} loader option '${o}${a}' not recognized. ${h}`)()}}}}function $j(e,t){let r=e.toLowerCase(),n="";for(let s of t)for(let i in s.options){if(e===i)return`Did you mean '${s.id}.${i}'?`;let o=i.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${s.id}.${i}'?`)}return n}function Xj(e,t,r){let s={...e.options||{}};return Yj(s,r),s.log===null&&(s.log=new pm),Xw(s,z2()),Xw(s,t),s}function Xw(e,t){for(let r in t)if(r in t){let n=t[r];N2(n)&&N2(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r]}}function Yj(e,t){t&&!("baseUri"in e)&&(e.baseUri=t)}function Nf(e){return e?(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions)):!1}function Ff(e){pt(e,"null loader"),pt(Nf(e),"invalid loader");let t;return Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}var Kw=()=>{let e=V2();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function Df(e){let t=Kw();e=Array.isArray(e)?e:[e];for(let r of e){let n=Ff(r);t.find(s=>n===s)||t.unshift(n)}}function Zw(){return Kw()}Ka();var Jw=new Mr({id:"loaders.gl"});var Kj=/\.([^.]+)$/;async function eC(e,t=[],r,n){if(!rC(e))return null;let s=Qw(e,t,{...r,nothrow:!0},n);if(s)return s;if(Xr(e)&&(e=await e.slice(0,10).arrayBuffer(),s=Qw(e,t,r,n)),!s&&!r?.nothrow)throw new Error(nC(e));return s}function Qw(e,t=[],r,n){if(!rC(e))return null;if(t&&!Array.isArray(t))return Ff(t);let s=[];t&&(s=s.concat(t)),r?.ignoreRegisteredLoaders||s.push(...Zw()),Jj(s);let i=Zj(e,s,r,n);if(!i&&!r?.nothrow)throw new Error(nC(e));return i}function Zj(e,t,r,n){let s=bo(e),i=Bf(e),o=Ja(s)||n?.url,a=null,c="";return r?.mimeType&&(a=W2(t,r?.mimeType),c=`match forced by supplied MIME type ${r?.mimeType}`),a=a||Qj(t,o),c=c||(a?`matched url ${o}`:""),a=a||W2(t,i),c=c||(a?`matched MIME type ${i}`:""),a=a||e7(t,e),c=c||(a?`matched initial data ${sC(e)}`:""),r?.fallbackMimeType&&(a=a||W2(t,r?.fallbackMimeType),c=c||(a?`matched fallback MIME type ${i}`:"")),c&&Jw.log(1,`selectLoader selected ${a?.name}: ${c}.`),a}function rC(e){return!(e instanceof Response&&e.status===204)}function nC(e){let t=bo(e),r=Bf(e),n="No valid loader found (";n+=t?`${Fr.filename(t)}, `:"no url provided, ",n+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let s=e?sC(e):"";return n+=s?` first bytes: "${s}"`:"first bytes: not available",n+=")",n}function Jj(e){for(let t of e)Ff(t)}function Qj(e,t){let r=t&&Kj.exec(t),n=r&&r[1];return n?t7(e,n):null}function t7(e,t){t=t.toLowerCase();for(let r of e)for(let n of r.extensions)if(n.toLowerCase()===t)return r;return null}function W2(e,t){for(let r of e)if(r.mimeTypes?.some(n=>F2(t,n))||F2(t,`application/x.${r.id}`))return r;return null}function e7(e,t){if(!t)return null;for(let r of e)if(typeof t=="string"){if(r7(t,r))return r}else if(ArrayBuffer.isView(t)){if(tC(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&tC(t,0,r))return r;return null}function r7(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(n=>e.startsWith(n))}function tC(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(s=>n7(e,t,r,s))}function n7(e,t,r,n){if(n instanceof ArrayBuffer)return w2(n,e,n.byteLength);switch(typeof n){case"function":return n(e);case"string":let s=H2(e,t,n.length);return n===s;default:return!1}}function sC(e,t=5){return typeof e=="string"?e.slice(0,t):ArrayBuffer.isView(e)?H2(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?H2(e,0,t):""}function H2(e,t,r){if(e.byteLength<t+r)return"";let n=new DataView(e),s="";for(let i=0;i<r;i++)s+=String.fromCharCode(n.getUint8(t+i));return s}function*iC(e,t){let r=t?.chunkSize||262144,n=0,s=new TextEncoder;for(;n<e.length;){let i=Math.min(e.length-n,r),o=e.slice(n,n+i);n+=i,yield s.encode(o)}}function*oC(e,t={}){let{chunkSize:r=262144}=t,n=0;for(;n<e.byteLength;){let s=Math.min(e.byteLength-n,r),i=new ArrayBuffer(s),o=new Uint8Array(e,n,s);new Uint8Array(i).set(o),n+=s,yield i}}async function*aC(e,t){let r=t?.chunkSize||1048576,n=0;for(;n<e.size;){let s=n+r,i=await e.slice(n,s).arrayBuffer();n=s,yield i}}function G2(e,t){return Ts?s7(e,t):i7(e,t)}async function*s7(e,t){let r=e.getReader(),n;try{for(;;){let s=n||r.read();t?._streamReadAhead&&(n=r.read());let{done:i,value:o}=await s;if(i)return;yield lm(o)}}catch{r.releaseLock()}}async function*i7(e,t){for await(let r of e)yield lm(r)}function cC(e,t){if(typeof e=="string")return iC(e,t);if(e instanceof ArrayBuffer)return oC(e,t);if(Xr(e))return aC(e,t);if(hm(e))return G2(e,t);if($r(e))return G2(e.body,t);throw new Error("makeIterator")}var lC="Cannot convert supplied data type";function o7(e,t,r){if(t.text&&typeof e=="string")return e;if(Uw(e)&&(e=e.buffer),e instanceof ArrayBuffer){let n=e;return t.text&&!t.binary?new TextDecoder("utf8").decode(n):n}if(ArrayBuffer.isView(e)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(e);let n=e.buffer,s=e.byteLength||e.length;return(e.byteOffset!==0||s!==n.byteLength)&&(n=n.slice(e.byteOffset,e.byteOffset+s)),n}throw new Error(lC)}async function fC(e,t,r){let n=e instanceof ArrayBuffer||ArrayBuffer.isView(e);if(typeof e=="string"||n)return o7(e,t,r);if(Xr(e)&&(e=await dm(e)),$r(e)){let s=e;return await jw(s),t.binary?await s.arrayBuffer():await s.text()}if(hm(e)&&(e=cC(e,r)),Dw(e)||kw(e))return I2(e);throw new Error(lC)}function gm(e,t){let r=z2(),n=e||r;return typeof n.fetch=="function"?n.fetch:Ao(n.fetch)?s=>Qa(s,n.fetch):t?.fetch?t?.fetch:Qa}function hC(e,t,r){if(r)return r;let n={fetch:gm(t,e),...e};if(n.url){let s=Ja(n.url);n.baseUrl=s,n.queryString=Ww(n.url),n.filename=Fr.filename(s),n.baseUrl=Fr.dirname(s)}return Array.isArray(n.loaders)||(n.loaders=null),n}function uC(e,t){if(e&&!Array.isArray(e))return e;let r;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let n=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...n]:n}return r&&r.length?r:void 0}async function gi(e,t,r,n){t&&!Array.isArray(t)&&!Nf(t)&&(n=void 0,r=t,t=void 0),e=await e,r=r||{};let s=bo(e),o=uC(t,n),a=await eC(e,o,r);return a?(r=Yw(r,a,o,s),n=hC({url:s,_parse:gi,loaders:o},r,n||null),await a7(a,e,r,n)):null}async function a7(e,t,r,n){if(b2(e),r=Ef(e.options,r),$r(t)){let i=t,{ok:o,redirected:a,status:c,statusText:l,type:f,url:h}=i,u=Object.fromEntries(i.headers.entries());n.response={headers:u,ok:o,redirected:a,status:c,statusText:l,type:f,url:h}}t=await fC(t,e,r);let s=e;if(s.parseTextSync&&typeof t=="string")return s.parseTextSync(t,r,n);if(M2(e,r))return await E2(e,t,r,n,gi);if(s.parseText&&typeof t=="string")return await s.parseText(t,r,n);if(s.parse)return await s.parse(t,r,n);throw je(!s.parseSync),new Error(`${e.id} loader - no parser found and worker is disabled`)}function dC(e){switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function Ms(e){let t=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0,a=e.POSITION?e.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let f=a[l],h=a[l+1],u=a[l+2];t=f<t?f:t,r=h<r?h:r,n=u<n?u:n,s=f>s?f:s,i=h>i?h:i,o=u>o?u:o}return[[t,r,n],[s,i,o]]}function j2(e,t,r){let n=dC(t.value),s=r||pC(t);return{name:e,type:{type:"fixed-size-list",listSize:t.size,children:[{name:"value",type:n}]},nullable:!1,metadata:s}}function pC(e){let t={};return"byteOffset"in e&&(t.byteOffset=e.byteOffset.toString(10)),"byteStride"in e&&(t.byteStride=e.byteStride.toString(10)),"normalized"in e&&(t.normalized=e.normalized.toString()),t}async function Me(e,t,r,n){let s,i;!Array.isArray(t)&&!Nf(t)?(s=[],i=t,n=void 0):(s=t,i=r);let o=gm(i),a=e;return typeof e=="string"&&(a=await o(e)),Xr(e)&&(a=await o(e)),Array.isArray(s)?await gi(a,s,i):await gi(a,s,i)}var mC="4.2.1";var c7=globalThis.loaders?.parseImageNode,q2=typeof Image<"u",$2=typeof ImageBitmap<"u",l7=Boolean(c7),X2=Ts?!0:l7;function gC(e){switch(e){case"auto":return $2||q2||X2;case"imagebitmap":return $2;case"image":return q2;case"data":return X2;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function xC(){if($2)return"imagebitmap";if(q2)return"image";if(X2)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function _C(e){let t=f7(e);if(!t)throw new Error("Not an image");return t}function kf(e){switch(_C(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function f7(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var h7=/^data:image\/svg\+xml/,u7=/\.svg((\?|#).*)?$/;function xm(e){return e&&(h7.test(e)||u7.test(e))}function yC(e,t){if(xm(t)){let n=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(i){throw new Error(i.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return Y2(e,t)}function Y2(e,t){if(xm(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function _m(e,t,r){let n=yC(e,r),s=self.URL||self.webkitURL,i=typeof n!="string"&&s.createObjectURL(n);try{return await d7(i||n,t)}finally{i&&s.revokeObjectURL(i)}}async function d7(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((n,s)=>{try{r.onload=()=>n(r),r.onerror=i=>{let o=i instanceof Error?i.message:"error";s(new Error(o))}}catch(i){s(i)}})}var p7={},vC=!0;async function AC(e,t,r){let n;xm(r)?n=await _m(e,t,r):n=Y2(e,r);let s=t&&t.imagebitmap;return await m7(n,s)}async function m7(e,t=null){if((g7(t)||!vC)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),vC=!1}return await createImageBitmap(e)}function g7(e){for(let t in e||p7)return!1;return!0}function bC(e){return!v7(e,"ftyp",4)||!(e[8]&96)?null:x7(e)}function x7(e){switch(_7(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function _7(e,t,r){return String.fromCharCode(...e.slice(t,r))}function y7(e){return[...e].map(t=>t.charCodeAt(0))}function v7(e,t,r=0){let n=y7(t);for(let s=0;s<n.length;++s)if(n[s]!==e[s+r])return!1;return!0}var jn=!1,Uf=!0;function To(e){let t=Vf(e);return b7(t)||E7(t)||T7(t)||M7(t)||A7(t)}function A7(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),r=bC(t);return r?{mimeType:r.mimeType,width:0,height:0}:null}function b7(e){let t=Vf(e);return t.byteLength>=24&&t.getUint32(0,jn)===2303741511?{mimeType:"image/png",width:t.getUint32(16,jn),height:t.getUint32(20,jn)}:null}function T7(e){let t=Vf(e);return t.byteLength>=10&&t.getUint32(0,jn)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,Uf),height:t.getUint16(8,Uf)}:null}function M7(e){let t=Vf(e);return t.byteLength>=14&&t.getUint16(0,jn)===16973&&t.getUint32(2,Uf)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,Uf),height:t.getUint32(22,Uf)}:null}function E7(e){let t=Vf(e);if(!(t.byteLength>=3&&t.getUint16(0,jn)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:n,sofMarkers:s}=S7(),i=2;for(;i+9<t.byteLength;){let o=t.getUint16(i,jn);if(s.has(o))return{mimeType:"image/jpeg",height:t.getUint16(i+5,jn),width:t.getUint16(i+7,jn)};if(!n.has(o))return null;i+=2,i+=t.getUint16(i,jn)}return null}function S7(){let e=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)e.add(r);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function Vf(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function TC(e,t){let{mimeType:r}=To(e)||{},n=globalThis.loaders?.parseImageNode;return pt(n),await n(e,r)}async function MC(e,t,r){t=t||{};let s=(t.image||{}).type||"auto",{url:i}=r||{},o=w7(s),a;switch(o){case"imagebitmap":a=await AC(e,t,i);break;case"image":a=await _m(e,t,i);break;case"data":a=await TC(e,t);break;default:pt(!1)}return s==="data"&&(a=kf(a)),a}function w7(e){switch(e){case"auto":case"data":return xC();default:return gC(e),e}}var C7=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],P7=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],I7={image:{type:"auto",decode:!0}},qn={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:mC,mimeTypes:P7,extensions:C7,parse:MC,tests:[e=>Boolean(To(new DataView(e)))],options:I7};var K2={};function Z2(e){if(K2[e]===void 0){let t=Ts?O7(e):R7(e);K2[e]=t}return K2[e]}function R7(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,n=globalThis.loaders?.parseImageNode;return Boolean(n)&&r.includes(e)}function O7(e){switch(e){case"image/avif":case"image/webp":return L7(e);default:return!0}}function L7(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}Ka();var B7=new Mr({id:"deck"}),H=B7;var J2={};function ym(e){J2=e}function ae(e,t,r,n){H.level>0&&J2[e]&&J2[e].call(null,t,r,n)}function N7(e){let t=e[0],r=e[e.length-1];return t==="{"&&r==="}"||t==="["&&r==="]"}var EC={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:N7,parseTextSync:JSON.parse};function F7(){let e="9.2.5",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==e)throw new Error(`deck.gl - multiple versions detected: ${t} vs ${e}`);return t||(H.log(1,`deck.gl ${e}`)(),globalThis.deck={...globalThis.deck,VERSION:e,version:e,log:H,_registerLoggers:ym},Df([EC,[qn,{imagebitmap:{premultiplyAlpha:"none"}}]])),e}var vm=F7();function Am(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Q2={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function wC(e){let t={};for(let[r,n]of Object.entries(e))t[r]=D7(n);return t}function D7(e){let t=SC(e);if(t!=="object")return{value:e,...Q2[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Q2[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=SC(e.value),{...e,...Q2[t],type:t}):{type:"object",value:null};throw new Error("props")}function SC(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var CC=`#ifdef MODULE_LOGDEPTH
|
|
30
30
|
logdepth_adjustPosition(gl_Position);
|
|
31
31
|
#endif
|
|
32
32
|
`,PC=`#ifdef MODULE_MATERIAL
|
|
@@ -3115,7 +3115,7 @@ void main() {
|
|
|
3115
3115
|
void main() {
|
|
3116
3116
|
fragColor = ${e}(texSrc, screen.texSize, coordinate);
|
|
3117
3117
|
}
|
|
3118
|
-
`;function bJ(e,t){if(t.filter){let r=typeof t.filter=="string"?t.filter:`${e.name}_filterColor_ext`;return vJ(r)}if(t.sampler){let r=typeof t.sampler=="string"?t.sampler:`${e.name}_sampleColor`;return AJ(r)}return""}var TJ={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},Mn=class extends $e{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer({layers:t,layerFilter:r,views:n,viewports:s,onViewportActive:i,pickingFBO:o,deviceRect:{x:a,y:c,width:l,height:f},cullRect:h,effects:u,pass:d="picking",pickZ:p,shaderModuleProps:m}){this.pickZ=p;let g=this._resetColorEncoder(p),x=[a,c,l,f],v=super.render({target:o,layers:t,layerFilter:r,views:n,viewports:s,onViewportActive:i,cullRect:h,effects:u?.filter(y=>y.useInPicking),pass:d,isPicking:!0,shaderModuleProps:m,clearColor:[0,0,0,0],colorMask:15,scissorRect:x});return this._colorEncoderState=null,{decodePickingColor:g&&EJ.bind(null,g),stats:v}}shouldDrawLayer(t){let{pickable:r,operation:n}=t.props;return r&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(t,r,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(t,r,n){let s={...t.props.parameters},{pickable:i,operation:o}=t.props;return!this._colorEncoderState||o.includes("terrain")?s.blend=!1:i&&o.includes("draw")&&(Object.assign(s,TJ),s.blend=!0,s.blendColor=MJ(this._colorEncoderState,t,n)),s}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function MJ(e,t,r){let{byLayer:n,byAlpha:s}=e,i,o=n.get(t);return o?(o.viewports.push(r),i=o.a):(i=n.size+1,i<=255?(o={a:i,layer:t,viewports:[r]},n.set(t,o),s[i]=o):(H.warn("Too many pickable layers, only picking the first 255")(),i=0)),[0,0,0,i/255]}function EJ(e,t){let r=e.byAlpha[t[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(t)}}var Li={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},Dc=Symbol.for("component"),on=Symbol.for("propTypes"),a0=Symbol.for("deprecatedProps"),Vs=Symbol.for("asyncPropDefaults"),rs=Symbol.for("asyncPropOriginal"),En=Symbol.for("asyncPropResolved");function er(e,t=()=>!0){return Array.isArray(e)?eO(e,t,[]):t(e)?[e]:[]}function eO(e,t,r){let n=-1;for(;++n<e.length;){let s=e[n];Array.isArray(s)?eO(s,t,r):t(s)&&r.push(s)}return r}function c0({target:e,source:t,start:r=0,count:n=1}){let s=t.length,i=n*s,o=0;for(let a=r;o<s;o++)e[a++]=t[o];for(;o<i;)o<i-o?(e.copyWithin(r+o,r,r+o),o*=2):(e.copyWithin(r+o,r,r+i-o),o=i);return e}vo();var Hh=class{constructor(t,r,n){this._loadCount=0,this._subscribers=new Set,this.id=t,this.context=n,this.setData(r)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let n=++this._loadCount,s=t;typeof t=="string"&&(s=Me(t)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=i)}).catch(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=i||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let i of this._subscribers)i.onChange(this.getData())}};var Gh=class{constructor(t){this.protocol=t.protocol||"resource://",this._context={device:t.device,gl:t.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:r,forceUpdate:n=!1,persistent:s=!0}){let i=this._resources[t];i?i.setData(r,n):(i=new Hh(t,r,this._context),this._resources[t]=i),i.persistent=s}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let n in r){let s=r[n],i=this._resources[s.resourceId];i&&i.unsubscribe(s)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:n,requestId:s="default"}){let{_resources:i,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,""),i[t]||this.add({resourceId:t,data:null,persistent:!1}));let a=i[t];if(this._track(n,s,a,r),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,n,s){let i=this._consumers,o=i[t]=i[t]||{},a=o[r],c=a&&a.resourceId&&this._resources[a.resourceId];c&&(c.unsubscribe(a),this.prune()),n&&(a?(a.onChange=s,a.resourceId=n.id):a={onChange:s,resourceId:n.id},o[r]=a,n.subscribe(a))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let r=this._resources[t];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[t])}}};var SJ="layerManager.setLayers",wJ="layerManager.activateViewport",Xo=class{constructor(t,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=a=>{ae(wJ,this,a),a&&(this.context.viewport=a)};let{deck:n,stats:s,viewport:i,timeline:o}=r||{};this.layers=[],this.resourceManager=new Gh({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:n,shaderAssembler:Jg(t?.info?.shadingLanguage||"glsl"),defaultShaderModules:[KA],renderPass:void 0,stats:s||new Ze({id:"deck.gl"}),viewport:i||new Se({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new jo,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let n of this.layers){let s=n.getNeedsRedraw(t);r=r||s}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(n=>r.id.indexOf(n)===0)):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,r){ae(SJ,this,r,t),this._lastRenderedLayers=t;let n=er(t,Boolean);for(let s of n)s.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){let{defaultShaderModules:r}=this.context;r.find(n=>n.name===t.name)||(r.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){let{defaultShaderModules:r}=this.context,n=r.findIndex(s=>s.name===t.name);n>=0&&(r.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(t,r,n){n.raiseError(r,`${t} of ${n}`)}_updateLayers(t,r){let n={};for(let o of t)n[o.id]?H.warn(`Multiple old layers with same id ${o.id}`)():n[o.id]=o;if(this._defaultShaderModulesChanged){for(let o of t)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let s=[];this._updateSublayersRecursively(r,n,s),this._finalizeOldLayers(n);let i=!1;for(let o of s)if(o.hasUniformTransition()){i=`Uniform transition in ${o}`;break}this._needsUpdate=i,this.layers=s}_updateSublayersRecursively(t,r,n){for(let s of t){s.context=this.context;let i=r[s.id];i===null&&H.warn(`Multiple new layers with same id ${s.id}`)(),r[s.id]=null;let o=null;try{this._debug&&i!==s&&s.validateProps(),i?(this._transferLayerState(i,s),this._updateLayer(s)):this._initializeLayer(s),n.push(s),o=s.isComposite?s.getSubLayers():null}catch(a){this._handleError("matching",a,s)}o&&this._updateSublayersRecursively(o,r,n)}}_finalizeOldLayers(t){for(let r in t){let n=t[r];n&&this._finalizeLayer(n)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=Li.INITIALIZED}catch(r){this._handleError("initialization",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle=Li.MATCHED,r!==t&&(t.lifecycle=Li.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(r){this._handleError("update",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle=Li.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=Li.FINALIZED}catch(r){this._handleError("finalization",r,t)}}};function dt(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!dt(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){let n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(let i of n)if(!t.hasOwnProperty(i)||!dt(e[i],t[i],r-1))return!1;return!0}return!1}var jh=class{constructor(t){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},Object.seal(this),this.setProps(t)}finalize(){for(let t in this.controllers){let r=this.controllers[t];r&&r.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(let t in this.controllers){let r=this.controllers[t];r&&r.updateTransition()}}getViewports(t){return t?this._viewports.filter(r=>r.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r=typeof t=="string"?this.getView(t):t,n=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(n):n}getViewport(t){return this._viewportMap[t]}unproject(t,r){let n=this.getViewports(),s={x:t[0],y:t[1]};for(let i=n.length-1;i>=0;--i){let o=n[i];if(o.containsPixel(s)){let a=t.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(t){t=er(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(!dt(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t):H.warn("missing `viewState` or `initialViewState`")()}_createController(t,r){let n=r.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:i=>this.getView(t.id)?.makeViewport({viewState:i,width:this.width,height:this.height})})}_updateController(t,r,n,s){let i=t.controller;if(i&&n){let o={...r,...i,id:t.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!s||s.constructor!==i.type)&&(s=this._createController(t,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:t}=this,r=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let s=t.length;s--;){let i=t[s],o=this.getViewState(i),a=i.makeViewport({viewState:o,width:this.width,height:this.height}),c=r[i.id],l=Boolean(i.controller);l&&!c&&(n=!0),(n||!l)&&c&&(c.finalize(),c=null),this.controllers[i.id]=this._updateController(i,o,a,c),a&&this._viewports.unshift(a)}for(let s in r){let i=r[s];i&&!this.controllers[s]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length?!0:t.some((n,s)=>!t[s].equals(r[s]))}};var CJ=/([0-9]+\.?[0-9]*)(%|px)/;function zs(e){switch(typeof e){case"number":return{position:e,relative:!1};case"string":let t=CJ.exec(e);if(t&&t.length>=3){let r=t[2]==="%",n=parseFloat(t[1]);return{position:r?n/100:n,relative:r}}default:throw new Error(`Could not parse position string ${e}`)}}function Ws(e,t){return e.relative?Math.round(e.position*t):e.position}var gr=class{constructor(t){let{id:r,x:n=0,y:s=0,width:i="100%",height:o="100%",padding:a=null}=t;this.id=r||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=zs(n),this._y=zs(s),this._width=zs(i),this._height=zs(o),this._padding=a&&{left:zs(a.left||0),right:zs(a.right||0),top:zs(a.top||0),bottom:zs(a.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.constructor===t.constructor&&dt(this.props,t.props,2)}clone(t){let r=this.constructor;return new r({...this.props,...t})}makeViewport({width:t,height:r,viewState:n}){n=this.filterViewState(n);let s=this.getDimensions({width:t,height:r});if(!s.height||!s.width)return null;let i=this.getViewportType(n);return new i({...n,...this.props,...s})}getViewStateId(){let{viewState:t}=this.props;return typeof t=="string"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...t};for(let n in this.props.viewState)n!=="id"&&(r[n]=this.props.viewState[n]);return r}return t}getDimensions({width:t,height:r}){let n={x:Ws(this._x,t),y:Ws(this._y,r),width:Ws(this._width,t),height:Ws(this._height,r)};return this._padding&&(n.padding={left:Ws(this._padding.left,t),top:Ws(this._padding.top,r),right:Ws(this._padding.right,t),bottom:Ws(this._padding.bottom,r)}),n}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t=="function"?{type:t}:{type:this.ControllerType,...t}:null}};var Sn=class{constructor(t){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=t}get inProgress(){return this._inProgress}start(t){this.cancel(),this.settings=t,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:t,settings:r}=this;this._handle=t.addChannel({delay:t.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var rO=()=>{},qh={BREAK:1,SNAP_TO_END:2,IGNORE:3},PJ=e=>e,IJ=qh.BREAK,$h=class{constructor(t){this._onTransitionUpdate=r=>{let{time:n,settings:{interpolator:s,startProps:i,endProps:o,duration:a,easing:c}}=r,l=c(n/a),f=s.interpolateProps(i,o,l);this.propsInTransition=this.getControllerState({...this.props,...f}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Sn(t.timeline),this.onViewStateChange=t.onViewStateChange||rO,this.onStateChange=t.onStateChange||rO}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){let s=n;if(this.transition.inProgress){let{interruption:i,endProps:o}=this.transition.settings;s={...n,...i===qh.SNAP_TO_END?o:this.propsInTransition||n}}this._triggerTransition(s,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:n}=t;return(r>0||r==="auto")&&Boolean(n)}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?this.transition.settings.interruption===qh.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(t,r):!0}_triggerTransition(t,r){let n=this.getControllerState(t),s=this.getControllerState(r).shortestPathFrom(n),i=r.transitionInterpolator,o=i.getDuration?i.getDuration(t,r):r.transitionDuration;if(o===0)return;let a=i.initializeProps(t,s);this.propsInTransition={};let c={duration:o,easing:r.transitionEasing||PJ,interpolator:i,interruption:r.transitionInterruption||IJ,startProps:a.start,endProps:a.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(c),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}};function Bt(e,t){if(!e)throw new Error(t||"deck.gl: assertion failed.")}var Hs=class{constructor(t){let{compare:r,extract:n,required:s}=t;this._propsToCompare=r,this._propsToExtract=n||r,this._requiredProps=s}arePropsEqual(t,r){for(let n of this._propsToCompare)if(!(n in t)||!(n in r)||!te(t[n],r[n]))return!1;return!0}initializeProps(t,r){let n={},s={};for(let i of this._propsToExtract)(i in t||i in r)&&(n[i]=t[i],s[i]=r[i]);return this._checkRequiredProps(n),this._checkRequiredProps(s),{start:n,end:s}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let n=t[r];Bt(Number.isFinite(n)||Array.isArray(n),`${r} is required for transition`)})}};var RJ=["longitude","latitude","zoom","bearing","pitch"],OJ=["longitude","latitude","zoom"],re=class extends Hs{constructor(t={}){let r=Array.isArray(t)?t:t.transitionProps,n=Array.isArray(t)?{}:t;n.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:RJ,required:OJ},super(n.transitionProps),this.opts=n}initializeProps(t,r){let n=super.initializeProps(t,r),{makeViewport:s,around:i}=this.opts;if(s&&i){let o=s(t),a=s(r),c=o.unproject(i);n.start.around=i,Object.assign(n.end,{around:a.project(c),aroundPosition:c,width:r.width,height:r.height})}return n}interpolateProps(t,r,n){let s={};for(let i of this._propsToExtract)s[i]=Oe(t[i]||0,r[i]||0,n);if(r.aroundPosition&&this.opts.makeViewport){let i=this.opts.makeViewport({...r,...s});Object.assign(s,i.panByPosition(r.aroundPosition,Oe(t.around,r.around,n)))}return s}};var Gs={transitionDuration:0},LJ=300,l0=e=>1-(1-e)*(1-e),kc={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},Yo={},xr=class{constructor(t){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new $h({...t,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case"panstart":return r?!1:this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return r?!1:this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"multipanstart":return r?!1:this._onMultiPanStart(t);case"multipanmove":return this._onMultiPan(t);case"multipanend":return this._onMultiPanEnd(t);case"dblclick":return this._onDoubleClick(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:n}=this.props,{offsetCenter:s}=t;return[s.x-r,s.y-n]}isPointInBounds(t,r){let{width:n,height:s}=this.props;if(r&&r.handled)return!1;let i=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=s;return i&&r&&r.stopPropagation(),i}isFunctionKeyPressed(t){let{srcEvent:r}=t;return Boolean(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:r}=t;this.inertia=Number.isFinite(r)?r:r===!0?LJ:0;let{scrollZoom:n=!0,dragPan:s=!0,dragRotate:i=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:c=!1,keyboard:l=!0}=t,f=Boolean(this.onViewStateChange);this.toggleEvents(kc.WHEEL,f&&n),this.toggleEvents(kc.PAN,f),this.toggleEvents(kc.PINCH,f&&(a||c)),this.toggleEvents(kc.MULTI_PAN,f&&c),this.toggleEvents(kc.DOUBLE_CLICK,f&&o),this.toggleEvents(kc.KEYBOARD,f&&l),this.scrollZoom=n,this.dragPan=s,this.dragRotate=i,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=c,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(n=>{this._events[n]!==r&&(this._events[n]=r,r?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(t,r=null,n={}){let s={...t.getViewportProps(),...r},i=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(n),i){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o,viewId:this.props.id})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);let s=this.controllerState[n?"panStart":"rotateStart"]({pos:r});return this._panMove=n,this.updateViewport(s,Gs,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),n=this.controllerState.pan({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let n=this.getCenter(t),s=[n[0]+t.velocityX*r/2,n[1]+t.velocityY*r/2],i=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isPanning:!0})}else{let n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),n=this.controllerState.rotate({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let n=this.getCenter(t),s=[n[0]+t.velocityX*r/2,n[1]+t.velocityY*r/2],i=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isRotating:!0})}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:n=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:i}=t,o=2/(1+Math.exp(-Math.abs(i*n)));i<0&&o!==0&&(o=1/o);let a=s?{...this._getTransitionProps({around:r}),transitionDuration:250}:Gs,c=this.controllerState.zoom({pos:r,scale:o});return this.updateViewport(c,a,{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.controllerState.rotateStart({pos:r});return this.updateViewport(n,Gs,{isDragging:!0}),!0}_onMultiPan(t){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(t);r[0]-=t.deltaX;let n=this.controllerState.rotate({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&t.velocityY){let n=this.getCenter(t),s=[n[0],n[1]+=t.velocityY*r/2],i=this.controllerState.rotate({pos:s});this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return Yo._startPinchRotation=t.rotation,Yo._lastPinchEvent=t,this.updateViewport(n,Gs,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:n}=t,s=this.getCenter(t);r=r.zoom({pos:s,scale:n})}if(this.touchRotate){let{rotation:n}=t;r=r.rotate({deltaAngleX:Yo._startPinchRotation-n})}return this.updateViewport(r,Gs,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Yo._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:n}=Yo;if(this.touchZoom&&r&&n&&t.scale!==n.scale){let s=this.getCenter(t),i=this.controllerState.rotateEnd(),o=Math.log2(t.scale),a=(o-Math.log2(n.scale))/(t.deltaTime-n.deltaTime),c=Math.pow(2,o+a*r/2);i=i.zoom({pos:s,scale:c}).zoomEnd(),this.updateViewport(i,{...this._getTransitionProps({around:s}),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return Yo._startPinchRotation=null,Yo._lastPinchEvent=null,!0}_onDoubleClick(t){if(!this.doubleClickZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.isFunctionKeyPressed(t),s=this.controllerState.zoom({pos:r,scale:n?.5:2});return this.updateViewport(s,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:s,rotateSpeedX:i,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:a}=this,c,l={};switch(t.srcEvent.code){case"Minus":c=r?a.zoomOut(n).zoomOut(n):a.zoomOut(n),l.isZooming=!0;break;case"Equal":c=r?a.zoomIn(n).zoomIn(n):a.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":r?(c=a.rotateLeft(i),l.isRotating=!0):(c=a.moveLeft(s),l.isPanning=!0);break;case"ArrowRight":r?(c=a.rotateRight(i),l.isRotating=!0):(c=a.moveRight(s),l.isPanning=!0);break;case"ArrowUp":r?(c=a.rotateUp(o),l.isRotating=!0):(c=a.moveUp(s),l.isPanning=!0);break;case"ArrowDown":r?(c=a.rotateDown(o),l.isRotating=!0):(c=a.moveDown(s),l.isPanning=!0);break;default:return!1}return this.updateViewport(c,this._getTransitionProps(),l),!0}_getTransitionProps(t){let{transition:r}=this;return!r||!r.transitionInterpolator?Gs:t?{...r,transitionInterpolator:new re({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var js=class{constructor(t,r){this._viewportProps=this.applyConstraints(t),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var nO=5,BJ=1.2,Xh=class extends js{constructor(t){let{width:r,height:n,latitude:s,longitude:i,zoom:o,bearing:a=0,pitch:c=0,altitude:l=1.5,position:f=[0,0,0],maxZoom:h=20,minZoom:u=0,maxPitch:d=60,minPitch:p=0,startPanLngLat:m,startZoomLngLat:g,startRotatePos:x,startBearing:v,startPitch:_,startZoom:y,normalize:b=!0}=t;Bt(Number.isFinite(i)),Bt(Number.isFinite(s)),Bt(Number.isFinite(o)),super({width:r,height:n,latitude:s,longitude:i,zoom:o,bearing:a,pitch:c,altitude:l,maxZoom:h,minZoom:u,maxPitch:d,minPitch:p,normalize:b,position:f},{startPanLngLat:m,startZoomLngLat:g,startRotatePos:x,startBearing:v,startPitch:_,startZoom:y}),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:r}){let n=this.getState().startPanLngLat||this._unproject(r);if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,t);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState();if(!s||i===void 0||o===void 0)return this;let a;return t?a=this._getNewRotation(t,s,o,i):a={bearing:i+r,pitch:o+n},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:r,scale:n}){let{startZoom:s,startZoomLngLat:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(r)||this._unproject(t)),!i)return this;let{maxZoom:o,minZoom:a}=this.getViewportProps(),c=s+Math.log2(n);c=Mt(c,a,o);let l=this.makeViewport({...this.getViewportProps(),zoom:c});return this._getUpdatedState({zoom:c,...l.panByPosition(i,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-r.bearing)>180&&(n.bearing=s<0?s+360:s-360),Math.abs(i-r.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}applyConstraints(t){let{maxZoom:r,minZoom:n,zoom:s}=t;t.zoom=Mt(s,n,r);let{maxPitch:i,minPitch:o,pitch:a}=t;t.pitch=Mt(a,o,i);let{normalize:c=!0}=t;return c&&Object.assign(t,hb(t)),t}_zoomFromCenter(t){let{width:r,height:n}=this.getViewportProps();return this.zoom({pos:[r/2,n/2],scale:t})}_panFromCenter(t){let{width:r,height:n}=this.getViewportProps();return this.pan({startPos:[r/2,n/2],pos:[r/2+t[0],n/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_getNewRotation(t,r,n,s){let i=t[0]-r[0],o=t[1]-r[1],a=t[1],c=r[1],{width:l,height:f}=this.getViewportProps(),h=i/l,u=0;o>0?Math.abs(f-c)>nO&&(u=o/(c-f)*BJ):o<0&&c>nO&&(u=1-a/c),u=Mt(u,-1,1);let{minPitch:d,maxPitch:p}=this.getViewportProps(),m=s+180*h,g=n;return u>0?g=n+u*(p-n):u<0&&(g=n-u*(d-n)),{pitch:g,bearing:m}}},Ko=class extends xr{constructor(){super(...arguments),this.ControllerState=Xh,this.transition={transitionDuration:300,transitionInterpolator:new re({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(t){t.position=t.position||[0,0,0];let r=this.props;super.setProps(t),(!r||r.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var f0=class extends gr{constructor(t={}){super(t)}getViewportType(){return tr}get ControllerType(){return Ko}};f0.displayName="MapView";var Bi=f0;var NJ=new Ri;function FJ(e,t){let r=e.order??1/0,n=t.order??1/0;return r-n}var Yh=class{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(n=>n.id===t.id)){let n=r.findIndex(s=>FJ(s,t)>0);n<0?r.push(t):r.splice(n,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(dt(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let s of this.effects)r[s.id]=s;let n=[];for(let s of t){let i=r[s.id],o=s;i&&i!==s?i.setProps?(i.setProps(s.props),o=i):i.cleanup(this._context):i||s.setup(this._context),n.push(o),delete r[s.id]}for(let s in r)r[s].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),t.some(s=>s instanceof Ri)||this._resolvedEffects.push(NJ),this._needsRedraw="effects changed"}finalize(){for(let t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Kh=class extends $e{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes("draw")||r.includes("terrain")}};var DJ="deckRenderer.renderLayers",Zo=class{constructor(t){this.device=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Kh(t),this.pickLayersPass=new Mn(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){if(!t.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};n.effects&&this._preRender(n.effects,n);let s=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);let i=r.render({...n,target:s});n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=t.clearCanvas===void 0?!0:t.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,ae(DJ,this,i,t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_preRender(t,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let n of t)r.preRenderStats[n.id]=n.preRender(r),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this,r=this.device.canvasContext.getDrawingBufferSize(),[n,s]=r;t.length===0&&[0,1].map(i=>{let o=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:s});t.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[o]}))});for(let i of t)i.resize(r)}_postRender(t,r){let{renderBuffers:n}=this,s={...r,inputBuffer:n[0],swapBuffer:n[1]};for(let i of t)if(i.postRender){s.target=i.id===this.lastPostProcessEffect?r.target:void 0;let o=i.postRender(s);s.inputBuffer=o,s.swapBuffer=o===n[0]?n[1]:n[0]}}};var kJ={pickedColor:null,pickedObjectIndex:-1};function Eb({pickedColors:e,decodePickingColor:t,deviceX:r,deviceY:n,deviceRadius:s,deviceRect:i}){let{x:o,y:a,width:c,height:l}=i,f=s*s,h=-1,u=0;for(let d=0;d<l;d++){let p=d+a-n,m=p*p;if(m>f)u+=4*c;else for(let g=0;g<c;g++){if(e[u+3]-1>=0){let v=g+o-r,_=v*v+m;_<=f&&(f=_,h=u)}u+=4}}if(h>=0){let d=e.slice(h,h+4),p=t(d);if(p){let m=Math.floor(h/4/c),g=h/4-m*c;return{...p,pickedColor:d,pickedX:o+g,pickedY:a+m}}H.error("Picked non-existent layer. Is picking buffer corrupt?")()}return kJ}function Sb({pickedColors:e,decodePickingColor:t}){let r=new Map;if(e){for(let n=0;n<e.length;n+=4)if(e[n+3]-1>=0){let i=e.slice(n,n+4),o=i.join(",");if(!r.has(o)){let a=t(i);a?r.set(o,{...a,color:i}):H.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function h0({pickInfo:e,viewports:t,pixelRatio:r,x:n,y:s,z:i}){let o=t[0];t.length>1&&(o=UJ(e?.pickedViewports||t,{x:n,y:s}));let a;if(o){let c=[n-o.x,s-o.y];i!==void 0&&(c[2]=i),a=o.unproject(c)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:s,pixel:[n,s],coordinate:a,devicePixel:e&&"pickedX"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:r}}function wb(e){let{pickInfo:t,lastPickedInfo:r,mode:n,layers:s}=e,{pickedColor:i,pickedLayer:o,pickedObjectIndex:a}=t,c=o?[o]:[];if(n==="hover"){let h=r.index,u=r.layerId,d=o?o.props.id:null;if(d!==u||a!==h){if(d!==u){let p=s.find(m=>m.props.id===u);p&&c.unshift(p)}r.layerId=d,r.index=a,r.info=null}}let l=h0(e),f=new Map;return f.set(null,l),c.forEach(h=>{let u={...l};h===o&&(u.color=i,u.index=a,u.picked=!0),u=u0({layer:h,info:u,mode:n});let d=u.layer;h===o&&n==="hover"&&(r.info=u),f.set(d.id,u),n==="hover"&&d.updateAutoHighlight(u)}),f}function u0({layer:e,info:t,mode:r}){for(;e&&t;){let n=t.layer||null;t.sourceLayer=n,t.layer=e,t=e.getPickingInfo({info:t,mode:r,sourceLayer:n}),e=e.parent}return t}function UJ(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.containsPixel(t))return n}return e[0]}var Zh=class{constructor(t){this._pickable=!0,this.device=t,this.pickLayersPass=new Mn(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(t){return this._pickClosestObjectAsync(t)}pickObjectsAsync(t){return this._pickVisibleObjectsAsync(t)}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:n,viewports:s},i=this.lastPickedInfo.info){let o=i&&i.layer&&i.layer.id,a=i&&i.viewport&&i.viewport.id,c=o?n.find(u=>u.id===o):null,l=a&&s.find(u=>u.id===a)||s[0],f=l&&l.unproject([t-l.x,r-l.y]);return{...i,...{x:t,y:r,viewport:l,coordinate:f,layer:c}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=r}let{canvas:t}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:t.width,height:t.height}),this.depthFBO?.resize({width:t.width,height:t.height})}_getPickable(t){if(this._pickable===!1)return null;let r=t.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return r.length?r:null}async _pickClosestObjectAsync({layers:t,views:r,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:f,effects:h}){let u=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(t);if(!d||n.length===0)return{result:[],emptyInfo:h0({viewports:n,x:s,y:i,pixelRatio:u})};this._resizeBuffer();let p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=[p.x+Math.floor(p.width/2),p.y+Math.floor(p.height/2)],g=Math.round(o*u),{width:x,height:v}=this.pickingFBO,_=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceWidth:x,deviceHeight:v}),y={x:s-o,y:i-o,width:o*2+1,height:o*2+1},b,T=[],C=new Set;for(let S=0;S<a;S++){let M;if(_){let I=this._drawAndSample({layers:d,views:r,viewports:n,onViewportActive:f,deviceRect:_,cullRect:y,effects:h,pass:`picking:${c}`});M=Eb({...I,deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceRect:_})}else M={pickedColor:null,pickedObjectIndex:-1};let A;if(M.pickedLayer&&l&&this.depthFBO){let{pickedColors:I}=this._drawAndSample({layers:[M.pickedLayer],views:r,viewports:n,onViewportActive:f,deviceRect:{x:M.pickedX,y:M.pickedY,width:1,height:1},cullRect:y,effects:h,pass:`picking:${c}:z`},!0);I[3]&&(A=I[0])}M.pickedLayer&&S+1<a&&(C.add(M.pickedLayer),M.pickedLayer.disablePickingIndex(M.pickedObjectIndex)),b=wb({pickInfo:M,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:A,pixelRatio:u});for(let I of b.values())I.layer&&T.push(I);if(!M.pickedColor)break}for(let S of C)S.restorePickingColors();return{result:T,emptyInfo:b.get(null)}}_pickClosestObject({layers:t,views:r,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:f,effects:h}){let u=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(t);if(!d||n.length===0)return{result:[],emptyInfo:h0({viewports:n,x:s,y:i,pixelRatio:u})};this._resizeBuffer();let p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=[p.x+Math.floor(p.width/2),p.y+Math.floor(p.height/2)],g=Math.round(o*u),{width:x,height:v}=this.pickingFBO,_=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceWidth:x,deviceHeight:v}),y={x:s-o,y:i-o,width:o*2+1,height:o*2+1},b,T=[],C=new Set;for(let S=0;S<a;S++){let M;if(_){let I=this._drawAndSample({layers:d,views:r,viewports:n,onViewportActive:f,deviceRect:_,cullRect:y,effects:h,pass:`picking:${c}`});M=Eb({...I,deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceRect:_})}else M={pickedColor:null,pickedObjectIndex:-1};let A;if(M.pickedLayer&&l&&this.depthFBO){let{pickedColors:I}=this._drawAndSample({layers:[M.pickedLayer],views:r,viewports:n,onViewportActive:f,deviceRect:{x:M.pickedX,y:M.pickedY,width:1,height:1},cullRect:y,effects:h,pass:`picking:${c}:z`},!0);I[3]&&(A=I[0])}M.pickedLayer&&S+1<a&&(C.add(M.pickedLayer),M.pickedLayer.disablePickingIndex(M.pickedObjectIndex)),b=wb({pickInfo:M,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:A,pixelRatio:u});for(let I of b.values())I.layer&&T.push(I);if(!M.pickedColor)break}for(let S of C)S.restorePickingColors();return{result:T,emptyInfo:b.get(null)}}async _pickVisibleObjectsAsync({layers:t,views:r,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:f,effects:h}){let u=this._getPickable(t);if(!u||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=p.x,g=p.y+p.height,x=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),v=x.x+x.width,_=x.y,y={x:m,y:_,width:v-m,height:g-_},b=this._drawAndSample({layers:u,views:r,viewports:n,onViewportActive:f,deviceRect:y,cullRect:{x:s,y:i,width:o,height:a},effects:h,pass:`picking:${c}`}),T=Sb(b),C=new Map,S=[],M=Number.isFinite(l);for(let A=0;A<T.length&&!(M&&S.length>=l);A++){let I=T[A],D={color:I.pickedColor,layer:null,index:I.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};D=u0({layer:I.pickedLayer,info:D,mode:c});let k=D.layer.id;C.has(k)||C.set(k,new Set);let P=C.get(k),q=D.object??D.index;P.has(q)||(P.add(q),S.push(D))}return S}_pickVisibleObjects({layers:t,views:r,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:f,effects:h}){let u=this._getPickable(t);if(!u||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=p.x,g=p.y+p.height,x=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),v=x.x+x.width,_=x.y,y={x:m,y:_,width:v-m,height:g-_},b=this._drawAndSample({layers:u,views:r,viewports:n,onViewportActive:f,deviceRect:y,cullRect:{x:s,y:i,width:o,height:a},effects:h,pass:`picking:${c}`}),T=Sb(b),C=new Map,S=[],M=Number.isFinite(l);for(let A=0;A<T.length&&!(M&&S.length>=l);A++){let I=T[A],D={color:I.pickedColor,layer:null,index:I.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};D=u0({layer:I.pickedLayer,info:D,mode:c});let k=D.layer.id;C.has(k)||C.set(k,new Set);let P=C.get(k),q=D.object??D.index;P.has(q)||(P.add(q),S.push(D))}return S}async _drawAndSampleAsync({layers:t,views:r,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let f=l?this.depthFBO:this.pickingFBO,h={layers:t,layerFilter:this.layerFilter,views:r,viewports:n,onViewportActive:s,pickingFBO:f,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let v of a)v.useInPicking&&(h.preRenderStats[v.id]=v.preRender(h));let{decodePickingColor:u}=this.pickLayersPass.render(h),{x:d,y:p,width:m,height:g}=i,x=new(l?Float32Array:Uint8Array)(m*g*4);return this.device.readPixelsToArrayWebGL(f,{sourceX:d,sourceY:p,sourceWidth:m,sourceHeight:g,target:x}),{pickedColors:x,decodePickingColor:u}}_drawAndSample({layers:t,views:r,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let f=l?this.depthFBO:this.pickingFBO,h={layers:t,layerFilter:this.layerFilter,views:r,viewports:n,onViewportActive:s,pickingFBO:f,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let v of a)v.useInPicking&&(h.preRenderStats[v.id]=v.preRender(h));let{decodePickingColor:u}=this.pickLayersPass.render(h),{x:d,y:p,width:m,height:g}=i,x=new(l?Float32Array:Uint8Array)(m*g*4);return this.device.readPixelsToArrayWebGL(f,{sourceX:d,sourceY:p,sourceWidth:m,sourceHeight:g,target:x}),{pickedColors:x,decodePickingColor:u}}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:n,deviceWidth:s,deviceHeight:i}){let o=Math.max(0,t-n),a=Math.max(0,r-n),c=Math.min(s,t+n+1)-o,l=Math.min(i,r+n+1)-a;return c<=0||l<=0?null:{x:o,y:a,width:c,height:l}}};var VJ={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},zJ="top-left",sO="__root",d0=class{constructor({deck:t,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=t,r?.classList.add("deck-widget-container"),this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(t){if(t.widgets&&!dt(t.widgets,this.widgets,1)){let r=t.widgets.filter(Boolean);this._setWidgets(r)}}finalize(){for(let t of this.getWidgets())this._removeWidget(t);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let t in this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find(r=>r.id===t.id)||(this._addWidget(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}onRedraw({viewports:t,layers:r}){let n=t.reduce((s,i)=>(s[i.id]=i,s),{});for(let s of this.getWidgets()){let{viewId:i}=s;if(i){let o=n[i];o&&(s.onViewportChange&&s.onViewportChange(o),s.onRedraw?.({viewports:[o],layers:r}))}else{if(s.onViewportChange)for(let o of t)s.onViewportChange(o);s.onRedraw?.({viewports:t,layers:r})}}this.lastViewports=n,this._updateContainers()}onHover(t,r){for(let n of this.getWidgets()){let{viewId:s}=n;(!s||s===t.viewport?.id)&&n.onHover?.(t,r)}}onEvent(t,r){let n=Ch[r.type];if(n)for(let s of this.getWidgets()){let{viewId:i}=s;(!i||i===t.viewport?.id)&&s[n]?.(t,r)}}_setWidgets(t){let r={};for(let n of this.resolvedWidgets)r[n.id]=n;this.resolvedWidgets.length=0;for(let n of this.defaultWidgets)r[n.id]=null,this.resolvedWidgets.push(n);for(let n of t){let s=r[n.id];s?s.viewId!==n.viewId||s.placement!==n.placement?(this._removeWidget(s),this._addWidget(n)):n!==s&&(s.setProps(n.props),n=s):this._addWidget(n),r[n.id]=null,this.resolvedWidgets.push(n)}for(let n in r){let s=r[n];s&&this._removeWidget(s)}this.widgets=t}_addWidget(t){let{viewId:r=null,placement:n=zJ}=t;t.widgetManager=this,t.deck=this.deck,t.rootElement=t._onAdd({deck:this.deck,viewId:r}),t.rootElement&&this._getContainer(r,n).append(t.rootElement),t.updateHTML()}_removeWidget(t){t.onRemove?.(),t.rootElement&&t.rootElement.remove(),t.rootElement=void 0,t.deck=void 0,t.widgetManager=void 0}_getContainer(t,r){let n=t||sO,s=this.containers[n];s||(s=document.createElement("div"),s.style.pointerEvents="none",s.style.position="absolute",s.style.overflow="hidden",this.parentElement?.append(s),this.containers[n]=s);let i=s.querySelector(`.${r}`);return i||(i=globalThis.document.createElement("div"),i.className=r,i.style.position="absolute",i.style.zIndex="2",Object.assign(i.style,VJ[r]),s.append(i)),i}_updateContainers(){let t=this.deck.width,r=this.deck.height;for(let n in this.containers){let s=this.lastViewports[n]||null,i=n===sO||s,o=this.containers[n];i?(o.style.display="block",o.style.left=`${s?s.x:0}px`,o.style.top=`${s?s.y:0}px`,o.style.width=`${s?s.width:t}px`,o.style.height=`${s?s.height:r}px`):o.style.display="none"}}};function Jo(e,t){t&&Object.entries(t).map(([r,n])=>{r.startsWith("--")?e.style.setProperty(r,n):e.style[r]=n})}function p0(e,t){t&&Object.keys(t).map(r=>{r.startsWith("--")?e.style.removeProperty(r):e.style[r]=""})}var et=class{constructor(t){this.viewId=null,this.props={...this.constructor.defaultProps,...t},this.id=this.props.id}setProps(t){let r=this.props,n=this.rootElement;n&&r.className!==t.className&&(r.className&&n.classList.remove(r.className),t.className&&n.classList.add(t.className)),n&&!dt(r.style,t.style,1)&&(p0(n,r.style),Jo(n,t.style)),Object.assign(this.props,t),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}onCreateRootElement(){let t=["deck-widget",this.className,this.props.className],r=document.createElement("div");return t.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>r.classList.add(n)),Jo(r,this.props.style),r}_onAdd(t){return this.onAdd(t)??this.onCreateRootElement()}onAdd(t){}onRemove(){}onViewportChange(t){}onRedraw(t){}onHover(t,r){}onClick(t,r){}onDrag(t,r){}onDragStart(t,r){}onDragEnd(t,r){}};et.defaultProps={id:"widget",style:{},className:""};var WJ={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},Jh=class extends et{constructor(t={}){super(t),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(t)}onCreateRootElement(){let t=document.createElement("div");return t.className=this.className,Object.assign(t.style,WJ),t}onRenderHTML(t){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&t!==this.lastViewport&&this.setTooltip(null)}onHover(t){let{deck:r}=this,n=r&&r.props.getTooltip;if(!n)return;let s=n(t);this.lastViewport=t.viewport,this.setTooltip(s,t.x,t.y)}setTooltip(t,r,n){let s=this.rootElement;if(s){if(typeof t=="string")s.innerText=t;else if(t)t.text&&(s.innerText=t.text),t.html&&(s.innerHTML=t.html),t.className&&(s.className=t.className);else{this.isVisible=!1,s.style.display="none";return}this.isVisible=!0,s.style.display="block",s.style.transform=`translate(${r}px, ${n}px)`,t&&typeof t=="object"&&"style"in t&&Object.assign(s.style,t.style)}}};Jh.defaultProps={...et.defaultProps};it();iu();vo();function Di(){}var $Q=({isDragging:e})=>e?"grabbing":"grab",CL={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Di,onWebGLInitialized:Di,onResize:Di,onViewStateChange:Di,onInteractionStateChange:Di,onBeforeRender:Di,onAfterRender:Di,onLoad:Di,onError:e=>H.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:$Q,getTooltip:null,debug:!1,drawPickingColors:!1},au=class{constructor(t){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Ze({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=n=>{let{_pickRequest:s}=this;if(n.type==="pointerleave")s.x=-1,s.y=-1,s.radius=0;else{if(n.leftButton||n.rightButton)return;{let i=n.offsetCenter;if(!i)return;s.x=i.x,s.y=i.y,s.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:s.x,y:s.y}),s.event=n},this._onEvent=n=>{let s=Ch[n.type],i=n.offsetCenter;if(!s||!i||!this.layerManager)return;let o=this.layerManager.getLayers(),a=this.deckPicker.getLastPickedObject({x:i.x,y:i.y,layers:o,viewports:this.getViewports(i)},this._lastPointerDownInfo),{layer:c}=a,l=c&&(c[s]||c.props[s]),f=this.props[s],h=!1;l&&(h=l.call(c,a,n)),h||(f?.(a,n),this.widgetManager.onEvent(a,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;let s=n.offsetCenter,i=this._pick("pickObject","pickObject Time",{x:s.x,y:s.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=i.result[0]||i.emptyInfo},this.props={...CL,...t},t=this.props,t.viewState&&t.initialViewState&&H.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,t.device&&(this.device=t.device);let r=this.device;if(!r&&t.gl){t.gl instanceof WebGLRenderingContext&&H.error("WebGL1 context not supported.")();let n=this.props.deviceProps?.onResize;r=ou.attach(t.gl,{...this.props.deviceProps,onResize:(s,i)=>{let{width:o,height:a}=s.canvas;s.drawingBufferWidth=o,s.drawingBufferHeight=a,this._needsRedraw="Canvas resized",n?.(s,i)}})}r||(r=this._createDevice(t)),this.animationLoop=this._createAnimationLoop(r,t),this.setProps(t),t._typedArrayManagerProps&&Tn.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&H.removed("onLayerHover","onHover")(),"onLayerClick"in t&&H.removed("onLayerClick","onClick")(),t.initialViewState&&!dt(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),t.device&&t.device.id!==this.device?.id&&(this.animationLoop?.stop(),this.canvas!==t.device.canvasContext?.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),H.log(`recreating animation loop for new device! id=${t.device.id}`)(),this.animationLoop=this._createAnimationLoop(t.device,t),this.animationLoop.start()),this.animationLoop?.setProps(r),t.useDevicePixels!==void 0&&this.device?.canvasContext&&this.device.canvasContext.setProps({useDevicePixels:t.useDevicePixels}),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let n=this.viewManager.needsRedraw(t),s=this.layerManager.needsRedraw(t),i=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r=r||n||s||i||o,r}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=t||r,r&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return Bt(this.viewManager),this.viewManager.views}getViewports(t){return Bt(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let r=this._pick("pickObject","pickObject Time",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_addResources(t,r=!1){for(let n in t)this.layerManager.resourceManager.add({resourceId:n,data:t[n],forceUpdate:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_pick(t,r,n){Bt(this.deckPicker);let{stats:s}=this;s.get("Pick Count").incrementCount(),s.get(r).timeStart();let i=this.deckPicker[t]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return s.get(r).timeEnd(),i}_createCanvas(t){let r=t.canvas;return typeof r=="string"&&(r=document.getElementById(r),Bt(r)),r||(r=document.createElement("canvas"),r.id=t.id||"deckgl-overlay",t.width&&typeof t.width=="number"&&(r.width=t.width),t.height&&typeof t.height=="number"&&(r.height=t.height),(t.parent||document.body).appendChild(r)),Object.assign(r.style,t.style),r}_setCanvasSize(t){if(!this.canvas)return;let{width:r,height:n}=t;if(r||r===0){let s=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=s}if(n||n===0){let s=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=s}}_updateCanvasSize(){let{canvas:t}=this;if(!t)return;let r=t.clientWidth??t.width,n=t.clientHeight??t.height;(r!==this.width||n!==this.height)&&(this.width=r,this.height=n,this.viewManager?.setProps({width:r,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:n}))}_createAnimationLoop(t,r){let{gl:n,onError:s}=r;return new Nc({device:t,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:i=>this._setDevice(i.device),onRender:this._onRenderFrame.bind(this),onError:s})}_createDevice(t){let r=this.props.deviceProps?.createCanvasContext,n=typeof r=="object"?r:void 0,s={adapters:[],...t.deviceProps};s.adapters.includes(ou)||s.adapters.push(ou);let i={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0},o=this.props.deviceProps?.onResize;return Xn.createDevice({_reuseDevices:!0,type:"webgl",...s,createCanvasContext:{...i,...n,canvas:this._createCanvas(t),useDevicePixels:this.props.useDevicePixels,autoResize:!0},onResize:(a,c)=>{this._needsRedraw="Canvas resized",o?.(a,c)}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:t}=this.props,r=Array.isArray(t)?t:t?[t]:[new Bi({id:"default-view"})];return r.length&&this.props.controller&&(r[0].props.controller=this.props.controller),r}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;let{_pickRequest:t}=this;if(t.event){let{result:r,emptyInfo:n}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=r.length>0;let s=n,i=!1;for(let o of r)s=o,i=o.layer?.onHover(o,t.event)||i;i||(this.props.onHover?.(s,t.event),this.widgetManager.onHover(s,t.event)),t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(t){if(this.device=t,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas,!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild)),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);let r=new jo;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new wh(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(ib).map(s=>{let[i,o,a,c]=ib[s],l=this.props.eventRecognizerOptions?.[s],f={...o,...l,event:s};return{recognizer:new i(f),recognizeWith:a,requestFailure:c}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in Ch)this.eventManager.on(s,this._onEvent);this.viewManager=new jh({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let n=this.viewManager.getViewports()[0];this.layerManager=new Xo(this.device,{deck:this,stats:this.stats,viewport:n,timeline:r}),this.effectManager=new Yh({deck:this,device:this.device}),this.deckRenderer=new Zo(this.device),this.deckPicker=new Zh(this.device),this.widgetManager=new d0({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new Jh),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,r){let{device:n,gl:s}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:s});let i={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};this.deckRenderer?.renderLayers(i),i.pass==="screen"&&this.widgetManager.onRedraw({viewports:i.viewports,layers:i.layers}),this.props.onAfterRender({device:n,gl:s})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),H.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();let r=this.animationLoop.stats;t.get("GPU Time").addTime(r.get("GPU Time").lastTiming),t.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get("frameRate").getHz(),t.setPropsTime=r.get("setProps Time").time,t.updateAttributesTime=r.get("Update Attributes").time,t.framesRedrawn=r.get("Redraw Count").count,t.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,t.pickCount=r.get("Pick Count").count,t.gpuTime=r.get("GPU Time").time,t.cpuTime=r.get("CPU Time").time,t.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let n=Xn.stats.get("Memory Usage");t.bufferMemory=n.get("Buffer Memory").count,t.textureMemory=n.get("Texture Memory").count,t.renderbufferMemory=n.get("Renderbuffer Memory").count,t.gpuMemory=n.get("GPU Memory").count}};au.defaultProps=CL;au.VERSION=vm;var In=au;it();it();function PL(e){switch(e){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return So(e)}}var IL=Eo;function cu(e,t,r){let n=r==="webgpu"&&t.type==="uint8"?"unorm8":t.type;return{attribute:e,format:t.size>1?`${n}x${t.size}`:t.type,byteOffset:t.offset||0}}function ki(e){return e.stride||e.size*e.bytesPerElement}function RL(e,t){return e.type===t.type&&e.size===t.size&&ki(e)===ki(t)&&(e.offset||0)===(t.offset||0)}function Kb(e,t){t.offset&&H.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=ki(e),n=t.vertexOffset!==void 0?t.vertexOffset:e.vertexOffset||0,s=t.elementOffset||0,i=n*r+s*e.bytesPerElement+(e.offset||0);return{...t,offset:i,stride:r}}function XQ(e,t){let r=Kb(e,t);return{high:r,low:{...r,offset:r.offset+e.size*4}}}var lu=class{constructor(t,r,n){this._buffer=null,this.device=t,this.id=r.id||"",this.size=r.size||1;let s=r.logicalType||r.type,i=s==="float64",{defaultValue:o}=r;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let a;i?a="float32":!s&&r.isIndexed?a="uint32":a=s||"float32";let c=PL(s||a);this.doublePrecision=i,i&&r.fp64===!1&&(c=Float32Array),this.value=null,this.settings={...r,defaultType:c,defaultValue:o,logicalType:s,type:a,normalized:a.includes("norm"),size:this.size,bytesPerElement:c.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let t=this.getAccessor();return t.vertexOffset?t.vertexOffset*ki(t):0}get numInstances(){return this.state.numInstances}set numInstances(t){this.state.numInstances=t}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),Tn.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(t=this.id,r=null){let n={};if(this.state.constant){let s=this.value;if(r){let i=Kb(this.getAccessor(),r),o=i.offset/s.BYTES_PER_ELEMENT,a=i.size||this.size;n[t]=s.subarray(o,o+a)}else n[t]=s}else n[t]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${t}64Low`]=n[t]:n[`${t}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(t=this.id,r=null){let n=this.getAccessor(),s=[],i={name:this.id,byteStride:ki(n),attributes:s};if(this.doublePrecision){let o=XQ(n,r||{});s.push(cu(t,{...n,...o.high},this.device.type),cu(`${t}64Low`,{...n,...o.low},this.device.type))}else if(r){let o=Kb(n,r);s.push(cu(t,{...n,...o},this.device.type))}else s.push(cu(t,n,this.device.type));return i}setAccessor(t){this.state.bufferAccessor=t}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let t=null;if(this.state.constant&&this.value){let r=Array.from(this.value);t=[r,r]}else{let{value:r,numInstances:n,size:s}=this,i=n*s;if(r&&i&&r.length>=i){let o=new Array(s).fill(1/0),a=new Array(s).fill(-1/0);for(let c=0;c<i;)for(let l=0;l<s;l++){let f=r[c++];f<o[l]&&(o[l]=f),f>a[l]&&(a[l]=f)}t=[o,a]}}return this.state.bounds=t,t}setData(t){let{state:r}=this,n;ArrayBuffer.isView(t)?n={value:t}:t instanceof at?n={buffer:t}:n=t;let s={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)s.type="float32";else{let o=IL(n.value);s.type=s.normalized?o.replace("int","norm"):o}s.bytesPerElement=n.value.BYTES_PER_ELEMENT,s.stride=ki(s)}if(r.bounds=null,n.constant){let i=n.value;if(i=this._normalizeValue(i,[],0),this.settings.normalized&&(i=this.normalizeConstant(i)),!(!r.constant||!this._areValuesEqual(i,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=ArrayBuffer.isView(i)?i:new Float32Array(i)}else if(n.buffer){let i=n.buffer;r.externalBuffer=i,r.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let i=n.value;r.externalBuffer=null,r.constant=!1,this.value=i;let{buffer:o}=this,a=ki(s),c=(s.vertexOffset||0)*a;if(this.doublePrecision&&i instanceof Float64Array&&(i=Qg(i,s)),this.settings.isIndexed){let f=this.settings.defaultType;i.constructor!==f&&(i=new f(i))}let l=i.byteLength+c+a*2;(!o||o.byteLength<l)&&(o=this._createBuffer(l)),o.write(i,c)}return this.setAccessor(s),!0}updateSubBuffer(t={}){this.state.bounds=null;let r=this.value,{startOffset:n=0,endOffset:s}=t;this.buffer.write(this.doublePrecision&&r instanceof Float64Array?Qg(r,{size:this.size,startIndex:n,endIndex:s}):r.subarray(n,s),n*r.BYTES_PER_ELEMENT+this.byteOffset)}allocate(t,r=!1){let{state:n}=this,s=n.allocatedValue,i=Tn.allocate(s,t+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=i;let{byteOffset:o}=this,{buffer:a}=this;return(!a||a.byteLength<i.byteLength+o)&&(a=this._createBuffer(i.byteLength+o),r&&s&&a.write(s instanceof Float64Array?Qg(s,this):s,o)),n.allocatedValue=i,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(t){let{value:r}=t;if(!ArrayBuffer.isView(r))throw new Error(`Attribute ${this.id} value is not TypedArray`);let n=this.settings.defaultType,s=!1;if(this.doublePrecision&&(s=r.BYTES_PER_ELEMENT<4),s)throw new Error(`Attribute ${this.id} does not support ${r.constructor.name}`);!(r instanceof n)&&this.settings.normalized&&!("normalized"in t)&&H.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(t){switch(this.settings.type){case"snorm8":return new Float32Array(t).map(r=>(r+128)/255*2-1);case"snorm16":return new Float32Array(t).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(t).map(r=>r/255);case"unorm16":return new Float32Array(t).map(r=>r/65535);default:return t}}_normalizeValue(t,r,n){let{defaultValue:s,size:i}=this.settings;if(Number.isFinite(t))return r[n]=t,r;if(!t){let o=i;for(;--o>=0;)r[n+o]=s[o];return r}switch(i){case 4:r[n+3]=Number.isFinite(t[3])?t[3]:s[3];case 3:r[n+2]=Number.isFinite(t[2])?t[2]:s[2];case 2:r[n+1]=Number.isFinite(t[1])?t[1]:s[1];case 1:r[n+0]=Number.isFinite(t[0])?t[0]:s[0];break;default:let o=i;for(;--o>=0;)r[n+o]=Number.isFinite(t[o])?t[o]:s[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:n}=this;for(let s=0;s<n;s++)if(t[s]!==r[s])return!1;return!0}_createBuffer(t){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(r?at.INDEX:at.VERTEX)|at.COPY_DST,indexType:r?n:void 0,byteLength:t}),this._buffer}};var OL=[],LL=[];function ue(e,t=0,r=1/0){let n=OL,s={index:-1,data:e,target:[]};return e?typeof e[Symbol.iterator]=="function"?n=e:e.length>0&&(LL.length=e.length,n=LL):n=OL,(t>0||Number.isFinite(r))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(t,r),s.index=t-1),{iterable:n,objectInfo:s}}function z0(e){return e&&e[Symbol.asyncIterator]}function W0(e,t){let{size:r,stride:n,offset:s,startIndices:i,nested:o}=t,a=e.BYTES_PER_ELEMENT,c=n?n/a:r,l=s?s/a:0,f=Math.floor((e.length-l)/c);return(h,{index:u,target:d})=>{if(!i){let x=u*c+l;for(let v=0;v<r;v++)d[v]=e[x+v];return d}let p=i[u],m=i[u+1]||f,g;if(o){g=new Array(m-p);for(let x=p;x<m;x++){let v=x*c+l;d=new Array(r);for(let _=0;_<r;_++)d[_]=e[v+_];g[x-p]=d}}else if(c===r)g=e.subarray(p*r+l,m*r+l);else{g=new e.constructor((m-p)*r);let x=0;for(let v=p;v<m;v++){let _=v*c+l;for(let y=0;y<r;y++)g[x++]=e[_+y]}}return g}}var BL=[],fu=[[0,1/0]];function NL(e,t){if(e===fu||(t[0]<0&&(t[0]=0),t[0]>=t[1]))return e;let r=[],n=e.length,s=0;for(let i=0;i<n;i++){let o=e[i];o[1]<t[0]?(r.push(o),s=i+1):o[0]>t[1]?r.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return r.splice(s,0,t),r}var KQ={interpolation:{duration:0,easing:e=>e},spring:{stiffness:.05,damping:.5}};function H0(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:"interpolation",duration:e});let r=e.type||"interpolation";return{...KQ[r],...t,...e,type:r}}var qs=class extends lu{constructor(t,r){super(t,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:fu}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(t){this.state.startIndices=t}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:t=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!t,r}layoutChanged(){return this.state.layoutChanged}setAccessor(t){var r;(r=this.state).layoutChanged||(r.layoutChanged=!RL(t,this.getAccessor())),super.setAccessor(t)}getUpdateTriggers(){let{accessor:t}=this.settings;return[this.id].concat(typeof t!="function"&&t||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;let{accessor:r}=this.settings,n=this.settings.transition,s=Array.isArray(r)?t[r.find(i=>t[i])]:t[r];return H0(s,n)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:n=0,endRow:s=1/0}=r;this.state.updateRanges=NL(this.state.updateRanges,[n,s])}else this.state.updateRanges=fu}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=BL}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(t,r.updateRanges!==fu),!0):!1}updateBuffer({numInstances:t,data:r,props:n,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:i},settings:{update:o,noAlloc:a}}=this,c=!0;if(o){for(let[l,f]of i)o.call(s,this,{data:r,startRow:l,endRow:f,props:n,numInstances:t});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[l,f]of i){let h=Number.isFinite(l)?this.getVertexOffset(l):0,u=Number.isFinite(f)?this.getVertexOffset(f):a||!Number.isFinite(t)?this.value.length:t*this.size;super.updateSubBuffer({startOffset:h,endOffset:u})}this._checkAttributeArray()}else c=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),c}setConstantValue(t,r){let n=this.device.type==="webgpu";if(n||r===void 0||typeof r=="function"){if(n&&typeof r!="function"){let o=this._normalizeValue(r,[],0);this._areValuesEqual(o,this.value)||this.setNeedsUpdate("WebGPU constant updated")}return!1}let s=this.settings.transform&&t?this.settings.transform.call(t,r):r;return this.setData({constant:!0,value:s})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}setExternalBuffer(t){let{state:r}=this;return t?(this.clearNeedsUpdate(),r.lastExternalBuffer===t||(r.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t)),!0):(r.lastExternalBuffer=null,!1)}setBinaryValue(t,r=null){let{state:n,settings:s}=this;if(!t)return n.binaryValue=null,n.binaryAccessor=null,!1;if(s.noAlloc)return!1;if(n.binaryValue===t)return this.clearNeedsUpdate(),!0;if(n.binaryValue=t,this.setNeedsRedraw(),s.transform||r!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});let o=t;Bt(ArrayBuffer.isView(o.value),`invalid ${s.accessor}`);let a=Boolean(o.size)&&o.size!==this.size;return n.binaryAccessor=W0(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:r,nested:a}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){let{startIndices:r}=this;return(r?t<r.length?r[t]:this.numInstances:t)*this.size}getValue(){let t=this.settings.shaderAttributes,r=super.getValue();if(!t)return r;for(let n in t)Object.assign(r,super.getValue(n,t[n]));return r}getBufferLayout(t){this.state.layoutChanged=!1;let r=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:s}=this.settings;if(s==="dynamic"?n.stepMode=t?t.isInstanced?"instance":"vertex":"instance":n.stepMode=s??"vertex",!r)return n;for(let i in r){let o=super._getBufferLayout(i,r[i]);n.attributes.push(...o.attributes)}return n}_autoUpdater(t,{data:r,startRow:n,endRow:s,props:i,numInstances:o}){if(t.constant&&this.context.device.type!=="webgpu")return;let{settings:a,state:c,value:l,size:f,startIndices:h}=t,{accessor:u,transform:d}=a,p=c.binaryAccessor||(typeof u=="function"?u:i[u]);typeof p!="function"&&typeof u=="string"&&(p=()=>i[u]),Bt(typeof p=="function",`accessor "${u}" is not a function`);let m=t.getVertexOffset(n),{iterable:g,objectInfo:x}=ue(r,n,s);for(let v of g){x.index++;let _=p(v,x);if(d&&(_=d.call(this,_)),h){let y=(x.index<h.length-1?h[x.index+1]:o)-h[x.index];if(_&&Array.isArray(_[0])){let b=m;for(let T of _)t._normalizeValue(T,l,b),b+=f}else _&&_.length>f?l.set(_,m):(t._normalizeValue(_,x.target,0),c0({target:l,source:x.target,start:m,count:y}));m+=y*f}else t._normalizeValue(_,l,m),m+=f}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||typeof t.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let n=!0;switch(r){case 4:n=n&&Number.isFinite(t[3]);case 3:n=n&&Number.isFinite(t[2]);case 2:n=n&&Number.isFinite(t[1]);case 1:n=n&&Number.isFinite(t[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function Zb(e){let{source:t,target:r,start:n=0,size:s,getData:i}=e,o=e.end||r.length,a=t.length,c=o-n;if(a>c){r.set(t.subarray(0,c),n);return}if(r.set(t,n),!i)return;let l=a;for(;l<c;){let f=i(l,t);for(let h=0;h<s;h++)r[n+l]=f[h]||0,l++}}function FL({source:e,target:t,size:r,getData:n,sourceStartIndices:s,targetStartIndices:i}){if(!s||!i)return Zb({source:e,target:t,size:r,getData:n}),t;let o=0,a=0,c=n&&((f,h)=>n(f+a,h)),l=Math.min(s.length,i.length);for(let f=1;f<l;f++){let h=s[f]*r,u=i[f]*r;Zb({source:e.subarray(o,h),target:t,start:a,end:u,size:r,getData:c}),o=h,a=u}return a<t.length&&Zb({source:[],target:t,start:a,size:r,getData:c}),t}function DL(e){let{device:t,settings:r,value:n}=e,s=new qs(t,r);return s.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:r.normalized}),s}function G0(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${e}"`)}}function j0(e){switch(e){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function q0(e){e.push(e.shift())}function kL(e,t){let{doublePrecision:r,settings:n,value:s,size:i}=e,o=r&&s instanceof Float64Array?2:1,a=0,{shaderAttributes:c}=e.settings;if(c)for(let l of Object.values(c))a=Math.max(a,l.vertexOffset??0);return(n.noAlloc?s.length:(t+a)*i)*o}function $0({device:e,source:t,target:r}){return(!r||r.byteLength<t.byteLength)&&(r?.destroy(),r=e.createBuffer({byteLength:t.byteLength,usage:t.usage})),r}function X0({device:e,buffer:t,attribute:r,fromLength:n,toLength:s,fromStartIndices:i,getData:o=a=>a}){let a=r.doublePrecision&&r.value instanceof Float64Array?2:1,c=r.size*a,l=r.byteOffset,f=r.settings.bytesPerElement<4?l/r.settings.bytesPerElement*4:l,h=r.startIndices,u=i&&h,d=r.isConstant;if(!u&&t&&n>=s)return t;let p=r.value instanceof Float64Array?Float32Array:r.value.constructor,m=d?r.value:new p(r.getBuffer().readSyncWebGL(l,s*p.BYTES_PER_ELEMENT).buffer);if(r.settings.normalized&&!d){let _=o;o=(y,b)=>r.normalizeConstant(_(y,b))}let g=d?(_,y)=>o(m,y):(_,y)=>o(m.subarray(_+l,_+l+c),y),x=t?new Float32Array(t.readSyncWebGL(f,n*4).buffer):new Float32Array(0),v=new Float32Array(s);return FL({source:x,target:v,sourceStartIndices:i,targetStartIndices:h,size:c,getData:g}),(!t||t.byteLength<v.byteLength+f)&&(t?.destroy(),t=e.createBuffer({byteLength:v.byteLength+f,usage:35050})),t.write(v,f),t}var Gc=class{constructor({device:t,attribute:r,timeline:n}){this.buffers=[],this.currentLength=0,this.device=t,this.transition=new Sn(n),this.attribute=r,this.attributeInTransition=DL(r),this.currentStartIndices=r.startIndices}get inProgress(){return this.transition.inProgress}start(t,r,n=1/0){this.settings=t,this.currentStartIndices=this.attribute.startIndices,this.currentLength=kL(this.attribute,r),this.transition.start({...t,duration:n})}update(){let t=this.transition.update();return t&&this.onUpdate(),t}setBuffer(t){this.attributeInTransition.setData({buffer:t,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(let t of this.buffers)t.destroy();this.buffers.length=0}};var hu=class extends Gc{constructor({device:t,attribute:r,timeline:n}){super({device:t,attribute:r,timeline:n}),this.type="interpolation",this.transform=ttt(t,r)}start(t,r){let n=this.currentLength,s=this.currentStartIndices;if(super.start(t,r,t.duration),t.duration<=0){this.transition.cancel();return}let{buffers:i,attribute:o}=this;q0(i),i[0]=X0({device:this.device,buffer:i[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:s,getData:t.enter}),i[1]=$0({device:this.device,source:i[0],target:i[1]}),this.setBuffer(i[1]);let{transform:a}=this,c=a.model,l=Math.floor(this.currentLength/o.size);VL(o)&&(l/=2),c.setVertexCount(l),o.isConstant?(c.setAttributes({aFrom:i[0]}),c.setConstantAttributes({aTo:o.value})):c.setAttributes({aFrom:i[0],aTo:o.getBuffer()}),a.transformFeedback.setBuffers({vCurrent:i[1]})}onUpdate(){let{duration:t,easing:r}=this.settings,{time:n}=this.transition,s=n/t;r&&(s=r(s));let{model:i}=this.transform,o={time:s};i.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},ZQ=`uniform interpolationUniforms {
|
|
3118
|
+
`;function bJ(e,t){if(t.filter){let r=typeof t.filter=="string"?t.filter:`${e.name}_filterColor_ext`;return vJ(r)}if(t.sampler){let r=typeof t.sampler=="string"?t.sampler:`${e.name}_sampleColor`;return AJ(r)}return""}var TJ={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"},Mn=class extends $e{constructor(){super(...arguments),this._colorEncoderState=null}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer({layers:t,layerFilter:r,views:n,viewports:s,onViewportActive:i,pickingFBO:o,deviceRect:{x:a,y:c,width:l,height:f},cullRect:h,effects:u,pass:d="picking",pickZ:p,shaderModuleProps:m}){this.pickZ=p;let g=this._resetColorEncoder(p),x=[a,c,l,f],v=super.render({target:o,layers:t,layerFilter:r,views:n,viewports:s,onViewportActive:i,cullRect:h,effects:u?.filter(y=>y.useInPicking),pass:d,isPicking:!0,shaderModuleProps:m,clearColor:[0,0,0,0],colorMask:15,scissorRect:x});return this._colorEncoderState=null,{decodePickingColor:g&&EJ.bind(null,g),stats:v}}shouldDrawLayer(t){let{pickable:r,operation:n}=t.props;return r&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(t,r,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(t,r,n){let s={...t.props.parameters},{pickable:i,operation:o}=t.props;return!this._colorEncoderState||o.includes("terrain")?s.blend=!1:i&&o.includes("draw")&&(Object.assign(s,TJ),s.blend=!0,s.blendColor=MJ(this._colorEncoderState,t,n)),s}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}};function MJ(e,t,r){let{byLayer:n,byAlpha:s}=e,i,o=n.get(t);return o?(o.viewports.push(r),i=o.a):(i=n.size+1,i<=255?(o={a:i,layer:t,viewports:[r]},n.set(t,o),s[i]=o):(H.warn("Too many pickable layers, only picking the first 255")(),i=0)),[0,0,0,i/255]}function EJ(e,t){let r=e.byAlpha[t[3]];return r&&{pickedLayer:r.layer,pickedViewports:r.viewports,pickedObjectIndex:r.layer.decodePickingColor(t)}}var Li={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},Dc=Symbol.for("component"),on=Symbol.for("propTypes"),a0=Symbol.for("deprecatedProps"),Vs=Symbol.for("asyncPropDefaults"),rs=Symbol.for("asyncPropOriginal"),En=Symbol.for("asyncPropResolved");function er(e,t=()=>!0){return Array.isArray(e)?eO(e,t,[]):t(e)?[e]:[]}function eO(e,t,r){let n=-1;for(;++n<e.length;){let s=e[n];Array.isArray(s)?eO(s,t,r):t(s)&&r.push(s)}return r}function c0({target:e,source:t,start:r=0,count:n=1}){let s=t.length,i=n*s,o=0;for(let a=r;o<s;o++)e[a++]=t[o];for(;o<i;)o<i-o?(e.copyWithin(r+o,r,r+o),o*=2):(e.copyWithin(r+o,r,r+i-o),o=i);return e}vo();var Hh=class{constructor(t,r,n){this._loadCount=0,this._subscribers=new Set,this.id=t,this.context=n,this.setData(r)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,r){if(t===this._data&&!r)return;this._data=t;let n=++this._loadCount,s=t;typeof t=="string"&&(s=Me(t)),s instanceof Promise?(this.isLoaded=!1,this._loader=s.then(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=i)}).catch(i=>{this._loadCount===n&&(this.isLoaded=!0,this._error=i||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(let i of this._subscribers)i.onChange(this.getData())}};var Gh=class{constructor(t){this.protocol=t.protocol||"resource://",this._context={device:t.device,gl:t.device?.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:r,forceUpdate:n=!1,persistent:s=!0}){let i=this._resources[t];i?i.setData(r,n):(i=new Hh(t,r,this._context),this._resources[t]=i),i.persistent=s}remove(t){let r=this._resources[t];r&&(r.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){let r=this._consumers[t];if(r){for(let n in r){let s=r[n],i=this._resources[s.resourceId];i&&i.unsubscribe(s)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:r,consumerId:n,requestId:s="default"}){let{_resources:i,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,""),i[t]||this.add({resourceId:t,data:null,persistent:!1}));let a=i[t];if(this._track(n,s,a,r),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(let t in this._resources)this._resources[t].delete()}_track(t,r,n,s){let i=this._consumers,o=i[t]=i[t]||{},a=o[r],c=a&&a.resourceId&&this._resources[a.resourceId];c&&(c.unsubscribe(a),this.prune()),n&&(a?(a.onChange=s,a.resourceId=n.id):a={onChange:s,resourceId:n.id},o[r]=a,n.subscribe(a))}_prune(){this._pruneRequest=null;for(let t of Object.keys(this._resources)){let r=this._resources[t];!r.persistent&&!r.inUse()&&(r.delete(),delete this._resources[t])}}};var SJ="layerManager.setLayers",wJ="layerManager.activateViewport",Xo=class{constructor(t,r){this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=a=>{ae(wJ,this,a),a&&(this.context.viewport=a)};let{deck:n,stats:s,viewport:i,timeline:o}=r||{};this.layers=[],this.resourceManager=new Gh({device:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:t,gl:t?.gl,deck:n,shaderAssembler:Jg(t?.info?.shadingLanguage||"glsl"),defaultShaderModules:[KA],renderPass:void 0,stats:s||new Ze({id:"deck.gl"}),viewport:i||new Se({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:o||new jo,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(let t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(let n of this.layers){let s=n.getNeedsRedraw(t);r=r||s}return r}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(r=>t.find(n=>r.id.indexOf(n)===0)):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,r){ae(SJ,this,r,t),this._lastRenderedLayers=t;let n=er(t,Boolean);for(let s of n)s.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){let t=this.needsUpdate();t&&(this.setNeedsRedraw(`updating layers: ${t}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}addDefaultShaderModule(t){let{defaultShaderModules:r}=this.context;r.find(n=>n.name===t.name)||(r.push(t),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(t){let{defaultShaderModules:r}=this.context,n=r.findIndex(s=>s.name===t.name);n>=0&&(r.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(t,r,n){n.raiseError(r,`${t} of ${n}`)}_updateLayers(t,r){let n={};for(let o of t)n[o.id]?H.warn(`Multiple old layers with same id ${o.id}`)():n[o.id]=o;if(this._defaultShaderModulesChanged){for(let o of t)o.setNeedsUpdate(),o.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}let s=[];this._updateSublayersRecursively(r,n,s),this._finalizeOldLayers(n);let i=!1;for(let o of s)if(o.hasUniformTransition()){i=`Uniform transition in ${o}`;break}this._needsUpdate=i,this.layers=s}_updateSublayersRecursively(t,r,n){for(let s of t){s.context=this.context;let i=r[s.id];i===null&&H.warn(`Multiple new layers with same id ${s.id}`)(),r[s.id]=null;let o=null;try{this._debug&&i!==s&&s.validateProps(),i?(this._transferLayerState(i,s),this._updateLayer(s)):this._initializeLayer(s),n.push(s),o=s.isComposite?s.getSubLayers():null}catch(a){this._handleError("matching",a,s)}o&&this._updateSublayersRecursively(o,r,n)}}_finalizeOldLayers(t){for(let r in t){let n=t[r];n&&this._finalizeLayer(n)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=Li.INITIALIZED}catch(r){this._handleError("initialization",r,t)}}_transferLayerState(t,r){r._transferState(t),r.lifecycle=Li.MATCHED,r!==t&&(t.lifecycle=Li.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(r){this._handleError("update",r,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||`finalized ${t}`,t.lifecycle=Li.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=Li.FINALIZED}catch(r){this._handleError("finalization",r,t)}}};function dt(e,t,r){if(e===t)return!0;if(!r||!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!dt(e[n],t[n],r-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){let n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(let i of n)if(!t.hasOwnProperty(i)||!dt(e[i],t[i],r-1))return!1;return!0}return!1}var jh=class{constructor(t){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},Object.seal(this),this.setProps(t)}finalize(){for(let t in this.controllers){let r=this.controllers[t];r&&r.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(let t in this.controllers){let r=this.controllers[t];r&&r.updateTransition()}}getViewports(t){return t?this._viewports.filter(r=>r.containsPixel(t)):this._viewports}getViews(){let t={};return this.views.forEach(r=>{t[r.id]=r}),t}getView(t){return this.views.find(r=>r.id===t)}getViewState(t){let r=typeof t=="string"?this.getView(t):t,n=r&&this.viewState[r.getViewStateId()]||this.viewState;return r?r.filterViewState(n):n}getViewport(t){return this._viewportMap[t]}unproject(t,r){let n=this.getViewports(),s={x:t[0],y:t[1]};for(let i=n.length-1;i>=0;--i){let o=n[i];if(o.containsPixel(s)){let a=t.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,r)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,r){(t!==this.width||r!==this.height)&&(this.width=t,this.height=r,this.setNeedsUpdate("Size changed"))}_setViews(t){t=er(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(!dt(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t):H.warn("missing `viewState` or `initialViewState`")()}_createController(t,r){let n=r.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:i=>this.getView(t.id)?.makeViewport({viewState:i,width:this.width,height:this.height})})}_updateController(t,r,n,s){let i=t.controller;if(i&&n){let o={...r,...i,id:t.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!s||s.constructor!==i.type)&&(s=this._createController(t,o)),s&&s.setProps(o),s}return null}_rebuildViewports(){let{views:t}=this,r=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let s=t.length;s--;){let i=t[s],o=this.getViewState(i),a=i.makeViewport({viewState:o,width:this.width,height:this.height}),c=r[i.id],l=Boolean(i.controller);l&&!c&&(n=!0),(n||!l)&&c&&(c.finalize(),c=null),this.controllers[i.id]=this._updateController(i,o,a,c),a&&this._viewports.unshift(a)}for(let s in r){let i=r[s];i&&!this.controllers[s]&&i.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,r){return t.length!==r.length?!0:t.some((n,s)=>!t[s].equals(r[s]))}};var CJ=/([0-9]+\.?[0-9]*)(%|px)/;function zs(e){switch(typeof e){case"number":return{position:e,relative:!1};case"string":let t=CJ.exec(e);if(t&&t.length>=3){let r=t[2]==="%",n=parseFloat(t[1]);return{position:r?n/100:n,relative:r}}default:throw new Error(`Could not parse position string ${e}`)}}function Ws(e,t){return e.relative?Math.round(e.position*t):e.position}var gr=class{constructor(t){let{id:r,x:n=0,y:s=0,width:i="100%",height:o="100%",padding:a=null}=t;this.id=r||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=zs(n),this._y=zs(s),this._width=zs(i),this._height=zs(o),this._padding=a&&{left:zs(a.left||0),right:zs(a.right||0),top:zs(a.top||0),bottom:zs(a.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.constructor===t.constructor&&dt(this.props,t.props,2)}clone(t){let r=this.constructor;return new r({...this.props,...t})}makeViewport({width:t,height:r,viewState:n}){n=this.filterViewState(n);let s=this.getDimensions({width:t,height:r});if(!s.height||!s.width)return null;let i=this.getViewportType(n);return new i({...n,...this.props,...s})}getViewStateId(){let{viewState:t}=this.props;return typeof t=="string"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;let r={...t};for(let n in this.props.viewState)n!=="id"&&(r[n]=this.props.viewState[n]);return r}return t}getDimensions({width:t,height:r}){let n={x:Ws(this._x,t),y:Ws(this._y,r),width:Ws(this._width,t),height:Ws(this._height,r)};return this._padding&&(n.padding={left:Ws(this._padding.left,t),top:Ws(this._padding.top,r),right:Ws(this._padding.right,t),bottom:Ws(this._padding.bottom,r)}),n}get controller(){let t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t=="function"?{type:t}:{type:this.ControllerType,...t}:null}};var Sn=class{constructor(t){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=t}get inProgress(){return this._inProgress}start(t){this.cancel(),this.settings=t,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(this._handle===null){let{_timeline:t,settings:r}=this;this._handle=t.addChannel({delay:t.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}};var rO=()=>{},qh={BREAK:1,SNAP_TO_END:2,IGNORE:3},PJ=e=>e,IJ=qh.BREAK,$h=class{constructor(t){this._onTransitionUpdate=r=>{let{time:n,settings:{interpolator:s,startProps:i,endProps:o,duration:a,easing:c}}=r,l=c(n/a),f=s.interpolateProps(i,o,l);this.propsInTransition=this.getControllerState({...this.props,...f}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new Sn(t.timeline),this.onViewStateChange=t.onViewStateChange||rO,this.onStateChange=t.onStateChange||rO}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let r=!1,n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){let s=n;if(this.transition.inProgress){let{interruption:i,endProps:o}=this.transition.settings;s={...n,...i===qh.SNAP_TO_END?o:this.propsInTransition||n}}this._triggerTransition(s,t),r=!0}else this.transition.cancel();return r}updateTransition(){this.transition.update()}_isTransitionEnabled(t){let{transitionDuration:r,transitionInterpolator:n}=t;return(r>0||r==="auto")&&Boolean(n)}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,r){return this.transition.inProgress?this.transition.settings.interruption===qh.IGNORE||this._isUpdateDueToCurrentTransition(r):this._isTransitionEnabled(r)?r.transitionInterpolator.arePropsEqual(t,r):!0}_triggerTransition(t,r){let n=this.getControllerState(t),s=this.getControllerState(r).shortestPathFrom(n),i=r.transitionInterpolator,o=i.getDuration?i.getDuration(t,r):r.transitionDuration;if(o===0)return;let a=i.initializeProps(t,s);this.propsInTransition={};let c={duration:o,easing:r.transitionEasing||PJ,interpolator:i,interruption:r.transitionInterruption||IJ,startProps:a.start,endProps:a.end,onStart:r.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(r.onTransitionInterrupt),onEnd:this._onTransitionEnd(r.onTransitionEnd)};this.transition.start(c),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return r=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(r)}}};function Bt(e,t){if(!e)throw new Error(t||"deck.gl: assertion failed.")}var Hs=class{constructor(t){let{compare:r,extract:n,required:s}=t;this._propsToCompare=r,this._propsToExtract=n||r,this._requiredProps=s}arePropsEqual(t,r){for(let n of this._propsToCompare)if(!(n in t)||!(n in r)||!te(t[n],r[n]))return!1;return!0}initializeProps(t,r){let n={},s={};for(let i of this._propsToExtract)(i in t||i in r)&&(n[i]=t[i],s[i]=r[i]);return this._checkRequiredProps(n),this._checkRequiredProps(s),{start:n,end:s}}getDuration(t,r){return r.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(r=>{let n=t[r];Bt(Number.isFinite(n)||Array.isArray(n),`${r} is required for transition`)})}};var RJ=["longitude","latitude","zoom","bearing","pitch"],OJ=["longitude","latitude","zoom"],re=class extends Hs{constructor(t={}){let r=Array.isArray(t)?t:t.transitionProps,n=Array.isArray(t)?{}:t;n.transitionProps=Array.isArray(r)?{compare:r,required:r}:r||{compare:RJ,required:OJ},super(n.transitionProps),this.opts=n}initializeProps(t,r){let n=super.initializeProps(t,r),{makeViewport:s,around:i}=this.opts;if(s&&i){let o=s(t),a=s(r),c=o.unproject(i);n.start.around=i,Object.assign(n.end,{around:a.project(c),aroundPosition:c,width:r.width,height:r.height})}return n}interpolateProps(t,r,n){let s={};for(let i of this._propsToExtract)s[i]=Oe(t[i]||0,r[i]||0,n);if(r.aroundPosition&&this.opts.makeViewport){let i=this.opts.makeViewport({...r,...s});Object.assign(s,i.panByPosition(r.aroundPosition,Oe(t.around,r.around,n)))}return s}};var Gs={transitionDuration:0},LJ=300,l0=e=>1-(1-e)*(1-e),kc={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},Yo={},xr=class{constructor(t){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new $h({...t,getControllerState:r=>new this.ControllerState(r),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(let t in this._events)this._events[t]&&this.eventManager?.off(t,this.handleEvent);this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;let r=this._eventStartBlocked;switch(t.type){case"panstart":return r?!1:this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return r?!1:this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"multipanstart":return r?!1:this._onMultiPanStart(t);case"multipanmove":return this._onMultiPan(t);case"multipanend":return this._onMultiPanEnd(t);case"dblclick":return this._onDoubleClick(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){let{x:r,y:n}=this.props,{offsetCenter:s}=t;return[s.x-r,s.y-n]}isPointInBounds(t,r){let{width:n,height:s}=this.props;if(r&&r.handled)return!1;let i=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=s;return i&&r&&r.stopPropagation(),i}isFunctionKeyPressed(t){let{srcEvent:r}=t;return Boolean(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){let r=setTimeout(()=>{this._eventStartBlocked===r&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=r}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);let{inertia:r}=t;this.inertia=Number.isFinite(r)?r:r===!0?LJ:0;let{scrollZoom:n=!0,dragPan:s=!0,dragRotate:i=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:c=!1,keyboard:l=!0}=t,f=Boolean(this.onViewStateChange);this.toggleEvents(kc.WHEEL,f&&n),this.toggleEvents(kc.PAN,f),this.toggleEvents(kc.PINCH,f&&(a||c)),this.toggleEvents(kc.MULTI_PAN,f&&c),this.toggleEvents(kc.DOUBLE_CLICK,f&&o),this.toggleEvents(kc.KEYBOARD,f&&l),this.scrollZoom=n,this.dragPan=s,this.dragRotate=i,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=c,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,r){this.eventManager&&t.forEach(n=>{this._events[n]!==r&&(this._events[n]=r,r?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(t,r=null,n={}){let s={...t.getViewportProps(),...r},i=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(n),i){let o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:s,interactionState:this._interactionState,oldViewState:o,viewId:this.props.id})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);let s=this.controllerState[n?"panStart":"rotateStart"]({pos:r});return this._panMove=n,this.updateViewport(s,Gs,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;let r=this.getCenter(t),n=this.controllerState.pan({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){let{inertia:r}=this;if(this.dragPan&&r&&t.velocity){let n=this.getCenter(t),s=[n[0]+t.velocityX*r/2,n[1]+t.velocityY*r/2],i=this.controllerState.pan({pos:s}).panEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isPanning:!0})}else{let n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;let r=this.getCenter(t),n=this.controllerState.rotate({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){let{inertia:r}=this;if(this.dragRotate&&r&&t.velocity){let n=this.getCenter(t),s=[n[0]+t.velocityX*r/2,n[1]+t.velocityY*r/2],i=this.controllerState.rotate({pos:s}).rotateEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isRotating:!0})}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;t.srcEvent.preventDefault();let{speed:n=.01,smooth:s=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:i}=t,o=2/(1+Math.exp(-Math.abs(i*n)));i<0&&o!==0&&(o=1/o);let a=s?{...this._getTransitionProps({around:r}),transitionDuration:250}:Gs,c=this.controllerState.zoom({pos:r,scale:o});return this.updateViewport(c,a,{isZooming:!0,isPanning:!0}),!0}_onMultiPanStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.controllerState.rotateStart({pos:r});return this.updateViewport(n,Gs,{isDragging:!0}),!0}_onMultiPan(t){if(!this.touchRotate||!this.isDragging())return!1;let r=this.getCenter(t);r[0]-=t.deltaX;let n=this.controllerState.rotate({pos:r});return this.updateViewport(n,Gs,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this;if(this.touchRotate&&r&&t.velocityY){let n=this.getCenter(t),s=[n[0],n[1]+=t.velocityY*r/2],i=this.controllerState.rotate({pos:s});this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isRotating:!0}),this.blockEvents(r)}else{let n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.controllerState.zoomStart({pos:r}).rotateStart({pos:r});return Yo._startPinchRotation=t.rotation,Yo._lastPinchEvent=t,this.updateViewport(n,Gs,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let r=this.controllerState;if(this.touchZoom){let{scale:n}=t,s=this.getCenter(t);r=r.zoom({pos:s,scale:n})}if(this.touchRotate){let{rotation:n}=t;r=r.rotate({deltaAngleX:Yo._startPinchRotation-n})}return this.updateViewport(r,Gs,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),Yo._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;let{inertia:r}=this,{_lastPinchEvent:n}=Yo;if(this.touchZoom&&r&&n&&t.scale!==n.scale){let s=this.getCenter(t),i=this.controllerState.rotateEnd(),o=Math.log2(t.scale),a=(o-Math.log2(n.scale))/(t.deltaTime-n.deltaTime),c=Math.pow(2,o+a*r/2);i=i.zoom({pos:s,scale:c}).zoomEnd(),this.updateViewport(i,{...this._getTransitionProps({around:s}),transitionDuration:r,transitionEasing:l0},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(r)}else{let s=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(s,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return Yo._startPinchRotation=null,Yo._lastPinchEvent=null,!0}_onDoubleClick(t){if(!this.doubleClickZoom)return!1;let r=this.getCenter(t);if(!this.isPointInBounds(r,t))return!1;let n=this.isFunctionKeyPressed(t),s=this.controllerState.zoom({pos:r,scale:n?.5:2});return this.updateViewport(s,this._getTransitionProps({around:r}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;let r=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:s,rotateSpeedX:i,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:a}=this,c,l={};switch(t.srcEvent.code){case"Minus":c=r?a.zoomOut(n).zoomOut(n):a.zoomOut(n),l.isZooming=!0;break;case"Equal":c=r?a.zoomIn(n).zoomIn(n):a.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":r?(c=a.rotateLeft(i),l.isRotating=!0):(c=a.moveLeft(s),l.isPanning=!0);break;case"ArrowRight":r?(c=a.rotateRight(i),l.isRotating=!0):(c=a.moveRight(s),l.isPanning=!0);break;case"ArrowUp":r?(c=a.rotateUp(o),l.isRotating=!0):(c=a.moveUp(s),l.isPanning=!0);break;case"ArrowDown":r?(c=a.rotateDown(o),l.isRotating=!0):(c=a.moveDown(s),l.isPanning=!0);break;default:return!1}return this.updateViewport(c,this._getTransitionProps(),l),!0}_getTransitionProps(t){let{transition:r}=this;return!r||!r.transitionInterpolator?Gs:t?{...r,transitionInterpolator:new re({...t,...r.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:r}};var js=class{constructor(t,r){this._viewportProps=this.applyConstraints(t),this._state=r}getViewportProps(){return this._viewportProps}getState(){return this._state}};var nO=5,BJ=1.2,Xh=class extends js{constructor(t){let{width:r,height:n,latitude:s,longitude:i,zoom:o,bearing:a=0,pitch:c=0,altitude:l=1.5,position:f=[0,0,0],maxZoom:h=20,minZoom:u=0,maxPitch:d=60,minPitch:p=0,startPanLngLat:m,startZoomLngLat:g,startRotatePos:x,startBearing:v,startPitch:_,startZoom:y,normalize:b=!0}=t;Bt(Number.isFinite(i)),Bt(Number.isFinite(s)),Bt(Number.isFinite(o)),super({width:r,height:n,latitude:s,longitude:i,zoom:o,bearing:a,pitch:c,altitude:l,maxZoom:h,minZoom:u,maxPitch:d,minPitch:p,normalize:b,position:f},{startPanLngLat:m,startZoomLngLat:g,startRotatePos:x,startBearing:v,startPitch:_,startZoom:y}),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:r}){let n=this.getState().startPanLngLat||this._unproject(r);if(!n)return this;let i=this.makeViewport(this.getViewportProps()).panByPosition(n,t);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:r=0,deltaAngleY:n=0}){let{startRotatePos:s,startBearing:i,startPitch:o}=this.getState();if(!s||i===void 0||o===void 0)return this;let a;return t?a=this._getNewRotation(t,s,o,i):a={bearing:i+r,pitch:o+n},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:r,scale:n}){let{startZoom:s,startZoomLngLat:i}=this.getState();if(i||(s=this.getViewportProps().zoom,i=this._unproject(r)||this._unproject(t)),!i)return this;let{maxZoom:o,minZoom:a}=this.getViewportProps(),c=s+Math.log2(n);c=Mt(c,a,o);let l=this.makeViewport({...this.getViewportProps(),zoom:c});return this._getUpdatedState({zoom:c,...l.panByPosition(i,t)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){let r=t.getViewportProps(),n={...this.getViewportProps()},{bearing:s,longitude:i}=n;return Math.abs(s-r.bearing)>180&&(n.bearing=s<0?s+360:s-360),Math.abs(i-r.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}applyConstraints(t){let{maxZoom:r,minZoom:n,zoom:s}=t;t.zoom=Mt(s,n,r);let{maxPitch:i,minPitch:o,pitch:a}=t;t.pitch=Mt(a,o,i);let{normalize:c=!0}=t;return c&&Object.assign(t,hb(t)),t}_zoomFromCenter(t){let{width:r,height:n}=this.getViewportProps();return this.zoom({pos:[r/2,n/2],scale:t})}_panFromCenter(t){let{width:r,height:n}=this.getViewportProps();return this.pan({startPos:[r/2,n/2],pos:[r/2+t[0],n/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){let r=this.makeViewport(this.getViewportProps());return t&&r.unproject(t)}_getNewRotation(t,r,n,s){let i=t[0]-r[0],o=t[1]-r[1],a=t[1],c=r[1],{width:l,height:f}=this.getViewportProps(),h=i/l,u=0;o>0?Math.abs(f-c)>nO&&(u=o/(c-f)*BJ):o<0&&c>nO&&(u=1-a/c),u=Mt(u,-1,1);let{minPitch:d,maxPitch:p}=this.getViewportProps(),m=s+180*h,g=n;return u>0?g=n+u*(p-n):u<0&&(g=n-u*(d-n)),{pitch:g,bearing:m}}},Ko=class extends xr{constructor(){super(...arguments),this.ControllerState=Xh,this.transition={transitionDuration:300,transitionInterpolator:new re({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan"}setProps(t){t.position=t.position||[0,0,0];let r=this.props;super.setProps(t),(!r||r.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}};var f0=class extends gr{constructor(t={}){super(t)}getViewportType(){return tr}get ControllerType(){return Ko}};f0.displayName="MapView";var Bi=f0;var NJ=new Ri;function FJ(e,t){let r=e.order??1/0,n=t.order??1/0;return r-n}var Yh=class{constructor(t){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=t,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){let r=this._defaultEffects;if(!r.find(n=>n.id===t.id)){let n=r.findIndex(s=>FJ(s,t)>0);n<0?r.push(t):r.splice(n,0,t),t.setup(this._context),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(dt(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}getEffects(){return this._resolvedEffects}_setEffects(t){let r={};for(let s of this.effects)r[s.id]=s;let n=[];for(let s of t){let i=r[s.id],o=s;i&&i!==s?i.setProps?(i.setProps(s.props),o=i):i.cleanup(this._context):i||s.setup(this._context),n.push(o),delete r[s.id]}for(let s in r)r[s].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),t.some(s=>s instanceof Ri)||this._resolvedEffects.push(NJ),this._needsRedraw="effects changed"}finalize(){for(let t of this._resolvedEffects)t.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}};var Kh=class extends $e{shouldDrawLayer(t){let{operation:r}=t.props;return r.includes("draw")||r.includes("terrain")}};var DJ="deckRenderer.renderLayers",Zo=class{constructor(t){this.device=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new Kh(t),this.pickLayersPass=new Mn(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){if(!t.viewports.length)return;let r=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t};n.effects&&this._preRender(n.effects,n);let s=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);let i=r.render({...n,target:s});n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=t.clearCanvas===void 0?!0:t.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,ae(DJ,this,i,t)}needsRedraw(t={clearRedrawFlags:!1}){let r=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),r}finalize(){let{renderBuffers:t}=this;for(let r of t)r.delete();t.length=0}_preRender(t,r){this.lastPostProcessEffect=null,r.preRenderStats=r.preRenderStats||{};for(let n of t)r.preRenderStats[n.id]=n.preRender(r),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){let{renderBuffers:t}=this,r=this.device.canvasContext.getDrawingBufferSize(),[n,s]=r;t.length===0&&[0,1].map(i=>{let o=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:s});t.push(this.device.createFramebuffer({id:`deck-renderbuffer-${i}`,colorAttachments:[o]}))});for(let i of t)i.resize(r)}_postRender(t,r){let{renderBuffers:n}=this,s={...r,inputBuffer:n[0],swapBuffer:n[1]};for(let i of t)if(i.postRender){s.target=i.id===this.lastPostProcessEffect?r.target:void 0;let o=i.postRender(s);s.inputBuffer=o,s.swapBuffer=o===n[0]?n[1]:n[0]}}};var kJ={pickedColor:null,pickedObjectIndex:-1};function Eb({pickedColors:e,decodePickingColor:t,deviceX:r,deviceY:n,deviceRadius:s,deviceRect:i}){let{x:o,y:a,width:c,height:l}=i,f=s*s,h=-1,u=0;for(let d=0;d<l;d++){let p=d+a-n,m=p*p;if(m>f)u+=4*c;else for(let g=0;g<c;g++){if(e[u+3]-1>=0){let v=g+o-r,_=v*v+m;_<=f&&(f=_,h=u)}u+=4}}if(h>=0){let d=e.slice(h,h+4),p=t(d);if(p){let m=Math.floor(h/4/c),g=h/4-m*c;return{...p,pickedColor:d,pickedX:o+g,pickedY:a+m}}H.error("Picked non-existent layer. Is picking buffer corrupt?")()}return kJ}function Sb({pickedColors:e,decodePickingColor:t}){let r=new Map;if(e){for(let n=0;n<e.length;n+=4)if(e[n+3]-1>=0){let i=e.slice(n,n+4),o=i.join(",");if(!r.has(o)){let a=t(i);a?r.set(o,{...a,color:i}):H.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(r.values())}function h0({pickInfo:e,viewports:t,pixelRatio:r,x:n,y:s,z:i}){let o=t[0];t.length>1&&(o=UJ(e?.pickedViewports||t,{x:n,y:s}));let a;if(o){let c=[n-o.x,s-o.y];i!==void 0&&(c[2]=i),a=o.unproject(c)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:n,y:s,pixel:[n,s],coordinate:a,devicePixel:e&&"pickedX"in e?[e.pickedX,e.pickedY]:void 0,pixelRatio:r}}function wb(e){let{pickInfo:t,lastPickedInfo:r,mode:n,layers:s}=e,{pickedColor:i,pickedLayer:o,pickedObjectIndex:a}=t,c=o?[o]:[];if(n==="hover"){let h=r.index,u=r.layerId,d=o?o.props.id:null;if(d!==u||a!==h){if(d!==u){let p=s.find(m=>m.props.id===u);p&&c.unshift(p)}r.layerId=d,r.index=a,r.info=null}}let l=h0(e),f=new Map;return f.set(null,l),c.forEach(h=>{let u={...l};h===o&&(u.color=i,u.index=a,u.picked=!0),u=u0({layer:h,info:u,mode:n});let d=u.layer;h===o&&n==="hover"&&(r.info=u),f.set(d.id,u),n==="hover"&&d.updateAutoHighlight(u)}),f}function u0({layer:e,info:t,mode:r}){for(;e&&t;){let n=t.layer||null;t.sourceLayer=n,t.layer=e,t=e.getPickingInfo({info:t,mode:r,sourceLayer:n}),e=e.parent}return t}function UJ(e,t){for(let r=e.length-1;r>=0;r--){let n=e[r];if(n.containsPixel(t))return n}return e[0]}var Zh=class{constructor(t){this._pickable=!0,this.device=t,this.pickLayersPass=new Mn(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}pickObjectAsync(t){return this._pickClosestObjectAsync(t)}pickObjectsAsync(t){return this._pickVisibleObjectsAsync(t)}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:r,layers:n,viewports:s},i=this.lastPickedInfo.info){let o=i&&i.layer&&i.layer.id,a=i&&i.viewport&&i.viewport.id,c=o?n.find(u=>u.id===o):null,l=a&&s.find(u=>u.id===a)||s[0],f=l&&l.unproject([t-l.x,r-l.y]);return{...i,...{x:t,y:r,viewport:l,coordinate:f,layer:c}}}_resizeBuffer(){if(!this.pickingFBO&&(this.pickingFBO=this.device.createFramebuffer({colorAttachments:["rgba8unorm"],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float"))){let r=this.device.createFramebuffer({colorAttachments:["rgba32float"],depthStencilAttachment:"depth16unorm"});this.depthFBO=r}let{canvas:t}=this.device.getDefaultCanvasContext();this.pickingFBO?.resize({width:t.width,height:t.height}),this.depthFBO?.resize({width:t.width,height:t.height})}_getPickable(t){if(this._pickable===!1)return null;let r=t.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return r.length?r:null}async _pickClosestObjectAsync({layers:t,views:r,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:f,effects:h}){let u=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(t);if(!d||n.length===0)return{result:[],emptyInfo:h0({viewports:n,x:s,y:i,pixelRatio:u})};this._resizeBuffer();let p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=[p.x+Math.floor(p.width/2),p.y+Math.floor(p.height/2)],g=Math.round(o*u),{width:x,height:v}=this.pickingFBO,_=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceWidth:x,deviceHeight:v}),y={x:s-o,y:i-o,width:o*2+1,height:o*2+1},b,T=[],C=new Set;for(let S=0;S<a;S++){let M;if(_){let I=this._drawAndSample({layers:d,views:r,viewports:n,onViewportActive:f,deviceRect:_,cullRect:y,effects:h,pass:`picking:${c}`});M=Eb({...I,deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceRect:_})}else M={pickedColor:null,pickedObjectIndex:-1};let A;if(M.pickedLayer&&l&&this.depthFBO){let{pickedColors:I}=this._drawAndSample({layers:[M.pickedLayer],views:r,viewports:n,onViewportActive:f,deviceRect:{x:M.pickedX,y:M.pickedY,width:1,height:1},cullRect:y,effects:h,pass:`picking:${c}:z`},!0);I[3]&&(A=I[0])}M.pickedLayer&&S+1<a&&(C.add(M.pickedLayer),M.pickedLayer.disablePickingIndex(M.pickedObjectIndex)),b=wb({pickInfo:M,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:A,pixelRatio:u});for(let I of b.values())I.layer&&T.push(I);if(!M.pickedColor)break}for(let S of C)S.restorePickingColors();return{result:T,emptyInfo:b.get(null)}}_pickClosestObject({layers:t,views:r,viewports:n,x:s,y:i,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:f,effects:h}){let u=this.device.canvasContext.cssToDeviceRatio(),d=this._getPickable(t);if(!d||n.length===0)return{result:[],emptyInfo:h0({viewports:n,x:s,y:i,pixelRatio:u})};this._resizeBuffer();let p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=[p.x+Math.floor(p.width/2),p.y+Math.floor(p.height/2)],g=Math.round(o*u),{width:x,height:v}=this.pickingFBO,_=this._getPickingRect({deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceWidth:x,deviceHeight:v}),y={x:s-o,y:i-o,width:o*2+1,height:o*2+1},b,T=[],C=new Set;for(let S=0;S<a;S++){let M;if(_){let I=this._drawAndSample({layers:d,views:r,viewports:n,onViewportActive:f,deviceRect:_,cullRect:y,effects:h,pass:`picking:${c}`});M=Eb({...I,deviceX:m[0],deviceY:m[1],deviceRadius:g,deviceRect:_})}else M={pickedColor:null,pickedObjectIndex:-1};let A;if(M.pickedLayer&&l&&this.depthFBO){let{pickedColors:I}=this._drawAndSample({layers:[M.pickedLayer],views:r,viewports:n,onViewportActive:f,deviceRect:{x:M.pickedX,y:M.pickedY,width:1,height:1},cullRect:y,effects:h,pass:`picking:${c}:z`},!0);I[3]&&(A=I[0])}M.pickedLayer&&S+1<a&&(C.add(M.pickedLayer),M.pickedLayer.disablePickingIndex(M.pickedObjectIndex)),b=wb({pickInfo:M,lastPickedInfo:this.lastPickedInfo,mode:c,layers:d,viewports:n,x:s,y:i,z:A,pixelRatio:u});for(let I of b.values())I.layer&&T.push(I);if(!M.pickedColor)break}for(let S of C)S.restorePickingColors();return{result:T,emptyInfo:b.get(null)}}async _pickVisibleObjectsAsync({layers:t,views:r,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:f,effects:h}){let u=this._getPickable(t);if(!u||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=p.x,g=p.y+p.height,x=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),v=x.x+x.width,_=x.y,y={x:m,y:_,width:v-m,height:g-_},b=this._drawAndSample({layers:u,views:r,viewports:n,onViewportActive:f,deviceRect:y,cullRect:{x:s,y:i,width:o,height:a},effects:h,pass:`picking:${c}`}),T=Sb(b),C=new Map,S=[],M=Number.isFinite(l);for(let A=0;A<T.length&&!(M&&S.length>=l);A++){let I=T[A],D={color:I.pickedColor,layer:null,index:I.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};D=u0({layer:I.pickedLayer,info:D,mode:c});let k=D.layer.id;C.has(k)||C.set(k,new Set);let P=C.get(k),q=D.object??D.index;P.has(q)||(P.add(q),S.push(D))}return S}_pickVisibleObjects({layers:t,views:r,viewports:n,x:s,y:i,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:f,effects:h}){let u=this._getPickable(t);if(!u||n.length===0)return[];this._resizeBuffer();let d=this.device.canvasContext.cssToDeviceRatio(),p=this.device.canvasContext.cssToDevicePixels([s,i],!0),m=p.x,g=p.y+p.height,x=this.device.canvasContext.cssToDevicePixels([s+o,i+a],!0),v=x.x+x.width,_=x.y,y={x:m,y:_,width:v-m,height:g-_},b=this._drawAndSample({layers:u,views:r,viewports:n,onViewportActive:f,deviceRect:y,cullRect:{x:s,y:i,width:o,height:a},effects:h,pass:`picking:${c}`}),T=Sb(b),C=new Map,S=[],M=Number.isFinite(l);for(let A=0;A<T.length&&!(M&&S.length>=l);A++){let I=T[A],D={color:I.pickedColor,layer:null,index:I.pickedObjectIndex,picked:!0,x:s,y:i,pixelRatio:d};D=u0({layer:I.pickedLayer,info:D,mode:c});let k=D.layer.id;C.has(k)||C.set(k,new Set);let P=C.get(k),q=D.object??D.index;P.has(q)||(P.add(q),S.push(D))}return S}async _drawAndSampleAsync({layers:t,views:r,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let f=l?this.depthFBO:this.pickingFBO,h={layers:t,layerFilter:this.layerFilter,views:r,viewports:n,onViewportActive:s,pickingFBO:f,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let v of a)v.useInPicking&&(h.preRenderStats[v.id]=v.preRender(h));let{decodePickingColor:u}=this.pickLayersPass.render(h),{x:d,y:p,width:m,height:g}=i,x=new(l?Float32Array:Uint8Array)(m*g*4);return this.device.readPixelsToArrayWebGL(f,{sourceX:d,sourceY:p,sourceWidth:m,sourceHeight:g,target:x}),{pickedColors:x,decodePickingColor:u}}_drawAndSample({layers:t,views:r,viewports:n,onViewportActive:s,deviceRect:i,cullRect:o,effects:a,pass:c},l=!1){let f=l?this.depthFBO:this.pickingFBO,h={layers:t,layerFilter:this.layerFilter,views:r,viewports:n,onViewportActive:s,pickingFBO:f,deviceRect:i,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{},isPicking:!0};for(let v of a)v.useInPicking&&(h.preRenderStats[v.id]=v.preRender(h));let{decodePickingColor:u}=this.pickLayersPass.render(h),{x:d,y:p,width:m,height:g}=i,x=new(l?Float32Array:Uint8Array)(m*g*4);return this.device.readPixelsToArrayWebGL(f,{sourceX:d,sourceY:p,sourceWidth:m,sourceHeight:g,target:x}),{pickedColors:x,decodePickingColor:u}}_getPickingRect({deviceX:t,deviceY:r,deviceRadius:n,deviceWidth:s,deviceHeight:i}){let o=Math.max(0,t-n),a=Math.max(0,r-n),c=Math.min(s,t+n+1)-o,l=Math.min(i,r+n+1)-a;return c<=0||l<=0?null:{x:o,y:a,width:c,height:l}}};var VJ={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},zJ="top-left",sO="__root",d0=class{constructor({deck:t,parentElement:r}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=t,r?.classList.add("deck-widget-container"),this.parentElement=r}getWidgets(){return this.resolvedWidgets}setProps(t){if(t.widgets&&!dt(t.widgets,this.widgets,1)){let r=t.widgets.filter(Boolean);this._setWidgets(r)}}finalize(){for(let t of this.getWidgets())this._removeWidget(t);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(let t in this.containers)this.containers[t].remove()}addDefault(t){this.defaultWidgets.find(r=>r.id===t.id)||(this._addWidget(t),this.defaultWidgets.push(t),this._setWidgets(this.widgets))}onRedraw({viewports:t,layers:r}){let n=t.reduce((s,i)=>(s[i.id]=i,s),{});for(let s of this.getWidgets()){let{viewId:i}=s;if(i){let o=n[i];o&&(s.onViewportChange&&s.onViewportChange(o),s.onRedraw?.({viewports:[o],layers:r}))}else{if(s.onViewportChange)for(let o of t)s.onViewportChange(o);s.onRedraw?.({viewports:t,layers:r})}}this.lastViewports=n,this._updateContainers()}onHover(t,r){for(let n of this.getWidgets()){let{viewId:s}=n;(!s||s===t.viewport?.id)&&n.onHover?.(t,r)}}onEvent(t,r){let n=Ch[r.type];if(n)for(let s of this.getWidgets()){let{viewId:i}=s;(!i||i===t.viewport?.id)&&s[n]?.(t,r)}}_setWidgets(t){let r={};for(let n of this.resolvedWidgets)r[n.id]=n;this.resolvedWidgets.length=0;for(let n of this.defaultWidgets)r[n.id]=null,this.resolvedWidgets.push(n);for(let n of t){let s=r[n.id];s?s.viewId!==n.viewId||s.placement!==n.placement?(this._removeWidget(s),this._addWidget(n)):n!==s&&(s.setProps(n.props),n=s):this._addWidget(n),r[n.id]=null,this.resolvedWidgets.push(n)}for(let n in r){let s=r[n];s&&this._removeWidget(s)}this.widgets=t}_addWidget(t){let{viewId:r=null,placement:n=zJ}=t;t.widgetManager=this,t.deck=this.deck,t.rootElement=t._onAdd({deck:this.deck,viewId:r}),t.rootElement&&this._getContainer(r,n).append(t.rootElement),t.updateHTML()}_removeWidget(t){t.onRemove?.(),t.rootElement&&t.rootElement.remove(),t.rootElement=void 0,t.deck=void 0,t.widgetManager=void 0}_getContainer(t,r){let n=t||sO,s=this.containers[n];s||(s=document.createElement("div"),s.style.pointerEvents="none",s.style.position="absolute",s.style.overflow="hidden",this.parentElement?.append(s),this.containers[n]=s);let i=s.querySelector(`.${r}`);return i||(i=globalThis.document.createElement("div"),i.className=r,i.style.position="absolute",i.style.zIndex="2",Object.assign(i.style,VJ[r]),s.append(i)),i}_updateContainers(){let t=this.deck.width,r=this.deck.height;for(let n in this.containers){let s=this.lastViewports[n]||null,i=n===sO||s,o=this.containers[n];i?(o.style.display="block",o.style.left=`${s?s.x:0}px`,o.style.top=`${s?s.y:0}px`,o.style.width=`${s?s.width:t}px`,o.style.height=`${s?s.height:r}px`):o.style.display="none"}}};function Jo(e,t){t&&Object.entries(t).map(([r,n])=>{r.startsWith("--")?e.style.setProperty(r,n):e.style[r]=n})}function p0(e,t){t&&Object.keys(t).map(r=>{r.startsWith("--")?e.style.removeProperty(r):e.style[r]=""})}var et=class{constructor(t){this.viewId=null,this.props={...this.constructor.defaultProps,...t},this.id=this.props.id}setProps(t){let r=this.props,n=this.rootElement;n&&r.className!==t.className&&(r.className&&n.classList.remove(r.className),t.className&&n.classList.add(t.className)),n&&!dt(r.style,t.style,1)&&(p0(n,r.style),Jo(n,t.style)),Object.assign(this.props,t),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}onCreateRootElement(){let t=["deck-widget",this.className,this.props.className],r=document.createElement("div");return t.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>r.classList.add(n)),Jo(r,this.props.style),r}_onAdd(t){return this.onAdd(t)??this.onCreateRootElement()}onAdd(t){}onRemove(){}onViewportChange(t){}onRedraw(t){}onHover(t,r){}onClick(t,r){}onDrag(t,r){}onDragStart(t,r){}onDragEnd(t,r){}};et.defaultProps={id:"widget",style:{},className:""};var WJ={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"},Jh=class extends et{constructor(t={}){super(t),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(t)}onCreateRootElement(){let t=document.createElement("div");return t.className=this.className,Object.assign(t.style,WJ),t}onRenderHTML(t){}onViewportChange(t){this.isVisible&&t.id===this.lastViewport?.id&&!t.equals(this.lastViewport)&&this.setTooltip(null),this.lastViewport=t}onHover(t){let{deck:r}=this,n=r&&r.props.getTooltip;if(!n)return;let s=n(t);this.setTooltip(s,t.x,t.y)}setTooltip(t,r,n){let s=this.rootElement;if(s){if(typeof t=="string")s.innerText=t;else if(t)t.text&&(s.innerText=t.text),t.html&&(s.innerHTML=t.html),t.className&&(s.className=t.className);else{this.isVisible=!1,s.style.display="none";return}this.isVisible=!0,s.style.display="block",s.style.transform=`translate(${r}px, ${n}px)`,t&&typeof t=="object"&&"style"in t&&Object.assign(s.style,t.style)}}};Jh.defaultProps={...et.defaultProps};it();iu();vo();function Di(){}var $Q=({isDragging:e})=>e?"grabbing":"grab",CL={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Di,onWebGLInitialized:Di,onResize:Di,onViewStateChange:Di,onInteractionStateChange:Di,onBeforeRender:Di,onAfterRender:Di,onLoad:Di,onError:e=>H.error(e.message,e.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:$Q,getTooltip:null,debug:!1,drawPickingColors:!1},au=class{constructor(t){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new Ze({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this._lastPointerDownInfo=null,this._onPointerMove=n=>{let{_pickRequest:s}=this;if(n.type==="pointerleave")s.x=-1,s.y=-1,s.radius=0;else{if(n.leftButton||n.rightButton)return;{let i=n.offsetCenter;if(!i)return;s.x=i.x,s.y=i.y,s.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:s.x,y:s.y}),s.event=n},this._onEvent=n=>{let s=Ch[n.type],i=n.offsetCenter;if(!s||!i||!this.layerManager)return;let o=this.layerManager.getLayers(),a=this.deckPicker.getLastPickedObject({x:i.x,y:i.y,layers:o,viewports:this.getViewports(i)},this._lastPointerDownInfo),{layer:c}=a,l=c&&(c[s]||c.props[s]),f=this.props[s],h=!1;l&&(h=l.call(c,a,n)),h||(f?.(a,n),this.widgetManager.onEvent(a,n))},this._onPointerDown=n=>{if(this.device?.type==="webgpu")return;let s=n.offsetCenter,i=this._pick("pickObject","pickObject Time",{x:s.x,y:s.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=i.result[0]||i.emptyInfo},this.props={...CL,...t},t=this.props,t.viewState&&t.initialViewState&&H.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,t.device&&(this.device=t.device);let r=this.device;if(!r&&t.gl){t.gl instanceof WebGLRenderingContext&&H.error("WebGL1 context not supported.")();let n=this.props.deviceProps?.onResize;r=ou.attach(t.gl,{...this.props.deviceProps,onResize:(s,i)=>{let{width:o,height:a}=s.canvas;s.drawingBufferWidth=o,s.drawingBufferHeight=a,this._needsRedraw="Canvas resized",n?.(s,i)}})}r||(r=this._createDevice(t)),this.animationLoop=this._createAnimationLoop(r,t),this.setProps(t),t._typedArrayManagerProps&&Tn.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){this.animationLoop?.stop(),this.animationLoop?.destroy(),this.animationLoop=null,this._lastPointerDownInfo=null,this.layerManager?.finalize(),this.layerManager=null,this.viewManager?.finalize(),this.viewManager=null,this.effectManager?.finalize(),this.effectManager=null,this.deckRenderer?.finalize(),this.deckRenderer=null,this.deckPicker?.finalize(),this.deckPicker=null,this.eventManager?.destroy(),this.eventManager=null,this.widgetManager?.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&(this.canvas.parentElement?.removeChild(this.canvas),this.canvas=null)}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&H.removed("onLayerHover","onHover")(),"onLayerClick"in t&&H.removed("onLayerClick","onClick")(),t.initialViewState&&!dt(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);let r=Object.create(this.props);Object.assign(r,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),t.device&&t.device.id!==this.device?.id&&(this.animationLoop?.stop(),this.canvas!==t.device.canvasContext?.canvas&&(this.canvas?.remove(),this.eventManager?.destroy(),this.canvas=null),H.log(`recreating animation loop for new device! id=${t.device.id}`)(),this.animationLoop=this._createAnimationLoop(t.device,t),this.animationLoop.start()),this.animationLoop?.setProps(r),t.useDevicePixels!==void 0&&this.device?.canvasContext&&this.device.canvasContext.setProps({useDevicePixels:t.useDevicePixels}),this.layerManager&&(this.viewManager.setProps(r),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(r),this.effectManager.setProps(r),this.deckRenderer.setProps(r),this.deckPicker.setProps(r),this.widgetManager.setProps(r)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let r=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);let n=this.viewManager.needsRedraw(t),s=this.layerManager.needsRedraw(t),i=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return r=r||n||s||i||o,r}redraw(t){if(!this.layerManager)return;let r=this.needsRedraw({clearRedrawFlags:!0});r=t||r,r&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(r):this._drawLayers(r))}get isInitialized(){return this.viewManager!==null}getViews(){return Bt(this.viewManager),this.viewManager.views}getViewports(t){return Bt(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){let r=this._pick("pickObject","pickObject Time",t).result;return r.length?r[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_addResources(t,r=!1){for(let n in t)this.layerManager.resourceManager.add({resourceId:n,data:t[n],forceUpdate:r})}_removeResources(t){for(let r of t)this.layerManager.resourceManager.remove(r)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_addDefaultShaderModule(t){this.layerManager.addDefaultShaderModule(t)}_removeDefaultShaderModule(t){this.layerManager?.removeDefaultShaderModule(t)}_pick(t,r,n){Bt(this.deckPicker);let{stats:s}=this;s.get("Pick Count").incrementCount(),s.get(r).timeStart();let i=this.deckPicker[t]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return s.get(r).timeEnd(),i}_createCanvas(t){let r=t.canvas;return typeof r=="string"&&(r=document.getElementById(r),Bt(r)),r||(r=document.createElement("canvas"),r.id=t.id||"deckgl-overlay",t.width&&typeof t.width=="number"&&(r.width=t.width),t.height&&typeof t.height=="number"&&(r.height=t.height),(t.parent||document.body).appendChild(r)),Object.assign(r.style,t.style),r}_setCanvasSize(t){if(!this.canvas)return;let{width:r,height:n}=t;if(r||r===0){let s=Number.isFinite(r)?`${r}px`:r;this.canvas.style.width=s}if(n||n===0){let s=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=t.style?.position||"absolute",this.canvas.style.height=s}}_updateCanvasSize(){let{canvas:t}=this;if(!t)return;let r=t.clientWidth??t.width,n=t.clientHeight??t.height;(r!==this.width||n!==this.height)&&(this.width=r,this.height=n,this.viewManager?.setProps({width:r,height:n}),this.layerManager?.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:n}))}_createAnimationLoop(t,r){let{gl:n,onError:s}=r;return new Nc({device:t,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:i=>this._setDevice(i.device),onRender:this._onRenderFrame.bind(this),onError:s})}_createDevice(t){let r=this.props.deviceProps?.createCanvasContext,n=typeof r=="object"?r:void 0,s={adapters:[],_cacheShaders:!0,_cachePipelines:!0,...t.deviceProps};s.adapters.includes(ou)||s.adapters.push(ou);let i={alphaMode:this.props.deviceProps?.type==="webgpu"?"premultiplied":void 0},o=this.props.deviceProps?.onResize;return Xn.createDevice({_reuseDevices:!0,type:"webgl",...s,createCanvasContext:{...i,...n,canvas:this._createCanvas(t),useDevicePixels:this.props.useDevicePixels,autoResize:!0},onResize:(a,c)=>{this._needsRedraw="Canvas resized",o?.(a,c)}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let{views:t}=this.props,r=Array.isArray(t)?t:t?[t]:[new Bi({id:"default-view"})];return r.length&&this.props.controller&&(r[0].props.controller=this.props.controller),r}_onContextLost(){let{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){if(this.device?.type==="webgpu")return;let{_pickRequest:t}=this;if(t.event){let{result:r,emptyInfo:n}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=r.length>0;let s=n,i=!1;for(let o of r)s=o,i=o.layer?.onHover(o,t.event)||i;i||(this.props.onHover?.(s,t.event),this.widgetManager.onHover(s,t.event)),t.event=null}}_updateCursor(){let t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(t){if(this.device=t,!this.animationLoop)return;this.canvas||(this.canvas=this.device.canvasContext?.canvas,!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild)),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);let r=new jo;r.play(),this.animationLoop.attachTimeline(r),this.eventManager=new wh(this.props.parent||this.canvas,{touchAction:this.props.touchAction,recognizers:Object.keys(ib).map(s=>{let[i,o,a,c]=ib[s],l=this.props.eventRecognizerOptions?.[s],f={...o,...l,event:s};return{recognizer:new i(f),recognizeWith:a,requestFailure:c}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(let s in Ch)this.eventManager.on(s,this._onEvent);this.viewManager=new jh({timeline:r,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});let n=this.viewManager.getViewports()[0];this.layerManager=new Xo(this.device,{deck:this,stats:this.stats,viewport:n,timeline:r}),this.effectManager=new Yh({deck:this,device:this.device}),this.deckRenderer=new Zo(this.device),this.deckPicker=new Zh(this.device),this.widgetManager=new d0({deck:this,parentElement:this.canvas?.parentElement}),this.widgetManager.addDefault(new Jh),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,r){let{device:n,gl:s}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:s});let i={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...r};this.deckRenderer?.renderLayers(i),i.pass==="screen"&&this.widgetManager.onRedraw({viewports:i.viewports,layers:i.layers}),this.props.onAfterRender({device:n,gl:s})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),H.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.layerManager.updateLayers(),this.device?.type!=="webgpu"&&this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){let r=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:r},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){let{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();let r=this.animationLoop.stats;t.get("GPU Time").addTime(r.get("GPU Time").lastTiming),t.get("CPU Time").addTime(r.get("CPU Time").lastTiming)}_getMetrics(){let{metrics:t,stats:r}=this;t.fps=r.get("frameRate").getHz(),t.setPropsTime=r.get("setProps Time").time,t.updateAttributesTime=r.get("Update Attributes").time,t.framesRedrawn=r.get("Redraw Count").count,t.pickTime=r.get("pickObject Time").time+r.get("pickMultipleObjects Time").time+r.get("pickObjects Time").time,t.pickCount=r.get("Pick Count").count,t.gpuTime=r.get("GPU Time").time,t.cpuTime=r.get("CPU Time").time,t.gpuTimePerFrame=r.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=r.get("CPU Time").getAverageTime();let n=Xn.stats.get("Memory Usage");t.bufferMemory=n.get("Buffer Memory").count,t.textureMemory=n.get("Texture Memory").count,t.renderbufferMemory=n.get("Renderbuffer Memory").count,t.gpuMemory=n.get("GPU Memory").count}};au.defaultProps=CL;au.VERSION=vm;var In=au;it();it();function PL(e){switch(e){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return So(e)}}var IL=Eo;function cu(e,t,r){let n=r==="webgpu"&&t.type==="uint8"?"unorm8":t.type;return{attribute:e,format:t.size>1?`${n}x${t.size}`:t.type,byteOffset:t.offset||0}}function ki(e){return e.stride||e.size*e.bytesPerElement}function RL(e,t){return e.type===t.type&&e.size===t.size&&ki(e)===ki(t)&&(e.offset||0)===(t.offset||0)}function Kb(e,t){t.offset&&H.removed("shaderAttribute.offset","vertexOffset, elementOffset")();let r=ki(e),n=t.vertexOffset!==void 0?t.vertexOffset:e.vertexOffset||0,s=t.elementOffset||0,i=n*r+s*e.bytesPerElement+(e.offset||0);return{...t,offset:i,stride:r}}function XQ(e,t){let r=Kb(e,t);return{high:r,low:{...r,offset:r.offset+e.size*4}}}var lu=class{constructor(t,r,n){this._buffer=null,this.device=t,this.id=r.id||"",this.size=r.size||1;let s=r.logicalType||r.type,i=s==="float64",{defaultValue:o}=r;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let a;i?a="float32":!s&&r.isIndexed?a="uint32":a=s||"float32";let c=PL(s||a);this.doublePrecision=i,i&&r.fp64===!1&&(c=Float32Array),this.value=null,this.settings={...r,defaultType:c,defaultValue:o,logicalType:s,type:a,normalized:a.includes("norm"),size:this.size,bytesPerElement:c.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){let t=this.getAccessor();return t.vertexOffset?t.vertexOffset*ki(t):0}get numInstances(){return this.state.numInstances}set numInstances(t){this.state.numInstances=t}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),Tn.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(t=this.id,r=null){let n={};if(this.state.constant){let s=this.value;if(r){let i=Kb(this.getAccessor(),r),o=i.offset/s.BYTES_PER_ELEMENT,a=i.size||this.size;n[t]=s.subarray(o,o+a)}else n[t]=s}else n[t]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${t}64Low`]=n[t]:n[`${t}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(t=this.id,r=null){let n=this.getAccessor(),s=[],i={name:this.id,byteStride:ki(n),attributes:s};if(this.doublePrecision){let o=XQ(n,r||{});s.push(cu(t,{...n,...o.high},this.device.type),cu(`${t}64Low`,{...n,...o.low},this.device.type))}else if(r){let o=Kb(n,r);s.push(cu(t,{...n,...o},this.device.type))}else s.push(cu(t,n,this.device.type));return i}setAccessor(t){this.state.bufferAccessor=t}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let t=null;if(this.state.constant&&this.value){let r=Array.from(this.value);t=[r,r]}else{let{value:r,numInstances:n,size:s}=this,i=n*s;if(r&&i&&r.length>=i){let o=new Array(s).fill(1/0),a=new Array(s).fill(-1/0);for(let c=0;c<i;)for(let l=0;l<s;l++){let f=r[c++];f<o[l]&&(o[l]=f),f>a[l]&&(a[l]=f)}t=[o,a]}}return this.state.bounds=t,t}setData(t){let{state:r}=this,n;ArrayBuffer.isView(t)?n={value:t}:t instanceof at?n={buffer:t}:n=t;let s={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)s.type="float32";else{let o=IL(n.value);s.type=s.normalized?o.replace("int","norm"):o}s.bytesPerElement=n.value.BYTES_PER_ELEMENT,s.stride=ki(s)}if(r.bounds=null,n.constant){let i=n.value;if(i=this._normalizeValue(i,[],0),this.settings.normalized&&(i=this.normalizeConstant(i)),!(!r.constant||!this._areValuesEqual(i,this.value)))return!1;r.externalBuffer=null,r.constant=!0,this.value=ArrayBuffer.isView(i)?i:new Float32Array(i)}else if(n.buffer){let i=n.buffer;r.externalBuffer=i,r.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let i=n.value;r.externalBuffer=null,r.constant=!1,this.value=i;let{buffer:o}=this,a=ki(s),c=(s.vertexOffset||0)*a;if(this.doublePrecision&&i instanceof Float64Array&&(i=Qg(i,s)),this.settings.isIndexed){let f=this.settings.defaultType;i.constructor!==f&&(i=new f(i))}let l=i.byteLength+c+a*2;(!o||o.byteLength<l)&&(o=this._createBuffer(l)),o.write(i,c)}return this.setAccessor(s),!0}updateSubBuffer(t={}){this.state.bounds=null;let r=this.value,{startOffset:n=0,endOffset:s}=t;this.buffer.write(this.doublePrecision&&r instanceof Float64Array?Qg(r,{size:this.size,startIndex:n,endIndex:s}):r.subarray(n,s),n*r.BYTES_PER_ELEMENT+this.byteOffset)}allocate(t,r=!1){let{state:n}=this,s=n.allocatedValue,i=Tn.allocate(s,t+1,{size:this.size,type:this.settings.defaultType,copy:r});this.value=i;let{byteOffset:o}=this,{buffer:a}=this;return(!a||a.byteLength<i.byteLength+o)&&(a=this._createBuffer(i.byteLength+o),r&&s&&a.write(s instanceof Float64Array?Qg(s,this):s,o)),n.allocatedValue=i,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(t){let{value:r}=t;if(!ArrayBuffer.isView(r))throw new Error(`Attribute ${this.id} value is not TypedArray`);let n=this.settings.defaultType,s=!1;if(this.doublePrecision&&(s=r.BYTES_PER_ELEMENT<4),s)throw new Error(`Attribute ${this.id} does not support ${r.constructor.name}`);!(r instanceof n)&&this.settings.normalized&&!("normalized"in t)&&H.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(t){switch(this.settings.type){case"snorm8":return new Float32Array(t).map(r=>(r+128)/255*2-1);case"snorm16":return new Float32Array(t).map(r=>(r+32768)/65535*2-1);case"unorm8":return new Float32Array(t).map(r=>r/255);case"unorm16":return new Float32Array(t).map(r=>r/65535);default:return t}}_normalizeValue(t,r,n){let{defaultValue:s,size:i}=this.settings;if(Number.isFinite(t))return r[n]=t,r;if(!t){let o=i;for(;--o>=0;)r[n+o]=s[o];return r}switch(i){case 4:r[n+3]=Number.isFinite(t[3])?t[3]:s[3];case 3:r[n+2]=Number.isFinite(t[2])?t[2]:s[2];case 2:r[n+1]=Number.isFinite(t[1])?t[1]:s[1];case 1:r[n+0]=Number.isFinite(t[0])?t[0]:s[0];break;default:let o=i;for(;--o>=0;)r[n+o]=Number.isFinite(t[o])?t[o]:s[o]}return r}_areValuesEqual(t,r){if(!t||!r)return!1;let{size:n}=this;for(let s=0;s<n;s++)if(t[s]!==r[s])return!1;return!0}_createBuffer(t){this._buffer&&this._buffer.destroy();let{isIndexed:r,type:n}=this.settings;return this._buffer=this.device.createBuffer({...this._buffer?.props,id:this.id,usage:(r?at.INDEX:at.VERTEX)|at.COPY_DST,indexType:r?n:void 0,byteLength:t}),this._buffer}};var OL=[],LL=[];function ue(e,t=0,r=1/0){let n=OL,s={index:-1,data:e,target:[]};return e?typeof e[Symbol.iterator]=="function"?n=e:e.length>0&&(LL.length=e.length,n=LL):n=OL,(t>0||Number.isFinite(r))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(t,r),s.index=t-1),{iterable:n,objectInfo:s}}function z0(e){return e&&e[Symbol.asyncIterator]}function W0(e,t){let{size:r,stride:n,offset:s,startIndices:i,nested:o}=t,a=e.BYTES_PER_ELEMENT,c=n?n/a:r,l=s?s/a:0,f=Math.floor((e.length-l)/c);return(h,{index:u,target:d})=>{if(!i){let x=u*c+l;for(let v=0;v<r;v++)d[v]=e[x+v];return d}let p=i[u],m=i[u+1]||f,g;if(o){g=new Array(m-p);for(let x=p;x<m;x++){let v=x*c+l;d=new Array(r);for(let _=0;_<r;_++)d[_]=e[v+_];g[x-p]=d}}else if(c===r)g=e.subarray(p*r+l,m*r+l);else{g=new e.constructor((m-p)*r);let x=0;for(let v=p;v<m;v++){let _=v*c+l;for(let y=0;y<r;y++)g[x++]=e[_+y]}}return g}}var BL=[],fu=[[0,1/0]];function NL(e,t){if(e===fu||(t[0]<0&&(t[0]=0),t[0]>=t[1]))return e;let r=[],n=e.length,s=0;for(let i=0;i<n;i++){let o=e[i];o[1]<t[0]?(r.push(o),s=i+1):o[0]>t[1]?r.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return r.splice(s,0,t),r}var KQ={interpolation:{duration:0,easing:e=>e},spring:{stiffness:.05,damping:.5}};function H0(e,t){if(!e)return null;Number.isFinite(e)&&(e={type:"interpolation",duration:e});let r=e.type||"interpolation";return{...KQ[r],...t,...e,type:r}}var qs=class extends lu{constructor(t,r){super(t,r,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:fu}),this.constant=!1,this.settings.update=r.update||(r.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(t){this.state.startIndices=t}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:t=!1}={}){let r=this.state.needsRedraw;return this.state.needsRedraw=r&&!t,r}layoutChanged(){return this.state.layoutChanged}setAccessor(t){var r;(r=this.state).layoutChanged||(r.layoutChanged=!RL(t,this.getAccessor())),super.setAccessor(t)}getUpdateTriggers(){let{accessor:t}=this.settings;return[this.id].concat(typeof t!="function"&&t||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;let{accessor:r}=this.settings,n=this.settings.transition,s=Array.isArray(r)?t[r.find(i=>t[i])]:t[r];return H0(s,n)}setNeedsUpdate(t=this.id,r){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),r){let{startRow:n=0,endRow:s=1/0}=r;this.state.updateRanges=NL(this.state.updateRanges,[n,s])}else this.state.updateRanges=fu}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=BL}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){let{state:r,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(t,r.updateRanges!==fu),!0):!1}updateBuffer({numInstances:t,data:r,props:n,context:s}){if(!this.needsUpdate())return!1;let{state:{updateRanges:i},settings:{update:o,noAlloc:a}}=this,c=!0;if(o){for(let[l,f]of i)o.call(s,this,{data:r,startRow:l,endRow:f,props:n,numInstances:t});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(let[l,f]of i){let h=Number.isFinite(l)?this.getVertexOffset(l):0,u=Number.isFinite(f)?this.getVertexOffset(f):a||!Number.isFinite(t)?this.value.length:t*this.size;super.updateSubBuffer({startOffset:h,endOffset:u})}this._checkAttributeArray()}else c=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),c}setConstantValue(t,r){let n=this.device.type==="webgpu";if(n||r===void 0||typeof r=="function"){if(n&&typeof r!="function"){let o=this._normalizeValue(r,[],0);this._areValuesEqual(o,this.value)||this.setNeedsUpdate("WebGPU constant updated")}return!1}let s=this.settings.transform&&t?this.settings.transform.call(t,r):r;return this.setData({constant:!0,value:s})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0}setExternalBuffer(t){let{state:r}=this;return t?(this.clearNeedsUpdate(),r.lastExternalBuffer===t||(r.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t)),!0):(r.lastExternalBuffer=null,!1)}setBinaryValue(t,r=null){let{state:n,settings:s}=this;if(!t)return n.binaryValue=null,n.binaryAccessor=null,!1;if(s.noAlloc)return!1;if(n.binaryValue===t)return this.clearNeedsUpdate(),!0;if(n.binaryValue=t,this.setNeedsRedraw(),s.transform||r!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});let o=t;Bt(ArrayBuffer.isView(o.value),`invalid ${s.accessor}`);let a=Boolean(o.size)&&o.size!==this.size;return n.binaryAccessor=W0(o.value,{size:o.size||this.size,stride:o.stride,offset:o.offset,startIndices:r,nested:a}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){let{startIndices:r}=this;return(r?t<r.length?r[t]:this.numInstances:t)*this.size}getValue(){let t=this.settings.shaderAttributes,r=super.getValue();if(!t)return r;for(let n in t)Object.assign(r,super.getValue(n,t[n]));return r}getBufferLayout(t){this.state.layoutChanged=!1;let r=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:s}=this.settings;if(s==="dynamic"?n.stepMode=t?t.isInstanced?"instance":"vertex":"instance":n.stepMode=s??"vertex",!r)return n;for(let i in r){let o=super._getBufferLayout(i,r[i]);n.attributes.push(...o.attributes)}return n}_autoUpdater(t,{data:r,startRow:n,endRow:s,props:i,numInstances:o}){if(t.constant&&this.context.device.type!=="webgpu")return;let{settings:a,state:c,value:l,size:f,startIndices:h}=t,{accessor:u,transform:d}=a,p=c.binaryAccessor||(typeof u=="function"?u:i[u]);typeof p!="function"&&typeof u=="string"&&(p=()=>i[u]),Bt(typeof p=="function",`accessor "${u}" is not a function`);let m=t.getVertexOffset(n),{iterable:g,objectInfo:x}=ue(r,n,s);for(let v of g){x.index++;let _=p(v,x);if(d&&(_=d.call(this,_)),h){let y=(x.index<h.length-1?h[x.index+1]:o)-h[x.index];if(_&&Array.isArray(_[0])){let b=m;for(let T of _)t._normalizeValue(T,l,b),b+=f}else _&&_.length>f?l.set(_,m):(t._normalizeValue(_,x.target,0),c0({target:l,source:x.target,start:m,count:y}));m+=y*f}else t._normalizeValue(_,l,m),m+=f}}_validateAttributeUpdaters(){let{settings:t}=this;if(!(t.noAlloc||typeof t.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){let{value:t}=this,r=Math.min(4,this.size);if(t&&t.length>=r){let n=!0;switch(r){case 4:n=n&&Number.isFinite(t[3]);case 3:n=n&&Number.isFinite(t[2]);case 2:n=n&&Number.isFinite(t[1]);case 1:n=n&&Number.isFinite(t[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}};function Zb(e){let{source:t,target:r,start:n=0,size:s,getData:i}=e,o=e.end||r.length,a=t.length,c=o-n;if(a>c){r.set(t.subarray(0,c),n);return}if(r.set(t,n),!i)return;let l=a;for(;l<c;){let f=i(l,t);for(let h=0;h<s;h++)r[n+l]=f[h]||0,l++}}function FL({source:e,target:t,size:r,getData:n,sourceStartIndices:s,targetStartIndices:i}){if(!s||!i)return Zb({source:e,target:t,size:r,getData:n}),t;let o=0,a=0,c=n&&((f,h)=>n(f+a,h)),l=Math.min(s.length,i.length);for(let f=1;f<l;f++){let h=s[f]*r,u=i[f]*r;Zb({source:e.subarray(o,h),target:t,start:a,end:u,size:r,getData:c}),o=h,a=u}return a<t.length&&Zb({source:[],target:t,start:a,size:r,getData:c}),t}function DL(e){let{device:t,settings:r,value:n}=e,s=new qs(t,r);return s.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:r.normalized}),s}function G0(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${e}"`)}}function j0(e){switch(e){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function q0(e){e.push(e.shift())}function kL(e,t){let{doublePrecision:r,settings:n,value:s,size:i}=e,o=r&&s instanceof Float64Array?2:1,a=0,{shaderAttributes:c}=e.settings;if(c)for(let l of Object.values(c))a=Math.max(a,l.vertexOffset??0);return(n.noAlloc?s.length:(t+a)*i)*o}function $0({device:e,source:t,target:r}){return(!r||r.byteLength<t.byteLength)&&(r?.destroy(),r=e.createBuffer({byteLength:t.byteLength,usage:t.usage})),r}function X0({device:e,buffer:t,attribute:r,fromLength:n,toLength:s,fromStartIndices:i,getData:o=a=>a}){let a=r.doublePrecision&&r.value instanceof Float64Array?2:1,c=r.size*a,l=r.byteOffset,f=r.settings.bytesPerElement<4?l/r.settings.bytesPerElement*4:l,h=r.startIndices,u=i&&h,d=r.isConstant;if(!u&&t&&n>=s)return t;let p=r.value instanceof Float64Array?Float32Array:r.value.constructor,m=d?r.value:new p(r.getBuffer().readSyncWebGL(l,s*p.BYTES_PER_ELEMENT).buffer);if(r.settings.normalized&&!d){let _=o;o=(y,b)=>r.normalizeConstant(_(y,b))}let g=d?(_,y)=>o(m,y):(_,y)=>o(m.subarray(_+l,_+l+c),y),x=t?new Float32Array(t.readSyncWebGL(f,n*4).buffer):new Float32Array(0),v=new Float32Array(s);return FL({source:x,target:v,sourceStartIndices:i,targetStartIndices:h,size:c,getData:g}),(!t||t.byteLength<v.byteLength+f)&&(t?.destroy(),t=e.createBuffer({byteLength:v.byteLength+f,usage:35050})),t.write(v,f),t}var Gc=class{constructor({device:t,attribute:r,timeline:n}){this.buffers=[],this.currentLength=0,this.device=t,this.transition=new Sn(n),this.attribute=r,this.attributeInTransition=DL(r),this.currentStartIndices=r.startIndices}get inProgress(){return this.transition.inProgress}start(t,r,n=1/0){this.settings=t,this.currentStartIndices=this.attribute.startIndices,this.currentLength=kL(this.attribute,r),this.transition.start({...t,duration:n})}update(){let t=this.transition.update();return t&&this.onUpdate(),t}setBuffer(t){this.attributeInTransition.setData({buffer:t,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(let t of this.buffers)t.destroy();this.buffers.length=0}};var hu=class extends Gc{constructor({device:t,attribute:r,timeline:n}){super({device:t,attribute:r,timeline:n}),this.type="interpolation",this.transform=ttt(t,r)}start(t,r){let n=this.currentLength,s=this.currentStartIndices;if(super.start(t,r,t.duration),t.duration<=0){this.transition.cancel();return}let{buffers:i,attribute:o}=this;q0(i),i[0]=X0({device:this.device,buffer:i[0],attribute:o,fromLength:n,toLength:this.currentLength,fromStartIndices:s,getData:t.enter}),i[1]=$0({device:this.device,source:i[0],target:i[1]}),this.setBuffer(i[1]);let{transform:a}=this,c=a.model,l=Math.floor(this.currentLength/o.size);VL(o)&&(l/=2),c.setVertexCount(l),o.isConstant?(c.setAttributes({aFrom:i[0]}),c.setConstantAttributes({aTo:o.value})):c.setAttributes({aFrom:i[0],aTo:o.getBuffer()}),a.transformFeedback.setBuffers({vCurrent:i[1]})}onUpdate(){let{duration:t,easing:r}=this.settings,{time:n}=this.transition,s=n/t;r&&(s=r(s));let{model:i}=this.transform,o={time:s};i.shaderInputs.setProps({interpolation:o}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}},ZQ=`uniform interpolationUniforms {
|
|
3119
3119
|
float time;
|
|
3120
3120
|
} interpolation;
|
|
3121
3121
|
`,UL={name:"interpolation",vs:ZQ,uniformTypes:{time:"f32"}},JQ=`#version 300 es
|