@luma.gl/effects 9.2.0-alpha.6 → 9.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/dist.min.js +3 -3
  2. package/package.json +3 -3
package/dist/dist.min.js CHANGED
@@ -4,8 +4,8 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['luma'] = factory();
6
6
  else root['luma'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var Ht=Object.create;var k=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var Vt=(r,e,t)=>e in r?k(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ot=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),jt=(r,e)=>{for(var t in e)k(r,t,{get:e[t],enumerable:!0})},ce=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kt(e))!Gt.call(r,n)&&n!==t&&k(r,n,{get:()=>e[n],enumerable:!(i=Nt(e,n))||i.enumerable});return r},ue=(r,e,t)=>(ce(r,e,"default"),t&&ce(t,e,"default")),Yt=(r,e,t)=>(t=r!=null?Ht(Wt(r)):{},ce(e||!r||!r.__esModule?k(t,"default",{value:r,enumerable:!0}):t,r)),Xt=r=>ce(k({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(Vt(r,typeof e!="symbol"?e+"":e,t),t);var $t=Ot((vo,zt)=>{zt.exports=globalThis.luma});var ae={};jt(ae,{Adapter:()=>Ae,Buffer:()=>d,CanvasContext:()=>$,CommandBuffer:()=>re,CommandEncoder:()=>te,ComputePass:()=>ee,ComputePipeline:()=>Z,Device:()=>C,DeviceFeatures:()=>ve,DeviceLimits:()=>we,ExternalTexture:()=>q,Framebuffer:()=>J,PipelineLayout:()=>oe,QuerySet:()=>se,RenderPass:()=>S,RenderPipeline:()=>Q,Resource:()=>u,Sampler:()=>I,Shader:()=>K,Texture:()=>g,TextureFormatDecoder:()=>Y,TextureView:()=>X,TransformFeedback:()=>ne,UniformBlock:()=>N,UniformBufferLayout:()=>H,UniformStore:()=>Re,VertexArray:()=>ie,_getTextureFormatDefinition:()=>j,_getTextureFormatTable:()=>xt,getAttributeInfosFromLayouts:()=>Je,getAttributeShaderTypeInfo:()=>Ce,getDataType:()=>ge,getDataTypeInfo:()=>F,getNormalizedDataType:()=>pe,getScratchArray:()=>Lt,getTypedArrayConstructor:()=>dt,getVariableShaderTypeInfo:()=>_e,getVertexFormatFromAttribute:()=>pt,getVertexFormatInfo:()=>E,log:()=>l,luma:()=>Pt,makeVertexFormat:()=>Fe,readPixel:()=>Mt,textureFormatDecoder:()=>_,writePixel:()=>Ft});function W(){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 P=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=W(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(W()-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 D=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:i}=e,n=this.stats[t];return n||(e instanceof P?n=e:n=new P(t,i),this.stats[t]=n),n}};var Le=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new D({id:e})),this.stats.get(e)}},fe=new Le;var le=globalThis,qt=globalThis.document||{},me=globalThis.process||{},Kt=globalThis.console,Qr=globalThis.navigator||{};function it(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)}function x(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||it()}var De="4.1.0";function Qt(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var he=class{constructor(e,t,i="sessionStorage"){this.storage=Qt(i),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 nt(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 st(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var de;(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"})(de||(de={}));var Zt=10;function ot(r){return typeof r!="string"?r:(r=r.toUpperCase(),de[r]||de.WHITE)}function at(r,e,t){return!x&&typeof r=="string"&&(e&&(r=`\x1B[${ot(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${ot(t)+Zt}m${r}\x1B[49m`)),r}function ct(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(let s of i){let o=n[s];typeof o=="function"&&(e.find(c=>s===c)||(n[s]=o.bind(r)))}}function G(r,e){if(!r)throw new Error(e||"Assertion failed")}function A(){let r;if(x()&&le.performance)r=le?.performance?.now?.();else if("hrtime"in me){let e=me?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var B={debug:x()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},er={enabled:!0,level:0};function M(){}var ut={},ft={once:!0},v=class{constructor({id:e}={id:""}){this.VERSION=De,this._startTs=A(),this._deltaTs=A(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new he(`__probe-${this.id}__`,er),this.timeStamp(`${this.id} started`),ct(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((A()-this._startTs).toPrecision(10))}getDelta(){return Number((A()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[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){return this._getLogFunction(0,e,B.warn,arguments,ft)}error(e){return this._getLogFunction(0,e,B.error,arguments)}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){return this._getLogFunction(e,t,B.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,B.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,B.debug||B.info,arguments,ft)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||M,i&&[i],{tag:rr(t)}):M}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||M)}group(e,t,i={collapsed:!1}){let n=lt({logLevel:e,message:t,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||M)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=mt(e)}_getLogFunction(e,t,i,n,s){if(this._shouldLog(e)){s=lt({logLevel:e,message:t,args:n,opts:s}),i=i||s.method,G(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=A();let o=s.tag||s.message;if(s.once&&o)if(!ut[o])ut[o]=A();else return M;return t=tr(this.id,s.message,s),i.bind(console,t,...s.args)}return M}};v.VERSION=De;function mt(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 G(Number.isFinite(e)&&e>=0),e}function lt(r){let{logLevel:e,message:t}=r;r.logLevel=mt(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return G(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function tr(r,e,t){if(typeof e=="string"){let i=t.time?st(nt(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=at(e,t.color,t.background)}return e}function rr(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var Si=new v({id:"@probe.gl/log"});var l=new v({id:"luma.gl"});var Be={};function T(r="id"){Be[r]=Be[r]||1;let e=Be[r]++;return`${r}-${e}`}var u=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,i){if(!e)throw new Error("no device");this._device=e,this.props=ir(t,i);let n=this.props.id!=="undefined"?this.props.id:T(this[Symbol.toStringTag]);this.props.id=n,this.id=n,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 i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.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()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function ir(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}var V=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&V.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array&&(i.indexType="uint16")),delete i.data,super(e,i,V.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:i,V.DEBUG_DATA_MAX_LENGTH);n===null?this.debugData=new ArrayBuffer(s):t===0&&i===n.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},d=V;a(d,"INDEX",16),a(d,"VERTEX",32),a(d,"UNIFORM",64),a(d,"STORAGE",128),a(d,"INDIRECT",256),a(d,"QUERY_RESOLVE",512),a(d,"MAP_READ",1),a(d,"MAP_WRITE",2),a(d,"COPY_SRC",4),a(d,"COPY_DST",8),a(d,"DEBUG_DATA_MAX_LENGTH",32),a(d,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});function F(r){let[e,t,i]=Me[r],n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:i,normalized:n,integer:s,signed:o}}function pe(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 ht(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function ge(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Me).find(i=>e===i[4]);if(!t)throw new Error(e.name);return t[0]}function dt(r){let[,,,,e]=Me[r];return e}var Me={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 E(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,i]=r.split("x"),n=t,s=i?parseInt(i):1,o=F(n),c={type:n,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function Fe(r,e,t){let i=t?pe(r):r;switch(i){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${i}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`${i}x${e}`;default:return e===1?i:`${i}x${e}`}}function pt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=ge(r);return Fe(n,i,t)}function gt(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 b="texture-compression-bc",m="texture-compression-astc",y="texture-compression-etc2",nr="texture-compression-etc1-webgl",be="texture-compression-pvrtc-webgl",ze="texture-compression-atc-webgl",xe="float32-renderable-webgl",$e="float16-renderable-webgl",sr="rgb9e5ufloat-renderable-webgl",Ue="snorm8-renderable-webgl",O="norm16-renderable-webgl",He="snorm16-renderable-webgl",ye="float32-filterable",bt="float16-filterable-webgl";function j(r){let e=yt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function xt(){return yt}var or={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Ue},rg8snorm:{render:Ue},"rgb8snorm-webgl":{},rgba8snorm:{render:Ue},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:O},rg16unorm:{render:O},"rgb16unorm-webgl":{f:O},rgba16unorm:{render:O},r16snorm:{f:He},rg16snorm:{render:He},"rgb16snorm-webgl":{f:O},rgba16snorm:{render:He},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:$e,filter:"float16-filterable-webgl"},rg16float:{render:$e,filter:bt},rgba16float:{render:$e,filter:bt},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:xe,filter:ye},rg32float:{render:!1,filter:ye},"rgb32float-webgl":{render:xe,filter:ye},rgba32float:{render:xe,filter:ye},"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:sr},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:xe},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}},ar={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:y},"etc2-rgb8unorm-srgb":{f:y},"etc2-rgb8a1unorm":{f:y},"etc2-rgb8a1unorm-srgb":{f:y},"etc2-rgba8unorm":{f:y},"etc2-rgba8unorm-srgb":{f:y},"eac-r11unorm":{f:y},"eac-r11snorm":{f:y},"eac-rg11unorm":{f:y},"eac-rg11snorm":{f:y},"astc-4x4-unorm":{f:m},"astc-4x4-unorm-srgb":{f:m},"astc-5x4-unorm":{f:m},"astc-5x4-unorm-srgb":{f:m},"astc-5x5-unorm":{f:m},"astc-5x5-unorm-srgb":{f:m},"astc-6x5-unorm":{f:m},"astc-6x5-unorm-srgb":{f:m},"astc-6x6-unorm":{f:m},"astc-6x6-unorm-srgb":{f:m},"astc-8x5-unorm":{f:m},"astc-8x5-unorm-srgb":{f:m},"astc-8x6-unorm":{f:m},"astc-8x6-unorm-srgb":{f:m},"astc-8x8-unorm":{f:m},"astc-8x8-unorm-srgb":{f:m},"astc-10x5-unorm":{f:m},"astc-10x5-unorm-srgb":{f:m},"astc-10x6-unorm":{f:m},"astc-10x6-unorm-srgb":{f:m},"astc-10x8-unorm":{f:m},"astc-10x8-unorm-srgb":{f:m},"astc-10x10-unorm":{f:m},"astc-10x10-unorm-srgb":{f:m},"astc-12x10-unorm":{f:m},"astc-12x10-unorm-srgb":{f:m},"astc-12x12-unorm":{f:m},"astc-12x12-unorm-srgb":{f:m},"pvrtc-rgb4unorm-webgl":{f:be},"pvrtc-rgba4unorm-webgl":{f:be},"pvrtc-rbg2unorm-webgl":{f:be},"pvrtc-rgba2unorm-webgl":{f:be},"etc1-rbg-unorm-webgl":{f:nr},"atc-rgb-unorm-webgl":{f:ze},"atc-rgba-unorm-webgl":{f:ze},"atc-rgbai-unorm-webgl":{f:ze}},yt={...or,...ar};var cr=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],ur=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,Y=class{getInfo(e){return wt(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 cr.some(t=>e.startsWith(t))}getCapabilities(e){let t=j(e),i={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=wt(e),s=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,c=n?.integer,f=n?.webgl;return i.render&&=!o,i.filter&&=!s&&!o&&!c&&!f,i}},_=new Y;function wt(r){let e=fr(r);if(_.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let i=lr(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=ur.exec(r);if(t){let[,i,n,s,o,c]=t,f=`${s}${n}`,h=F(f),p=h.byteLength*8,L=i.length,Ut=[p,L>=2?p:0,L>=3?p:0,L>=4?p:0];e={format:r,attachment:e.attachment,dataType:h.signedType,components:L,channels:i,integer:h.integer,signed:h.signed,normalized:h.normalized,bitsPerChannel:Ut,bytesPerPixel:h.byteLength*i.length,packed:e.packed,srgb:e.srgb},c==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function fr(r){let e=j(r),t=e.bytesPerPixel||1,i=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:i,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 lr(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,n]=t;return{blockWidth:Number(i),blockHeight:Number(n)}}return null}function vt(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 Tt(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 we=class{},ve=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)}},Ne=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=fe;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...Ne.defaultProps,...e},this.id=this.props.id||T(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return E(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return _.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let n=Math.max(e,t,i);return 1+Math.floor(Math.log2(n))}isExternalImage(e){return vt(e)}getExternalImageSize(e){return Tt(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 _.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,...i){return this.props.onError(e,t)?()=>{}:l.error(e.message,t,...i)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
- or create a device with the 'debug: true' prop.`;l.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=_.getCapabilities(e),i=s=>(typeof s=="string"?this.features.has(s):s)??!0,n=i(t.create);return{format:e,create:n,render:n&&i(t.render),filter:n&&i(t.filter),blend:n&&i(t.blend),store:n&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&d.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},C=Ne;a(C,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,n]=e.getDevicePixelSize();l.log(1,`${e} resized => ${i}x${n}px`)()},onPositionChange:(e,t)=>{let[i,n]=e.getPosition();l.log(1,`${e} repositioned => ${i},${n}`)()},onVisibilityChange:e=>l.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>l.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:l.get("debug")||void 0,debugShaders:l.get("debug-shaders")||void 0,debugFramebuffers:Boolean(l.get("debug-framebuffers")),debugFactories:Boolean(l.get("debug-factories")),debugWebGL:Boolean(l.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 mr="set luma.log.level=1 (or higher) to trace rendering",St="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Se=class{stats=fe;log=l;VERSION="9.2.0-alpha.6";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${mr}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Se.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(St);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),n=i&&this.selectAdapter(i,t.adapters);if(!n)throw new Error(St);return await n?.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(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let n of t)if(i.get(n)?.isSupported?.())return n;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let n=this._getAdapterMap(t);return i&&n.get(i)||null}enforceWebGL2(e=!0,t=[]){let n=this._getAdapterMap(t).get("webgl");n||l.warn("enforceWebGL2: webgl adapter not found")(),n?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Se.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);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?l.warn("WebGL1 is not supported",e)():l.warn("Unknown handle type",e)(),null)}},Te=Se;a(Te,"defaultProps",{...C.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var Pt=new Te;var Ae=class{get pageLoaded(){return pr()}},hr=x()&&typeof document<"u",dr=()=>hr&&document.readyState==="complete",Pe=null;function pr(){return Pe||(dr()||typeof window>"u"?Pe=Promise.resolve():Pe=new Promise(r=>window.addEventListener("load",()=>r()))),Pe}function At(){let r,e;return{promise:new Promise((i,n)=>{r=i,e=n}),resolve:r,reject:e}}var z=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=At();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...z.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,x()?e.canvas?typeof e.canvas=="string"?this.canvas=br(e.canvas):this.canvas=e.canvas:this.canvas=xr(e):this.canvas={width:e.width||1,height:e.height||1},z.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):z.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],z.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 i=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return yr(e,i,n,s,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(n=>n.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(f=>f.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let i=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,s=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,o)),this.devicePixelHeight=Math.max(1,Math.min(s,c)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:i})}_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 n=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:n})}}}},$=z;a($,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function gr(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 br(r){let e=document.getElementById(r);if(!$.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function xr(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=T("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let n=gr(r?.container||null);return n.insertBefore(i,n.firstChild),i}function yr(r,e,t,i,n){let s=r,o=Et(s[0],e,t),c=_t(s[1],e,i,n),f=Et(s[0]+1,e,t),h=f===t-1?f:f-1;f=_t(s[1]+1,e,i,n);let p;return n?(f=f===0?f:f+1,p=c,c=f):p=f===i-1?f:f-1,{x:o,y:c,width:Math.max(h-o+1,1),height:Math.max(p-c+1,1)}}function Et(r,e,t){return Math.min(Math.round(r*e),t-1)}function _t(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Ee=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Ee.normalizeProps(e,t),super(e,t,Ee.defaultProps)}static normalizeProps(e,t){return t}},I=Ee;a(I,"defaultProps",{...u.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 wr={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},w=class extends u{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=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.baseDimension=wr[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 i=e.getExternalImageSize(t.data);this.width=i?.width||1,this.height=i?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&l.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof I?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let i={...t},{width:n,height:s}=i;return typeof n=="number"&&(i.width=Math.max(1,Math.ceil(n))),typeof s=="number"&&(i.height=Math.max(1,Math.ceil(s))),i}_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:i,depth:n}=this,s={...w.defaultCopyDataOptions,width:t,height:i,depth:n,...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 s.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),s.rowsPerImage=e.rowsPerImage||i,s}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),i={...w.defaultCopyExternalImageOptions,...t,...e};return i.width=Math.min(i.width,this.width-i.x),i.height=Math.min(i.height,this.height-i.y),i}},g=w;a(g,"SAMPLE",4),a(g,"STORAGE",8),a(g,"RENDER",16),a(g,"COPY_SRC",1),a(g,"COPY_DST",2),a(g,"TEXTURE",4),a(g,"RENDER_ATTACHMENT",16),a(g,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:w.TEXTURE|w.RENDER_ATTACHMENT|w.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),a(g,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),a(g,"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 ke=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,ke.defaultProps)}},X=ke;a(X,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var We=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,We.defaultProps)}},q=We;a(q,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function Ct(r,e,t){let i="",n=e.split(/\r?\n/),s=r.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=n.length;c++)for(i+=It(n[c-1],c,t);s.length>o&&s[o].lineNum===c;){let f=s[o++];i+=Ge(f,n,f.lineNum,{...t,inlineSource:!1})}for(;s.length>o;){let c=s[o++];i+=Ge(c,[],0,{...t,inlineSource:!1})}return i;case"issues":case"no":for(let c of r)i+=Ge(c,n,c.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function Ge(r,e,t,i){if(i?.inlineSource){let s=vr(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
7
+ "use strict";var __exports__=(()=>{var Ht=Object.create;var k=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Wt=Object.getPrototypeOf,Gt=Object.prototype.hasOwnProperty;var Vt=(r,e,t)=>e in r?k(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ot=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),jt=(r,e)=>{for(var t in e)k(r,t,{get:e[t],enumerable:!0})},ce=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of kt(e))!Gt.call(r,n)&&n!==t&&k(r,n,{get:()=>e[n],enumerable:!(i=Nt(e,n))||i.enumerable});return r},ue=(r,e,t)=>(ce(r,e,"default"),t&&ce(t,e,"default")),Yt=(r,e,t)=>(t=r!=null?Ht(Wt(r)):{},ce(e||!r||!r.__esModule?k(t,"default",{value:r,enumerable:!0}):t,r)),Xt=r=>ce(k({},"__esModule",{value:!0}),r);var a=(r,e,t)=>(Vt(r,typeof e!="symbol"?e+"":e,t),t);var $t=Ot((vo,zt)=>{zt.exports=globalThis.luma});var ae={};jt(ae,{Adapter:()=>Ae,Buffer:()=>h,CanvasContext:()=>$,CommandBuffer:()=>re,CommandEncoder:()=>te,ComputePass:()=>ee,ComputePipeline:()=>Z,Device:()=>C,DeviceFeatures:()=>ve,DeviceLimits:()=>we,ExternalTexture:()=>q,Framebuffer:()=>J,PipelineLayout:()=>oe,QuerySet:()=>se,RenderPass:()=>S,RenderPipeline:()=>Q,Resource:()=>u,Sampler:()=>I,Shader:()=>K,Texture:()=>g,TextureFormatDecoder:()=>Y,TextureView:()=>X,TransformFeedback:()=>ne,UniformBlock:()=>N,UniformBufferLayout:()=>H,UniformStore:()=>Re,VertexArray:()=>ie,_getTextureFormatDefinition:()=>j,_getTextureFormatTable:()=>xt,getAttributeInfosFromLayouts:()=>Je,getAttributeShaderTypeInfo:()=>Ce,getDataType:()=>ge,getDataTypeInfo:()=>F,getNormalizedDataType:()=>pe,getScratchArray:()=>Lt,getTypedArrayConstructor:()=>ht,getVariableShaderTypeInfo:()=>_e,getVertexFormatFromAttribute:()=>pt,getVertexFormatInfo:()=>E,log:()=>l,luma:()=>Pt,makeVertexFormat:()=>Fe,readPixel:()=>Mt,textureFormatDecoder:()=>_,writePixel:()=>Ft});function W(){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 P=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=W(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(W()-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 D=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:i}=e,n=this.stats[t];return n||(e instanceof P?n=e:n=new P(t,i),this.stats[t]=n),n}};var Le=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new D({id:e})),this.stats.get(e)}},fe=new Le;var le=globalThis,qt=globalThis.document||{},me=globalThis.process||{},Kt=globalThis.console,Qr=globalThis.navigator||{};function it(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)}function x(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||it()}var De="4.1.0";function Qt(r){try{let e=window[r],t="__storage_test__";return e.setItem(t,t),e.removeItem(t),e}catch{return null}}var de=class{constructor(e,t,i="sessionStorage"){this.storage=Qt(i),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 nt(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 st(r,e=8){let t=Math.max(e-r.length,0);return`${" ".repeat(t)}${r}`}var he;(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"})(he||(he={}));var Zt=10;function ot(r){return typeof r!="string"?r:(r=r.toUpperCase(),he[r]||he.WHITE)}function at(r,e,t){return!x&&typeof r=="string"&&(e&&(r=`\x1B[${ot(e)}m${r}\x1B[39m`),t&&(r=`\x1B[${ot(t)+Zt}m${r}\x1B[49m`)),r}function ct(r,e=["constructor"]){let t=Object.getPrototypeOf(r),i=Object.getOwnPropertyNames(t),n=r;for(let s of i){let o=n[s];typeof o=="function"&&(e.find(c=>s===c)||(n[s]=o.bind(r)))}}function G(r,e){if(!r)throw new Error(e||"Assertion failed")}function A(){let r;if(x()&&le.performance)r=le?.performance?.now?.();else if("hrtime"in me){let e=me?.hrtime?.();r=e[0]*1e3+e[1]/1e6}else r=Date.now();return r}var B={debug:x()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},er={enabled:!0,level:0};function M(){}var ut={},ft={once:!0},v=class{constructor({id:e}={id:""}){this.VERSION=De,this._startTs=A(),this._deltaTs=A(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new de(`__probe-${this.id}__`,er),this.timeStamp(`${this.id} started`),ct(this),Object.seal(this)}set level(e){this.setLevel(e)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((A()-this._startTs).toPrecision(10))}getDelta(){return Number((A()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._storage.setConfiguration({enabled:e}),this}setLevel(e){return this._storage.setConfiguration({level:e}),this}get(e){return this._storage.config[e]}set(e,t){this._storage.setConfiguration({[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){return this._getLogFunction(0,e,B.warn,arguments,ft)}error(e){return this._getLogFunction(0,e,B.error,arguments)}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){return this._getLogFunction(e,t,B.log,arguments,{time:!0,once:!0})}log(e,t){return this._getLogFunction(e,t,B.debug,arguments)}info(e,t){return this._getLogFunction(e,t,console.info,arguments)}once(e,t){return this._getLogFunction(e,t,B.debug||B.info,arguments,ft)}table(e,t,i){return t?this._getLogFunction(e,t,console.table||M,i&&[i],{tag:rr(t)}):M}time(e,t){return this._getLogFunction(e,t,console.time?console.time:console.info)}timeEnd(e,t){return this._getLogFunction(e,t,console.timeEnd?console.timeEnd:console.info)}timeStamp(e,t){return this._getLogFunction(e,t,console.timeStamp||M)}group(e,t,i={collapsed:!1}){let n=lt({logLevel:e,message:t,opts:i}),{collapsed:s}=i;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(e,t,i={}){return this.group(e,t,Object.assign({},i,{collapsed:!0}))}groupEnd(e){return this._getLogFunction(e,"",console.groupEnd||M)}withGroup(e,t,i){this.group(e,t)();try{i()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&this.getLevel()>=mt(e)}_getLogFunction(e,t,i,n,s){if(this._shouldLog(e)){s=lt({logLevel:e,message:t,args:n,opts:s}),i=i||s.method,G(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=A();let o=s.tag||s.message;if(s.once&&o)if(!ut[o])ut[o]=A();else return M;return t=tr(this.id,s.message,s),i.bind(console,t,...s.args)}return M}};v.VERSION=De;function mt(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 G(Number.isFinite(e)&&e>=0),e}function lt(r){let{logLevel:e,message:t}=r;r.logLevel=mt(e);let i=r.args?Array.from(r.args):[];for(;i.length&&i.shift()!==t;);switch(typeof e){case"string":case"function":t!==void 0&&i.unshift(t),r.message=e;break;case"object":Object.assign(r,e);break;default:}typeof r.message=="function"&&(r.message=r.message());let n=typeof r.message;return G(n==="string"||n==="object"),Object.assign(r,{args:i},r.opts)}function tr(r,e,t){if(typeof e=="string"){let i=t.time?st(nt(t.total)):"";e=t.time?`${r}: ${i} ${e}`:`${r}: ${e}`,e=at(e,t.color,t.background)}return e}function rr(r){for(let e in r)for(let t in r[e])return t||"untitled";return"empty"}globalThis.probe={};var Si=new v({id:"@probe.gl/log"});var l=new v({id:"luma.gl"});var Be={};function T(r="id"){Be[r]=Be[r]||1;let e=Be[r]++;return`${r}-${e}`}var u=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,i){if(!e)throw new Error("no device");this._device=e,this.props=ir(t,i);let n=this.props.id!=="undefined"?this.props.id:T(this[Symbol.toStringTag]);this.props.id=n,this.id=n,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 i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.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()}};a(u,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function ir(r,e){let t={...e};for(let i in r)r[i]!==void 0&&(t[i]=r[i]);return t}var V=class extends u{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){let i={...t};(t.usage||0)&V.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?i.indexType="uint32":t.data instanceof Uint16Array&&(i.indexType="uint16")),delete i.data,super(e,i,V.defaultProps),this.usage=i.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}debugData=new ArrayBuffer(0);_setDebugData(e,t,i){let n=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:i,V.DEBUG_DATA_MAX_LENGTH);n===null?this.debugData=new ArrayBuffer(s):t===0&&i===n.byteLength?this.debugData=n.slice(0,s):this.debugData=n.slice(t,t+s)}},h=V;a(h,"INDEX",16),a(h,"VERTEX",32),a(h,"UNIFORM",64),a(h,"STORAGE",128),a(h,"INDIRECT",256),a(h,"QUERY_RESOLVE",512),a(h,"MAP_READ",1),a(h,"MAP_WRITE",2),a(h,"COPY_SRC",4),a(h,"COPY_DST",8),a(h,"DEBUG_DATA_MAX_LENGTH",32),a(h,"defaultProps",{...u.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});function F(r){let[e,t,i]=Me[r],n=r.includes("norm"),s=!n&&!r.startsWith("float"),o=r.startsWith("s");return{signedType:e,primitiveType:t,byteLength:i,normalized:n,integer:s,signed:o}}function pe(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 dt(r,e){switch(e){case 1:return r;case 2:return r+r%2;default:return r+(4-r%4)%4}}function ge(r){let e=ArrayBuffer.isView(r)?r.constructor:r;if(e===Uint8ClampedArray)return"uint8";let t=Object.values(Me).find(i=>e===i[4]);if(!t)throw new Error(e.name);return t[0]}function ht(r){let[,,,,e]=Me[r];return e}var Me={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 E(r){let e;r.endsWith("-webgl")&&(r.replace("-webgl",""),e=!0);let[t,i]=r.split("x"),n=t,s=i?parseInt(i):1,o=F(n),c={type:n,components:s,byteLength:o.byteLength*s,integer:o.integer,signed:o.signed,normalized:o.normalized};return e&&(c.webglOnly=!0),c}function Fe(r,e,t){let i=t?pe(r):r;switch(i){case"unorm8":return e===1?"unorm8":e===3?"unorm8x3-webgl":`${i}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`${i}x${e}`;default:return e===1?i:`${i}x${e}`}}function pt(r,e,t){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=ge(r);return Fe(n,i,t)}function gt(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 b="texture-compression-bc",m="texture-compression-astc",y="texture-compression-etc2",nr="texture-compression-etc1-webgl",be="texture-compression-pvrtc-webgl",ze="texture-compression-atc-webgl",xe="float32-renderable-webgl",$e="float16-renderable-webgl",sr="rgb9e5ufloat-renderable-webgl",Ue="snorm8-renderable-webgl",O="norm16-renderable-webgl",He="snorm16-renderable-webgl",ye="float32-filterable",bt="float16-filterable-webgl";function j(r){let e=yt[r];if(!e)throw new Error(`Unsupported texture format ${r}`);return e}function xt(){return yt}var or={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:Ue},rg8snorm:{render:Ue},"rgb8snorm-webgl":{},rgba8snorm:{render:Ue},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:O},rg16unorm:{render:O},"rgb16unorm-webgl":{f:O},rgba16unorm:{render:O},r16snorm:{f:He},rg16snorm:{render:He},"rgb16snorm-webgl":{f:O},rgba16snorm:{render:He},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:$e,filter:"float16-filterable-webgl"},rg16float:{render:$e,filter:bt},rgba16float:{render:$e,filter:bt},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:xe,filter:ye},rg32float:{render:!1,filter:ye},"rgb32float-webgl":{render:xe,filter:ye},rgba32float:{render:xe,filter:ye},"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:sr},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:xe},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}},ar={"bc1-rgb-unorm-webgl":{f:b},"bc1-rgb-unorm-srgb-webgl":{f:b},"bc1-rgba-unorm":{f:b},"bc1-rgba-unorm-srgb":{f:b},"bc2-rgba-unorm":{f:b},"bc2-rgba-unorm-srgb":{f:b},"bc3-rgba-unorm":{f:b},"bc3-rgba-unorm-srgb":{f:b},"bc4-r-unorm":{f:b},"bc4-r-snorm":{f:b},"bc5-rg-unorm":{f:b},"bc5-rg-snorm":{f:b},"bc6h-rgb-ufloat":{f:b},"bc6h-rgb-float":{f:b},"bc7-rgba-unorm":{f:b},"bc7-rgba-unorm-srgb":{f:b},"etc2-rgb8unorm":{f:y},"etc2-rgb8unorm-srgb":{f:y},"etc2-rgb8a1unorm":{f:y},"etc2-rgb8a1unorm-srgb":{f:y},"etc2-rgba8unorm":{f:y},"etc2-rgba8unorm-srgb":{f:y},"eac-r11unorm":{f:y},"eac-r11snorm":{f:y},"eac-rg11unorm":{f:y},"eac-rg11snorm":{f:y},"astc-4x4-unorm":{f:m},"astc-4x4-unorm-srgb":{f:m},"astc-5x4-unorm":{f:m},"astc-5x4-unorm-srgb":{f:m},"astc-5x5-unorm":{f:m},"astc-5x5-unorm-srgb":{f:m},"astc-6x5-unorm":{f:m},"astc-6x5-unorm-srgb":{f:m},"astc-6x6-unorm":{f:m},"astc-6x6-unorm-srgb":{f:m},"astc-8x5-unorm":{f:m},"astc-8x5-unorm-srgb":{f:m},"astc-8x6-unorm":{f:m},"astc-8x6-unorm-srgb":{f:m},"astc-8x8-unorm":{f:m},"astc-8x8-unorm-srgb":{f:m},"astc-10x5-unorm":{f:m},"astc-10x5-unorm-srgb":{f:m},"astc-10x6-unorm":{f:m},"astc-10x6-unorm-srgb":{f:m},"astc-10x8-unorm":{f:m},"astc-10x8-unorm-srgb":{f:m},"astc-10x10-unorm":{f:m},"astc-10x10-unorm-srgb":{f:m},"astc-12x10-unorm":{f:m},"astc-12x10-unorm-srgb":{f:m},"astc-12x12-unorm":{f:m},"astc-12x12-unorm-srgb":{f:m},"pvrtc-rgb4unorm-webgl":{f:be},"pvrtc-rgba4unorm-webgl":{f:be},"pvrtc-rbg2unorm-webgl":{f:be},"pvrtc-rgba2unorm-webgl":{f:be},"etc1-rbg-unorm-webgl":{f:nr},"atc-rgb-unorm-webgl":{f:ze},"atc-rgba-unorm-webgl":{f:ze},"atc-rgbai-unorm-webgl":{f:ze}},yt={...or,...ar};var cr=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],ur=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,Y=class{getInfo(e){return wt(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 cr.some(t=>e.startsWith(t))}getCapabilities(e){let t=j(e),i={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},n=wt(e),s=e.startsWith("depth")||e.startsWith("stencil"),o=n?.signed,c=n?.integer,f=n?.webgl;return i.render&&=!o,i.filter&&=!s&&!o&&!c&&!f,i}},_=new Y;function wt(r){let e=fr(r);if(_.isCompressed(r)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0;let i=lr(r);i&&(e.blockWidth=i.blockWidth,e.blockHeight=i.blockHeight)}let t=ur.exec(r);if(t){let[,i,n,s,o,c]=t,f=`${s}${n}`,d=F(f),p=d.byteLength*8,L=i.length,Ut=[p,L>=2?p:0,L>=3?p:0,L>=4?p:0];e={format:r,attachment:e.attachment,dataType:d.signedType,components:L,channels:i,integer:d.integer,signed:d.signed,normalized:d.normalized,bitsPerChannel:Ut,bytesPerPixel:d.byteLength*i.length,packed:e.packed,srgb:e.srgb},c==="-webgl"&&(e.webgl=!0),o==="-srgb"&&(e.srgb=!0)}return r.endsWith("-webgl")&&(e.webgl=!0),r.endsWith("-srgb")&&(e.srgb=!0),e}function fr(r){let e=j(r),t=e.bytesPerPixel||1,i=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:i,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 lr(r){let t=/.*-(\d+)x(\d+)-.*/.exec(r);if(t){let[,i,n]=t;return{blockWidth:Number(i),blockHeight:Number(n)}}return null}function vt(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 Tt(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 we=class{},ve=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)}},Ne=class{get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}id;props;userData={};statsManager=fe;timestamp=0;_reused=!1;_lumaData={};_textureCaps={};constructor(e){this.props={...Ne.defaultProps,...e},this.id=this.props.id||T(this[Symbol.toStringTag].toLowerCase())}getVertexFormatInfo(e){return E(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return _.getInfo(e)}getTextureFormatCapabilities(e){let t=this._textureCaps[e];if(!t){let i=this._getDeviceTextureFormatCapabilities(e);t=this._getDeviceSpecificTextureFormatCapabilities(i),this._textureCaps[e]=t}return t}getMipLevelCount(e,t,i=1){let n=Math.max(e,t,i);return 1+Math.floor(Math.log2(n))}isExternalImage(e){return vt(e)}getExternalImageSize(e){return Tt(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 _.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,...i){return this.props.onError(e,t)?()=>{}:l.error(e.message,t,...i)}debug(){if(this.props.debug)debugger;else{let e=`'Type luma.log.set({debug: true}) in console to enable debug breakpoints',
8
+ or create a device with the 'debug: true' prop.`;l.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=_.getCapabilities(e),i=s=>(typeof s=="string"?this.features.has(s):s)??!0,n=i(t.create);return{format:e,create:n,render:n&&i(t.render),filter:n&&i(t.filter),blend:n&&i(t.blend),store:n&&i(t.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};if((e.usage||0)&h.INDEX&&(e.indexType||(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array&&(t.indexType="uint16")),!t.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return t}},C=Ne;a(C,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,t)=>{},onResize:(e,t)=>{let[i,n]=e.getDevicePixelSize();l.log(1,`${e} resized => ${i}x${n}px`)()},onPositionChange:(e,t)=>{let[i,n]=e.getPosition();l.log(1,`${e} repositioned => ${i},${n}`)()},onVisibilityChange:e=>l.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,t)=>l.log(1,`${e} DPR changed ${t.oldRatio} => ${e.devicePixelRatio}`)(),debug:l.get("debug")||void 0,debugShaders:l.get("debug-shaders")||void 0,debugFramebuffers:Boolean(l.get("debug-framebuffers")),debugFactories:Boolean(l.get("debug-factories")),debugWebGL:Boolean(l.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 mr="set luma.log.level=1 (or higher) to trace rendering",St="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",Se=class{stats=fe;log=l;VERSION="9.2.0-beta.2";spector;preregisteredAdapters=new Map;constructor(){if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw l.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),l.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");l.error("This version of luma.gl has already been initialized")()}l.log(1,`${this.VERSION} - ${mr}`)(),globalThis.luma=this}async createDevice(e={}){let t={...Se.defaultProps,...e},i=this.selectAdapter(t.type,t.adapters);if(!i)throw new Error(St);return t.waitForPageLoad&&await i.pageLoaded,await i.create(t)}async attachDevice(e,t){let i=this._getTypeFromHandle(e,t.adapters),n=i&&this.selectAdapter(i,t.adapters);if(!n)throw new Error(St);return await n?.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(([,i])=>i).filter(i=>i.isSupported?.()).map(i=>i.type)}getBestAvailableAdapterType(e=[]){let t=["webgpu","webgl","null"],i=this._getAdapterMap(e);for(let n of t)if(i.get(n)?.isSupported?.())return n;return null}selectAdapter(e,t=[]){let i=e;e==="best-available"&&(i=this.getBestAvailableAdapterType(t));let n=this._getAdapterMap(t);return i&&n.get(i)||null}enforceWebGL2(e=!0,t=[]){let n=this._getAdapterMap(t).get("webgl");n||l.warn("enforceWebGL2: webgl adapter not found")(),n?.enforceWebGL2?.(e)}setDefaultDeviceProps(e){Object.assign(Se.defaultProps,e)}_getAdapterMap(e=[]){let t=new Map(this.preregisteredAdapters);for(let i of e)t.set(i.type,i);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?l.warn("WebGL1 is not supported",e)():l.warn("Unknown handle type",e)(),null)}},Te=Se;a(Te,"defaultProps",{...C.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});var Pt=new Te;var Ae=class{get pageLoaded(){return pr()}},dr=x()&&typeof document<"u",hr=()=>dr&&document.readyState==="complete",Pe=null;function pr(){return Pe||(hr()||typeof window>"u"?Pe=Promise.resolve():Pe=new Promise(r=>window.addEventListener("load",()=>r()))),Pe}function At(){let r,e;return{promise:new Promise((i,n)=>{r=i,e=n}),resolve:r,reject:e}}var z=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=At();_resizeObserver;_intersectionObserver;_position;destroyed=!1;toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...z.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,x()?e.canvas?typeof e.canvas=="string"?this.canvas=br(e.canvas):this.canvas=e.canvas:this.canvas=xr(e):this.canvas={width:e.width||1,height:e.height||1},z.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):z.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],z.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 i=this.cssToDeviceRatio(),[n,s]=this.getDrawingBufferSize();return yr(e,i,n,s,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(n=>n.target===this.canvas);if(!t)return;let i=t.isIntersecting;this.isVisible!==i&&(this.isVisible=i,this.device.props.onVisibilityChange(this))}_handleResize(e){let t=e.find(f=>f.target===this.canvas);if(!t)return;this.cssWidth=t.contentBoxSize[0].inlineSize,this.cssHeight=t.contentBoxSize[0].blockSize;let i=this.getDevicePixelSize(),n=t.devicePixelContentBoxSize?.[0].inlineSize||t.contentBoxSize[0].inlineSize*devicePixelRatio,s=t.devicePixelContentBoxSize?.[0].blockSize||t.contentBoxSize[0].blockSize*devicePixelRatio,[o,c]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(n,o)),this.devicePixelHeight=Math.max(1,Math.min(s,c)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:i})}_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 n=this._position;this._position=t,this.device.props.onPositionChange?.(this,{oldPosition:n})}}}},$=z;a($,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});function gr(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 br(r){let e=document.getElementById(r);if(!$.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function xr(r){let{width:e,height:t}=r,i=document.createElement("canvas");i.id=T("lumagl-auto-created-canvas"),i.width=e||1,i.height=t||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(t)?`${t}px`:"100%",r?.visible||(i.style.visibility="hidden");let n=gr(r?.container||null);return n.insertBefore(i,n.firstChild),i}function yr(r,e,t,i,n){let s=r,o=Et(s[0],e,t),c=_t(s[1],e,i,n),f=Et(s[0]+1,e,t),d=f===t-1?f:f-1;f=_t(s[1]+1,e,i,n);let p;return n?(f=f===0?f:f+1,p=c,c=f):p=f===i-1?f:f-1,{x:o,y:c,width:Math.max(d-o+1,1),height:Math.max(p-c+1,1)}}function Et(r,e,t){return Math.min(Math.round(r*e),t-1)}function _t(r,e,t,i){return i?Math.max(0,t-1-Math.round(r*e)):Math.min(Math.round(r*e),t-1)}var Ee=class extends u{get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=Ee.normalizeProps(e,t),super(e,t,Ee.defaultProps)}static normalizeProps(e,t){return t}},I=Ee;a(I,"defaultProps",{...u.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 wr={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},w=class extends u{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=w.normalizeProps(e,t),super(e,t,w.defaultProps),this.dimension=this.props.dimension,this.baseDimension=wr[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 i=e.getExternalImageSize(t.data);this.width=i?.width||1,this.height=i?.height||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&l.warn(`${this} created with undefined width or height. This is deprecated. Use AsyncTexture instead.`)();this.updateTimestamp=e.incrementTimestamp()}setSampler(e){this.sampler=e instanceof I?e:this.device.createSampler(e)}clone(e){return this.device.createTexture({...this.props,...e})}static normalizeProps(e,t){let i={...t},{width:n,height:s}=i;return typeof n=="number"&&(i.width=Math.max(1,Math.ceil(n))),typeof s=="number"&&(i.height=Math.max(1,Math.ceil(s))),i}_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:i,depth:n}=this,s={...w.defaultCopyDataOptions,width:t,height:i,depth:n,...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 s.bytesPerRow=e.bytesPerRow||t*(o.bytesPerPixel||4),s.rowsPerImage=e.rowsPerImage||i,s}_normalizeCopyExternalImageOptions(e){let t=this.device.getExternalImageSize(e.image),i={...w.defaultCopyExternalImageOptions,...t,...e};return i.width=Math.min(i.width,this.width-i.x),i.height=Math.min(i.height,this.height-i.y),i}},g=w;a(g,"SAMPLE",4),a(g,"STORAGE",8),a(g,"RENDER",16),a(g,"COPY_SRC",1),a(g,"COPY_DST",2),a(g,"TEXTURE",4),a(g,"RENDER_ATTACHMENT",16),a(g,"defaultProps",{...u.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:w.TEXTURE|w.RENDER_ATTACHMENT|w.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),a(g,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),a(g,"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 ke=class extends u{get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,ke.defaultProps)}},X=ke;a(X,"defaultProps",{...u.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});var We=class extends u{get[Symbol.toStringTag](){return"ExternalTexture"}constructor(e,t){super(e,t,We.defaultProps)}},q=We;a(q,"defaultProps",{...u.defaultProps,source:void 0,colorSpace:"srgb"});function Ct(r,e,t){let i="",n=e.split(/\r?\n/),s=r.slice().sort((o,c)=>o.lineNum-c.lineNum);switch(t?.showSourceCode||"no"){case"all":let o=0;for(let c=1;c<=n.length;c++)for(i+=It(n[c-1],c,t);s.length>o&&s[o].lineNum===c;){let f=s[o++];i+=Ge(f,n,f.lineNum,{...t,inlineSource:!1})}for(;s.length>o;){let c=s[o++];i+=Ge(c,[],0,{...t,inlineSource:!1})}return i;case"issues":case"no":for(let c of r)i+=Ge(c,n,c.lineNum,{inlineSource:t?.showSourceCode!=="no"});return i}}function Ge(r,e,t,i){if(i?.inlineSource){let s=vr(e,t),o=r.linePos>0?`${" ".repeat(r.linePos+5)}^^^
9
9
  `:"";return`
10
10
  ${s}${o}${r.type.toUpperCase()}: ${r.message}
11
11
 
@@ -14,6 +14,6 @@ ${s}${o}${r.type.toUpperCase()}: ${r.message}
14
14
  <h1>Compilation error in ${n}</h1><br /><br />
15
15
  <code style="user-select:text;"><pre>
16
16
  ${s}
17
- </pre></code>`,c.style.top="10px",c.style.left="10px",c.style.position="absolute",c.style.zIndex="9999",c.style.width="100%",c.style.textAlign="left",document.body.appendChild(c),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),c.onclick=()=>{let h=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(h)}}},K=Ve;a(K,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function Pr(r){return Ar(r.source)||r.id||T(`unnamed ${r.stage}-shader`)}function Ar(r,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return i?i[1]:e}var Oe=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,Oe.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(n=>n.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||i!==this.width,this.width=i,this.height=n}t&&(l.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,i)=>{if(typeof t=="string"){let n=this.createColorTexture(t,i);return this.attachResource(n),n.view}return t instanceof g?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 g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:g.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:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.colorAttachments[i].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},J=Oe;a(J,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var je=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,je.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},Q=je;a(Q,"defaultProps",{...u.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 R=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=R.normalizeProps(e,t),super(e,t,R.defaultProps)}static normalizeProps(e,t){return t}},S=R;a(S,"defaultClearColor",[0,0,0,1]),a(S,"defaultClearDepth",1),a(S,"defaultClearStencil",0),a(S,"defaultProps",{...u.defaultProps,framebuffer:null,parameters:void 0,clearColor:R.defaultClearColor,clearColors:void 0,clearDepth:R.defaultClearDepth,clearStencil:R.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ye=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ye.defaultProps),this.shaderLayout=t.shaderLayout}},Z=Ye;a(Z,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Xe=class extends u{constructor(e,t){super(e,t,Xe.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},ee=Xe;a(ee,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var qe=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,qe.defaultProps)}},te=qe;a(te,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var Ke=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,Ke.defaultProps)}},re=Ke;a(re,"defaultProps",{...u.defaultProps});function _e(r){return Cr[r]}function Ce(r){let[e,t]=_r[r],i=e==="i32"||e==="u32",n=e!=="u32",s=Er[e]*t;return{primitiveType:e,components:t,byteLength:s,integer:i,signed:n}}var Er={f32:4,f16:2,i32:4,u32:4},_r={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]},Cr={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}},Ir={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>"},rs={...Ir,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 Je(r,e){let t={};for(let i of r.attributes){let n=Rr(r,e,i.name);n&&(t[i.name]=n)}return t}function Rt(r,e,t=16){let i=Je(r,e),n=new Array(t).fill(null);for(let s of Object.values(i))n[s.location]=s;return n}function Rr(r,e,t){let i=Lr(r,t),n=Dr(e,t);if(!i)return null;let s=Ce(i.type),o=gt(s),c=n?.vertexFormat||o,f=E(c);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:s.primitiveType,shaderComponents:s.components,vertexFormat:c,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:s.integer,stepMode:n?.stepMode||i.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Lr(r,e){let t=r.attributes.find(i=>i.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Dr(r,e){Br(r);let t=Mr(r,e);return t||(t=Fr(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Br(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Mr(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Fr(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let o=E(s.format);i+=o.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}var Qe=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Qe.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=Rt(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},ie=Qe;a(ie,"defaultProps",{...u.defaultProps,shaderLayout:void 0,bufferLayout:[]});var Ze=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ze.defaultProps)}},ne=Ze;a(ne,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var et=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,et.defaultProps)}},se=et;a(se,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var tt=class extends u{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,tt.defaultProps)}},oe=tt;a(oe,"defaultProps",{...u.defaultProps,shaderLayout:{attributes:[],bindings:[]}});var Ie;function rt(r){return(!Ie||Ie.byteLength<r)&&(Ie=new ArrayBuffer(r)),Ie}function Lt(r,e){let t=rt(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function zr(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function U(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":zr(r)}var $r=1024,H=class{layout={};byteLength;constructor(e,t={}){let i=0;for(let[s,o]of Object.entries(e)){let c=_e(o),{type:f,components:h}=c,p=h*(t?.[s]??1);i=ht(i,p);let L=i;i+=p,this.layout[s]={type:f,size:p,offset:L}}i+=(4-i%4)%4;let n=i*4;this.byteLength=Math.max(n,$r)}getData(e){let t=rt(this.byteLength),i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[n,s]of Object.entries(e)){let o=this.layout[n];if(!o){l.warn(`Supplied uniform value ${n} not present in uniform block layout`)();continue}let{type:c,size:f,offset:h}=o,p=i[c];if(f===1){if(typeof s!="number"&&typeof s!="boolean"){l.warn(`Supplied value for single component uniform ${n} is not a number: ${s}`)();continue}p[h]=Number(s)}else{if(!U(s)){l.warn(`Supplied value for multi component / array uniform ${n} is not a numeric array: ${s}`)();continue}p.set(s,h)}}return new Uint8Array(t,0,this.byteLength)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function Dt(r,e,t=16){if(r!==e)return!1;let i=r,n=e;if(!U(i))return!1;if(U(n)&&i.length===n.length){for(let s=0;s<i.length;++s)if(n[s]!==i[s])return!1}return!0}function Bt(r){return U(r)?r.slice():r}var N=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){Dt(this.uniforms[e],t)||(this.uniforms[e]=Bt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Re=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let n=t,s=new H(i.uniformTypes??{},i.uniformSizes??{});this.uniformBufferLayouts.set(n,s);let o=new N({name:t});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:n}),o=this.getUniformBufferData(t);return s.write(o),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:d.UNIFORM|d.COPY_DST,byteLength:i});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&t?.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(s);let o=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return n}};function Mt(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let n=t*r.bytesPerRow+e*r.bytesPerPixel,s=new DataView(r.arrayBuffer,n,r.bytesPerPixel),o=0,c=[];for(let f=0;f<4;f++){let h=i[f];if(h<=0)c.push(0);else{let p=Ur(s,o,h);c.push(p),o+=h}}return[c[0],c[1],c[2],c[3]]}function Ft(r,e,t,i){let n=e;for(let s=0;s<4;s++){let o=t[s],c=(1<<o)-1,f=i[s]&c;Hr(r,n,o,f),n+=o}}function Ur(r,e,t){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength)return r.getUint8(n);if(t===16&&n+2<=r.byteLength)return r.getUint16(n,!1);if(t===32&&n+4<=r.byteLength)return r.getUint32(n,!1)}let i=0;for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),c=s%8,h=r.getUint8(o)>>7-c&1;i=i<<1|h}return i}function Hr(r,e,t,i){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength){r.setUint8(n,i&255);return}else if(t===16&&n+2<=r.byteLength){r.setUint16(n,i&65535,!1);return}else if(t===32&&n+4<=r.byteLength){r.setUint32(n,i,!1);return}}for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),f=1<<7-s%8,h=i>>t-1-n&1,p=r.getUint8(o);p&=~f,h&&(p|=f),r.setUint8(o,p)}}ue(ae,Yt($t(),1));return Xt(ae);})();
17
+ </pre></code>`,c.style.top="10px",c.style.left="10px",c.style.position="absolute",c.style.zIndex="9999",c.style.width="100%",c.style.textAlign="left",document.body.appendChild(c),document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView(),c.onclick=()=>{let d=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(d)}}},K=Ve;a(K,"defaultProps",{...u.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});function Pr(r){return Ar(r.source)||r.id||T(`unnamed ${r.stage}-shader`)}function Ar(r,e="unnamed"){let i=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(r);return i?i[1]:e}var Oe=class extends u{get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,Oe.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(n=>n.texture.clone(e)),i=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:i})}resize(e){let t=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];t=t||n!==this.height||i!==this.width,this.width=i,this.height=n}t&&(l.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,i)=>{if(typeof t=="string"){let n=this.createColorTexture(t,i);return this.attachResource(n),n.view}return t instanceof g?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 g?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:g.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:g.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,t){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.colorAttachments[i].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}this.updateAttachments()}},J=Oe;a(J,"defaultProps",{...u.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var je=class extends u{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,je.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}},Q=je;a(Q,"defaultProps",{...u.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 R=class extends u{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=R.normalizeProps(e,t),super(e,t,R.defaultProps)}static normalizeProps(e,t){return t}},S=R;a(S,"defaultClearColor",[0,0,0,1]),a(S,"defaultClearDepth",1),a(S,"defaultClearStencil",0),a(S,"defaultProps",{...u.defaultProps,framebuffer:null,parameters:void 0,clearColor:R.defaultClearColor,clearColors:void 0,clearDepth:R.defaultClearDepth,clearStencil:R.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var Ye=class extends u{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";shaderLayout;constructor(e,t){super(e,t,Ye.defaultProps),this.shaderLayout=t.shaderLayout}},Z=Ye;a(Z,"defaultProps",{...u.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var Xe=class extends u{constructor(e,t){super(e,t,Xe.defaultProps)}get[Symbol.toStringTag](){return"ComputePass"}},ee=Xe;a(ee,"defaultProps",{...u.defaultProps,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var qe=class extends u{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,qe.defaultProps)}},te=qe;a(te,"defaultProps",{...u.defaultProps,measureExecutionTime:void 0});var Ke=class extends u{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,Ke.defaultProps)}},re=Ke;a(re,"defaultProps",{...u.defaultProps});function _e(r){return Cr[r]}function Ce(r){let[e,t]=_r[r],i=e==="i32"||e==="u32",n=e!=="u32",s=Er[e]*t;return{primitiveType:e,components:t,byteLength:s,integer:i,signed:n}}var Er={f32:4,f16:2,i32:4,u32:4},_r={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]},Cr={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}},Ir={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>"},rs={...Ir,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 Je(r,e){let t={};for(let i of r.attributes){let n=Rr(r,e,i.name);n&&(t[i.name]=n)}return t}function Rt(r,e,t=16){let i=Je(r,e),n=new Array(t).fill(null);for(let s of Object.values(i))n[s.location]=s;return n}function Rr(r,e,t){let i=Lr(r,t),n=Dr(e,t);if(!i)return null;let s=Ce(i.type),o=gt(s),c=n?.vertexFormat||o,f=E(c);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,primitiveType:s.primitiveType,shaderComponents:s.components,vertexFormat:c,bufferDataType:f.type,bufferComponents:f.components,normalized:f.normalized,integer:s.integer,stepMode:n?.stepMode||i.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Lr(r,e){let t=r.attributes.find(i=>i.name===e);return t||l.warn(`shader layout attribute "${e}" not present in shader`),t||null}function Dr(r,e){Br(r);let t=Mr(r,e);return t||(t=Fr(r,e),t)?t:(l.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function Br(r){for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&l.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function Mr(r,e){for(let t of r)if(t.format&&t.name===e)return{attributeName:t.name,bufferName:e,stepMode:t.stepMode,vertexFormat:t.format,byteOffset:0,byteStride:t.byteStride||0};return null}function Fr(r,e){for(let t of r){let i=t.byteStride;if(typeof t.byteStride!="number")for(let s of t.attributes||[]){let o=E(s.format);i+=o.byteLength}let n=t.attributes?.find(s=>s.attribute===e);if(n)return{attributeName:n.attribute,bufferName:t.name,stepMode:t.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}var Qe=class extends u{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,Qe.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=Rt(t.shaderLayout,t.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(new Error("constant attributes not supported"),this)()}},ie=Qe;a(ie,"defaultProps",{...u.defaultProps,shaderLayout:void 0,bufferLayout:[]});var Ze=class extends u{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,Ze.defaultProps)}},ne=Ze;a(ne,"defaultProps",{...u.defaultProps,layout:void 0,buffers:{}});var et=class extends u{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,et.defaultProps)}},se=et;a(se,"defaultProps",{...u.defaultProps,type:void 0,count:void 0});var tt=class extends u{get[Symbol.toStringTag](){return"PipelineLayout"}constructor(e,t){super(e,t,tt.defaultProps)}},oe=tt;a(oe,"defaultProps",{...u.defaultProps,shaderLayout:{attributes:[],bindings:[]}});var Ie;function rt(r){return(!Ie||Ie.byteLength<r)&&(Ie=new ArrayBuffer(r)),Ie}function Lt(r,e){let t=rt(r.BYTES_PER_ELEMENT*e);return new r(t,0,e)}function zr(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function U(r){return Array.isArray(r)?r.length===0||typeof r[0]=="number":zr(r)}var $r=1024,H=class{layout={};byteLength;constructor(e,t={}){let i=0;for(let[s,o]of Object.entries(e)){let c=_e(o),{type:f,components:d}=c,p=d*(t?.[s]??1);i=dt(i,p);let L=i;i+=p,this.layout[s]={type:f,size:p,offset:L}}i+=(4-i%4)%4;let n=i*4;this.byteLength=Math.max(n,$r)}getData(e){let t=rt(this.byteLength),i={i32:new Int32Array(t),u32:new Uint32Array(t),f32:new Float32Array(t),f16:new Uint16Array(t)};for(let[n,s]of Object.entries(e)){let o=this.layout[n];if(!o){l.warn(`Supplied uniform value ${n} not present in uniform block layout`)();continue}let{type:c,size:f,offset:d}=o,p=i[c];if(f===1){if(typeof s!="number"&&typeof s!="boolean"){l.warn(`Supplied value for single component uniform ${n} is not a number: ${s}`)();continue}p[d]=Number(s)}else{if(!U(s)){l.warn(`Supplied value for multi component / array uniform ${n} is not a numeric array: ${s}`)();continue}p.set(s,d)}}return new Uint8Array(t,0,this.byteLength)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function Dt(r,e,t=16){if(r!==e)return!1;let i=r,n=e;if(!U(i))return!1;if(U(n)&&i.length===n.length){for(let s=0;s<i.length;++s)if(n[s]!==i[s])return!1}return!0}function Bt(r){return U(r)?r.slice():r}var N=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name||"unnamed",e?.name&&e?.shaderLayout){let t=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!t)throw new Error(e?.name);let i=t;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[t,i]of Object.entries(e))this._setUniform(t,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${t}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,t){Dt(this.uniforms[e],t)||(this.uniforms[e]=Bt(t),this.modifiedUniforms[e]=!0,this.modified=!0)}};var Re=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[t,i]of Object.entries(e)){let n=t,s=new H(i.uniformTypes??{},i.uniformSizes??{});this.uniformBufferLayouts.set(n,s);let o=new N({name:t});o.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,o)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[t,i]of Object.entries(e))this.uniformBlocks.get(t)?.setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e)?.byteLength||0}getUniformBufferData(e){let t=this.uniformBlocks.get(e)?.getAllUniforms()||{};return this.uniformBufferLayouts.get(e)?.getData(t)}createUniformBuffer(e,t,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(t),s=e.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:n}),o=this.getUniformBufferData(t);return s.write(o),s}getManagedUniformBuffer(e,t){if(!this.uniformBuffers.get(t)){let i=this.getUniformBufferByteLength(t),n=e.createBuffer({usage:h.UNIFORM|h.COPY_DST,byteLength:i});this.uniformBuffers.set(t,n)}return this.uniformBuffers.get(t)}updateUniformBuffers(){let e=!1;for(let t of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(t);e||=i}return e&&l.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let t=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&t?.needsRedraw){n||=t.needsRedraw;let s=this.getUniformBufferData(e);i=this.uniformBuffers.get(e),i?.write(s);let o=this.uniformBlocks.get(e)?.getAllUniforms();l.log(4,`Writing to uniform buffer ${String(e)}`,s,o)()}return n}};function Mt(r,e,t,i){if(e<0||e>=r.width||t<0||t>=r.height)throw new Error("Coordinates out of bounds.");let n=t*r.bytesPerRow+e*r.bytesPerPixel,s=new DataView(r.arrayBuffer,n,r.bytesPerPixel),o=0,c=[];for(let f=0;f<4;f++){let d=i[f];if(d<=0)c.push(0);else{let p=Ur(s,o,d);c.push(p),o+=d}}return[c[0],c[1],c[2],c[3]]}function Ft(r,e,t,i){let n=e;for(let s=0;s<4;s++){let o=t[s],c=(1<<o)-1,f=i[s]&c;Hr(r,n,o,f),n+=o}}function Ur(r,e,t){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength)return r.getUint8(n);if(t===16&&n+2<=r.byteLength)return r.getUint16(n,!1);if(t===32&&n+4<=r.byteLength)return r.getUint32(n,!1)}let i=0;for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),c=s%8,d=r.getUint8(o)>>7-c&1;i=i<<1|d}return i}function Hr(r,e,t,i){if(e%8===0){let n=e/8;if(t===8&&n+1<=r.byteLength){r.setUint8(n,i&255);return}else if(t===16&&n+2<=r.byteLength){r.setUint16(n,i&65535,!1);return}else if(t===32&&n+4<=r.byteLength){r.setUint32(n,i,!1);return}}for(let n=0;n<t;n++){let s=e+n,o=Math.floor(s/8),f=1<<7-s%8,d=i>>t-1-n&1,p=r.getUint8(o);p&=~f,d&&(p|=f),r.setUint8(o,p)}}ue(ae,Yt($t(),1));return Xt(ae);})();
18
18
  return __exports__;
19
19
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/effects",
3
- "version": "9.2.0-alpha.6",
3
+ "version": "9.2.0-beta.2",
4
4
  "description": "Post-processing effects for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,12 +46,12 @@
46
46
  "prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
47
47
  },
48
48
  "peerDependencies": {
49
- "@luma.gl/shadertools": "9.2.0-alpha.1"
49
+ "@luma.gl/shadertools": "~9.2.0-beta.1"
50
50
  },
51
51
  "dependencies": {
52
52
  "@math.gl/core": "^4.1.0",
53
53
  "@math.gl/types": "^4.1.0",
54
54
  "wgsl_reflect": "^1.0.1"
55
55
  },
56
- "gitHead": "63fe3fd0912c83f7c4a012016c57048a250b591f"
56
+ "gitHead": "03d6fda3d022f348513c01c5e953bc20be80d91a"
57
57
  }