@deck.gl/core
Version:
deck.gl core library
17 lines (16 loc) • 756 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') exports['deck'] = factory();
else root['deck'] = factory();})(globalThis, function () {
"use strict";var __exports__=(()=>{var Oo=Object.defineProperty;var gb=Object.getOwnPropertyDescriptor;var _b=Object.getOwnPropertyNames;var yb=Object.prototype.hasOwnProperty;var xb=(r,e,t)=>e in r?Oo(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var O=(r,e)=>()=>(r&&(e=r(r=0)),e);var $t=(r,e)=>{for(var t in e)Oo(r,t,{get:e[t],enumerable:!0})},bb=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _b(e))!yb.call(r,s)&&s!==t&&Oo(r,s,{get:()=>e[s],enumerable:!(n=gb(e,s))||n.enumerable});return r};var Tb=r=>bb(Oo({},"__esModule",{value:!0}),r);var L=(r,e,t)=>(xb(r,typeof e!="symbol"?e+"":e,t),t);function Ps(){let r;if(typeof window<"u"&&window.performance)r=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var Vl=O(()=>{});var zr,zl=O(()=>{Vl();zr=class{constructor(e,t){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=e,this.type=t,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(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Ps(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ps()-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 hr,Ud=O(()=>{zl();hr=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(t=>this._getOrCreate(t))}_getOrCreate(e){let{name:t,type:n}=e,s=this.stats[t];return s||(e instanceof zr?s=e:s=new zr(t,n),this.stats[t]=s),s}}});var Wl=O(()=>{Ud();zl();Vl()});var $l,ko,jl=O(()=>{Wl();$l=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new hr({id:e})),this.stats.get(e)}},ko=new $l});var No,wb,Do,vb,gR,Vd=O(()=>{No=globalThis,wb=globalThis.document||{},Do=globalThis.process||{},vb=globalThis.console,gR=globalThis.navigator||{}});function zd(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}var Wd=O(()=>{});function Wr(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||zd()}var $d=O(()=>{Wd()});var Hl,Fo=O(()=>{Vd();$d();Hl="4.1.1"});function On(r,e){if(!r)throw new Error(e||"Assertion failed")}var Xl=O(()=>{});function Yl(r){if(!r)return 0;let e;switch(typeof r){case"number":e=r;break;case"object":e=r.logLevel||r.priority||0;break;default:return 0}return On(Number.isFinite(e)&&e>=0),e}function jd(r){let{logLevel:e,message:t}=r;r.logLevel=Yl(e);let n=r.args?Array.from(r.args):[];for(;n.length&&n.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&n.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let s=typeof r.message;return On(s==="string"||s==="object"),Object.assign(r,{args:n},r.opts)}var Hd=O(()=>{Xl()});var $r,Bo,Xd=O(()=>{Hd();$r=()=>{},Bo=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...n){return this._log("log",e,t,n)}info(e,t,...n){return this._log("info",e,t,n)}once(e,t,...n){return this._log("once",e,t,n,{once:!0})}_log(e,t,n,s,i={}){let o=jd({logLevel:t,message:n,args:this._buildArgs(t,n,s),opts:i});return this._createLogFunction(e,o,i)}_buildArgs(e,t,n){return[e,t,...n]}_createLogFunction(e,t,n){if(!this._shouldLog(t.logLevel))return $r;let s=this._getOnceTag(n.tag??t.tag??t.message);if((n.once||t.once)&&s!==void 0){if(this._onceCache.has(s))return $r;this._onceCache.add(s)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=Yl(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}}});function Sb(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var Lo,Yd=O(()=>{Lo=class{constructor(e,t,n="sessionStorage"){this.storage=Sb(n),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let e={};if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}});function qd(r){let e;return r<10?e=`${r.toFixed(2)}ms`:r<100?e=`${r.toFixed(1)}ms`:r<1e3?e=`${r.toFixed(0)}ms`:e=`${(r/1e3).toFixed(2)}s`,e}function Kd(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var Zd=O(()=>{});function Gd(r){return typeof r!="string"?r:(r=r.toUpperCase(),Uo[r]||Uo.WHITE)}function Qd(r,e,t){return!Wr&&typeof r=="string"&&(e&&(r=`\x1B[${Gd(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${Gd(t)+Eb}m${r}\x1B[49m`)),r}var Uo,Eb,Jd=O(()=>{Fo();(function(r){r[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Uo||(Uo={}));Eb=10});function ep(r,e=["constructor"]){let t=Object.getPrototypeOf(r),n=Object.getOwnPropertyNames(t),s=r;for(let i of n){let o=s[i];typeof o=="function"&&(e.find(a=>i===a)||(s[i]=o.bind(r)))}}var tp=O(()=>{});function kn(){let r;if(Wr()&&No.performance)r=No?.performance?.now?.();else if("hrtime"in Do){let e=Do?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var rp=O(()=>{Fo()});function Rb(r,e,t){if(typeof e=="string"){let n=t.time?Kd(qd(t.total)):"";e=t.time?`${r}: ${n} ${e}`:`${r}: ${e}`,e=Qd(e,t.color,t.background)}return e}function Ib(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}var Nn,ql,Ie,Kl=O(()=>{Fo();Xd();Yd();Zd();Jd();tp();Xl();rp();Nn={debug:Wr()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ql={enabled:!0,level:0},Ie=class extends Bo{constructor({id:e}={id:""}){super({level:0}),this.VERSION=Hl,this._startTs=kn(),this._deltaTs=kn(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new Lo(`__probe-${this.id}__`,{[this.id]:ql}),this.timeStamp(`${this.id} started`),ep(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((kn()-this._startTs).toPrecision(10))}getDelta(){return Number((kn()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw new Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:Nn.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:Nn.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...n){return this._log("log",e,t,n,{method:Nn.log,time:!0,once:!0})}log(e,t,...n){return this._log("log",e,t,n,{method:Nn.debug})}info(e,t,...n){return this._log("info",e,t,n,{method:console.info})}once(e,t,...n){return this._log("once",e,t,n,{method:Nn.debug||Nn.info,once:!0})}table(e,t,n){return t?this._log("table",e,t,n&&[n]||[],{method:console.table||$r,tag:Ib(t)}):$r}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||$r})}group(e,t,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:s})}groupCollapsed(e,t,n={}){return this.group(e,t,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||$r})}withGroup(e,t,n){this.group(e,t)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){let n=t.method;On(n),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=kn();let s=Rb(this.id,t.message,t);return n.bind(console,s,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(ql),this._storage.config[this.id]}_updateConfiguration(e){let t=this._storage.config[this.id]||{...ql};this._storage.setConfiguration({[this.id]:{...t,...e}})}};Ie.VERSION=Hl});var np=O(()=>{globalThis.probe={}});var XR,Cs=O(()=>{Kl();Kl();np();XR=new Ie({id:"@probe.gl/log"})});var I,jt=O(()=>{Cs();I=new Ie({id:"luma.gl"})});function dr(r="id"){Zl[r]=Zl[r]||1;let e=Zl[r]++;return`${r}-${e}`}var Zl,Ms=O(()=>{Zl={}});function Pb(r,e){let t={...e};for(let n in r)r[n]!==void 0&&(t[n]=r[n]);return t}var j,Pe=O(()=>{Ms();j=class{toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,n){if(!e)throw new Error("no device");this._device=e,this.props=Pb(t,n);let s=this.props.id!=="undefined"?this.props.id:dr(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(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let n=this._device.statsManager.getStats("Resource Counts");n.get("GPU Memory").addCount(e),n.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}};L(j,"defaultProps",{id:"undefined",handle:void 0,userData:void 0})});var Os,W,Vo=O(()=>{Pe();Os=class extends j{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let n={...t};(t.usage||0)&Os.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?n.indexType="uint32":t.data instanceof Uint16Array?n.indexType="uint16":t.data instanceof Uint8Array&&(n.indexType="uint8")),delete n.data,super(e,n,Os.defaultProps),this.usage=n.usage||0,this.indexType=n.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,n){let s=ArrayBuffer.isView(e)?e.buffer:e,i=Math.min(e?e.byteLength:n,Os.DEBUG_DATA_MAX_LENGTH);s===null?this.debugData=new ArrayBuffer(i):t===0&&n===s.byteLength?this.debugData=s.slice(0,i):this.debugData=s.slice(t,t+i)}},W=Os;L(W,"INDEX",16),L(W,"VERTEX",32),L(W,"UNIFORM",64),L(W,"STORAGE",128),L(W,"INDIRECT",256),L(W,"QUERY_RESOLVE",512),L(W,"MAP_READ",1),L(W,"MAP_WRITE",2),L(W,"COPY_SRC",4),L(W,"COPY_DST",8),L(W,"DEBUG_DATA_MAX_LENGTH",32),L(W,"defaultProps",{...j.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0})});function ks(r){let[e,t,n]=Ql[r],s=r.includes("norm"),i=!s&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:n,normalized:s,integer:i,signed:o}}function Gl(r){let e=r;switch(e){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return e}}function sp(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function jr(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Ql).find(n=>e===n[4]);if(!t)throw new Error(e.name);return t[0]}function Hr(r){let[,,,,e]=Ql[r];return e}var Ql,Ns=O(()=>{Ql={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 Dn(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,n]=r.split("x"),s=t,i=n?parseInt(n):1,o=ks(s),a={type:s,components:i,byteLength:o.byteLength*i,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(a.webglOnly=!0),a}function ip(r,e,t){let n=t?Gl(r):r;switch(n){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${n}x${e}`;case"snorm8":case"uint8":case"sint8":case"uint16":case"sint16":case"unorm16":case"snorm16":case"float16":if(e===1||e===3)throw new Error(`size: ${e}`);return`${n}x${e}`;default:return e===1?n:`${n}x${e}`}}function Jl(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let n=e,s=jr(r);return ip(s,n,t)}function op(r){let e;switch(r.primitiveType){case"f32":e="float32";break;case"i32":e="sint32";break;case"u32":e="uint32";break;case"f16":return r.components<=2?"float16x2":"float16x4"}return r.components===1?e:`${e}x${r.components}`}var zo=O(()=>{Ns()});function su(r){let e=Nb[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}var Se,se,St,Cb,Wo,eu,$o,tu,Mb,ru,Ds,nu,jo,ap,Ob,kb,Nb,cp=O(()=>{Se="texture-compression-bc",se="texture-compression-astc",St="texture-compression-etc2",Cb="texture-compression-etc1-webgl",Wo="texture-compression-pvrtc-webgl",eu="texture-compression-atc-webgl",$o="float32-renderable-webgl",tu="float16-renderable-webgl",Mb="rgb9e5ufloat-renderable-webgl",ru="snorm8-renderable-webgl",Ds="norm16-renderable-webgl",nu="snorm16-renderable-webgl",jo="float32-filterable",ap="float16-filterable-webgl";Ob={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:ru},rg8snorm:{render:ru},"rgb8snorm-webgl":{},rgba8snorm:{render:ru},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:Ds},rg16unorm:{render:Ds},"rgb16unorm-webgl":{f:Ds},rgba16unorm:{render:Ds},r16snorm:{f:nu},rg16snorm:{render:nu},"rgb16snorm-webgl":{f:Ds},rgba16snorm:{render:nu},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:tu,filter:"float16-filterable-webgl"},rg16float:{render:tu,filter:ap},rgba16float:{render:tu,filter:ap},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:$o,filter:jo},rg32float:{render:!1,filter:jo},"rgb32float-webgl":{render:$o,filter:jo},rgba32float:{render:$o,filter:jo},"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:Mb},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:$o},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}},kb={"bc1-rgb-unorm-webgl":{f:Se},"bc1-rgb-unorm-srgb-webgl":{f:Se},"bc1-rgba-unorm":{f:Se},"bc1-rgba-unorm-srgb":{f:Se},"bc2-rgba-unorm":{f:Se},"bc2-rgba-unorm-srgb":{f:Se},"bc3-rgba-unorm":{f:Se},"bc3-rgba-unorm-srgb":{f:Se},"bc4-r-unorm":{f:Se},"bc4-r-snorm":{f:Se},"bc5-rg-unorm":{f:Se},"bc5-rg-snorm":{f:Se},"bc6h-rgb-ufloat":{f:Se},"bc6h-rgb-float":{f:Se},"bc7-rgba-unorm":{f:Se},"bc7-rgba-unorm-srgb":{f:Se},"etc2-rgb8unorm":{f:St},"etc2-rgb8unorm-srgb":{f:St},"etc2-rgb8a1unorm":{f:St},"etc2-rgb8a1unorm-srgb":{f:St},"etc2-rgba8unorm":{f:St},"etc2-rgba8unorm-srgb":{f:St},"eac-r11unorm":{f:St},"eac-r11snorm":{f:St},"eac-rg11unorm":{f:St},"eac-rg11snorm":{f:St},"astc-4x4-unorm":{f:se},"astc-4x4-unorm-srgb":{f:se},"astc-5x4-unorm":{f:se},"astc-5x4-unorm-srgb":{f:se},"astc-5x5-unorm":{f:se},"astc-5x5-unorm-srgb":{f:se},"astc-6x5-unorm":{f:se},"astc-6x5-unorm-srgb":{f:se},"astc-6x6-unorm":{f:se},"astc-6x6-unorm-srgb":{f:se},"astc-8x5-unorm":{f:se},"astc-8x5-unorm-srgb":{f:se},"astc-8x6-unorm":{f:se},"astc-8x6-unorm-srgb":{f:se},"astc-8x8-unorm":{f:se},"astc-8x8-unorm-srgb":{f:se},"astc-10x5-unorm":{f:se},"astc-10x5-unorm-srgb":{f:se},"astc-10x6-unorm":{f:se},"astc-10x6-unorm-srgb":{f:se},"astc-10x8-unorm":{f:se},"astc-10x8-unorm-srgb":{f:se},"astc-10x10-unorm":{f:se},"astc-10x10-unorm-srgb":{f:se},"astc-12x10-unorm":{f:se},"astc-12x10-unorm-srgb":{f:se},"astc-12x12-unorm":{f:se},"astc-12x12-unorm-srgb":{f:se},"pvrtc-rgb4unorm-webgl":{f:Wo},"pvrtc-rgba4unorm-webgl":{f:Wo},"pvrtc-rbg2unorm-webgl":{f:Wo},"pvrtc-rgba2unorm-webgl":{f:Wo},"etc1-rbg-unorm-webgl":{f:Cb},"atc-rgb-unorm-webgl":{f:eu},"atc-rgba-unorm-webgl":{f:eu},"atc-rgbai-unorm-webgl":{f:eu}},Nb={...Ob,...kb}});function lp(r){let e=Bb(r);if(Ht.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let n=Lb(r);n&&(e.blockWidth=n.blockWidth,e.blockHeight=n.blockHeight)}let t=Fb.exec(r);if(t){let[,n,s,i,o,a]=t,c=`${i}${s}`,l=ks(c),u=l.byteLength*8,f=n.length,h=[u,f>=2?u:0,f>=3?u:0,f>=4?u:0];e={format:r,attachment:e.attachment,dataType:l.signedType,components:f,channels:n,integer:l.integer,signed:l.signed,normalized:l.normalized,bitsPerChannel:h,bytesPerPixel:l.byteLength*n.length,packed:e.packed,srgb:e.srgb},a==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function Bb(r){let e=su(r),t=e.bytesPerPixel||1,n=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:r,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||e.channels?.length||1,bytesPerPixel:t,bitsPerChannel:n,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function Lb(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,n,s]=t;return{blockWidth:Number(n),blockHeight:Number(s)}}return null}var Db,Fb,Ho,Ht,iu=O(()=>{Ns();cp();Db=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Fb=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,Ho=class{getInfo(e){return lp(e)}isColor(e){return e.startsWith("rgba")||e.startsWith("bgra")||e.startsWith("rgb")}isDepthStencil(e){return e.startsWith("depth")||e.startsWith("stencil")}isCompressed(e){return Db.some(t=>e.startsWith(t))}getCapabilities(e){let t=su(e),n={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},s=lp(e),i=e.startsWith("depth")||e.startsWith("stencil"),o=s?.signed,a=s?.integer,c=s?.webgl;return n.render&&=!o,n.filter&&=!i&&!o&&!a&&!c,n}},Ht=new Ho});function up(r){return typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement||typeof VideoFrame<"u"&&r instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas}function fp(r){if(typeof ImageData<"u"&&r instanceof ImageData||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height};if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement)return{width:r.naturalWidth,height:r.naturalHeight};if(typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement)return{width:r.videoWidth,height:r.videoHeight};if(typeof VideoFrame<"u"&&r instanceof VideoFrame)return{width:r.displayWidth,height:r.displayHeight};throw new Error("Unknown image type")}var hp=O(()=>{});var Fs,Bs,ou,Fe,au=O(()=>{jl();jt();Ms();Vo();zo();iu();hp();Fs=class{},Bs=class{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}},ou=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=ko;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...ou.defaultProps,...e},this.id=this.props.id||dr(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return Dn(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return Ht.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let n=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,n=1){let s=Math.max(e,t,n);return 1+Math.floor(Math.log2(s))}isExternalImage(e){return up(e)}getExternalImageSize(e){return fp(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return Ht.isCompressed(e)}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){this.commandEncoder?.popDebugGroup()}insertDebugMarker(e){this.commandEncoder?.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,t,...n){return this.props.onError(e,t)?()=>{}:I.error(e.message,t,...n)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
or create a device with the 'debug: true' prop.`;I.once(0,e)()}}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw new Error("not implemented")}readPixelsToBufferWebGL(e,t){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,t){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){let t=Ht.getCapabilities(e),n=i=>(typeof i=="string"?this.features.has(i):i)??!0,s=n(t.create);return{format:e,create:s,render:s&&n(t.render),filter:s&&n(t.filter),blend:s&&n(t.blend),store:s&&n(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&W.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":e.data instanceof Uint8Array&&(t.data=new Uint16Array(e.data),t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},Fe=ou;L(Fe,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[n,s]=e.getDevicePixelSize();I.log(1,`${e} resized => ${n}x${s}px`)()},onPositionChange:(e,t)=>{let[n,s]=e.getPosition();I.log(1,`${e} repositioned => ${n},${s}`)()},onVisibilityChange:e=>I.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>I.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:I.get("debug")||void 0,debugShaders:I.get("debug-shaders")||void 0,debugFramebuffers:Boolean(I.get("debug-framebuffers")),debugFactories:Boolean(I.get("debug-factories")),debugWebGL:Boolean(I.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 Ub,dp,Yo,Xo,pr,pp=O(()=>{au();jl();jt();Ub="set luma.log.level=1 (or higher) to trace rendering",dp="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Yo=class{stats=ko;log=I;VERSION="9.2.6";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw I.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),I.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");I.error("This version of luma.gl has already been initialized")()}I.log(1,`${this.VERSION} - ${Ub}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Yo.defaultProps,...e},n=this.selectAdapter(t.type,t.adapters);if(!n)throw new Error(dp);return t.waitForPageLoad&&await n.pageLoaded,await n.create(t)}async attachDevice(e,t){let n=this._getTypeFromHandle(e,t.adapters),s=n&&this.selectAdapter(n,t.adapters);if(!s)throw new Error(dp);return await s?.attach?.(e,t)}registerAdapters(e){for(let t of e)this.preregisteredAdapters.set(t.type,t)}getSupportedAdapters(e=[]){let t=this._getAdapterMap(e);return Array.from(t).map(([,n])=>n).filter(n=>n.isSupported?.()).map(n=>n.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],n=this._getAdapterMap(e);for(let s of t)if(n.get(s)?.isSupported?.())return s;return null}selectAdapter(e,t=[]){let n=e;e==="best-available"&&(n=this.getBestAvailableAdapterType(t));let s=this._getAdapterMap(t);return n&&s.get(n)||null}enforceWebGL2(e=!0,t=[]){let s=this._getAdapterMap(t).get("webgl");s||I.warn("enforceWebGL2: webgl adapter not found")(),s?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Yo.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let n of e)t.set(n.type,n);return t}_getTypeFromHandle(e,t=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e?.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?I.warn("WebGL1 is not supported",e)():I.warn("Unknown handle type",e)(),null)}},Xo=Yo;L(Xo,"defaultProps",{...Fe.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});pr=new Xo});var RI,II,PI,mp,gp=O(()=>{RI=globalThis.document||{},II=globalThis.process||{},PI=globalThis.console,mp=globalThis.navigator||{}});function qo(r){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&Boolean(process.versions?.electron))return!0;let e=typeof navigator<"u"&&navigator.userAgent,t=r||e;return Boolean(t&&t.indexOf("Electron")>=0)}var cu=O(()=>{});function Xt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||qo()}var lu=O(()=>{cu()});function uu(r){return!r&&!Xt()?"Node":qo(r)?"Electron":(r||mp.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown"}var _p=O(()=>{lu();cu();gp()});var Ls=O(()=>{lu();_p()});function Wb(){return Ko||(zb()||typeof window>"u"?Ko=Promise.resolve():Ko=new Promise(r=>window.addEventListener("load",()=>r()))),Ko}var Us,Vb,zb,Ko,yp=O(()=>{Ls();Us=class{get pageLoaded(){return Wb()}},Vb=Xt()&&typeof document<"u",zb=()=>Vb&&document.readyState==="complete",Ko=null});function xp(){let r,e;return{promise:new Promise((n,s)=>{r=n,e=s}),resolve:r,reject:e}}var bp=O(()=>{});function $b(r){if(typeof r=="string"){let e=document.getElementById(r);if(!e)throw new Error(`${r} is not an HTML element`);return e}return r||document.body}function jb(r){let e=document.getElementById(r);if(!Xr.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function Hb(r){let{width:e,height:t}=r,n=document.createElement("canvas");n.id=dr("lumagl-auto-created-canvas"),n.width=e||1,n.height=t||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(n.style.visibility="hidden");let s=$b(r?.container||null);return s.insertBefore(n,s.firstChild),n}function Xb(r,e,t,n,s){let i=r,o=Tp(i[0],e,t),a=wp(i[1],e,n,s),c=Tp(i[0]+1,e,t),l=c===t-1?c:c-1;c=wp(i[1]+1,e,n,s);let u;return s?(c=c===0?c:c+1,u=a,a=c):u=c===n-1?c:c-1,{x:o,y:a,width:Math.max(l-o+1,1),height:Math.max(u-a+1,1)}}function Tp(r,e,t){return Math.min(Math.round(r*e),t-1)}function wp(r,e,t,n){return n?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Fn,Xr,vp=O(()=>{Ls();Ms();bp();Fn=class{static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}id;props;canvas;htmlCanvas;offscreenCanvas;type;initialized;isInitialized=!1;isVisible=!0;cssWidth;cssHeight;devicePixelRatio;devicePixelWidth;devicePixelHeight;drawingBufferWidth;drawingBufferHeight;_initializedResolvers=xp();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...Fn.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,Xt()?e.canvas?typeof e.canvas=="string"?this.canvas=jb(e.canvas):this.canvas=e.canvas:this.canvas=Hb(e):this.canvas={width:e.width||1,height:e.height||1},Fn.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):Fn.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.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],Fn.isHTMLCanvas(this.canvas)){this._intersectionObserver=new IntersectionObserver(t=>this._handleIntersection(t)),this._intersectionObserver.observe(this.canvas),this._resizeObserver=new ResizeObserver(t=>this._handleResize(t));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(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.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 e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,t){this.canvas.width=e,this.canvas.height=t,this.drawingBufferWidth=e,this.drawingBufferHeight=t}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,t=!0){let n=this.cssToDeviceRatio(),[s,i]=this.getDrawingBufferSize();return Xb(e,n,s,i,t)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){let[e,t]=this.getDevicePixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),[t]=this.getCSSSize();return t?e/t:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_handleIntersection(e){let t=e.find(s=>s.target===this.canvas);if(!t)return;let n=t.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(c=>c.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let n=this.getDevicePixelSize(),s=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,i=t.devicePixelContentBoxSize?.[0].blockSize||t.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 e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}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 e=this.devicePixelRatio;this.devicePixelRatio=window.devicePixelRatio,this.updatePosition(),this.device.props.onDevicePixelRatioChange(this,{oldRatio:e}),matchMedia(`(resolution: ${this.devicePixelRatio}dppx)`).addEventListener("change",()=>this._observeDevicePixelRatio(),{once:!0})}_trackPosition(e=100){let t=setInterval(()=>{this.destroyed?clearInterval(t):this.updatePosition()},e)}updatePosition(){let e=this.htmlCanvas?.getBoundingClientRect();if(e){let t=[e.left,e.top];if(this._position??=t,t[0]!==this._position[0]||t[1]!==this._position[1]){let s=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:s})}}}},Xr=Fn;L(Xr,"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 Zo,Ke,fu=O(()=>{Pe();Zo=class extends j{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Zo.normalizeProps(e,t),super(e,t,Zo.defaultProps)}static normalizeProps(e,t){return t}},Ke=Zo;L(Ke,"defaultProps",{...j.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 Yb,Yt,K,hu=O(()=>{Pe();fu();jt();Yb={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},Yt=class extends j{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(e,t){if(t=Yt.normalizeProps(e,t),super(e,t,Yt.defaultProps),this.dimension=this.props.dimension,this.baseDimension=Yb[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(e.isExternalImage(t.data)){let n=e.getExternalImageSize(t.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)&&I.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof Ke?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let n={...t},{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(e){this.device.isExternalImage(e)?this.copyExternalImage({image:e,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}):e&&this.copyImageData({data:e,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(e){let{width:t,height:n,depth:s}=this,i={...Yt.defaultCopyDataOptions,width:t,height:n,depth:s,...e},o=this.device.getTextureFormatInfo(this.format);if(!e.bytesPerRow&&!o.bytesPerPixel)throw new Error(`bytesPerRow must be provided for texture format ${this.format}`);return i.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),i.rowsPerImage=e.rowsPerImage||n,i}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),n={...Yt.defaultCopyExternalImageOptions,...t,...e};return n.width=Math.min(n.width,this.width-n.x),n.height=Math.min(n.height,this.height-n.y),n}},K=Yt;L(K,"SAMPLE",4),L(K,"STORAGE",8),L(K,"RENDER",16),L(K,"COPY_SRC",1),L(K,"COPY_DST",2),L(K,"TEXTURE",4),L(K,"RENDER_ATTACHMENT",16),L(K,"defaultProps",{...j.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:Yt.TEXTURE|Yt.RENDER_ATTACHMENT|Yt.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),L(K,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),L(K,"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 du,mr,Ap=O(()=>{Pe();du=class extends j{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,du.defaultProps)}},mr=du;L(mr,"defaultProps",{...j.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0})});function Sp(r,e,t){let n="",s=e.split(/\r?\n/),i=r.slice().sort((o,a)=>o.lineNum-a.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let a=1;a<=s.length;a++)for(n+=Ep(s[a-1],a,t);i.length>o&&i[o].lineNum===a;){let c=i[o++];n+=pu(c,s,c.lineNum,{...t,inlineSource:!1})}for(;i.length>o;){let a=i[o++];n+=pu(a,[],0,{...t,inlineSource:!1})}return n;case"issues":case"no":for(let a of r)n+=pu(a,s,a.lineNum,{inlineSource:t?.showSourceCode!=="no"});return n}}function pu(r,e,t,n){if(n?.inlineSource){let i=qb(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
`:"";return`
${i}${o}${r.type.toUpperCase()}: ${r.message}
`}let s=r.type==="error"?"red":"#8B4000";return n?.html?`<div class='luma-compiler-log-error' style="color:${s};"><b> ${r.type.toUpperCase()}: ${r.message}</b></div>`:`${r.type.toUpperCase()}: ${r.message}`}function qb(r,e,t){let n="";for(let s=e-2;s<=e;s++){let i=r[s-1];i!==void 0&&(n+=Ep(i,e,t))}return n}function Ep(r,e,t){let n=t?.html?Zb(r):r;return`${Kb(String(e),4)}: ${n}${t?.html?"<br/>":`
`}`}function Kb(r,e){let t="";for(let n=r.length;n<e;++n)t+=" ";return t+r}function Zb(r){return r.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}var Rp=O(()=>{});function Gb(r){return Qb(r.source)||r.id||dr(`unnamed ${r.stage}-shader`)}function Qb(r,e="unnamed"){let n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return n?n[1]:e}var mu,gr,Ip=O(()=>{Pe();Ms();Rp();mu=class extends j{get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:Gb(t),...t},mu.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if(this.compilationStatus==="success")return;break;case"warnings":case"always":break}let t=await this.getCompilationInfo();e==="warnings"&&t?.length===0||this._displayShaderLog(t,this.id)}_displayShaderLog(e,t){if(typeof document>"u"||!document?.createElement)return;let n=t,s=`${this.stage} shader "${n}"`,i=Sp(e,this.source,{showSourceCode:"all",html:!0}),o=this.getTranslatedSource();o&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${o}</pre></code>`);let a=document.createElement("Button");a.innerHTML=`
<h1>Compilation error in ${s}</h1><br /><br />
<code style="user-select:text;"><pre>
${i}
</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)}}},gr=mu;L(gr,"defaultProps",{...j.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0})});var gu,Et,Pp=O(()=>{Pe();hu();jt();gu=class extends j{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,gu.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(s=>s.texture.clone(e)),n=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:n})}resize(e){let t=!e;if(e){let[n,s]=Array.isArray(e)?e:[e.width,e.height];t=t||s!==this.height||n!==this.width,this.width=n,this.height=s}t&&(I.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((t,n)=>{if(typeof t=="string"){let s=this.createColorTexture(t,n);return this.attachResource(s),s.view}return t instanceof K?t.view:t});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof K?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:K.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:K.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let n=0;n<this.colorAttachments.length;++n)if(this.colorAttachments[n]){let s=this.colorAttachments[n].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[n]),this.colorAttachments[n]=s.view,this.attachResource(s.view)}if(this.depthStencilAttachment){let n=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=n.view,this.attachResource(n)}this.updateAttachments()}},Et=gu;L(Et,"defaultProps",{...j.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null})});var _u,Ze,Cp=O(()=>{Pe();_u=class extends j{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,_u.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},Ze=_u;L(Ze,"defaultProps",{...j.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 Yr,qt,Mp=O(()=>{Pe();Yr=class extends j{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=Yr.normalizeProps(e,t),super(e,t,Yr.defaultProps)}static normalizeProps(e,t){return t}},qt=Yr;L(qt,"defaultClearColor",[0,0,0,1]),L(qt,"defaultClearDepth",1),L(qt,"defaultClearStencil",0),L(qt,"defaultProps",{...j.defaultProps,framebuffer:null,parameters:void 0,clearColor:Yr.defaultClearColor,clearColors:void 0,clearDepth:Yr.defaultClearDepth,clearStencil:Yr.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0})});var yu,qr,Op=O(()=>{Pe();yu=class extends j{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,yu.defaultProps),this.shaderLayout=t.shaderLayout}},qr=yu;L(qr,"defaultProps",{...j.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0})});var xu,Bn,kp=O(()=>{Pe();xu=class extends j{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,xu.defaultProps)}},Bn=xu;L(Bn,"defaultProps",{...j.defaultProps,measureExecutionTime:void 0})});var bu,Ln,Np=O(()=>{Pe();bu=class extends j{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,bu.defaultProps)}},Ln=bu;L(Ln,"defaultProps",{...j.defaultProps})});function Vs(r){return t0[r]}function Tu(r){let[e,t]=e0[r],n=e==="i32"||e==="u32",s=e!=="u32",i=Jb[e]*t;return{primitiveType:e,components:t,byteLength:i,integer:n,signed:s}}var Jb,e0,t0,r0,kP,Go=O(()=>{Jb={f32:4,f16:2,i32:4,u32:4},e0={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]},t0={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>":{ty