@deck.gl/jupyter-widget 9.0.7 → 9.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -540,7 +540,7 @@ __p+='`),h}),o+=`';
540
540
  } catch (error) {
541
541
  console.error(error);
542
542
  throw error;
543
- }`}function BP(t,e=!0,r){let i=r||new Set;if(t){if(aU(t))i.add(t);else if(aU(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)BP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function aU(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var OP=()=>{},gd=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Za||typeof I0<"u"&&!Za}constructor(e){let{name:r,source:i,url:n}=e;vl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=OP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=OP,this.onError=OP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||BP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=oU({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new I0(i,{eval:!1})}else if(this.source)e=new I0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return gd.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,s)=>n.done(s),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new gd({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nU?this.maxMobileConcurrency:this.maxConcurrency}};var Dre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},KA=class{props;workerPools=new Map;static isSupported(){return gd.isSupported()}static getWorkerFarm(e={}){return KA._workerFarm=KA._workerFarm||new KA({}),KA._workerFarm.setProps(e),KA._workerFarm}constructor(e){this.props={...Dre},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Kv({name:r,source:i,url:n}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},_d=KA;Yr(_d,"_workerFarm");function DP(t,e={}){let r=e[t.id]||{},i=Za?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Za?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=rU);let s=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${s}/dist/${i}`}return vl(n),n}function LP(t,e=qv){vl(t,"no worker provided");let r=t.version;return!(!e||!r)}var FP={};async function gh(t,e=null,r={},i=null){return e&&(t=lU(t,e,r,i)),FP[t]=FP[t]||Lre(t),await FP[t]}function lU(t,e,r={},i=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:Za?r.CDN?(vl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${qv}/dist/libs/${i}`):Xv?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function Lre(t){if(t.endsWith("wasm"))return await Nre(t);if(!Za)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(t)}catch(r){return console.error(r),null}if(Xv)return importScripts(t);let e=await kre(t);return Fre(e,t)}function Fre(t,e){if(!Za){let{requireFromString:i}=globalThis.loaders||{};return i?.(t,e)}if(Xv)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function Nre(t){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await e(t)}async function kre(t){let{readFileAsText:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).text():await e(t)}function NP(t,e){return!_d.isSupported()||!Za&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function kP(t,e,r,i,n){let o=t.id,s=DP(t,r),u=_d.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let h=await u.startJob("process-on-worker",Ure.bind(null,n));return h.postMessage("process",{input:e,options:r,context:i}),await(await h.result).result}async function Ure(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:s}=i;try{let l=await t(o,s);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function uU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?cU(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?cU(t,0,e):""}function cU(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function UP(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${uU(t)}"`)}}function zP(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function VP(...t){return fU(t)}function fU(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function Zv(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=e.reduce((s,l)=>s+l.length,0),n=new r(i),o=0;for(let s of e)n.set(s,o),o+=s.length;return n}function ZA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function yd(t,e){return On(t>=0),On(e>0),t+(e-1)&~(e-1)}function jP(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+yd(i.byteLength,4)}async function HP(t){let e=[];for await(let r of t)e.push(r);return VP(...e)}function Jv(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var JA=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(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=Jv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Jv()-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 Dl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}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 r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof JA?n=e:n=new JA(r,i),this.stats[r]=n),n}};var zre="Queued Requests",Vre="Active Requests",jre="Cancelled Requests",Hre="Queued Requests Ever",Gre="Active Requests Ever",Wre={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},vd=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...Wre,...e},this.stats=new Dl({id:this.props.id}),this.stats.get(zre),this.stats.get(Vre),this.stats.get(jre),this.stats.get(Hre),this.stats.get(Gre)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var qre="",hU={};function GP(t){for(let e in hU)if(t.startsWith(e)){let r=hU[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${qre}${t}`),t}function pU(t){return t&&typeof t=="object"&&t.isBuffer}function D2(t){if(pU(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Yc={};As(Yc,{dirname:()=>Yre,filename:()=>Xre,join:()=>Kre,resolve:()=>Zre});function dU(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function Xre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Yre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function Kre(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function Zre(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",i=!1,n;for(let o=e.length-1;o>=-1&&!i;o--){let s;o>=0?s=e[o]:(n===void 0&&(n=dU()),s=n),s.length!==0&&(r=`${s}/${r}`,i=s.charCodeAt(0)===Qv)}return r=Jre(r,!i),i?`/${r}`:r.length>0?r:"."}var Qv=47,WP=46;function Jre(t,e){let r="",i=-1,n=0,o,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===Qv)break;o=Qv}if(o===Qv){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==WP||r.charCodeAt(r.length-2)!==WP){if(r.length>2){let u=r.length-1,h=u;for(;h>=0&&r.charCodeAt(h)!==Qv;--h);if(h!==u){r=h===-1?"":r.slice(0,h),i=l,n=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,s=!1}i=l,n=0}else o===WP&&n!==-1?++n:n=-1}return r}var L2=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Qre(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Qre(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Eu=class extends L2{};Yr(Eu,"type","template"),Yr(Eu,"testURL",e=>!1);var $re=t=>typeof t=="boolean",$v=t=>typeof t=="function",QA=t=>t!==null&&typeof t=="object",qP=t=>QA(t)&&t.constructor==={}.constructor;var AU=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",mU=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Su=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Cu=t=>typeof Blob<"u"&&t instanceof Blob,gU=t=>t&&typeof t=="object"&&t.isBuffer;var eie=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||QA(t)&&$v(t.tee)&&$v(t.cancel)&&$v(t.getReader);var tie=t=>QA(t)&&$v(t.read)&&$v(t.pipe)&&$re(t.readable),F2=t=>eie(t)||tie(t);var N2=class extends Error{constructor(e,r){super(e),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var rie=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,iie=/^([-\w.]+\/[-\w.+]+)/;function XP(t,e){return t.toLowerCase()===e.toLowerCase()}function _U(t){let e=iie.exec(t);return e?e[1]:t}function YP(t){let e=rie.exec(t);return e?e[1]:""}var yU=/\?.*/;function vU(t){let e=t.match(yU);return e&&e[0]}function P0(t){return t.replace(yU,"")}function xU(t){if(t.length<50)return t;let e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function $A(t){return Su(t)?t.url:Cu(t)?t.name||"":typeof t=="string"?t:""}function ex(t){if(Su(t)){let e=t,r=e.headers.get("content-type")||"",i=P0(e.url);return _U(r)||YP(i)}return Cu(t)?t.type||"":typeof t=="string"?YP(t):""}function bU(t){return Su(t)?t.headers["content-length"]||-1:Cu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function k2(t){if(Su(t))return t;let e={},r=bU(t);r>=0&&(e["content-length"]=String(r));let i=$A(t),n=ex(t);n&&(e["content-type"]=n);let o=await oie(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:i}),s}async function wU(t){if(!t.ok)throw await nie(t)}async function nie(t){let e=xU(t.url),r=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;r=r.length>100?`${r.slice(0,100)}...`:r;let i={reason:t.statusText,url:t.url,response:t};try{let n=t.headers.get("Content-Type");i.reason=n?.includes("application/json")?await t.json():t.text()}catch{}return new N2(r,i)}async function oie(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>i(o?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${sie(r)}`}return null}function sie(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function aie(t){return!lie(t)&&!cie(t)}function lie(t){return t.startsWith("http:")||t.startsWith("https:")}function cie(t){return t.startsWith("data:")}async function R0(t,e){if(typeof t=="string"){let r=GP(t);return aie(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,e):await fetch(r,e)}return await k2(t)}var KP=new xc({id:"loaders.gl"}),U2=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},z2=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var ZP={fetch:null,mimeType:void 0,nothrow:!1,log:new z2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ap,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},TU={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function JP(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function QP(){let t=JP();return t.globalOptions=t.globalOptions||{...ZP},t.globalOptions}function CU(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],uie(t,r),hie(e,t,i)}function uie(t,e){EU(t,null,ZP,TU,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};EU(i,r.id,n,o,e)}}function EU(t,e,r,i,n){let o=e||"Top level",s=e?`${e}.`:"";for(let l in t){let u=!e&&QA(t[l]),h=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in r)&&!h&&!v){if(l in i)KP.warn(`${o} loader option '${s}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let T=fie(l,n);KP.warn(`${o} loader option '${s}${l}' not recognized. ${T}`)()}}}}function fie(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function hie(t,e,r){let n={...t.options||{}};return pie(n,r),n.log===null&&(n.log=new U2),SU(n,QP()),SU(n,e),n}function SU(t,e){for(let r in e)if(r in e){let i=e[r];qP(i)&&qP(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function pie(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function tx(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function rx(t){On(t,"null loader"),On(tx(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var MU=()=>{let t=JP();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function em(t){let e=MU();t=Array.isArray(t)?t:[t];for(let r of t){let i=rx(r);e.find(n=>i===n)||e.unshift(i)}}function IU(){return MU()}var PU=new xc({id:"loaders.gl"});var die=/\.([^.]+)$/;async function OU(t,e=[],r,i){if(!DU(t))return null;let n=RU(t,e,{...r,nothrow:!0},i);if(n)return n;if(Cu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=RU(t,e,r,i)),!n&&!r?.nothrow)throw new Error(LU(t));return n}function RU(t,e=[],r,i){if(!DU(t))return null;if(e&&!Array.isArray(e))return rx(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...IU()),mie(n);let o=Aie(t,n,r,i);if(!o&&!r?.nothrow)throw new Error(LU(t));return o}function Aie(t,e,r,i){let n=$A(t),o=ex(t),s=P0(n)||i?.url,l=null,u="";return r?.mimeType&&(l=$P(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||gie(e,s),u=u||(l?`matched url ${s}`:""),l=l||$P(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||yie(e,t),u=u||(l?`matched initial data ${FU(t)}`:""),r?.fallbackMimeType&&(l=l||$P(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u&&PU.log(1,`selectLoader selected ${l?.name}: ${u}.`),l}function DU(t){return!(t instanceof Response&&t.status===204)}function LU(t){let e=$A(t),r=ex(t),i="No valid loader found (";i+=e?`${Yc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?FU(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function mie(t){for(let e of t)rx(e)}function gie(t,e){let r=e&&die.exec(e),i=r&&r[1];return i?_ie(t,i):null}function _ie(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function $P(t,e){for(let r of t)if(r.mimeTypes?.some(i=>XP(e,i))||XP(e,`application/x.${r.id}`))return r;return null}function yie(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(vie(e,r))return r}else if(ArrayBuffer.isView(e)){if(BU(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&BU(e,0,r))return r;return null}function vie(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function BU(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>xie(t,e,r,n))}function xie(t,e,r,i){if(i instanceof ArrayBuffer)return zP(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=e3(t,e,i.length);return i===n;default:return!1}}function FU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?e3(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?e3(t,0,e):""}function e3(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*NU(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),s=t.slice(i,i+o);i+=o,yield n.encode(s)}}function*kU(t,e={}){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),s=new Uint8Array(t,i,n);new Uint8Array(o).set(s),i+=n,yield o}}async function*UU(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function t3(t,e){return Ap?bie(t,e):wie(t,e)}async function*bie(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e?._streamReadAhead&&(i=r.read());let{done:o,value:s}=await n;if(o)return;yield D2(s)}}catch{r.releaseLock()}}async function*wie(t,e){for await(let r of t)yield D2(r)}function zU(t,e){if(typeof t=="string")return NU(t,e);if(t instanceof ArrayBuffer)return kU(t,e);if(Cu(t))return UU(t,e);if(F2(t))return t3(t,e);if(Su(t))return t3(t.body,e);throw new Error("makeIterator")}var VU="Cannot convert supplied data type";function Tie(t,e,r){if(e.text&&typeof t=="string")return t;if(gU(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(VU)}async function jU(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return Tie(t,e,r);if(Cu(t)&&(t=await k2(t)),Su(t)){let n=t;return await wU(n),e.binary?await n.arrayBuffer():await n.text()}if(F2(t)&&(t=zU(t,r)),AU(t)||mU(t))return HP(t);throw new Error(VU)}function V2(t,e){let r=QP(),i=t||r;return typeof i.fetch=="function"?i.fetch:QA(i.fetch)?n=>R0(n,i.fetch):e?.fetch?e?.fetch:R0}function HU(t,e,r){if(r)return r;let i={fetch:V2(e,t),...t};if(i.url){let n=P0(i.url);i.baseUrl=n,i.queryString=vU(i.url),i.filename=Yc.filename(n),i.baseUrl=Yc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function GU(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function xd(t,e,r,i){e&&!Array.isArray(e)&&!tx(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=$A(t),s=GU(e,i),l=await OU(t,s,r);return l?(r=CU(r,l,s,n),i=HU({url:n,_parse:xd,loaders:s},r,i||null),await Eie(l,t,r,i)):null}async function Eie(t,e,r,i){if(LP(t),r=Wv(t.options,r),Su(e)){let o=e,{ok:s,redirected:l,status:u,statusText:h,type:v,url:T}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:s,redirected:l,status:u,statusText:h,type:v,url:T}}e=await jU(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(NP(t,r))return await kP(t,e,r,i,xd);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw vl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function _a(t,e,r,i){let n,o;!Array.isArray(e)&&!tx(e)?(n=[],o=e,i=void 0):(n=e,o=r);let s=V2(o),l=t;return typeof t=="string"&&(l=await s(t)),Cu(t)&&(l=await s(t)),Array.isArray(n)?await xd(l,n,o):await xd(l,n,o)}var Kt=new xc({id:"luma.gl"});var r3=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Dl({id:e})),this.stats.get(e)}},B0=new r3;function Sie(){let t="9.0.9",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Ol()&&Kt.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Kt,stats:B0}),t}var WU=Sie();function Cie(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function bd(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Cie(t)}var i3={};function oa(t="id"){i3[t]=i3[t]||1;let e=i3[t]++;return`${t}-${e}`}function wd(t){let e=!0;for(let r in t){e=!1;break}return e}var fn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=Mie(r,i);let n=this.props.id!=="undefined"?this.props.id:oa(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}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}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"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};Yr(fn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Mie(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var ix=class extends fn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&ix.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,ix.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,ix.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},Xi=ix;Yr(Xi,"defaultProps",{...fn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),Yr(Xi,"MAP_READ",1),Yr(Xi,"MAP_WRITE",2),Yr(Xi,"COPY_SRC",4),Yr(Xi,"COPY_DST",8),Yr(Xi,"INDEX",16),Yr(Xi,"VERTEX",32),Yr(Xi,"UNIFORM",64),Yr(Xi,"STORAGE",128),Yr(Xi,"INDIRECT",256),Yr(Xi,"QUERY_RESOLVE",512),Yr(Xi,"DEBUG_DATA_MAX_LENGTH",32);function j2(t){let e=qU[t],r=Iie(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:qU[t],byteLength:r,integer:n,signed:o,normalized:i}}function Iie(t){return Pie[t]}var qU={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Pie={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Rie=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Bie=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function XU(t){return Rie.some(e=>t.startsWith(e))}function H2(t){let e=Bie.exec(t);if(e){let[,r,i,n,o,s]=e;if(r){let l=`${n}${i}`,u=j2(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:s==="-unsized",webgl:s==="-webgl",...u}}}return Die(t)}var Oie={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Die(t){let e=Oie[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var nx=class{},ox=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},n3=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...n3.defaultProps,...e},this.id=this.props.id||oa(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=B0;_lumaData={};isTextureFormatCompressed(e){return XU(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Xi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":Kt.warn("indices buffer content must be of integer type")()),r}},bc=n3;Yr(bc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(Kt.get("debug")),spector:Boolean(Kt.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>Kt.error(e.message)}),Yr(bc,"VERSION",WU);function Yi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var sx=new Map,wc=class{static registerDevices(e){for(let r of e)Yi(r.type&&r.isSupported&&r.create),sx.set(r.type,r)}static getAvailableDevices(){return Array.from(sx).map(e=>e.type)}static getSupportedDevices(){return Array.from(sx).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(bc.defaultProps,e)}static async attachDevice(e){let r=YU(e.devices)||sx;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...bc.defaultProps,...e},e.gl&&(e.type="webgl");let r=YU(e.devices)||sx;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let o=r.get("unknown");if(o)return await o.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}};Yr(wc,"defaultProps",{...bc.defaultProps,type:"best-available",devices:void 0}),Yr(wc,"stats",B0),Yr(wc,"log",Kt);function YU(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var Lie=Ol()&&typeof document<"u",G2=()=>Lie&&document.readyState==="complete",Fie={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Td=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return G2()}constructor(e){if(this.props={...Fie,...e},e=this.props,!Ol()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Uie(e.canvas):this.canvas=e.canvas;else{let r=zie(e),i=kie(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return Vie(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(Kt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let s=e,l=Math.floor(i*s),u=Math.floor(n*s);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[h,v]=this.getDrawingBufferSize();(h!==l||v!==u)&&(s=Math.min(h/i,v/n),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(n*s),Kt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};Yr(Td,"pageLoaded",Nie());function Nie(){return G2()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function kie(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Uie(t){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function zie(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function Vie(t,e,r,i,n){let o=t,s=KU(o[0],e,r),l=ZU(o[1],e,i,n),u=KU(o[0]+1,e,r),h=u===r-1?u:u-1;u=ZU(o[1]+1,e,i,n);let v;return n?(u=u===0?u:u+1,v=l,l=u):v=u===i-1?u:u-1,{x:s,y:l,width:Math.max(h-s+1,1),height:Math.max(v-l+1,1)}}function KU(t,e,r){return Math.min(Math.round(t*e),r-1)}function ZU(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var o3=class extends fn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=o3.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},bo=o3;Yr(bo,"defaultProps",{...fn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),Yr(bo,"COPY_SRC",1),Yr(bo,"COPY_DST",2),Yr(bo,"TEXTURE_BINDING",4),Yr(bo,"STORAGE_BINDING",8),Yr(bo,"RENDER_ATTACHMENT",16);var s3=class extends fn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,s3.defaultProps)}},Ed=s3;Yr(Ed,"defaultProps",{...fn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function QU(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((s,l)=>s.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let l=1;l<=n.length;l++)for(i+=$U(n[l-1],l,r);o.length>s&&o[s].lineNum===l;){let u=o[s++];i+=JU(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=JU(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function JU(t,e,r,i){if(i?.inlineSource){let n=jie(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
543
+ }`}function BP(t,e=!0,r){let i=r||new Set;if(t){if(aU(t))i.add(t);else if(aU(t.buffer))i.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(let n in t)BP(t[n],e,i)}}return r===void 0?Array.from(i):[]}function aU(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}var OP=()=>{},gd=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Za||typeof I0<"u"&&!Za}constructor(e){let{name:r,source:i,url:n}=e;vl(i||n),this.name=r,this.source=i,this.url=n,this.onMessage=OP,this.onError=o=>console.log(o),this.worker=Za?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=OP,this.onError=OP,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(e,r){r=r||BP(e),this.worker.postMessage(e,r)}_getErrorFromErrorEvent(e){let r="Failed to load ";return r+=`worker ${this.name} from ${this.url}. `,e.message&&(r+=`${e.message} in `),e.lineno&&(r+=`:${e.lineno}:${e.colno}`),new Error(r)}_createBrowserWorker(){this._loadableURL=oU({source:this.source,url:this.url});let e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=r=>{r.data?this.onMessage(r.data):this.onError(new Error("No data received"))},e.onerror=r=>{this.onError(this._getErrorFromErrorEvent(r)),this.terminated=!0},e.onmessageerror=r=>console.error(r),e}_createNodeWorker(){let e;if(this.url){let i=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`;e=new I0(i,{eval:!1})}else if(this.source)e=new I0(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",r=>{this.onMessage(r)}),e.on("error",r=>{this.onError(r)}),e.on("exit",r=>{}),e}};var Kv=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return gd.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,r=(n,o,s)=>n.done(s),i=(n,o)=>n.error(o)){let n=new Promise(o=>(this.jobQueue.push({name:e,onMessage:r,onError:i,onStart:o}),this));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let r=this.jobQueue.shift();if(r){this.onDebug({message:"Starting job",name:r.name,workerThread:e,backlog:this.jobQueue.length});let i=new Yv(r.name,e);e.onMessage=n=>r.onMessage(i,n.type,n.payload),e.onError=n=>r.onError(i,n),r.onStart(i);try{await i.result}catch(n){console.error(`Worker exception: ${n}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Za||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new gd({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nU?this.maxMobileConcurrency:this.maxConcurrency}};var Dre={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},KA=class{props;workerPools=new Map;static isSupported(){return gd.isSupported()}static getWorkerFarm(e={}){return KA._workerFarm=KA._workerFarm||new KA({}),KA._workerFarm.setProps(e),KA._workerFarm}constructor(e){this.props={...Dre},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(let r of this.workerPools.values())r.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:r,source:i,url:n}=e,o=this.workerPools.get(r);return o||(o=new Kv({name:r,source:i,url:n}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(r,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},_d=KA;Yr(_d,"_workerFarm");function DP(t,e={}){let r=e[t.id]||{},i=Za?`${t.id}-worker.js`:`${t.id}-worker-node.js`,n=r.workerUrl;if(!n&&t.id==="compression"&&(n=e.workerUrl),e._workerType==="test"&&(Za?n=`modules/${t.module}/dist/${i}`:n=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!n){let o=t.version;o==="latest"&&(o=rU);let s=o?`@${o}`:"";n=`https://unpkg.com/@loaders.gl/${t.module}${s}/dist/${i}`}return vl(n),n}function LP(t,e=qv){vl(t,"no worker provided");let r=t.version;return!(!e||!r)}var FP={};async function gh(t,e=null,r={},i=null){return e&&(t=lU(t,e,r,i)),FP[t]=FP[t]||Lre(t),await FP[t]}function lU(t,e,r={},i=null){if(!r.useLocalLibraries&&t.startsWith("http"))return t;i=i||t;let n=r.modules||{};return n[i]?n[i]:Za?r.CDN?(vl(r.CDN.startsWith("http")),`${r.CDN}/${e}@${qv}/dist/libs/${i}`):Xv?`../src/libs/${i}`:`modules/${e}/src/libs/${i}`:`modules/${e}/dist/libs/${i}`}async function Lre(t){if(t.endsWith("wasm"))return await Nre(t);if(!Za)try{let{requireFromFile:r}=globalThis.loaders||{};return await r?.(t)}catch(r){return console.error(r),null}if(Xv)return importScripts(t);let e=await kre(t);return Fre(e,t)}function Fre(t,e){if(!Za){let{requireFromString:i}=globalThis.loaders||{};return i?.(t,e)}if(Xv)return eval.call(globalThis,t),null;let r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch{r.text=t}return document.body.appendChild(r),null}async function Nre(t){let{readFileAsArrayBuffer:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).arrayBuffer():await e(t)}async function kre(t){let{readFileAsText:e}=globalThis.loaders||{};return Za||!e||t.startsWith("http")?await(await fetch(t)).text():await e(t)}function NP(t,e){return!_d.isSupported()||!Za&&!e?._nodeWorkers?!1:t.worker&&e?.worker}async function kP(t,e,r,i,n){let o=t.id,s=DP(t,r),u=_d.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let h=await u.startJob("process-on-worker",Ure.bind(null,n));return h.postMessage("process",{input:e,options:r,context:i}),await(await h.result).result}async function Ure(t,e,r,i){switch(r){case"done":e.done(i);break;case"error":e.error(new Error(i.error));break;case"process":let{id:n,input:o,options:s}=i;try{let l=await t(o,s);e.postMessage("done",{id:n,result:l})}catch(l){let u=l instanceof Error?l.message:"unknown error";e.postMessage("error",{id:n,error:u})}break;default:console.warn(`parse-with-worker unknown message ${r}`)}}function uU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?cU(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?cU(t,0,e):""}function cU(t,e,r){if(t.byteLength<=e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function UP(t){try{return JSON.parse(t)}catch{throw new Error(`Failed to parse JSON from data starting with "${uU(t)}"`)}}function zP(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;let i=new Uint8Array(t),n=new Uint8Array(e);for(let o=0;o<i.length;++o)if(i[o]!==n[o])return!1;return!0}function VP(...t){return fU(t)}function fU(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,s)=>o+s.byteLength,0),i=new Uint8Array(r),n=0;for(let o of e)i.set(o,n),n+=o.byteLength;return i.buffer}function Zv(...t){let e=t,r=e&&e.length>1&&e[0].constructor||null;if(!r)throw new Error('"concatenateTypedArrays" - incorrect quantity of arguments or arguments have incompatible data types');let i=e.reduce((s,l)=>s+l.length,0),n=new r(i),o=0;for(let s of e)n.set(s,o),o+=s.length;return n}function ZA(t,e,r){let i=r!==void 0?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(i).buffer}function yd(t,e){return On(t>=0),On(e>0),t+(e-1)&~(e-1)}function jP(t,e,r){let i;if(t instanceof ArrayBuffer)i=new Uint8Array(t);else{let n=t.byteOffset,o=t.byteLength;i=new Uint8Array(t.buffer||t.arrayBuffer,n,o)}return e.set(i,r),r+yd(i.byteLength,4)}async function HP(t){let e=[];for await(let r of t)e.push(r);return VP(...e)}function Jv(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var JA=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(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=Jv(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Jv()-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 Dl=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}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 r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:i}=e,n=this.stats[r];return n||(e instanceof JA?n=e:n=new JA(r,i),this.stats[r]=n),n}};var zre="Queued Requests",Vre="Active Requests",jre="Cancelled Requests",Hre="Queued Requests Ever",Gre="Active Requests Ever",Wre={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},vd=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...Wre,...e},this.stats=new Dl({id:this.props.id}),this.stats.get(zre),this.stats.get(Vre),this.stats.get(jre),this.stats.get(Hre),this.stats.get(Gre)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let i={handle:e,priority:0,getPriority:r},n=new Promise(o=>(i.resolve=o,i));return this.requestQueue.push(i),this.requestMap.set(e,n),this._issueNewRequests(),n}_issueRequest(e){let{handle:r,resolve:i}=e,n=!1,o=()=>{n||(n=!0,this.requestMap.delete(r),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,i?i({done:o}):Promise.resolve({done:o})}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let i=this.requestQueue.shift();i&&this._issueRequest(i)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let i=e[r];this._updateRequest(i)||(e.splice(r,1),this.requestMap.delete(i.handle),r--)}e.sort((r,i)=>r.priority-i.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};var qre="",hU={};function GP(t){for(let e in hU)if(t.startsWith(e)){let r=hU[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${qre}${t}`),t}function pU(t){return t&&typeof t=="object"&&t.isBuffer}function D2(t){if(pU(t))return t;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if(typeof t=="string"){let e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}var Yc={};As(Yc,{dirname:()=>Yre,filename:()=>Xre,join:()=>Kre,resolve:()=>Zre});function dU(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let t=window.location?.pathname;return t?.slice(0,t.lastIndexOf("/")+1)||""}function Xre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function Yre(t){let e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}function Kre(...t){let e="/";return t=t.map((r,i)=>(i&&(r=r.replace(new RegExp(`^${e}`),"")),i!==t.length-1&&(r=r.replace(new RegExp(`${e}$`),"")),r)),t.join(e)}function Zre(...t){let e=[];for(let o=0;o<t.length;o++)e[o]=t[o];let r="",i=!1,n;for(let o=e.length-1;o>=-1&&!i;o--){let s;o>=0?s=e[o]:(n===void 0&&(n=dU()),s=n),s.length!==0&&(r=`${s}/${r}`,i=s.charCodeAt(0)===Qv)}return r=Jre(r,!i),i?`/${r}`:r.length>0?r:"."}var Qv=47,WP=46;function Jre(t,e){let r="",i=-1,n=0,o,s=!1;for(let l=0;l<=t.length;++l){if(l<t.length)o=t.charCodeAt(l);else{if(o===Qv)break;o=Qv}if(o===Qv){if(!(i===l-1||n===1))if(i!==l-1&&n===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==WP||r.charCodeAt(r.length-2)!==WP){if(r.length>2){let u=r.length-1,h=u;for(;h>=0&&r.charCodeAt(h)!==Qv;--h);if(h!==u){r=h===-1?"":r.slice(0,h),i=l,n=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",i=l,n=0,s=!1;continue}}e&&(r.length>0?r+="/..":r="..",s=!0)}else{let u=t.slice(i+1,l);r.length>0?r+=`/${u}`:r=u,s=!1}i=l,n=0}else o===WP&&n!==-1?++n:n=-1}return r}var L2=class{fetch;loadOptions;_needsRefresh=!0;props;constructor(e){this.props={...e},this.loadOptions={...e.loadOptions},this.fetch=Qre(this.loadOptions)}setProps(e){this.props=Object.assign(this.props,e),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}};function Qre(t){let e=t?.fetch;if(e&&typeof e=="function")return(i,n)=>e(i,n);let r=t?.fetch;return r&&typeof r!="function"?i=>fetch(i,r):i=>fetch(i)}var Eu=class extends L2{};Yr(Eu,"type","template"),Yr(Eu,"testURL",e=>!1);var $re=t=>typeof t=="boolean",$v=t=>typeof t=="function",QA=t=>t!==null&&typeof t=="object",qP=t=>QA(t)&&t.constructor==={}.constructor;var AU=t=>Boolean(t)&&typeof t[Symbol.iterator]=="function",mU=t=>t&&typeof t[Symbol.asyncIterator]=="function";var Su=t=>typeof Response<"u"&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json;var Cu=t=>typeof Blob<"u"&&t instanceof Blob,gU=t=>t&&typeof t=="object"&&t.isBuffer;var eie=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||QA(t)&&$v(t.tee)&&$v(t.cancel)&&$v(t.getReader);var tie=t=>QA(t)&&$v(t.read)&&$v(t.pipe)&&$re(t.readable),F2=t=>eie(t)||tie(t);var N2=class extends Error{constructor(e,r){super(e),this.reason=r.reason,this.url=r.url,this.response=r.response}reason;url;response};var rie=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,iie=/^([-\w.]+\/[-\w.+]+)/;function XP(t,e){return t.toLowerCase()===e.toLowerCase()}function _U(t){let e=iie.exec(t);return e?e[1]:t}function YP(t){let e=rie.exec(t);return e?e[1]:""}var yU=/\?.*/;function vU(t){let e=t.match(yU);return e&&e[0]}function P0(t){return t.replace(yU,"")}function xU(t){if(t.length<50)return t;let e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function $A(t){return Su(t)?t.url:Cu(t)?t.name||"":typeof t=="string"?t:""}function ex(t){if(Su(t)){let e=t,r=e.headers.get("content-type")||"",i=P0(e.url);return _U(r)||YP(i)}return Cu(t)?t.type||"":typeof t=="string"?YP(t):""}function bU(t){return Su(t)?t.headers["content-length"]||-1:Cu(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function k2(t){if(Su(t))return t;let e={},r=bU(t);r>=0&&(e["content-length"]=String(r));let i=$A(t),n=ex(t);n&&(e["content-type"]=n);let o=await oie(t);o&&(e["x-first-bytes"]=o),typeof t=="string"&&(t=new TextEncoder().encode(t));let s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:i}),s}async function wU(t){if(!t.ok)throw await nie(t)}async function nie(t){let e=xU(t.url),r=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;r=r.length>100?`${r.slice(0,100)}...`:r;let i={reason:t.statusText,url:t.url,response:t};try{let n=t.headers.get("Content-Type");i.reason=n?.includes("application/json")?await t.json():t.text()}catch{}return new N2(r,i)}async function oie(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){let r=t.slice(0,5);return await new Promise(i=>{let n=new FileReader;n.onload=o=>i(o?.target?.result),n.readAsDataURL(r)})}if(t instanceof ArrayBuffer){let r=t.slice(0,5);return`data:base64,${sie(r)}`}return null}function sie(t){let e="",r=new Uint8Array(t);for(let i=0;i<r.byteLength;i++)e+=String.fromCharCode(r[i]);return btoa(e)}function aie(t){return!lie(t)&&!cie(t)}function lie(t){return t.startsWith("http:")||t.startsWith("https:")}function cie(t){return t.startsWith("data:")}async function R0(t,e){if(typeof t=="string"){let r=GP(t);return aie(r)&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(r,e):await fetch(r,e)}return await k2(t)}var KP=new xc({id:"loaders.gl"}),U2=class{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}},z2=class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}};var ZP={fetch:null,mimeType:void 0,nothrow:!1,log:new z2,useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Ap,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},TU={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function JP(){globalThis.loaders=globalThis.loaders||{};let{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function QP(){let t=JP();return t.globalOptions=t.globalOptions||{...ZP},t.globalOptions}function CU(t,e,r,i){return r=r||[],r=Array.isArray(r)?r:[r],uie(t,r),hie(e,t,i)}function uie(t,e){EU(t,null,ZP,TU,e);for(let r of e){let i=t&&t[r.id]||{},n=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};EU(i,r.id,n,o,e)}}function EU(t,e,r,i,n){let o=e||"Top level",s=e?`${e}.`:"";for(let l in t){let u=!e&&QA(t[l]),h=l==="baseUri"&&!e,v=l==="workerUrl"&&e;if(!(l in r)&&!h&&!v){if(l in i)KP.warn(`${o} loader option '${s}${l}' no longer supported, use '${i[l]}'`)();else if(!u){let T=fie(l,n);KP.warn(`${o} loader option '${s}${l}' not recognized. ${T}`)()}}}}function fie(t,e){let r=t.toLowerCase(),i="";for(let n of e)for(let o in n.options){if(t===o)return`Did you mean '${n.id}.${o}'?`;let s=o.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${o}'?`)}return i}function hie(t,e,r){let n={...t.options||{}};return pie(n,r),n.log===null&&(n.log=new U2),SU(n,QP()),SU(n,e),n}function SU(t,e){for(let r in e)if(r in e){let i=e[r];qP(i)&&qP(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function pie(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}function tx(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t?.extensions)):!1}function rx(t){On(t,"null loader"),On(tx(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t?.parseTextSync||t?.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}var MU=()=>{let t=JP();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function em(t){let e=MU();t=Array.isArray(t)?t:[t];for(let r of t){let i=rx(r);e.find(n=>i===n)||e.unshift(i)}}function IU(){return MU()}var PU=new xc({id:"loaders.gl"});var die=/\.([^.]+)$/;async function OU(t,e=[],r,i){if(!DU(t))return null;let n=RU(t,e,{...r,nothrow:!0},i);if(n)return n;if(Cu(t)&&(t=await t.slice(0,10).arrayBuffer(),n=RU(t,e,r,i)),!n&&!r?.nothrow)throw new Error(LU(t));return n}function RU(t,e=[],r,i){if(!DU(t))return null;if(e&&!Array.isArray(e))return rx(e);let n=[];e&&(n=n.concat(e)),r?.ignoreRegisteredLoaders||n.push(...IU()),mie(n);let o=Aie(t,n,r,i);if(!o&&!r?.nothrow)throw new Error(LU(t));return o}function Aie(t,e,r,i){let n=$A(t),o=ex(t),s=P0(n)||i?.url,l=null,u="";return r?.mimeType&&(l=$P(e,r?.mimeType),u=`match forced by supplied MIME type ${r?.mimeType}`),l=l||gie(e,s),u=u||(l?`matched url ${s}`:""),l=l||$P(e,o),u=u||(l?`matched MIME type ${o}`:""),l=l||yie(e,t),u=u||(l?`matched initial data ${FU(t)}`:""),r?.fallbackMimeType&&(l=l||$P(e,r?.fallbackMimeType),u=u||(l?`matched fallback MIME type ${o}`:"")),u&&PU.log(1,`selectLoader selected ${l?.name}: ${u}.`),l}function DU(t){return!(t instanceof Response&&t.status===204)}function LU(t){let e=$A(t),r=ex(t),i="No valid loader found (";i+=e?`${Yc.filename(e)}, `:"no url provided, ",i+=`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=t?FU(t):"";return i+=n?` first bytes: "${n}"`:"first bytes: not available",i+=")",i}function mie(t){for(let e of t)rx(e)}function gie(t,e){let r=e&&die.exec(e),i=r&&r[1];return i?_ie(t,i):null}function _ie(t,e){e=e.toLowerCase();for(let r of t)for(let i of r.extensions)if(i.toLowerCase()===e)return r;return null}function $P(t,e){for(let r of t)if(r.mimeTypes?.some(i=>XP(e,i))||XP(e,`application/x.${r.id}`))return r;return null}function yie(t,e){if(!e)return null;for(let r of t)if(typeof e=="string"){if(vie(e,r))return r}else if(ArrayBuffer.isView(e)){if(BU(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer&&BU(e,0,r))return r;return null}function vie(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(i=>t.startsWith(i))}function BU(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(n=>xie(t,e,r,n))}function xie(t,e,r,i){if(i instanceof ArrayBuffer)return zP(i,t,i.byteLength);switch(typeof i){case"function":return i(t);case"string":let n=e3(t,e,i.length);return i===n;default:return!1}}function FU(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?e3(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?e3(t,0,e):""}function e3(t,e,r){if(t.byteLength<e+r)return"";let i=new DataView(t),n="";for(let o=0;o<r;o++)n+=String.fromCharCode(i.getUint8(e+o));return n}function*NU(t,e){let r=e?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<t.length;){let o=Math.min(t.length-i,r),s=t.slice(i,i+o);i+=o,yield n.encode(s)}}function*kU(t,e={}){let{chunkSize:r=262144}=e,i=0;for(;i<t.byteLength;){let n=Math.min(t.byteLength-i,r),o=new ArrayBuffer(n),s=new Uint8Array(t,i,n);new Uint8Array(o).set(s),i+=n,yield o}}async function*UU(t,e){let r=e?.chunkSize||1048576,i=0;for(;i<t.size;){let n=i+r,o=await t.slice(i,n).arrayBuffer();i=n,yield o}}function t3(t,e){return Ap?bie(t,e):wie(t,e)}async function*bie(t,e){let r=t.getReader(),i;try{for(;;){let n=i||r.read();e?._streamReadAhead&&(i=r.read());let{done:o,value:s}=await n;if(o)return;yield D2(s)}}catch{r.releaseLock()}}async function*wie(t,e){for await(let r of t)yield D2(r)}function zU(t,e){if(typeof t=="string")return NU(t,e);if(t instanceof ArrayBuffer)return kU(t,e);if(Cu(t))return UU(t,e);if(F2(t))return t3(t,e);if(Su(t))return t3(t.body,e);throw new Error("makeIterator")}var VU="Cannot convert supplied data type";function Tie(t,e,r){if(e.text&&typeof t=="string")return t;if(gU(t)&&(t=t.buffer),t instanceof ArrayBuffer){let i=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let i=t.buffer,n=t.byteLength||t.length;return(t.byteOffset!==0||n!==i.byteLength)&&(i=i.slice(t.byteOffset,t.byteOffset+n)),i}throw new Error(VU)}async function jU(t,e,r){let i=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if(typeof t=="string"||i)return Tie(t,e,r);if(Cu(t)&&(t=await k2(t)),Su(t)){let n=t;return await wU(n),e.binary?await n.arrayBuffer():await n.text()}if(F2(t)&&(t=zU(t,r)),AU(t)||mU(t))return HP(t);throw new Error(VU)}function V2(t,e){let r=QP(),i=t||r;return typeof i.fetch=="function"?i.fetch:QA(i.fetch)?n=>R0(n,i.fetch):e?.fetch?e?.fetch:R0}function HU(t,e,r){if(r)return r;let i={fetch:V2(e,t),...t};if(i.url){let n=P0(i.url);i.baseUrl=n,i.queryString=vU(i.url),i.filename=Yc.filename(n),i.baseUrl=Yc.dirname(n)}return Array.isArray(i.loaders)||(i.loaders=null),i}function GU(t,e){if(t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){let i=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...i]:i}return r&&r.length?r:void 0}async function xd(t,e,r,i){e&&!Array.isArray(e)&&!tx(e)&&(i=void 0,r=e,e=void 0),t=await t,r=r||{};let n=$A(t),s=GU(e,i),l=await OU(t,s,r);return l?(r=CU(r,l,s,n),i=HU({url:n,_parse:xd,loaders:s},r,i||null),await Eie(l,t,r,i)):null}async function Eie(t,e,r,i){if(LP(t),r=Wv(t.options,r),Su(e)){let o=e,{ok:s,redirected:l,status:u,statusText:h,type:v,url:T}=o,E=Object.fromEntries(o.headers.entries());i.response={headers:E,ok:s,redirected:l,status:u,statusText:h,type:v,url:T}}e=await jU(e,t,r);let n=t;if(n.parseTextSync&&typeof e=="string")return n.parseTextSync(e,r,i);if(NP(t,r))return await kP(t,e,r,i,xd);if(n.parseText&&typeof e=="string")return await n.parseText(e,r,i);if(n.parse)return await n.parse(e,r,i);throw vl(!n.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}async function _a(t,e,r,i){let n,o;!Array.isArray(e)&&!tx(e)?(n=[],o=e,i=void 0):(n=e,o=r);let s=V2(o),l=t;return typeof t=="string"&&(l=await s(t)),Cu(t)&&(l=await s(t)),Array.isArray(n)?await xd(l,n,o):await xd(l,n,o)}var Kt=new xc({id:"luma.gl"});var r3=class{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new Dl({id:e})),this.stats.get(e)}},B0=new r3;function Sie(){let t="9.0.11",e="set luma.log.level=1 (or higher) to trace rendering";if(globalThis.luma&&globalThis.luma.VERSION!==t)throw new Error(`luma.gl - multiple VERSIONs detected: ${globalThis.luma.VERSION} vs ${t}`);return globalThis.luma||(Ol()&&Kt.log(1,`${t} - ${e}`)(),globalThis.luma=globalThis.luma||{VERSION:t,version:t,log:Kt,stats:B0}),t}var WU=Sie();function Cie(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)?t:null}function bd(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number"?t:null:Cie(t)}var i3={};function oa(t="id"){i3[t]=i3[t]||1;let e=i3[t]++;return`${t}-${e}`}function wd(t){let e=!0;for(let r in t){e=!1;break}return e}var fn=class{id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,r,i){if(!e)throw new Error("no device");this._device=e,this.props=Mie(r,i);let n=this.props.id!=="undefined"?this.props.id:oa(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}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}(${this.id})`}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"),r=this[Symbol.toStringTag];e.get(`${r}s Active`).decrementCount()}trackAllocatedMemory(e,r=this[Symbol.toStringTag]){let i=this._device.statsManager.getStats("Resource Counts");i.get("GPU Memory").addCount(e),i.get(`${r} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").subtractCount(this.allocatedBytes),r.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),r=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${r}s Created`).incrementCount(),e.get(`${r}s Active`).incrementCount()}};Yr(fn,"defaultProps",{id:"undefined",handle:void 0,userData:void 0});function Mie(t,e){let r={...e};for(let i in t)t[i]!==void 0&&(r[i]=t[i]);return r}var ix=class extends fn{get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,r){let i={...r};(r.usage||0)&ix.INDEX&&!r.indexType&&(r.data instanceof Uint32Array?i.indexType="uint32":r.data instanceof Uint16Array&&(i.indexType="uint16")),super(e,i,ix.defaultProps),this.usage=r.usage||0,this.indexType=i.indexType,this.updateTimestamp=e.incrementTimestamp()}readSyncWebGL(e,r){throw new Error("not implemented")}debugData=new ArrayBuffer(0);_setDebugData(e,r,i){let n=ArrayBuffer.isView(e)?e.buffer:e,o=Math.min(e?e.byteLength:i,ix.DEBUG_DATA_MAX_LENGTH);e===null?this.debugData=new ArrayBuffer(o):r===0&&i===e.byteLength?this.debugData=n.slice(0,o):this.debugData=n.slice(r,r+o)}},Xi=ix;Yr(Xi,"defaultProps",{...fn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1}),Yr(Xi,"MAP_READ",1),Yr(Xi,"MAP_WRITE",2),Yr(Xi,"COPY_SRC",4),Yr(Xi,"COPY_DST",8),Yr(Xi,"INDEX",16),Yr(Xi,"VERTEX",32),Yr(Xi,"UNIFORM",64),Yr(Xi,"STORAGE",128),Yr(Xi,"INDIRECT",256),Yr(Xi,"QUERY_RESOLVE",512),Yr(Xi,"DEBUG_DATA_MAX_LENGTH",32);function j2(t){let e=qU[t],r=Iie(e),i=t.includes("norm"),n=!i&&!t.startsWith("float"),o=t.startsWith("s");return{dataType:qU[t],byteLength:r,integer:n,signed:o,normalized:i}}function Iie(t){return Pie[t]}var qU={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},Pie={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4};var Rie=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],Bie=/^(rg?b?a?)([0-9]*)([a-z]*)(-srgb)?(-webgl|-unsized)?$/;function XU(t){return Rie.some(e=>t.startsWith(e))}function H2(t){let e=Bie.exec(t);if(e){let[,r,i,n,o,s]=e;if(r){let l=`${n}${i}`,u=j2(l);return{format:r,components:r.length,srgb:o==="-srgb",unsized:s==="-unsized",webgl:s==="-webgl",...u}}}return Die(t)}var Oie={"rgba4unorm-webgl":{format:"rgba",bpp:2},"rgb565unorm-webgl":{format:"rgb",bpp:2},"rgb5a1unorm-webgl":{format:"rgba",bbp:2},rgb9e5ufloat:{format:"rgb",bbp:4},rg11b10ufloat:{format:"rgb",bbp:4},rgb10a2unorm:{format:"rgba",bbp:4},"rgb10a2uint-webgl":{format:"rgba",bbp:4},stencil8:{components:1,bpp:1,a:"stencil"},depth16unorm:{components:1,bpp:2,a:"depth"},depth24plus:{components:1,bpp:3,a:"depth"},depth32float:{components:1,bpp:4,a:"depth"},"depth24plus-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth24unorm-stencil8":{components:2,bpp:4,a:"depth-stencil"},"depth32float-stencil8":{components:2,bpp:4,a:"depth-stencil"}};function Die(t){let e=Oie[t];if(!e)throw new Error(`Unknown format ${t}`);return{format:e.format||"",components:e.components||e.format?.length||1,byteLength:e.bpp||1,srgb:!1,unsized:!1}}var nx=class{},ox=class{features;disabledFeatures;constructor(e=[],r){this.features=new Set(e),this.disabledFeatures=r||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures[e]&&this.features.has(e)}},n3=class{get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...n3.defaultProps,...e},this.id=this.props.id||oa(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=B0;_lumaData={};isTextureFormatCompressed(e){return XU(e)}loseDevice(){return!1}getCanvasContext(){if(!this.canvasContext)throw new Error("Device has no CanvasContext");return this.canvasContext}createTexture(e){return(e instanceof Promise||typeof e=="string")&&(e={data:e}),this._createTexture(e)}createCommandEncoder(e={}){throw new Error("not implemented")}readPixelsToArrayWebGL(e,r){throw new Error("not implemented")}readPixelsToBufferWebGL(e,r){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,r){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}timestamp=0;incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}_getBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let r={...e};return(e.usage||0)&Xi.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?r.indexType="uint32":e.data instanceof Uint16Array?r.indexType="uint16":Kt.warn("indices buffer content must be of integer type")()),r}},bc=n3;Yr(bc,"defaultProps",{id:null,canvas:null,container:null,manageState:!0,width:800,height:600,requestMaxLimits:!0,debug:Boolean(Kt.get("debug")),spector:Boolean(Kt.get("spector")),break:[],initalizeFeatures:!0,disabledFeatures:{"compilation-status-async-webgl":!0},gl:null,onError:e=>Kt.error(e.message)}),Yr(bc,"VERSION",WU);function Yi(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}var sx=new Map,wc=class{static registerDevices(e){for(let r of e)Yi(r.type&&r.isSupported&&r.create),sx.set(r.type,r)}static getAvailableDevices(){return Array.from(sx).map(e=>e.type)}static getSupportedDevices(){return Array.from(sx).filter(e=>e.isSupported()).map(e=>e.type)}static setDefaultDeviceProps(e){Object.assign(bc.defaultProps,e)}static async attachDevice(e){let r=YU(e.devices)||sx;if(e.handle instanceof WebGL2RenderingContext){let i=r.get("webgl");if(i)return await i.attach(e.handle)}if(e.handle===null){let i=r.get("unknown");if(i)return await i.attach(null)}throw new Error("Failed to attach device. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static async createDevice(e={}){e={...bc.defaultProps,...e},e.gl&&(e.type="webgl");let r=YU(e.devices)||sx;switch(e.type){case"webgpu":let i=r.get("webgpu");if(i)return await i.create(e);break;case"webgl":let n=r.get("webgl");if(n)return await n.create(e);break;case"unknown":let o=r.get("unknown");if(o)return await o.create(e);break;case"best-available":if(i=r.get("webgpu"),i?.isSupported?.())return await i.create(e);if(n=r.get("webgl"),n?.isSupported?.())return await n.create(e);break}throw new Error("No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.")}static enforceWebGL2(e=!0){let r=HTMLCanvasElement.prototype;if(!e&&r.originalGetContext){r.getContext=r.originalGetContext,r.originalGetContext=void 0;return}r.originalGetContext=r.getContext,r.getContext=function(i,n){return i==="webgl"||i==="experimental-webgl"?this.originalGetContext("webgl2",n):this.originalGetContext(i,n)}}};Yr(wc,"defaultProps",{...bc.defaultProps,type:"best-available",devices:void 0}),Yr(wc,"stats",B0),Yr(wc,"log",Kt);function YU(t){if(!t||t?.length===0)return null;let e=new Map;for(let r of t)e.set(r.type,r);return e}var Lie=Ol()&&typeof document<"u",G2=()=>Lie&&document.readyState==="complete",Fie={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,colorSpace:"srgb",alphaMode:"opaque"},Td=class{id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};static get isPageLoaded(){return G2()}constructor(e){if(this.props={...Fie,...e},e=this.props,!Ol()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)typeof e.canvas=="string"?this.canvas=Uie(e.canvas):this.canvas=e.canvas;else{let r=zie(e),i=kie(e?.container||null);i.insertBefore(r,i.firstChild),this.canvas=r,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(r=>{for(let i of r)i.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return typeof OffscreenCanvas<"u"&&this.canvas instanceof OffscreenCanvas||(e=e===void 0?this.props.useDevicePixels:e,!e||e<=0)?1:e===!0?typeof window<"u"&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),r=this.canvas;return r.parentElement?[r.clientWidth*e,r.clientHeight*e]:[this.canvas.width,this.canvas.height];default:throw new Error(this.type)}}getAspect(){let[e,r]=this.getPixelSize();return e/r}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),{clientWidth:r}=this._canvasSizeInfo;return r?e/r:1}catch{return 1}}cssToDevicePixels(e,r=!0){let i=this.cssToDeviceRatio(),[n,o]=this.getDrawingBufferSize();return Vie(e,i,n,o,r)}setDevicePixelRatio(e,r={}){if(!this.htmlCanvas)return;let i="width"in r?r.width:this.htmlCanvas.clientWidth,n="height"in r?r.height:this.htmlCanvas.clientHeight;(!i||!n)&&(Kt.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,i=this.htmlCanvas.width||1,n=this.htmlCanvas.height||1);let o=this._canvasSizeInfo;if(o.clientWidth!==i||o.clientHeight!==n||o.devicePixelRatio!==e){let s=e,l=Math.floor(i*s),u=Math.floor(n*s);this.htmlCanvas.width=l,this.htmlCanvas.height=u;let[h,v]=this.getDrawingBufferSize();(h!==l||v!==u)&&(s=Math.min(h/i,v/n),this.htmlCanvas.width=Math.floor(i*s),this.htmlCanvas.height=Math.floor(n*s),Kt.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=i,this._canvasSizeInfo.clientHeight=n,this._canvasSizeInfo.devicePixelRatio=e}}getDrawingBufferSize(){let e=this.device.gl;if(!e)throw new Error("canvas size");return[e.drawingBufferWidth,e.drawingBufferHeight]}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}};Yr(Td,"pageLoaded",Nie());function Nie(){return G2()||typeof window>"u"?Promise.resolve():new Promise(t=>{window.addEventListener("load",()=>t())})}function kie(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!e)throw new Error(`${t} is not an HTML element`);return e}else if(t)return t;return document.body}function Uie(t){let e=document.getElementById(t);if(!e&&!G2())throw new Error(`Accessing '${t}' before page was loaded`);if(!(e instanceof HTMLCanvasElement))throw new Error("Object is not a canvas element");return e}function zie(t){let{width:e,height:r}=t,i=document.createElement("canvas");return i.id="lumagl-auto-created-canvas",i.width=e||1,i.height=r||1,i.style.width=Number.isFinite(e)?`${e}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}function Vie(t,e,r,i,n){let o=t,s=KU(o[0],e,r),l=ZU(o[1],e,i,n),u=KU(o[0]+1,e,r),h=u===r-1?u:u-1;u=ZU(o[1]+1,e,i,n);let v;return n?(u=u===0?u:u+1,v=l,l=u):v=u===i-1?u:u-1,{x:s,y:l,width:Math.max(h-s+1,1),height:Math.max(v-l+1,1)}}function KU(t,e,r){return Math.min(Math.round(t*e),r-1)}function ZU(t,e,r,i){return i?Math.max(0,r-1-Math.round(t*e)):Math.min(Math.round(t*e),r-1)}var o3=class extends fn{get[Symbol.toStringTag](){return"Texture"}dimension;format;width;height;depth;updateTimestamp;constructor(e,r,i=o3.defaultProps){super(e,r,i),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.updateTimestamp=e.incrementTimestamp()}},bo=o3;Yr(bo,"defaultProps",{...fn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!0,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,type:void 0,sampler:{},view:void 0}),Yr(bo,"COPY_SRC",1),Yr(bo,"COPY_DST",2),Yr(bo,"TEXTURE_BINDING",4),Yr(bo,"STORAGE_BINDING",8),Yr(bo,"RENDER_ATTACHMENT",16);var s3=class extends fn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,r){super(e,r,s3.defaultProps)}},Ed=s3;Yr(Ed,"defaultProps",{...fn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});function QU(t,e,r){let i="",n=e.split(/\r?\n/),o=t.slice().sort((s,l)=>s.lineNum-l.lineNum);switch(r?.showSourceCode||"no"){case"all":let s=0;for(let l=1;l<=n.length;l++)for(i+=$U(n[l-1],l,r);o.length>s&&o[s].lineNum===l;){let u=o[s++];i+=JU(u,n,u.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let l of t)i+=JU(l,n,l.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}function JU(t,e,r,i){if(i?.inlineSource){let n=jie(e,r),o=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^
544
544
  `:"";return`
545
545
  ${n}${o}${t.type.toUpperCase()}: ${t.message}
546
546
 
@@ -549,8 +549,8 @@ ${n}${o}${t.type.toUpperCase()}: ${t.message}
549
549
  <h1>Shader Compilation Error in ${i}</h1><br /><br />
550
550
  <code style="user-select:text;"><pre>
551
551
  ${n}
552
- </pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),s.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},Sd=l3;Yr(Sd,"defaultProps",{...fn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Xie(t){return a3(t.source).name||t.id||oa(`unnamed ${t.stage}-shader`)}var c3=class extends fn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,c3.defaultProps)}},Cd=c3;Yr(Cd,"defaultProps",{...fn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var u3=class extends fn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,u3.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(Kt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof bo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof bo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},_h=u3;Yr(_h,"defaultProps",{...fn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var f3=class extends fn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,f3.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},df=f3;Yr(df,"defaultProps",{...fn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},vertexCount:0,instanceCount:0,bindings:{},uniforms:{}});var h3=class extends fn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,h3.defaultProps)}},O0=h3;Yr(O0,"defaultProps",{...fn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var p3=class extends fn{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,r){super(e,r,p3.defaultProps)}},tm=p3;Yr(tm,"defaultProps",{...fn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var d3=class extends fn{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,d3.defaultProps)}},D0=d3;Yr(D0,"defaultProps",{...fn.defaultProps,measureExecutionTime:void 0});var A3=class extends fn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,A3.defaultProps)}},L0=A3;Yr(L0,"defaultProps",{...fn.defaultProps});function ez(t){let[e,r]=Kie[t],i=e==="i32"||e==="u32",n=e!=="u32",o=Zie[e]*r,s=Yie(e,r);return{dataType:e,components:r,defaultVertexFormat:s,byteLength:o,integer:i,signed:n}}function Yie(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var Kie={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]},Zie={f32:4,f16:2,i32:4,u32:4};function m3(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,o=i?parseInt(i):1,s=j2(n),l={type:n,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(l.webglOnly=!0),l}function W2(t,e){let r={};for(let i of t.attributes)r[i.name]=Jie(t,e,i.name);return r}function tz(t,e,r=16){let i=W2(t,e),n=new Array(r).fill(null);for(let o of Object.values(i))n[o.location]=o;return n}function Jie(t,e,r){let i=Qie(t,r),n=$ie(e,r);if(!i)return null;let o=ez(i.type),s=n?.vertexFormat||o.defaultVertexFormat,l=m3(s);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Qie(t,e){let r=t.attributes.find(i=>i.name===e);return r||Kt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function $ie(t,e){ene(t);let r=tne(t,e);return r||(r=rne(t,e),r)?r:(Kt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function ene(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&Kt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function tne(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function rne(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=m3(o.format);i+=s.byteLength}let n=r.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function g3(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(o=>o.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):Kt.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var _3=class extends fn{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,_3.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=tz(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},F0=_3;Yr(F0,"defaultProps",{...fn.defaultProps,renderPipeline:null});var y3=class extends fn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,y3.defaultProps)}},N0=y3;Yr(N0,"defaultProps",{...fn.defaultProps,layout:void 0,buffers:{}});var v3=class extends fn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,v3.defaultProps)}},k0=v3;Yr(k0,"defaultProps",{...fn.defaultProps,type:void 0,count:void 0});var ine={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function rz(t){let e=ine[t];return Yi(t),e}function iz(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var q2;function X2(t){return(!q2||q2.byteLength<t)&&(q2=new ArrayBuffer(t)),q2}function x3(t,e){let r=X2(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function b3(t){let{target:e,source:r,start:i=0,count:n=1}=t,o=r.length,s=n*o,l=0;for(let u=i;l<o;l++)e[u++]=r[l];for(;l<s;)l<s-l?(e.copyWithin(i+l,i,i+l),l*=2):(e.copyWithin(i+l,i,i+s-l),l=s);return t.target}var nz=1024,Y2=class{layout={};byteLength;constructor(e){let r=0;for(let[n,o]of Object.entries(e)){let s=rz(o),{type:l,components:u}=s;r=iz(r,u);let h=r;r+=u,this.layout[n]={type:l,size:u,offset:h}}r+=(4-r%4)%4;let i=r*4;this.byteLength=Math.max(i,nz)}getData(e){let r=Math.max(this.byteLength,nz),i=X2(r),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[o,s]of Object.entries(e)){let l=this.layout[o];if(!l){Kt.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:u,size:h,offset:v}=l,T=n[u];if(h===1){if(typeof s!="number"&&typeof s!="boolean"){Kt.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}T[v]=Number(s)}else{let E=bd(s);if(!E){Kt.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}T.set(E,v)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function oz(t,e,r=16){if(t!==e)return!1;let i=bd(t);if(!i)return!1;let n=bd(e);if(n&&i.length===n.length){for(let o=0;o<i.length;++o)if(n[o]!==i[o])return!1}return!0}function sz(t){let e=bd(t);return e?e.slice():t}var K2=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){oz(this.uniforms[e],r)||(this.uniforms[e]=sz(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ax=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,o=new Y2(i.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let s=new K2({name:r});s.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,s)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:n}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&Kt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(o);let l=this.uniformBlocks.get(e).getAllUniforms();Kt.log(4,`Writing to uniform buffer ${String(e)}`,o,l)()}return n}};function Z2(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function lx(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function w3(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=Z2(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function az(t){return bd(t)!==null||typeof t=="number"||typeof t=="boolean"}function cx(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];az(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function T3(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:o={}}=r;for(let l in i)if(l in e){let h=i[l]?`${t}.${i[l]}`:"N/A";Kt.removed(`${t}.${l}`,h)()}for(let l in n)if(l in e){let u=n[l];Kt.deprecated(`${t}.${l}`,`${t}.${u}`)()}let s=null;for(let[l,u]of Object.entries(o))l in e&&(Kt.deprecated(`${t}.${l}`,`${t}.${u}`)(),s=s||Object.assign({},e),s[u]=e[l],delete s[l]);return s||e}var nne="";async function E3(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:nne+t}catch(n){i(n)}})}async function ux(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,o)=>{i.onload=n,i.onerror=s=>o(new Error(`Unable to load script '${t}': ${s}`)),r.appendChild(i)})}function fx(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!fx(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!fx(t[o],e[o],r-1))return!1;return!0}return!1}function S3(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function C3(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var yh;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(yh||(yh={}));var px={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},ya=(t,e,r)=>e?t.enable(r):t.disable(r),lz=(t,e,r)=>t.hint(r,e),Kc=(t,e,r)=>t.pixelStorei(r,e),cz=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},hx=(t,e,r)=>{let n={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(n,e)};function M3(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var uz={[3042]:ya,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:ya,[2885]:(t,e)=>t.cullFace(e),[2929]:ya,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:ya,[35723]:lz,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:cz,[36010]:cz,[34964]:hx,[36662]:hx,[36663]:hx,[35053]:hx,[35055]:hx,[2886]:(t,e)=>t.frontFace(e),[33170]:lz,[2849]:(t,e)=>t.lineWidth(e),[32823]:ya,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:ya,[32926]:ya,[32928]:ya,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:ya,[3088]:(t,e)=>t.scissor(...e),[2960]:ya,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(t,e)=>t.viewport(...e),[34383]:ya,[10754]:ya,[12288]:ya,[12289]:ya,[12290]:ya,[12291]:ya,[12292]:ya,[12293]:ya,[12294]:ya,[12295]:ya,[3333]:Kc,[3317]:Kc,[37440]:Kc,[37441]:Kc,[37443]:Kc,[3330]:Kc,[3332]:Kc,[3331]:Kc,[3314]:Kc,[32878]:Kc,[3316]:Kc,[3315]:Kc,[32877]:Kc,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=M3(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=M3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,o,s,l)},stencilOp:(t,e)=>{e=M3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,o,s,l)},viewport:(t,e)=>t.viewport(...e)};function Ys(t,e,r){return e[t]!==void 0?e[t]:r[t]}var fz={blendEquation:(t,e,r)=>t.blendEquationSeparate(Ys(32777,e,r),Ys(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(Ys(32969,e,r),Ys(32968,e,r),Ys(32971,e,r),Ys(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(Ys(32824,e,r),Ys(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(Ys(32938,e,r),Ys(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,Ys(2962,e,r),Ys(2967,e,r),Ys(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,Ys(34816,e,r),Ys(36003,e,r),Ys(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,Ys(2964,e,r),Ys(2965,e,r),Ys(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,Ys(34817,e,r),Ys(34818,e,r),Ys(34819,e,r))},I3={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let i={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({[32773]:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,i,n)=>t({[32969]:e,[32968]:r,[32971]:i,[32970]:n}),clearColor:(t,e,r,i,n)=>t({[3106]:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,i,n)=>t({[3107]:[e,r,i,n]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,i,n)=>t({[3088]:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({[2962]:e,[2967]:r,[2963]:i,[34816]:e,[36003]:r,[36004]:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({[2964]:e,[2965]:r,[2966]:i,[34817]:e,[34818]:r,[34819]:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({[2978]:[e,r,i,n]})},vh=(t,e)=>t.isEnabled(e),P3={[3042]:vh,[2884]:vh,[2929]:vh,[3024]:vh,[32823]:vh,[32926]:vh,[32928]:vh,[3089]:vh,[2960]:vh,[35977]:vh},hz=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Af(t,e){if(one(e))return;let r={};for(let n in e){let o=Number(n),s=uz[n];s&&(typeof s=="string"?r[s]=!0:s(t,e[n],o))}let i=t.state&&t.state.cache;if(i)for(let n in r){let o=fz[n];o(t,e,i)}}function J2(t,e=px){if(typeof e=="number"){let n=e,o=P3[n];return o?o(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let o=P3[n];i[n]=o?o(t,Number(n)):t.getParameter(Number(n))}return i}function pz(t){Af(t,px)}function one(t){for(let e in t)return!1;return!0}function dz(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}var R3=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:i=()=>{}}={}){this.gl=e,this.cache=r?J2(e):Object.assign({},px),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){Yi(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];Af(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){Yi(o!==void 0);let s=e[o],l=this.cache[o];dz(s,l)||(r=!0,i=l,n&&!(o in n)&&(n[o]=l),this.cache[o]=s)}return{valueChanged:r,oldValue:i}}};function rm(t){return t.state}function B3(t,e){let{enable:r=!0,copyState:i}=e;if(Yi(i!==void 0),!t.state){t.state=new R3(t,{copyState:i}),ane(t);for(let o in I3){let s=I3[o];sne(t,o,s)}Az(t,"getParameter"),Az(t,"isEnabled")}let n=rm(t);return n.enable=r,t}function Md(t){let e=rm(t);e||(B3(t,{copyState:!1}),e=rm(t)),e.push()}function mp(t){let e=rm(t);Yi(e),e.pop()}function Az(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||hz.has(n))return r(n);let o=rm(t);return n in o.cache||(o.cache[n]=r(n)),o.enable?o.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function sne(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...o){let s=rm(t),{valueChanged:l,oldValue:u}=r(s._updateCache,...o);return l&&i(...o),u},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function ane(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=rm(t);n.program!==i&&(e(i),n.program=i)}}var lne={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function mz(t,e){e={...lne,...e};let r=null,i=o=>r=o.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:o}=e;t.addEventListener("webglcontextlost",s=>o(s),!1)}if(e.onContextRestored){let{onContextRestored:o}=e;t.addEventListener("webglcontextrestored",s=>o(s),!1)}return n}function Mu(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function gz(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Mu(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,o=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),s=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),l=o||r,u=s||i,h=t.getParameter(7938),v=_z(l,u),T=cne(l,u),E=une(l,u);return{type:"webgl",gpu:v,gpuType:E,gpuBackend:T,vendor:l,renderer:u,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function _z(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function cne(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function une(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(_z(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Q2(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var Ll="texture-compression-bc",Ho="texture-compression-astc",xh="texture-compression-etc2",fne="texture-compression-etc1-webgl",$2="texture-compression-pvrtc-webgl",O3="texture-compression-atc-webgl",dx="float32-renderable-webgl",D3="float16-renderable-webgl",hne="rgb9e5ufloat_renderable-webgl",L3="snorm8-renderable-webgl",Ax="norm16-renderable-webgl",F3="snorm16-renderable-webgl",eT="float32-filterable",yz="float16-filterable-webgl",mx="WEBGL_compressed_texture_s3tc",gx="WEBGL_compressed_texture_s3tc_srgb",U0="EXT_texture_compression_rgtc",z0="EXT_texture_compression_bptc",pne="WEBGL_compressed_texture_etc",dne="WEBGL_compressed_texture_astc",Ane="WEBGL_compressed_texture_etc1",mne="WEBGL_compressed_texture_pvrtc",gne="WEBGL_compressed_texture_atc",vz="EXT_texture_norm16",xz="EXT_render_snorm",_ne="EXT_color_buffer_float",tT={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat_renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[xz],"norm16-renderable-webgl":[vz],"snorm16-renderable-webgl":[vz,xz],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[mx,gx,U0,z0],"texture-compression-bc5-webgl":[U0],"texture-compression-bc7-webgl":[z0],"texture-compression-etc2":[pne],"texture-compression-astc":[dne],"texture-compression-etc1-webgl":[Ane],"texture-compression-pvrtc-webgl":[mne],"texture-compression-atc-webgl":[gne]};function bz(t){return t in tT}function wz(t,e,r){return(tT[e]||[]).every(n=>Mu(t,n,r))}var rT={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:L3},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:L3},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:D3,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:Ax,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:F3},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:L3},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:D3,filter:yz,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:Ax},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:F3},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:dx,filter:eT},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:hne},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:dx,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:Ax},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:Ax},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:dx,filter:eT,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:D3,filter:yz},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:Ax,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:F3},"rgb32float-webgl":{gl:34837,render:dx,filter:eT,gl2ext:_ne,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:dx,filter:eT,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:mx,f:Ll},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:gx,f:Ll},"bc1-rgba-unorm":{gl:33777,x:mx,f:Ll},"bc1-rgba-unorm-srgb":{gl:35916,x:gx,f:Ll},"bc2-rgba-unorm":{gl:33778,x:mx,f:Ll},"bc2-rgba-unorm-srgb":{gl:35918,x:gx,f:Ll},"bc3-rgba-unorm":{gl:33779,x:mx,f:Ll},"bc3-rgba-unorm-srgb":{gl:35919,x:gx,f:Ll},"bc4-r-unorm":{gl:36283,x:U0,f:Ll},"bc4-r-snorm":{gl:36284,x:U0,f:Ll},"bc5-rg-unorm":{gl:36285,x:U0,f:Ll},"bc5-rg-snorm":{gl:36286,x:U0,f:Ll},"bc6h-rgb-ufloat":{gl:36495,x:z0,f:Ll},"bc6h-rgb-float":{gl:36494,x:z0,f:Ll},"bc7-rgba-unorm":{gl:36492,x:z0,f:Ll},"bc7-rgba-unorm-srgb":{gl:36493,x:z0,f:Ll},"etc2-rgb8unorm":{gl:37492,f:xh},"etc2-rgb8unorm-srgb":{gl:37494,f:xh},"etc2-rgb8a1unorm":{gl:37496,f:xh},"etc2-rgb8a1unorm-srgb":{gl:37497,f:xh},"etc2-rgba8unorm":{gl:37493,f:xh},"etc2-rgba8unorm-srgb":{gl:37495,f:xh},"eac-r11unorm":{gl:37488,f:xh},"eac-r11snorm":{gl:37489,f:xh},"eac-rg11unorm":{gl:37490,f:xh},"eac-rg11snorm":{gl:37491,f:xh},"astc-4x4-unorm":{gl:37808,f:Ho},"astc-4x4-unorm-srgb":{gl:37840,f:Ho},"astc-5x4-unorm":{gl:37809,f:Ho},"astc-5x4-unorm-srgb":{gl:37841,f:Ho},"astc-5x5-unorm":{gl:37810,f:Ho},"astc-5x5-unorm-srgb":{gl:37842,f:Ho},"astc-6x5-unorm":{gl:37811,f:Ho},"astc-6x5-unorm-srgb":{gl:37843,f:Ho},"astc-6x6-unorm":{gl:37812,f:Ho},"astc-6x6-unorm-srgb":{gl:37844,f:Ho},"astc-8x5-unorm":{gl:37813,f:Ho},"astc-8x5-unorm-srgb":{gl:37845,f:Ho},"astc-8x6-unorm":{gl:37814,f:Ho},"astc-8x6-unorm-srgb":{gl:37846,f:Ho},"astc-8x8-unorm":{gl:37815,f:Ho},"astc-8x8-unorm-srgb":{gl:37847,f:Ho},"astc-10x5-unorm":{gl:37819,f:Ho},"astc-10x5-unorm-srgb":{gl:37851,f:Ho},"astc-10x6-unorm":{gl:37817,f:Ho},"astc-10x6-unorm-srgb":{gl:37849,f:Ho},"astc-10x8-unorm":{gl:37818,f:Ho},"astc-10x8-unorm-srgb":{gl:37850,f:Ho},"astc-10x10-unorm":{gl:37819,f:Ho},"astc-10x10-unorm-srgb":{gl:37851,f:Ho},"astc-12x10-unorm":{gl:37820,f:Ho},"astc-12x10-unorm-srgb":{gl:37852,f:Ho},"astc-12x12-unorm":{gl:37821,f:Ho},"astc-12x12-unorm-srgb":{gl:37853,f:Ho},"pvrtc-rgb4unorm-webgl":{gl:35840,f:$2},"pvrtc-rgba4unorm-webgl":{gl:35842,f:$2},"pvrtc-rbg2unorm-webgl":{gl:35841,f:$2},"pvrtc-rgba2unorm-webgl":{gl:35843,f:$2},"etc1-rbg-unorm-webgl":{gl:36196,f:fne},"atc-rgb-unorm-webgl":{gl:35986,f:O3},"atc-rgba-unorm-webgl":{gl:35986,f:O3},"atc-rgbai-unorm-webgl":{gl:34798,f:O3}},yne={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},vne={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function iT(t,e,r){let i=rT[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?Boolean(Mu(t,n,r)):!0}function N3(t){let r=rT[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function Tz(t,e,r){if(!iT(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(H2(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Mu(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Mu(t,"OES_texture_half_float_linear, extensions",r)):!0}function Ez(t,e,r){return!(!iT(t,e,r)||typeof e=="number")}function V0(t){let e=rT[t],r=N3(t),i=H2(t);return{format:r,dataFormat:e?.dataFormat||xne(i.format,i.integer,i.normalized,r),type:i.dataType?Q2(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function Sz(t){let e=rT[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function k3(t){let e=V0(t),r=yne[e.dataFormat]||4,i=vne[e.type]||1;return r*i}function xne(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var Cz={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},nT=class extends ox{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Mu(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),bz(e)&&wz(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(Cz),...Object.keys(tT)]}getWebGLFeature(e){let r=Cz[e];return Boolean(typeof r=="string"?Mu(this.gl,r,this.extensions):r)}};var oT=class extends nx{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Iu(t,e,r){if(bne(e))return r(t);let{nocatch:i=!0}=e;Md(t),Af(t,e);let n;if(i)n=r(t),mp(t);else try{n=r(t)}finally{mp(t)}return n}function bne(t){for(let e in t)return!1;return!0}function Iz(t,e,r,i){if(wd(e))return i(t);let n=t;Md(n.gl);try{return wne(t,e),Af(n.gl,r),i(t)}finally{mp(n.gl)}}function wne(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(im("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&(i.enable(32823),i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=im("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=im("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(Ene("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(aT("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&Kt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,o=aT("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,o,0,n),i.stencilFuncSeparate(1029,o,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=U3("stencilPassOperation",e.stencilPassOperation),o=U3("stencilFailOperation",e.stencilFailOperation),s=U3("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,o,s,n),i.stencilOpSeparate(1029,o,s,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=Mz("blendColorOperation",e.blendColorOperation||"add"),o=Mz("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,o);let s=sT("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=sT("blendColorDstFactor",e.blendColorDstFactor||"zero"),u=sT("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=sT("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(s,l,u,h)}}function aT(t,e){return im(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function U3(t,e){return im(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Mz(t,e){return im(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function sT(t,e){return im(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Tne(t,e){return`Illegal parameter ${e} for ${t}`}function im(t,e,r){if(!(e in r))throw new Error(Tne(t,e));return r[e]}function Ene(t,e){return e}function lT(t){let e={};return t.addressModeU&&(e[10242]=z3(t.addressModeU)),t.addressModeV&&(e[10243]=z3(t.addressModeV)),t.addressModeW&&(e[32882]=z3(t.addressModeW)),t.magFilter&&(e[10240]=Pz(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=Sne(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=aT("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function z3(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Pz(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function Sne(t,e){if(!e)return Pz(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var Ql=class extends Xi{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Cne(this.props.usage),this.glUsage=Mne(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){Yi(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function Cne(t){return t&Xi.INDEX?34963:t&Xi.VERTEX?34962:t&Xi.UNIFORM?35345:34962}function Mne(t){return t&Xi.INDEX||t&Xi.VERTEX?35044:t&Xi.UNIFORM?35048:35044}var nm=class extends Cd{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=lT(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var mf=class extends Ed{device;gl;handle;texture;constructor(e,r){super(e,{...bo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Ine={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},cT=class extends bo{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Ine,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Pne(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:E3(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new mf(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(z=>this.initialize(Object.assign({},e,{pixels:z,data:z}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:n={}}=e,{pixels:o=null,pixelStore:s={},textureUnit:l=void 0,mipmaps:u=!0}=e;r||(r=o);let{width:h,height:v,dataFormat:T,type:E,compressed:M=!1}=e,{depth:O=0}=e,F=N3(e.format);return{width:h,height:v,compressed:M,dataFormat:T,type:E}=this._deduceParameters({format:e.format,type:E,dataFormat:T,compressed:M,data:r,width:h,height:v}),this.width=h,this.height=v,this.glFormat=F,this.type=E,this.dataFormat=T,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=u,this.setImageData({data:r,width:h,height:v,depth:O,format:F,type:E,dataFormat:T,parameters:s,compressed:M}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),u&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof nm?(this.sampler=e,r=e.props):(this.sampler=new nm(this.device,e),r=e);let i=lT(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Iu(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:o=this.glFormat,offset:s=0,parameters:l={}}=e,{data:u=null,type:h=this.type,width:v=this.width,height:T=this.height,dataFormat:E=this.dataFormat,compressed:M=!1}=e;u||(u=i),{type:h,dataFormat:E,compressed:M,width:v,height:T}=this._deduceParameters({format:this.props.format,type:h,dataFormat:E,compressed:M,data:u,width:v,height:T});let{gl:O}=this;O.bindTexture(this.target,this.handle);let F=null;if({data:u,dataType:F}=this._getDataType({data:u,compressed:M}),Iu(this.gl,l,()=>{switch(F){case"null":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"typed-array":O.texImage2D(r,n,o,v,T,0,E,h,u,s);break;case"buffer":this.device.gl.bindBuffer(35052,u.handle||u),this.device.gl.texImage2D(r,n,o,v,T,0,E,h,s),this.device.gl.bindBuffer(35052,null);break;case"browser-object":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"compressed":for(let[z,W]of u.entries())O.compressedTexImage2D(r,z,W.format,W.width,W.height,0,W.data);break;default:Yi(!1,"Unknown image data type")}}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let z=k3(this.props.format);this.trackAllocatedMemory(this.width*this.height*z,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:o=0,width:s=this.width,height:l=this.height,level:u=0,glFormat:h=this.glFormat,type:v=this.type,dataFormat:T=this.dataFormat,compressed:E=!1,offset:M=0,parameters:O={}}){if({type:v,dataFormat:T,compressed:E,width:s,height:l}=this._deduceParameters({format:this.props.format,type:v,dataFormat:T,compressed:E,data:i,width:s,height:l}),Yi(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let F=i;i=F.data,s=F.shape[0],l=F.shape[1]}i instanceof Ql&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Iu(this.gl,O,()=>{E?this.gl.compressedTexSubImage2D(e,u,n,o,s,l,h,i):i===null?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,i,M):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,M),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return Kt.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof Ql?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:o,dataFormat:s,type:l,compressed:u}=e,h=V0(r);return s=s||h.dataFormat,l=l||h.type,u=u||h.compressed,{width:n,height:o}=this._deduceImageSize(i,n,o),{dataFormat:s,type:l,compressed:u,width:n,height:o,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},Yi(n,"Could not deduced texture size"),Yi(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),Yi(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,h=o||s,v=await Promise.all(cT.FACES.map(T=>{let E=h[T];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),cT.FACES.forEach((T,E)=>{v[E].length>1&&this.props.mipmaps!==!1&&Kt.warn(`${this.id} has mipmap and multiple LODs.`)(),v[E].forEach((M,O)=>{i&&n?r.texImage2D(T,O,l,i,n,0,l,u,M):r.texImage2D(T,O,l,l,u,M)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,{gl:h}=this,v=o||s;return this.bind(),v instanceof Promise?v.then(T=>this.setImageDataForFace(Object.assign({},e,{face:r,data:T,pixels:T}))):this.width||this.height?h.texImage2D(r,0,l,i,n,0,l,u,v):h.texImage2D(r,0,l,l,u,v),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:o,width:s,height:l,depth:u=1,offset:h=0,data:v,parameters:T={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=V0(n);if(Iu(this.gl,T,()=>{ArrayBuffer.isView(v)&&this.gl.texImage3D(this.target,r,E.format,s,l,u,0,E.dataFormat,E.type,v),v instanceof Ql&&(this.gl.bindBuffer(35052,v.handle),this.gl.texImage3D(this.target,r,i,s,l,u,0,n,o,h))}),v&&v.byteLength)this.trackAllocatedMemory(v.byteLength,"Texture");else{let M=k3(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!wd(e)){Rne(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),o=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,o);break;default:this.gl.texParameteri(this.target,n,o);break}}this.gl.bindTexture(this.target,null)}}},$l=cT;Yr($l,"FACES",[34069,34070,34071,34072,34073,34074]);function Pne(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function Rne(t){Kt.log(1,"texture sampler parameters",t)()}var bh=class extends _h{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();let n=this.gl.bindFramebuffer(36160,this.handle);for(let o=0;o<this.colorAttachments.length;++o){let s=this.colorAttachments[o],l=36064+o;s&&this._attachOne(l,s)}if(this.depthStencilAttachment&&this._attachOne(Sz(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let o=this.gl.checkFramebufferStatus(36160);if(o!==36053)throw new Error(`Framebuffer ${One(o)}`)}this.gl.bindFramebuffer(36160,n)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new $l(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let i of this.colorAttachments)i.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[i,n=0,o=0]=r;return this._attachTexture(e,i,n,o),i}if(r instanceof $l)return this._attachTexture(e,r,0,0),r;if(r instanceof mf){let i=r;return this._attachTexture(e,i.texture,i.props.baseMipLevel,i.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,i,n){let{gl:o}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:o.framebufferTextureLayer(36160,e,r.target,n,i);break;case 34067:let s=Bne(i);o.framebufferTexture2D(36160,e,s,r.handle,n);break;case 3553:o.framebufferTexture2D(36160,e,3553,r.handle,n);break;default:Yi(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Bne(t){return t<34069?t+34069:t}function One(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}var uT=class extends Td{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new bh(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var Dne={spector:Kt.get("spector")||Kt.get("inspect")},Lne="https://spectorcdn.babylonjs.com/spector.bundle.js",Fne=1,Tc=null,Rz=!1;async function Bz(t){if(!globalThis.SPECTOR)try{await ux(Lne)}catch(e){Kt.warn(String(e))}}function Oz(t){if(t={...Dne,...t},!t?.spector||(!Tc&&globalThis.SPECTOR&&(Kt.probe(Fne,"SPECTOR found and initialized")(),Tc=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=Tc)),!Tc))return null;if(Rz||(Rz=!0,Tc.spyCanvases(),Tc?.onCaptureStarted.add(e=>Kt.info("Spector capture started:",e)()),Tc?.onCapture.add(e=>{Kt.info("Spector capture complete:",e)(),Tc?.getResultUI(),Tc?.resultView.display(),Tc?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return Tc;Tc?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{Kt.info("Spector capture stopped after 2 seconds")(),Tc?.stopCapture()})}return Tc}var Nne="https://unpkg.com/webgl-debug@2.0.1/index.js";function Dz(t){return t.luma=t.luma||{},t.luma}async function Lz(){Ol()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await ux(Nne))}function Fz(t,e={}){return t?e.debug?Une(t,e):kne(t):null}function kne(t){let e=Dz(t);return e.realContext?e.realContext:t}function Une(t,e){if(!globalThis.WebGLDebugUtils)return Kt.warn("webgl-debug not loaded")(),t;let r=Dz(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...yh,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,zne.bind(null,e),Vne.bind(null,e));for(let s in yh)!(s in i)&&typeof yh[s]=="number"&&(i[s]=yh[s]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let o=Object.create(n);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function V3(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function zne(t,e,r,i){i=Array.from(i).map(l=>l===void 0?"undefined":l);let n=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),s=`${n} in gl.${r}(${o})`;Kt.error(s)();debugger;if(t.throwOnError)throw new Error(s)}function Vne(t,e,r){let i="";if(Kt.level>=1&&(i=V3(e,r),Kt.log(1,i)()),t.break&&t.break.length>0&&(i=i||V3(e,r),t.break.every(o=>i.indexOf(o)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||V3(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);Kt.error(`Undefined argument: ${i}`)();debugger}}function kz(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[T,E]=n;r.push({message:E.trim(),type:Nz(T),lineNum:0,linePos:0});continue}let[o,s,l,...u]=n,h=parseInt(l,10);isNaN(h)&&(h=0);let v=parseInt(s,10);isNaN(v)&&(v=0),r.push({message:u.join(":").trim(),type:Nz(o),lineNum:h,linePos:v})}return r}function Nz(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var fT=class extends Sd{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return kz(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100
553
- ${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var jne=256,Hne=1024,Gne=16384,j3=6144,Wne=[1,2,4,8],hT=class extends O0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Md(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){mp(this.device.gl)}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=Wne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,Af(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Gne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=jne,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Hne,e.clearStencil=this.props.clearStencil),r!==0&&Iu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Iu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(j3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(j3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(j3,e,r);break}})}};var qne="Failed to deduce GL constant from typed array";function Uz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(qne)}}function _x(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Xne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Yne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Id=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return _x(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),_x(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Id(Xne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Id.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Id.getBytesPerVertex(this)}_assign(e={}){return e=T3("Accessor",e,Yne),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function zz(t){return Kne.includes(t)}var Kne=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Vz={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function H3(t){let e=Vz[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function jz(t){let e=Vz[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function Hz(t,e){let r={attributes:[],bindings:[]};r.attributes=Zne(t,e);let i=$ne(t,e);for(let l of i){let u=l.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=Qne(t,e),o=0;for(let l of n)if(zz(l.type)){let{viewDimension:u,sampleType:h}=toe(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:h}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let s=Jne(t,e);return s?.length&&(r.varyings=s),r}function Zne(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l}=o,u=t.getAttribLocation(e,s);if(u>=0){let{attributeType:h}=jz(l),v=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:u,stepMode:v,type:h})}}return r.sort((n,o)=>n.location-o.location),r}function Jne(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l,size:u}=o,{glType:h,components:v}=H3(l),T=new Id({type:h,size:u*v}),E={location:n,name:s,accessor:T};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function Qne(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:s,size:l,type:u}=o,{name:h,isArray:v}=roe(s),T=t.getUniformLocation(e,h),E={location:T,name:h,size:l,type:u,isArray:v};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let O=`${h}[${M}]`;T=t.getUniformLocation(e,O);let F={...E,name:O,location:T};r.push(F)}}return r}function $ne(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),h=t.getActiveUniforms(e,l,35384),v=t.getActiveUniforms(e,l,35387),T=t.getActiveUniforms(e,l,35388);for(let E=0;E<s.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");s.uniforms.push({name:M.name,format:H3(u[E]).format,type:u[E],arrayLength:h[E],byteOffset:v[E],byteStride:T[E]})}i.push(s)}return i.sort((o,s)=>o.location-s.location),i}var eoe={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function toe(t){let e=eoe[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function roe(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Gz(t,e,r,i){let n=t,o=i;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return n.uniform1uiv(e,s,1);case 36294:return n.uniform2uiv(e,s,2);case 36295:return n.uniform3uiv(e,s,3);case 36296:return n.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return n.uniformMatrix2x3fv(e,!1,s);case 35686:return n.uniformMatrix2x4fv(e,!1,s);case 35687:return n.uniformMatrix3x2fv(e,!1,s);case 35688:return n.uniformMatrix3x4fv(e,!1,s);case 35689:return n.uniformMatrix4x2fv(e,!1,s);case 35690:return n.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function Wz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function qz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var Xz=4,pT=class extends df{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),Kt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Hz(this.device.gl,this.handle),Kt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=g3(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":Kt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===i)||this.shaderLayout.bindings.find(s=>s.name===`${i}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(l=>`"${l.name}"`).join(", ");r?.disableWarnings||Kt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||Kt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof Ql)&&!(n.buffer instanceof Ql))throw new Error("buffer value");break;case"texture":if(!(n instanceof mf||n instanceof $l||n instanceof bh))throw new Error("texture value");break;case"sampler":Kt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(o.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:l,firstVertex:u=0,transformFeedback:h}=e,v=Wz(n),T=Boolean(o.indexBuffer),E=o.indexBuffer?.glIndexType,M=Number(l)>0;if(this.linkStatus!=="success")return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),h&&h.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let O=r;return Iz(this.device,i,O.glParameters,()=>{T&&M?this.device.gl.drawElementsInstanced(v,s||0,E,u,l||0):T?this.device.gl.drawElements(v,s||0,E,u):M?this.device.gl.drawArraysInstanced(v,u,s||0,l||0):this.device.gl.drawArrays(v,u,s||0),h&&h.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=cx(e);Object.keys(r).forEach(i=>{Kt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Kt.time(Xz,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Kt.timeEnd(Xz,`linkProgram for ${this.id}`)(),Kt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}Kt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Kt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof $l&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:s}=n,l=e.getUniformBlockIndex(this.handle,s);if(l===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,i,l),o instanceof Ql?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof mf||o instanceof $l||o instanceof bh))throw new Error("texture");let u;if(o instanceof mf)u=o.texture;else if(o instanceof $l)u=o;else if(o instanceof bh&&o.colorAttachments[0]instanceof mf)Kt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&Gz(this.device.gl,i,n,s)}}};var dT=class extends L0{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":ioe(this.device,r.options);break;case"copy-buffer-to-texture":noe(this.device,r.options);break;case"copy-texture-to-buffer":ooe(this.device,r.options);break;case"copy-texture-to-texture":soe(this.device,r.options);break}}};function ioe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function noe(t,e){throw new Error("Not implemented")}function ooe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:s=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:h,byteOffset:v=0,bytesPerRow:T,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||T||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:O}=Yz(r),F;try{let z=h,W=o||M.width,J=s||M.height,K=V0(M.texture.props.format),ne=K.dataFormat,ge=K.type;t.gl.bindBuffer(35051,z.handle),F=t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],W,J,ne,ge,v)}finally{t.gl.bindBuffer(35051,null),F!==void 0&&t.gl.bindFramebuffer(36160,F),O&&M.destroy()}}function soe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:o=[0,0],destination:s}=e,{width:l=e.destination.width,height:u=e.destination.height}=e,{framebuffer:h,destroyFramebuffer:v}=Yz(r),[T,E]=n,[M,O,F]=o,z=t.gl.bindFramebuffer(36160,h.handle),W=null,J;if(s instanceof $l)W=s,l=Number.isFinite(l)?l:W.width,u=Number.isFinite(u)?u:W.height,W.bind(0),J=W.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,M,O,T,E,l,u);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,M,O,F,T,E,l,u);break;default:}W&&W.unbind(),t.gl.bindFramebuffer(36160,z),v&&h.destroy()}function Yz(t){if(t instanceof bo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var AT=class extends D0{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new dT(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var j0=class extends F0{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return SP()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:s,offset:l,normalized:u,integer:h,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),h?this.device.gl.vertexAttribIPointer(e,n,o,s,l):this.device.gl.vertexAttribPointer(e,n,o,u,s,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=Q2(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=j0.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=aoe(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),s=s||!loe(i,this.bufferValue),s){let l=x3(r.constructor,o);b3({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function aoe(t){return Array.isArray(t)?new Float32Array(t):t}function loe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var mT=class extends N0{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(qz(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,Kt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(i,n,s,o)}getBuffer(e){if(Kz(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Ql)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(Kz(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function Kz(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var gT=class extends k0{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function G3(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yi(!1),0}}function Zz(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yi(!1),0}}function Jz(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:s=null,sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=$z(t);Yi(v);let{gl:E,handle:M}=v;l=l||v.width,u=u||v.height;let O=o-36064;h=h||v.colorAttachments[O]?.texture?.type||5121,s=uoe(s,h,n,l,u),h=h||Uz(s);let F=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,h,s),E.bindFramebuffer(36160,F||null),T&&v.destroy(),s}function Qz(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=$z(t);Yi(v),l=l||v.width,u=u||v.height;let E=v;h=h||5121;let M=r;if(!M){let F=G3(o),z=Zz(h),W=s+l*u*F*z;M=E.device.createBuffer({byteLength:W})}let O=t.device.createCommandEncoder();return O.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:s}),O.destroy(),T&&v.destroy(),M}function $z(t){return t instanceof _h?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:coe(t),deleteFramebuffer:!0}}function coe(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function uoe(t,e,r,i,n){if(t)return t;e=e||5121;let o=_x(e,{clamped:!1}),s=G3(r);return new o(i*n*s)}var foe=256,hoe=1024,poe=16384;var doe="clear: bad arguments";function e5(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},s={};r&&(s.framebuffer=r);let l=0;i&&(l|=poe,i!==!0&&(s.clearColor=i)),n&&(l|=foe,n!==!0&&(s.clearDepth=n)),o&&(l|=hoe,n!==!0&&(s.clearStencil=n)),Yi(l!==0,doe);let u=t.gl;Iu(u,s,()=>{u.clear(l)})}var yx=1,H0=class extends bc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof H0)return e;if(e?.device instanceof bc)return e.device;if(!Aoe(e))throw new Error("Invalid WebGL2RenderingContext");return new H0({gl:e})}static async create(e={}){Kt.groupCollapsed(yx,"WebGLDevice created")();let r=[];e.debug&&r.push(Lz()),e.spector&&r.push(Bz()),typeof e.canvas=="string"&&r.push(Td.pageLoaded);let i=await Promise.allSettled(r);for(let s of i)s.status==="rejected"&&Kt.error(`Failed to initialize debug libraries ${s.reason}`)();if(Kt.probe(yx+1,"DOM is loaded")(),e.gl?.device)return Kt.warn("reattaching existing device")(),H0.attach(e.gl);let n=new H0(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return Kt.probe(yx,o)(),Kt.table(yx,n.info)(),Kt.groupEnd(yx)(),n}constructor(e){super({...e,id:e.id||oa("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new uT(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=mz(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=gz(this.gl,this._extensions),this.limits=new oT(this.gl),this.features=new nT(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:s=!1}=e;B3(this.gl,{enable:o,copyState:s,log:(...l)=>Kt.log(1,...l)()}),e.debug&&(this.gl=Fz(this.gl,{...e,throwOnError:!0}),this.debug=!0,Kt.level=Math.max(Kt.level,1),Kt.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=Oz({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return iT(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return Tz(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return Ez(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new Ql(this,r)}_createTexture(e){return new $l(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new nm(this,e)}createShader(e){return new fT(this,e)}createFramebuffer(e){return new bh(this,e)}createVertexArray(e){return new j0(this,e)}createTransformFeedback(e){return new mT(this,e)}createQuerySet(e){return new gT(this,e)}createRenderPipeline(e){return new pT(this,e)}beginRenderPass(e){return new hT(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new AT(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return Jz(e,r)}readPixelsToBufferWebGL(e,r){return Qz(e,r)}setParametersWebGL(e){Af(this.gl,e)}getParametersWebGL(e){return J2(this.gl,e)}withParametersWebGL(e,r){return Iu(this.gl,e,r)}clearWebGL(e){e5(this,e)}resetWebGL(){Kt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),pz(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Md(this.gl)}popState(){mp(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&yoe(n,r)&&Kt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:moe(this,e,r);break;case Int32Array:goe(this,e,r);break;case Uint32Array:_oe(this,e,r);break;default:Yi(!1)}}getExtension(e){return Mu(this.gl,e,this._extensions),this._extensions}},wh=H0;Yr(wh,"type","webgl");function Aoe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function moe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:Yi(!1)}}function goe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function _oe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function yoe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var t5,r5,n5={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function _T(){return document.createElement("div")}function voe(t){if(!t.picked)return null;if(t.object===t5)return r5;let e={html:boe(t.object),style:n5};return r5=e,t5=t.object,e}var xoe=new Set(["position","index"]);function boe(t){let e=_T();for(let r in t){if(xoe.has(r))continue;let i=_T();i.className="header",i.textContent=r;let n=_T();n.className="value",n.textContent=Toe(t[r]);let o=_T();woe(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function woe(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Toe(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function i5(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,s=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(s))];for(let u of l){if(u.includes(".")){r=e;let h=u.split(".");for(let v of h)if(r.hasOwnProperty(v))r=r[v];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function W3(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||n5};return t.html?r.html=i5(t.html,e.object):r.text=i5(t.text,e.object),r}:voe:null}function o5(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function s5(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var l5=ga(a5()),Eoe="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",Y3=l5.default;function c5(t=Eoe){o5(t)}function u5(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var K3={};function f5(t){if(!K3[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),K3[t]=new Promise(i=>{e.onload=i})}return K3[t]}var h5="4.2.0-beta.2";var Soe=globalThis.loaders?.parseImageNode,Z3=typeof Image<"u",J3=typeof ImageBitmap<"u",Coe=Boolean(Soe),Q3=Ap?!0:Coe;function p5(t){switch(t){case"auto":return J3||Z3||Q3;case"imagebitmap":return J3;case"image":return Z3;case"data":return Q3;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function d5(){if(J3)return"imagebitmap";if(Z3)return"image";if(Q3)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function A5(t){let e=Moe(t);if(!e)throw new Error("Not an image");return e}function vx(t){switch(A5(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Moe(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Ioe=/^data:image\/svg\+xml/,Poe=/\.svg((\?|#).*)?$/;function yT(t){return t&&(Ioe.test(t)||Poe.test(t))}function m5(t,e){if(yT(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return $3(t,e)}function $3(t,e){if(yT(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function vT(t,e,r){let i=m5(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await Roe(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function Roe(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";n(new Error(s))}}catch(o){n(o)}})}var Boe={},g5=!0;async function _5(t,e,r){let i;yT(r)?i=await vT(t,e,r):i=$3(t,r);let n=e&&e.imagebitmap;return await Ooe(i,n)}async function Ooe(t,e=null){if((Doe(e)||!g5)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),g5=!1}return await createImageBitmap(t)}function Doe(t){for(let e in t||Boe)return!1;return!0}function y5(t){return!koe(t,"ftyp",4)||!(t[8]&96)?null:Loe(t)}function Loe(t){switch(Foe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Foe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Noe(t){return[...t].map(e=>e.charCodeAt(0))}function koe(t,e,r=0){let i=Noe(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var Th=!1,xx=!0;function om(t){let e=bx(t);return zoe(e)||Hoe(e)||Voe(e)||joe(e)||Uoe(e)}function Uoe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=y5(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function zoe(t){let e=bx(t);return e.byteLength>=24&&e.getUint32(0,Th)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Th),height:e.getUint32(20,Th)}:null}function Voe(t){let e=bx(t);return e.byteLength>=10&&e.getUint32(0,Th)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,xx),height:e.getUint16(8,xx)}:null}function joe(t){let e=bx(t);return e.byteLength>=14&&e.getUint16(0,Th)===16973&&e.getUint32(2,xx)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,xx),height:e.getUint32(22,xx)}:null}function Hoe(t){let e=bx(t);if(!(e.byteLength>=3&&e.getUint16(0,Th)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Goe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Th);if(n.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Th),width:e.getUint16(o+7,Th)};if(!i.has(s))return null;o+=2,o+=e.getUint16(o,Th)}return null}function Goe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function bx(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function v5(t,e){let{mimeType:r}=om(t)||{},i=globalThis.loaders?.parseImageNode;return On(i),await i(t,r)}async function x5(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},s=Woe(n),l;switch(s){case"imagebitmap":l=await _5(t,e,o);break;case"image":l=await vT(t,e,o);break;case"data":l=await v5(t,e);break;default:On(!1)}return n==="data"&&(l=vx(l)),l}function Woe(t){switch(t){case"auto":case"data":return d5();default:return p5(t),t}}var qoe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Xoe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Yoe={image:{type:"auto",decode:!0}},Eh={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:h5,mimeTypes:Xoe,extensions:qoe,parse:x5,tests:[t=>Boolean(om(new DataView(t)))],options:Yoe};var eR={};function tR(t){if(eR[t]===void 0){let e=Ap?Zoe(t):Koe(t);eR[t]=e}return eR[t]}function Koe(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,i=globalThis.loaders?.parseImageNode;return Boolean(i)&&r.includes(t)}function Zoe(t){switch(t){case"image/avif":case"image/webp":return Joe(t);default:return!0}}function Joe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Qoe=new xc({id:"deck"}),ur=Qoe;var rR={};function b5(t){rR=t}function Ks(t,e,r,i){ur.level>0&&rR[t]&&rR[t].call(null,e,r,i)}function $oe(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var w5={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:$oe,parseTextSync:JSON.parse};function ese(){let t="9.0.7",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(ur.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:ur,_registerLoggers:b5},em([w5,[Eh,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var xT=ese();function Sh(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var iR={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function E5(t){let e={};for(let[r,i]of Object.entries(t))e[r]=tse(i);return e}function S5(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&Sh(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function tse(t){let e=T5(t);if(e!=="object")return{value:t,...iR[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...iR[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=T5(t.value),{...t,...iR[e],type:e}):{type:"object",value:null};throw new Error("props")}function T5(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var C5=`#ifdef MODULE_LOGDEPTH
552
+ </pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);let l=document.getElementsByClassName("luma-compiler-log-error");l[0]?.scrollIntoView&&l[0].scrollIntoView(),s.onclick=()=>{let u=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(u)}}},Sd=l3;Yr(Sd,"defaultProps",{...fn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debug:"errors"});function Xie(t){return a3(t.source).name||t.id||oa(`unnamed ${t.stage}-shader`)}var c3=class extends fn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,r){super(e,r,c3.defaultProps)}},Cd=c3;Yr(Cd,"defaultProps",{...fn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});var u3=class extends fn{get[Symbol.toStringTag](){return"Framebuffer"}width;height;colorAttachments=[];depthStencilAttachment=null;constructor(e,r={}){super(e,r,u3.defaultProps),this.width=this.props.width,this.height=this.props.height}resize(e){let r=!e;if(e){let[i,n]=Array.isArray(e)?e:[e.width,e.height];r=r||n!==this.height||i!==this.width,this.width=i,this.height=n}r&&(Kt.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map(r=>{if(typeof r=="string"){let i=this.createColorTexture(r);return this.attachResource(i),i.view}return r instanceof bo?r.view:r});let e=this.props.depthStencilAttachment;if(e)if(typeof e=="string"){let r=this.createDepthStencilTexture(e);this.attachResource(r),this.depthStencilAttachment=r.view}else e instanceof bo?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e){return this.device.createTexture({id:"color-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}createDepthStencilTexture(e){return this.device.createTexture({id:"depth-stencil-attachment",usage:bo.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height})}resizeAttachments(e,r){for(let i=0;i<this.colorAttachments.length;++i)if(this.colorAttachments[i]){let n=this.device._createTexture({...this.colorAttachments[i].props,width:e,height:r});this.destroyAttachedResource(this.colorAttachments[i]),this.colorAttachments[i]=n.view,this.attachResource(n.view)}if(this.depthStencilAttachment){let i=this.device._createTexture({...this.depthStencilAttachment.props,width:e,height:r});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=i.view,this.attachResource(i)}}},_h=u3;Yr(_h,"defaultProps",{...fn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});var f3=class extends fn{get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,r){super(e,r,f3.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw new Error("Use uniform blocks")}},df=f3;Yr(df,"defaultProps",{...fn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}});var h3=class extends fn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,r){super(e,r,h3.defaultProps)}},O0=h3;Yr(O0,"defaultProps",{...fn.defaultProps,framebuffer:null,parameters:void 0,clearColor:[0,0,0,0],clearDepth:1,clearStencil:0,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});var p3=class extends fn{get[Symbol.toStringTag](){return"ComputePipeline"}hash="";constructor(e,r){super(e,r,p3.defaultProps)}},tm=p3;Yr(tm,"defaultProps",{...fn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});var d3=class extends fn{get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,r){super(e,r,d3.defaultProps)}},D0=d3;Yr(D0,"defaultProps",{...fn.defaultProps,measureExecutionTime:void 0});var A3=class extends fn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,r){super(e,r,A3.defaultProps)}},L0=A3;Yr(L0,"defaultProps",{...fn.defaultProps});function ez(t){let[e,r]=Kie[t],i=e==="i32"||e==="u32",n=e!=="u32",o=Zie[e]*r,s=Yie(e,r);return{dataType:e,components:r,defaultVertexFormat:s,byteLength:o,integer:i,signed:n}}function Yie(t,e){let r;switch(t){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return e<=2?"float16x2":"float16x4"}return e===1?r:`${r}x${e}`}var Kie={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]},Zie={f32:4,f16:2,i32:4,u32:4};function m3(t){let e;t.endsWith("-webgl")&&(t.replace("-webgl",""),e=!0);let[r,i]=t.split("x"),n=r,o=i?parseInt(i):1,s=j2(n),l={type:n,components:o,byteLength:s.byteLength*o,integer:s.integer,signed:s.signed,normalized:s.normalized};return e&&(l.webglOnly=!0),l}function W2(t,e){let r={};for(let i of t.attributes)r[i.name]=Jie(t,e,i.name);return r}function tz(t,e,r=16){let i=W2(t,e),n=new Array(r).fill(null);for(let o of Object.values(i))n[o.location]=o;return n}function Jie(t,e,r){let i=Qie(t,r),n=$ie(e,r);if(!i)return null;let o=ez(i.type),s=n?.vertexFormat||o.defaultVertexFormat,l=m3(s);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:s,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode,byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}function Qie(t,e){let r=t.attributes.find(i=>i.name===e);return r||Kt.warn(`shader layout attribute "${e}" not present in shader`),r||null}function $ie(t,e){ene(t);let r=tne(t,e);return r||(r=rne(t,e),r)?r:(Kt.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function ene(t){for(let e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&Kt.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function tne(t,e){for(let r of t)if(r.format&&r.name===e)return{attributeName:r.name,bufferName:e,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}function rne(t,e){for(let r of t){let i=r.byteStride;if(typeof r.byteStride!="number")for(let o of r.attributes||[]){let s=m3(o.format);i+=s.byteLength}let n=r.attributes?.find(o=>o.attribute===e);if(n)return{attributeName:n.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:n.format,byteOffset:n.byteOffset,byteStride:i}}return null}function g3(t,e){let r={...t,attributes:t.attributes.map(i=>({...i}))};for(let i of e?.attributes||[]){let n=r.attributes.find(o=>o.name===i.name);n?(n.type=i.type||n.type,n.stepMode=i.stepMode||n.stepMode):Kt.warn(`shader layout attribute ${i.name} not present in shader`)}return r}var _3=class extends fn{get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,r){super(e,r,_3.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=tz(r.renderPipeline.shaderLayout,r.renderPipeline.bufferLayout,this.maxVertexAttributes)}setConstantWebGL(e,r){throw new Error("constant attributes not supported")}},F0=_3;Yr(F0,"defaultProps",{...fn.defaultProps,renderPipeline:null});var y3=class extends fn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,r){super(e,r,y3.defaultProps)}},N0=y3;Yr(N0,"defaultProps",{...fn.defaultProps,layout:void 0,buffers:{}});var v3=class extends fn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,r){super(e,r,v3.defaultProps)}},k0=v3;Yr(k0,"defaultProps",{...fn.defaultProps,type:void 0,count:void 0});var ine={f32:{type:"f32",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16}};function rz(t){let e=ine[t];return Yi(t),e}function iz(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}var q2;function X2(t){return(!q2||q2.byteLength<t)&&(q2=new ArrayBuffer(t)),q2}function x3(t,e){let r=X2(t.BYTES_PER_ELEMENT*e);return new t(r,0,e)}function b3(t){let{target:e,source:r,start:i=0,count:n=1}=t,o=r.length,s=n*o,l=0;for(let u=i;l<o;l++)e[u++]=r[l];for(;l<s;)l<s-l?(e.copyWithin(i+l,i,i+l),l*=2):(e.copyWithin(i+l,i,i+s-l),l=s);return t.target}var nz=1024,Y2=class{layout={};byteLength;constructor(e){let r=0;for(let[n,o]of Object.entries(e)){let s=rz(o),{type:l,components:u}=s;r=iz(r,u);let h=r;r+=u,this.layout[n]={type:l,size:u,offset:h}}r+=(4-r%4)%4;let i=r*4;this.byteLength=Math.max(i,nz)}getData(e){let r=Math.max(this.byteLength,nz),i=X2(r),n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)};for(let[o,s]of Object.entries(e)){let l=this.layout[o];if(!l){Kt.warn(`Supplied uniform value ${o} not present in uniform block layout`)();continue}let{type:u,size:h,offset:v}=l,T=n[u];if(h===1){if(typeof s!="number"&&typeof s!="boolean"){Kt.warn(`Supplied value for single component uniform ${o} is not a number: ${s}`)();continue}T[v]=Number(s)}else{let E=bd(s);if(!E){Kt.warn(`Supplied value for multi component / array uniform ${o} is not a numeric array: ${s}`)();continue}T.set(E,v)}}return new Uint8Array(i)}has(e){return Boolean(this.layout[e])}get(e){return this.layout[e]}};function oz(t,e,r=16){if(t!==e)return!1;let i=bd(t);if(!i)return!1;let n=bd(e);if(n&&i.length===n.length){for(let o=0;o<i.length;++o)if(n[o]!==i[o])return!1}return!0}function sz(t){let e=bd(t);return e?e.slice():t}var K2=class{name;uniforms={};modifiedUniforms={};modified=!0;bindingLayout={};needsRedraw="initialized";constructor(e){if(this.name=e?.name,e?.name&&e?.shaderLayout){let r=e?.shaderLayout.bindings?.find(n=>n.type==="uniform"&&n.name===e?.name);if(!r)throw new Error(e?.name);let i=r;for(let n of i.uniforms||[])this.bindingLayout[n.name]=n}}setUniforms(e){for(let[r,i]of Object.entries(e))this._setUniform(r,i),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${r}=${i}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,r){oz(this.uniforms[e],r)||(this.uniforms[e]=sz(r),this.modifiedUniforms[e]=!0,this.modified=!0)}};var ax=class{uniformBlocks=new Map;uniformBufferLayouts=new Map;uniformBuffers=new Map;constructor(e){for(let[r,i]of Object.entries(e)){let n=r,o=new Y2(i.uniformTypes||{});this.uniformBufferLayouts.set(n,o);let s=new K2({name:r});s.setUniforms(i.defaultUniforms||{}),this.uniformBlocks.set(n,s)}}destroy(){for(let e of this.uniformBuffers.values())e.destroy()}setUniforms(e){for(let[r,i]of Object.entries(e))this.uniformBlocks.get(r).setUniforms(i);this.updateUniformBuffers()}getUniformBufferByteLength(e){return this.uniformBufferLayouts.get(e).byteLength}getUniformBufferData(e){let r=this.uniformBlocks.get(e).getAllUniforms();return this.uniformBufferLayouts.get(e).getData(r)}createUniformBuffer(e,r,i){i&&this.setUniforms(i);let n=this.getUniformBufferByteLength(r),o=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:n}),s=this.getUniformBufferData(r);return o.write(s),o}getManagedUniformBuffer(e,r){if(!this.uniformBuffers.get(r)){let i=this.getUniformBufferByteLength(r),n=e.createBuffer({usage:Xi.UNIFORM|Xi.COPY_DST,byteLength:i});this.uniformBuffers.set(r,n)}return this.uniformBuffers.get(r)}updateUniformBuffers(){let e=!1;for(let r of this.uniformBlocks.keys()){let i=this.updateUniformBuffer(r);e||=i}return e&&Kt.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){let r=this.uniformBlocks.get(e),i=this.uniformBuffers.get(e),n=!1;if(i&&r.needsRedraw){n||=r.needsRedraw;let o=this.getUniformBufferData(e);this.uniformBuffers.get(e).write(o);let l=this.uniformBlocks.get(e).getAllUniforms();Kt.log(4,`Writing to uniform buffer ${String(e)}`,o,l)()}return n}};function Z2(t){let e=ArrayBuffer.isView(t)?t.constructor:t;switch(e){case Float32Array:return"float32";case Uint16Array:return"uint16";case Uint32Array:return"uint32";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int8Array:return"sint8";case Int16Array:return"sint16";case Int32Array:return"sint32";default:throw new Error(e.constructor.name)}}function lx(t){switch(t){case"float32":return Float32Array;case"uint32":return Uint32Array;case"sint32":return Int32Array;case"uint16":case"unorm16":return Uint16Array;case"sint16":case"snorm16":return Int16Array;case"uint8":case"unorm8":return Uint8Array;case"sint8":case"snorm8":return Int8Array;default:throw new Error(t)}}function w3(t,e,r){if(!e||e>4)throw new Error(`size ${e}`);let i=e,n=Z2(t);if(n==="uint8"||n==="sint8"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}if(n==="uint16"||n==="sint16"){if(i===1||i===3)throw new Error(`size: ${e}`);return r&&(n=n.replace("int","norm")),`${n}x${i}`}return i===1?n:`${n}x${i}`}function az(t){return bd(t)!==null||typeof t=="number"||typeof t=="boolean"}function cx(t){let e={bindings:{},uniforms:{}};return Object.keys(t).forEach(r=>{let i=t[r];az(i)?e.uniforms[r]=i:e.bindings[r]=i}),e}function T3(t,e,r){let{removedProps:i={},deprecatedProps:n={},replacedProps:o={}}=r;for(let l in i)if(l in e){let h=i[l]?`${t}.${i[l]}`:"N/A";Kt.removed(`${t}.${l}`,h)()}for(let l in n)if(l in e){let u=n[l];Kt.deprecated(`${t}.${l}`,`${t}.${u}`)()}let s=null;for(let[l,u]of Object.entries(o))l in e&&(Kt.deprecated(`${t}.${l}`,`${t}.${u}`)(),s=s||Object.assign({},e),s[u]=e[l],delete s[l]);return s||e}var nne="";async function E3(t,e){return await new Promise((r,i)=>{try{let n=new Image;n.onload=()=>r(n),n.onerror=()=>i(new Error(`Could not load image ${t}.`)),n.crossOrigin=e?.crossOrigin||"anonymous",n.src=t.startsWith("http")?t:nne+t}catch(n){i(n)}})}async function ux(t,e){let r=document.getElementsByTagName("head")[0];if(!r)throw new Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",t),e&&(i.id=e),new Promise((n,o)=>{i.onload=n,i.onerror=s=>o(new Error(`Unable to load script '${t}': ${s}`)),r.appendChild(i)})}function fx(t,e,r){if(t===e)return!0;if(!r||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!fx(t[i],e[i],r-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){let i=Object.keys(t),n=Object.keys(e);if(i.length!==n.length)return!1;for(let o of i)if(!e.hasOwnProperty(o)||!fx(t[o],e[o],r-1))return!1;return!0}return!1}function S3(t){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}function C3(t){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(t):clearTimeout(t)}var yh;(function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"})(yh||(yh={}));var px={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},ya=(t,e,r)=>e?t.enable(r):t.disable(r),lz=(t,e,r)=>t.hint(r,e),Kc=(t,e,r)=>t.pixelStorei(r,e),cz=(t,e,r)=>{let i=r===36006?36009:36008;return t.bindFramebuffer(i,e)},hx=(t,e,r)=>{let n={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];t.bindBuffer(n,e)};function M3(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}var uz={[3042]:ya,[32773]:(t,e)=>t.blendColor(...e),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(t,e)=>t.clearColor(...e),[3107]:(t,e)=>t.colorMask(...e),[2884]:ya,[2885]:(t,e)=>t.cullFace(e),[2929]:ya,[2931]:(t,e)=>t.clearDepth(e),[2932]:(t,e)=>t.depthFunc(e),[2928]:(t,e)=>t.depthRange(...e),[2930]:(t,e)=>t.depthMask(e),[3024]:ya,[35723]:lz,[35725]:(t,e)=>t.useProgram(e),[36007]:(t,e)=>t.bindRenderbuffer(36161,e),[36389]:(t,e)=>t.bindTransformFeedback?.(36386,e),[34229]:(t,e)=>t.bindVertexArray(e),[36006]:cz,[36010]:cz,[34964]:hx,[36662]:hx,[36663]:hx,[35053]:hx,[35055]:hx,[2886]:(t,e)=>t.frontFace(e),[33170]:lz,[2849]:(t,e)=>t.lineWidth(e),[32823]:ya,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:ya,[32926]:ya,[32928]:ya,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:ya,[3088]:(t,e)=>t.scissor(...e),[2960]:ya,[2961]:(t,e)=>t.clearStencil(e),[2968]:(t,e)=>t.stencilMaskSeparate(1028,e),[36005]:(t,e)=>t.stencilMaskSeparate(1029,e),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(t,e)=>t.viewport(...e),[34383]:ya,[10754]:ya,[12288]:ya,[12289]:ya,[12290]:ya,[12291]:ya,[12292]:ya,[12293]:ya,[12294]:ya,[12295]:ya,[3333]:Kc,[3317]:Kc,[37440]:Kc,[37441]:Kc,[37443]:Kc,[3330]:Kc,[3332]:Kc,[3331]:Kc,[3314]:Kc,[32878]:Kc,[3316]:Kc,[3315]:Kc,[32877]:Kc,framebuffer:(t,e)=>{let r=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,r)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{let r=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...r)},blendFunc:(t,e)=>{let r=e?.length===2?[...e,...e]:e;t.blendFuncSeparate(...r)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=M3(e)?e:[e,e];let[r,i]=e;t.stencilMaskSeparate(1028,r),t.stencilMaskSeparate(1029,i)},stencilFunc:(t,e)=>{e=M3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilFuncSeparate(1028,r,i,n),t.stencilFuncSeparate(1029,o,s,l)},stencilOp:(t,e)=>{e=M3(e)&&e.length===3?[...e,...e]:e;let[r,i,n,o,s,l]=e;t.stencilOpSeparate(1028,r,i,n),t.stencilOpSeparate(1029,o,s,l)},viewport:(t,e)=>t.viewport(...e)};function Ys(t,e,r){return e[t]!==void 0?e[t]:r[t]}var fz={blendEquation:(t,e,r)=>t.blendEquationSeparate(Ys(32777,e,r),Ys(34877,e,r)),blendFunc:(t,e,r)=>t.blendFuncSeparate(Ys(32969,e,r),Ys(32968,e,r),Ys(32971,e,r),Ys(32970,e,r)),polygonOffset:(t,e,r)=>t.polygonOffset(Ys(32824,e,r),Ys(10752,e,r)),sampleCoverage:(t,e,r)=>t.sampleCoverage(Ys(32938,e,r),Ys(32939,e,r)),stencilFuncFront:(t,e,r)=>t.stencilFuncSeparate(1028,Ys(2962,e,r),Ys(2967,e,r),Ys(2963,e,r)),stencilFuncBack:(t,e,r)=>t.stencilFuncSeparate(1029,Ys(34816,e,r),Ys(36003,e,r),Ys(36004,e,r)),stencilOpFront:(t,e,r)=>t.stencilOpSeparate(1028,Ys(2964,e,r),Ys(2965,e,r),Ys(2966,e,r)),stencilOpBack:(t,e,r)=>t.stencilOpSeparate(1029,Ys(34817,e,r),Ys(34818,e,r),Ys(34819,e,r))},I3={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,r)=>t({[e]:r}),hint:(t,e,r)=>t({[e]:r}),useProgram:(t,e)=>t({[35725]:e}),bindRenderbuffer:(t,e,r)=>t({[36007]:r}),bindTransformFeedback:(t,e,r)=>t({[36389]:r}),bindVertexArray:(t,e)=>t({[34229]:e}),bindFramebuffer:(t,e,r)=>{switch(e){case 36160:return t({[36006]:r,[36010]:r});case 36009:return t({[36006]:r});case 36008:return t({[36010]:r});default:return null}},bindBuffer:(t,e,r)=>{let i={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[e];return i?t({[i]:r}):{valueChanged:!0}},blendColor:(t,e,r,i,n)=>t({[32773]:new Float32Array([e,r,i,n])}),blendEquation:(t,e)=>t({[32777]:e,[34877]:e}),blendEquationSeparate:(t,e,r)=>t({[32777]:e,[34877]:r}),blendFunc:(t,e,r)=>t({[32969]:e,[32968]:r,[32971]:e,[32970]:r}),blendFuncSeparate:(t,e,r,i,n)=>t({[32969]:e,[32968]:r,[32971]:i,[32970]:n}),clearColor:(t,e,r,i,n)=>t({[3106]:new Float32Array([e,r,i,n])}),clearDepth:(t,e)=>t({[2931]:e}),clearStencil:(t,e)=>t({[2961]:e}),colorMask:(t,e,r,i,n)=>t({[3107]:[e,r,i,n]}),cullFace:(t,e)=>t({[2885]:e}),depthFunc:(t,e)=>t({[2932]:e}),depthRange:(t,e,r)=>t({[2928]:new Float32Array([e,r])}),depthMask:(t,e)=>t({[2930]:e}),frontFace:(t,e)=>t({[2886]:e}),lineWidth:(t,e)=>t({[2849]:e}),polygonOffset:(t,e,r)=>t({[32824]:e,[10752]:r}),sampleCoverage:(t,e,r)=>t({[32938]:e,[32939]:r}),scissor:(t,e,r,i,n)=>t({[3088]:new Int32Array([e,r,i,n])}),stencilMask:(t,e)=>t({[2968]:e,[36005]:e}),stencilMaskSeparate:(t,e,r)=>t({[e===1028?2968:36005]:r}),stencilFunc:(t,e,r,i)=>t({[2962]:e,[2967]:r,[2963]:i,[34816]:e,[36003]:r,[36004]:i}),stencilFuncSeparate:(t,e,r,i,n)=>t({[e===1028?2962:34816]:r,[e===1028?2967:36003]:i,[e===1028?2963:36004]:n}),stencilOp:(t,e,r,i)=>t({[2964]:e,[2965]:r,[2966]:i,[34817]:e,[34818]:r,[34819]:i}),stencilOpSeparate:(t,e,r,i,n)=>t({[e===1028?2964:34817]:r,[e===1028?2965:34818]:i,[e===1028?2966:34819]:n}),viewport:(t,e,r,i,n)=>t({[2978]:[e,r,i,n]})},vh=(t,e)=>t.isEnabled(e),P3={[3042]:vh,[2884]:vh,[2929]:vh,[3024]:vh,[32823]:vh,[32926]:vh,[32928]:vh,[3089]:vh,[2960]:vh,[35977]:vh},hz=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Af(t,e){if(one(e))return;let r={};for(let n in e){let o=Number(n),s=uz[n];s&&(typeof s=="string"?r[s]=!0:s(t,e[n],o))}let i=t.state&&t.state.cache;if(i)for(let n in r){let o=fz[n];o(t,e,i)}}function J2(t,e=px){if(typeof e=="number"){let n=e,o=P3[n];return o?o(t,n):t.getParameter(n)}let r=Array.isArray(e)?e:Object.keys(e),i={};for(let n of r){let o=P3[n];i[n]=o?o(t,Number(n)):t.getParameter(Number(n))}return i}function pz(t){Af(t,px)}function one(t){for(let e in t)return!1;return!0}function dz(t,e){if(t===e)return!0;let r=Array.isArray(t)||ArrayBuffer.isView(t),i=Array.isArray(e)||ArrayBuffer.isView(e);if(r&&i&&t.length===e.length){for(let n=0;n<t.length;++n)if(t[n]!==e[n])return!1;return!0}return!1}var R3=class{gl;program=null;stateStack=[];enable=!0;cache;log;constructor(e,{copyState:r=!1,log:i=()=>{}}={}){this.gl=e,this.cache=r?J2(e):Object.assign({},px),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){Yi(this.stateStack.length>0);let e=this.stateStack[this.stateStack.length-1];Af(this.gl,e),this.stateStack.pop()}_updateCache(e){let r=!1,i,n=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in e){Yi(o!==void 0);let s=e[o],l=this.cache[o];dz(s,l)||(r=!0,i=l,n&&!(o in n)&&(n[o]=l),this.cache[o]=s)}return{valueChanged:r,oldValue:i}}};function rm(t){return t.state}function B3(t,e){let{enable:r=!0,copyState:i}=e;if(Yi(i!==void 0),!t.state){t.state=new R3(t,{copyState:i}),ane(t);for(let o in I3){let s=I3[o];sne(t,o,s)}Az(t,"getParameter"),Az(t,"isEnabled")}let n=rm(t);return n.enable=r,t}function Md(t){let e=rm(t);e||(B3(t,{copyState:!1}),e=rm(t)),e.push()}function mp(t){let e=rm(t);Yi(e),e.pop()}function Az(t,e){let r=t[e].bind(t);t[e]=function(n){if(n===void 0||hz.has(n))return r(n);let o=rm(t);return n in o.cache||(o.cache[n]=r(n)),o.enable?o.cache[n]:r(n)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function sne(t,e,r){if(!t[e])return;let i=t[e].bind(t);t[e]=function(...o){let s=rm(t),{valueChanged:l,oldValue:u}=r(s._updateCache,...o);return l&&i(...o),u},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function ane(t){let e=t.useProgram.bind(t);t.useProgram=function(i){let n=rm(t);n.program!==i&&(e(i),n.program=i)}}var lne={powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function mz(t,e){e={...lne,...e};let r=null,i=o=>r=o.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);let n=null;if(n||=t.getContext("webgl2",e),t.removeEventListener("webglcontextcreationerror",i,!1),!n)throw new Error(`Failed to create WebGL context: ${r||"Unknown error"}`);if(e.onContextLost){let{onContextLost:o}=e;t.addEventListener("webglcontextlost",s=>o(s),!1)}if(e.onContextRestored){let{onContextRestored:o}=e;t.addEventListener("webglcontextrestored",s=>o(s),!1)}return n}function Mu(t,e,r){return r[e]===void 0&&(r[e]=t.getExtension(e)||null),r[e]}function gz(t,e){let r=t.getParameter(7936),i=t.getParameter(7937);Mu(t,"WEBGL_debug_renderer_info",e);let n=e.WEBGL_debug_renderer_info,o=t.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),s=t.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),l=o||r,u=s||i,h=t.getParameter(7938),v=_z(l,u),T=cne(l,u),E=une(l,u);return{type:"webgl",gpu:v,gpuType:E,gpuBackend:T,vendor:l,renderer:u,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}function _z(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function cne(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function une(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(_z(t,e)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Q2(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}var Ll="texture-compression-bc",Ho="texture-compression-astc",xh="texture-compression-etc2",fne="texture-compression-etc1-webgl",$2="texture-compression-pvrtc-webgl",O3="texture-compression-atc-webgl",dx="float32-renderable-webgl",D3="float16-renderable-webgl",hne="rgb9e5ufloat_renderable-webgl",L3="snorm8-renderable-webgl",Ax="norm16-renderable-webgl",F3="snorm16-renderable-webgl",eT="float32-filterable",yz="float16-filterable-webgl",mx="WEBGL_compressed_texture_s3tc",gx="WEBGL_compressed_texture_s3tc_srgb",U0="EXT_texture_compression_rgtc",z0="EXT_texture_compression_bptc",pne="WEBGL_compressed_texture_etc",dne="WEBGL_compressed_texture_astc",Ane="WEBGL_compressed_texture_etc1",mne="WEBGL_compressed_texture_pvrtc",gne="WEBGL_compressed_texture_atc",vz="EXT_texture_norm16",xz="EXT_render_snorm",_ne="EXT_color_buffer_float",tT={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat_renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[xz],"norm16-renderable-webgl":[vz],"snorm16-renderable-webgl":[vz,xz],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[mx,gx,U0,z0],"texture-compression-bc5-webgl":[U0],"texture-compression-bc7-webgl":[z0],"texture-compression-etc2":[pne],"texture-compression-astc":[dne],"texture-compression-etc1-webgl":[Ane],"texture-compression-pvrtc-webgl":[mne],"texture-compression-atc-webgl":[gne]};function bz(t){return t in tT}function wz(t,e,r){return(tT[e]||[]).every(n=>Mu(t,n,r))}var rT={"rgb8unorm-unsized":{gl:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,rb:!0},r8snorm:{gl:36756,b:1,c:1,render:L3},r8uint:{gl:33330,b:1,c:1,rb:!0},r8sint:{gl:33329,b:1,c:1,rb:!0},rg8unorm:{gl:33323,b:2,c:2,rb:!0},rg8snorm:{gl:36757,b:2,c:2,render:L3},rg8uint:{gl:33336,b:2,c:2,rb:!0},rg8sint:{gl:33335,b:2,c:2,rb:!0},r16uint:{gl:33332,b:2,c:1,rb:!0},r16sint:{gl:33331,b:2,c:1,rb:!0},r16float:{gl:33325,b:2,c:1,render:D3,filter:"float16-filterable-webgl",rb:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:Ax,rb:!0},"r16snorm-webgl":{gl:36760,b:2,c:1,f:F3},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,rb:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,rb:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,rb:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,b:4,c:4,bpp:4},rgba8snorm:{gl:36759,b:4,c:4,render:L3},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:D3,filter:yz,rb:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,render:Ax},"rg16snorm-webgl":{gl:36761,b:2,c:2,render:F3},r32uint:{gl:33334,b:4,c:1,bpp:4,rb:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,rb:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:dx,filter:eT},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:hne},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:dx,rb:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,rb:!0},"rgb10a2uint-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,rb:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:Ax},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:Ax},rg32uint:{gl:33340,b:8,c:2,rb:!0},rg32sint:{gl:33339,b:8,c:2,rb:!0},rg32float:{gl:33328,b:8,c:2,render:dx,filter:eT,rb:!0},rgba16uint:{gl:36214,b:8,c:4,rb:!0},rgba16sint:{gl:36232,b:8,c:4,rb:!0},rgba16float:{gl:34842,b:8,c:4,render:D3,filter:yz},"rgba16unorm-webgl":{gl:32859,b:2,c:4,render:Ax,rb:!0},"rgba16snorm-webgl":{gl:36763,b:2,c:4,render:F3},"rgb32float-webgl":{gl:34837,render:dx,filter:eT,gl2ext:_ne,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,rb:!0},rgba32sint:{gl:36226,b:16,c:4,rb:!0},rgba32float:{gl:34836,b:16,c:4,render:dx,filter:eT,rb:!0},stencil8:{gl:36168,b:1,c:1,attachment:36128,rb:!0},depth16unorm:{gl:33189,b:2,c:1,attachment:36096,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096,dataFormat:6402,types:[5125]},depth32float:{gl:36012,b:4,c:1,attachment:36096,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,dataFormat:34041,types:[34042],rb:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:mx,f:Ll},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:gx,f:Ll},"bc1-rgba-unorm":{gl:33777,x:mx,f:Ll},"bc1-rgba-unorm-srgb":{gl:35916,x:gx,f:Ll},"bc2-rgba-unorm":{gl:33778,x:mx,f:Ll},"bc2-rgba-unorm-srgb":{gl:35918,x:gx,f:Ll},"bc3-rgba-unorm":{gl:33779,x:mx,f:Ll},"bc3-rgba-unorm-srgb":{gl:35919,x:gx,f:Ll},"bc4-r-unorm":{gl:36283,x:U0,f:Ll},"bc4-r-snorm":{gl:36284,x:U0,f:Ll},"bc5-rg-unorm":{gl:36285,x:U0,f:Ll},"bc5-rg-snorm":{gl:36286,x:U0,f:Ll},"bc6h-rgb-ufloat":{gl:36495,x:z0,f:Ll},"bc6h-rgb-float":{gl:36494,x:z0,f:Ll},"bc7-rgba-unorm":{gl:36492,x:z0,f:Ll},"bc7-rgba-unorm-srgb":{gl:36493,x:z0,f:Ll},"etc2-rgb8unorm":{gl:37492,f:xh},"etc2-rgb8unorm-srgb":{gl:37494,f:xh},"etc2-rgb8a1unorm":{gl:37496,f:xh},"etc2-rgb8a1unorm-srgb":{gl:37497,f:xh},"etc2-rgba8unorm":{gl:37493,f:xh},"etc2-rgba8unorm-srgb":{gl:37495,f:xh},"eac-r11unorm":{gl:37488,f:xh},"eac-r11snorm":{gl:37489,f:xh},"eac-rg11unorm":{gl:37490,f:xh},"eac-rg11snorm":{gl:37491,f:xh},"astc-4x4-unorm":{gl:37808,f:Ho},"astc-4x4-unorm-srgb":{gl:37840,f:Ho},"astc-5x4-unorm":{gl:37809,f:Ho},"astc-5x4-unorm-srgb":{gl:37841,f:Ho},"astc-5x5-unorm":{gl:37810,f:Ho},"astc-5x5-unorm-srgb":{gl:37842,f:Ho},"astc-6x5-unorm":{gl:37811,f:Ho},"astc-6x5-unorm-srgb":{gl:37843,f:Ho},"astc-6x6-unorm":{gl:37812,f:Ho},"astc-6x6-unorm-srgb":{gl:37844,f:Ho},"astc-8x5-unorm":{gl:37813,f:Ho},"astc-8x5-unorm-srgb":{gl:37845,f:Ho},"astc-8x6-unorm":{gl:37814,f:Ho},"astc-8x6-unorm-srgb":{gl:37846,f:Ho},"astc-8x8-unorm":{gl:37815,f:Ho},"astc-8x8-unorm-srgb":{gl:37847,f:Ho},"astc-10x5-unorm":{gl:37819,f:Ho},"astc-10x5-unorm-srgb":{gl:37851,f:Ho},"astc-10x6-unorm":{gl:37817,f:Ho},"astc-10x6-unorm-srgb":{gl:37849,f:Ho},"astc-10x8-unorm":{gl:37818,f:Ho},"astc-10x8-unorm-srgb":{gl:37850,f:Ho},"astc-10x10-unorm":{gl:37819,f:Ho},"astc-10x10-unorm-srgb":{gl:37851,f:Ho},"astc-12x10-unorm":{gl:37820,f:Ho},"astc-12x10-unorm-srgb":{gl:37852,f:Ho},"astc-12x12-unorm":{gl:37821,f:Ho},"astc-12x12-unorm-srgb":{gl:37853,f:Ho},"pvrtc-rgb4unorm-webgl":{gl:35840,f:$2},"pvrtc-rgba4unorm-webgl":{gl:35842,f:$2},"pvrtc-rbg2unorm-webgl":{gl:35841,f:$2},"pvrtc-rgba2unorm-webgl":{gl:35843,f:$2},"etc1-rbg-unorm-webgl":{gl:36196,f:fne},"atc-rgb-unorm-webgl":{gl:35986,f:O3},"atc-rgba-unorm-webgl":{gl:35986,f:O3},"atc-rgbai-unorm-webgl":{gl:34798,f:O3}},yne={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},vne={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function iT(t,e,r){let i=rT[e];if(!i||i.gl===void 0)return!1;let n=i.x||i.gl2ext;return n?Boolean(Mu(t,n,r)):!0}function N3(t){let r=rT[t]?.gl;if(r===void 0)throw new Error(`Unsupported texture format ${t}`);return r}function Tz(t,e,r){if(!iT(t,e,r)||e.startsWith("depth")||e.startsWith("stencil"))return!1;try{if(H2(e).signed)return!1}catch{return!1}return e.endsWith("32float")?Boolean(Mu(t,"OES_texture_float_linear, extensions",r)):e.endsWith("16float")?Boolean(Mu(t,"OES_texture_half_float_linear, extensions",r)):!0}function Ez(t,e,r){return!(!iT(t,e,r)||typeof e=="number")}function V0(t){let e=rT[t],r=N3(t),i=H2(t);return{format:r,dataFormat:e?.dataFormat||xne(i.format,i.integer,i.normalized,r),type:i.dataType?Q2(i.dataType):e?.types?.[0]||5121,compressed:i.compressed}}function Sz(t){let e=rT[t];if(!e?.attachment)throw new Error(`${t} is not a depth stencil format`);return e.attachment}function k3(t){let e=V0(t),r=yne[e.dataFormat]||4,i=vne[e.type]||1;return r*i}function xne(t,e,r,i){if(i===6408||i===6407)return i;switch(t){case"r":return e&&!r?36244:6403;case"rg":return e&&!r?33320:33319;case"rgb":return e&&!r?36248:6407;case"rgba":return e&&!r?36249:6408;default:return 6408}}var Cz={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"},nT=class extends ox{gl;extensions;testedFeatures=new Set;constructor(e,r,i){super([],i),this.gl=e,this.extensions=r,Mu(e,"EXT_color_buffer_float",r)}*[Symbol.iterator](){let e=this.getFeatures();for(let r of e)this.has(r)&&(yield r);return[]}has(e){return this.disabledFeatures[e]?!1:(this.testedFeatures.has(e)||(this.testedFeatures.add(e),bz(e)&&wz(this.gl,e,this.extensions)&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)),this.features.has(e))}initializeFeatures(){let e=this.getFeatures().filter(r=>r!=="polygon-mode-webgl");for(let r of e)this.has(r)}getFeatures(){return[...Object.keys(Cz),...Object.keys(tT)]}getWebGLFeature(e){let r=Cz[e];return Boolean(typeof r=="string"?Mu(this.gl,r,this.extensions):r)}};var oT=class extends nx{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return this.limits[e]===void 0&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]}};function Iu(t,e,r){if(bne(e))return r(t);let{nocatch:i=!0}=e;Md(t),Af(t,e);let n;if(i)n=r(t),mp(t);else try{n=r(t)}finally{mp(t)}return n}function bne(t){for(let e in t)return!1;return!0}function Iz(t,e,r,i){if(wd(e))return i(t);let n=t;Md(n.gl);try{return wne(t,e),Af(n.gl,r),i(t)}finally{mp(n.gl)}}function wne(t,e){let r=t,{gl:i}=r;if(e.cullMode)switch(e.cullMode){case"none":i.disable(2884);break;case"front":i.enable(2884),i.cullFace(1028);break;case"back":i.enable(2884),i.cullFace(1029);break}if(e.frontFace&&i.frontFace(im("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&i.enable(34383),e.depthBias!==void 0&&(i.enable(32823),i.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){let o=r.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,s=im("provokingVertex",e.provokingVertex,{first:36429,last:36430});o?.provokingVertexWEBGL(s)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){let o=r.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,s=im("polygonMode",e.polygonMode,{fill:6914,line:6913});o?.polygonModeWEBGL(1028,s),o?.polygonModeWEBGL(1029,s)}e.polygonOffsetLine&&i.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&i.enable(12288),e.clipDistance1&&i.enable(12289),e.clipDistance2&&i.enable(12290),e.clipDistance3&&i.enable(12291),e.clipDistance4&&i.enable(12292),e.clipDistance5&&i.enable(12293),e.clipDistance6&&i.enable(12294),e.clipDistance7&&i.enable(12295)),e.depthWriteEnabled!==void 0&&i.depthMask(Ene("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?i.enable(2929):i.disable(2929),i.depthFunc(aT("depthCompare",e.depthCompare))),e.stencilWriteMask){let n=e.stencilWriteMask;i.stencilMaskSeparate(1028,n),i.stencilMaskSeparate(1029,n)}if(e.stencilReadMask&&Kt.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){let n=e.stencilReadMask||4294967295,o=aT("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?i.enable(2960):i.disable(2960),i.stencilFuncSeparate(1028,o,0,n),i.stencilFuncSeparate(1029,o,0,n)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){let n=U3("stencilPassOperation",e.stencilPassOperation),o=U3("stencilFailOperation",e.stencilFailOperation),s=U3("stencilDepthFailOperation",e.stencilDepthFailOperation);i.stencilOpSeparate(1028,o,s,n),i.stencilOpSeparate(1029,o,s,n)}if(e.blendColorOperation||e.blendAlphaOperation){i.enable(3042);let n=Mz("blendColorOperation",e.blendColorOperation||"add"),o=Mz("blendAlphaOperation",e.blendAlphaOperation||"add");i.blendEquationSeparate(n,o);let s=sT("blendColorSrcFactor",e.blendColorSrcFactor||"one"),l=sT("blendColorDstFactor",e.blendColorDstFactor||"zero"),u=sT("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),h=sT("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");i.blendFuncSeparate(s,l,u,h)}}function aT(t,e){return im(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function U3(t,e){return im(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Mz(t,e){return im(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function sT(t,e){return im(t,e,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function Tne(t,e){return`Illegal parameter ${e} for ${t}`}function im(t,e,r){if(!(e in r))throw new Error(Tne(t,e));return r[e]}function Ene(t,e){return e}function lT(t){let e={};return t.addressModeU&&(e[10242]=z3(t.addressModeU)),t.addressModeV&&(e[10243]=z3(t.addressModeV)),t.addressModeW&&(e[32882]=z3(t.addressModeW)),t.magFilter&&(e[10240]=Pz(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=Sne(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=aT("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function z3(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Pz(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function Sne(t,e){if(!e)return Pz(t);switch(t){case"nearest":return e==="nearest"?9984:9986;case"linear":return e==="nearest"?9985:9987}}var Ql=class extends Xi{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,r={}){super(e,r),this.device=e,this.gl=this.device.gl;let i=typeof r=="object"?r.handle:void 0;this.handle=i||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Cne(this.props.usage),this.glUsage=Mne(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(e,r=0,i=e.byteLength+r){let n=this.glTarget;this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,i,this.glUsage),this.gl.bufferSubData(n,r,e),this.gl.bindBuffer(n,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(e,r,i),this.trackAllocatedMemory(i)}_initWithByteLength(e){Yi(e>=0);let r=e;e===0&&(r=new Float32Array(0));let i=this.glTarget;return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bindBuffer(i,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,r=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,r,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,r,e.byteLength)}async readAsync(e=0,r){return this.readSyncWebGL(e,r)}readSyncWebGL(e=0,r){r=r??this.byteLength-e;let i=new Uint8Array(r),n=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,i,n,r),this.gl.bindBuffer(36662,null),this._setDebugData(i,e,r),i}};function Cne(t){return t&Xi.INDEX?34963:t&Xi.VERTEX?34962:t&Xi.UNIFORM?35345:34962}function Mne(t){return t&Xi.INDEX||t&Xi.VERTEX?35044:t&Xi.UNIFORM?35048:35044}var nm=class extends Cd{device;handle;parameters;constructor(e,r){super(e,r),this.device=e,this.parameters=lT(r),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[r,i]of Object.entries(e)){let n=Number(r);switch(n){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,n,i);break;default:this.device.gl.samplerParameteri(this.handle,n,i);break}}}};var mf=class extends Ed{device;gl;handle;texture;constructor(e,r){super(e,{...bo.defaultProps,...r}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=r.texture}};var Ine={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},cT=class extends bo{MAX_ATTRIBUTES;device;gl;handle;sampler=void 0;view=void 0;glFormat=void 0;type=void 0;dataFormat=void 0;mipmaps=void 0;target;textureUnit=void 0;loaded=!1;_video;constructor(e,r){super(e,{...Ine,format:"rgba8unorm",...r}),this.device=e,this.gl=this.device.gl,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Pne(this.props),this.loaded=!1,typeof this.props?.data=="string"&&Object.assign(this.props,{data:E3(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}createView(e){return new mf(this.device,{...e,texture:this})}initialize(e={}){if(this.props.dimension==="cube")return this.initializeCube(e);let r=e.data;if(r instanceof Promise)return r.then(z=>this.initialize(Object.assign({},e,{pixels:z,data:z}))),this;let i=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(i&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(e)),this;let{parameters:n={}}=e,{pixels:o=null,pixelStore:s={},textureUnit:l=void 0,mipmaps:u=!0}=e;r||(r=o);let{width:h,height:v,dataFormat:T,type:E,compressed:M=!1}=e,{depth:O=0}=e,F=N3(e.format);return{width:h,height:v,compressed:M,dataFormat:T,type:E}=this._deduceParameters({format:e.format,type:E,dataFormat:T,compressed:M,data:r,width:h,height:v}),this.width=h,this.height=v,this.glFormat=F,this.type=E,this.dataFormat=T,this.textureUnit=l,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),this.mipmaps=u,this.setImageData({data:r,width:h,height:v,depth:O,format:F,type:E,dataFormat:T,parameters:s,compressed:M}),this.setSampler(e.sampler),this._setSamplerParameters(n),this.view=this.createView({...this.props,mipLevelCount:1,arrayLayerCount:1}),u&&this.device.isTextureFormatFilterable(e.format)&&this.generateMipmap(),i&&(this._video={video:r,parameters:n,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(e){let{mipmaps:r=!0,parameters:i={}}=e;return this.setCubeMapImageData(e).then(()=>{this.loaded=!0,r&&this.generateMipmap(e),this.setSampler(e.sampler),this._setSamplerParameters(i)}),this}setSampler(e={}){let r;e instanceof nm?(this.sampler=e,r=e.props):(this.sampler=new nm(this.device,e),r=e);let i=lT(r);return this._setSamplerParameters(i),this}resize(e){let{height:r,width:i,mipmaps:n=!1}=e;return i!==this.width||r!==this.height?this.initialize({width:i,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:n}):this}update(){if(this._video){let{video:e,parameters:r,lastTime:i}=this._video;if(i===e.currentTime||e.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:e,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=e.currentTime}}generateMipmap(e={}){return this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Iu(this.gl,e,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this}setImageData(e){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(e);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:i=null,level:n=0,glFormat:o=this.glFormat,offset:s=0,parameters:l={}}=e,{data:u=null,type:h=this.type,width:v=this.width,height:T=this.height,dataFormat:E=this.dataFormat,compressed:M=!1}=e;u||(u=i),{type:h,dataFormat:E,compressed:M,width:v,height:T}=this._deduceParameters({format:this.props.format,type:h,dataFormat:E,compressed:M,data:u,width:v,height:T});let{gl:O}=this;O.bindTexture(this.target,this.handle);let F=null;if({data:u,dataType:F}=this._getDataType({data:u,compressed:M}),Iu(this.gl,l,()=>{switch(F){case"null":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"typed-array":O.texImage2D(r,n,o,v,T,0,E,h,u,s);break;case"buffer":this.device.gl.bindBuffer(35052,u.handle||u),this.device.gl.texImage2D(r,n,o,v,T,0,E,h,s),this.device.gl.bindBuffer(35052,null);break;case"browser-object":O.texImage2D(r,n,o,v,T,0,E,h,u);break;case"compressed":for(let[z,W]of u.entries())O.compressedTexImage2D(r,z,W.format,W.width,W.height,0,W.data);break;default:Yi(!1,"Unknown image data type")}}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let z=k3(this.props.format);this.trackAllocatedMemory(this.width*this.height*z,"Texture")}return this.loaded=!0,this}setSubImageData({target:e=this.target,pixels:r=null,data:i=null,x:n=0,y:o=0,width:s=this.width,height:l=this.height,level:u=0,glFormat:h=this.glFormat,type:v=this.type,dataFormat:T=this.dataFormat,compressed:E=!1,offset:M=0,parameters:O={}}){if({type:v,dataFormat:T,compressed:E,width:s,height:l}=this._deduceParameters({format:this.props.format,type:v,dataFormat:T,compressed:E,data:i,width:s,height:l}),Yi(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=r),i&&i.data){let F=i;i=F.data,s=F.shape[0],l=F.shape[1]}i instanceof Ql&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Iu(this.gl,O,()=>{E?this.gl.compressedTexSubImage2D(e,u,n,o,s,l,h,i):i===null?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,null):ArrayBuffer.isView(i)?this.gl.texSubImage2D(e,u,n,o,s,l,T,v,i,M):typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer?(this.device.gl.bindBuffer(35052,i),this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,M),this.device.gl.bindBuffer(35052,null)):this.device.gl.texSubImage2D(e,u,n,o,s,l,T,v,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(e={}){return Kt.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,this.handle),e}unbind(e=this.textureUnit){let{gl:r}=this;return e!==void 0&&(this.textureUnit=e,r.activeTexture(33984+e)),r.bindTexture(this.target,null),e}_getDataType({data:e,compressed:r=!1}){return r?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof Ql?{data:e.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&e instanceof WebGLBuffer?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(e){let{format:r,data:i}=e,{width:n,height:o,dataFormat:s,type:l,compressed:u}=e,h=V0(r);return s=s||h.dataFormat,l=l||h.type,u=u||h.compressed,{width:n,height:o}=this._deduceImageSize(i,n,o),{dataFormat:s,type:l,compressed:u,width:n,height:o,format:r,data:i}}_deduceImageSize(e,r,i){let n;return typeof ImageData<"u"&&e instanceof ImageData?n={width:e.width,height:e.height}:typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement?n={width:e.naturalWidth,height:e.naturalHeight}:typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement?n={width:e.width,height:e.height}:typeof ImageBitmap<"u"&&e instanceof ImageBitmap?n={width:e.width,height:e.height}:typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?n={width:e.videoWidth,height:e.videoHeight}:e?n={width:r,height:i}:n={width:r>=0?r:1,height:i>=0?i:1},Yi(n,"Could not deduced texture size"),Yi(r===void 0||n.width===r,"Deduced texture width does not match supplied width"),Yi(i===void 0||n.height===i,"Deduced texture height does not match supplied height"),n}async setCubeMapImageData(e){let{gl:r}=this,{width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,h=o||s,v=await Promise.all(cT.FACES.map(T=>{let E=h[T];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),cT.FACES.forEach((T,E)=>{v[E].length>1&&this.props.mipmaps!==!1&&Kt.warn(`${this.id} has mipmap and multiple LODs.`)(),v[E].forEach((M,O)=>{i&&n?r.texImage2D(T,O,l,i,n,0,l,u,M):r.texImage2D(T,O,l,l,u,M)})}),this.unbind()}setImageDataForFace(e){let{face:r,width:i,height:n,pixels:o,data:s,format:l=6408,type:u=5121}=e,{gl:h}=this,v=o||s;return this.bind(),v instanceof Promise?v.then(T=>this.setImageDataForFace(Object.assign({},e,{face:r,data:T,pixels:T}))):this.width||this.height?h.texImage2D(r,0,l,i,n,0,l,u,v):h.texImage2D(r,0,l,l,u,v),this}setImageData3D(e){let{level:r=0,dataFormat:i,format:n,type:o,width:s,height:l,depth:u=1,offset:h=0,data:v,parameters:T={}}=e;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=V0(n);if(Iu(this.gl,T,()=>{ArrayBuffer.isView(v)&&this.gl.texImage3D(this.target,r,E.format,s,l,u,0,E.dataFormat,E.type,v),v instanceof Ql&&(this.gl.bindBuffer(35052,v.handle),this.gl.texImage3D(this.target,r,i,s,l,u,0,n,o,h))}),v&&v.byteLength)this.trackAllocatedMemory(v.byteLength,"Texture");else{let M=k3(this.props.format);this.trackAllocatedMemory(this.width*this.height*this.depth*M,"Texture")}return this.loaded=!0,this}_setSamplerParameters(e){if(!wd(e)){Rne(e),this.gl.bindTexture(this.target,this.handle);for(let[r,i]of Object.entries(e)){let n=Number(r),o=i;switch(n){case 33082:case 33083:this.gl.texParameterf(this.target,n,o);break;default:this.gl.texParameteri(this.target,n,o);break}}this.gl.bindTexture(this.target,null)}}},$l=cT;Yr($l,"FACES",[34069,34070,34071,34072,34073,34074]);function Pne(t){switch(t.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(t.dimension)}}function Rne(t){Kt.log(1,"texture sampler parameters",t)()}var bh=class extends _h{device;gl;handle;get texture(){return this.colorAttachments[0]}constructor(e,r){super(e,r);let i=r.handle===null;if(this.device=e,this.gl=e.gl,this.handle=this.props.handle||i?this.props.handle:this.gl.createFramebuffer(),!i){e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures();let n=this.gl.bindFramebuffer(36160,this.handle);for(let o=0;o<this.colorAttachments.length;++o){let s=this.colorAttachments[o],l=36064+o;s&&this._attachOne(l,s)}if(this.depthStencilAttachment&&this._attachOne(Sz(this.depthStencilAttachment.props.format),this.depthStencilAttachment),r.check!==!1){let o=this.gl.checkFramebufferStatus(36160);if(o!==36053)throw new Error(`Framebuffer ${One(o)}`)}this.gl.bindFramebuffer(36160,n)}}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}createDepthStencilTexture(e){return new $l(this.device,{id:`${this.id}-depth-stencil`,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let i of this.colorAttachments)i.texture.resize({width:e,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.texture.resize({width:e,height:r}),this}_attachOne(e,r){if(Array.isArray(r)){let[i,n=0,o=0]=r;return this._attachTexture(e,i,n,o),i}if(r instanceof $l)return this._attachTexture(e,r,0,0),r;if(r instanceof mf){let i=r;return this._attachTexture(e,i.texture,i.props.baseMipLevel,i.props.baseArrayLayer),r.texture}throw new Error("attach")}_attachTexture(e,r,i,n){let{gl:o}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:o.framebufferTextureLayer(36160,e,r.target,n,i);break;case 34067:let s=Bne(i);o.framebufferTexture2D(36160,e,s,r.handle,n);break;case 3553:o.framebufferTexture2D(36160,e,3553,r.handle,n);break;default:Yi(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Bne(t){return t<34069?t+34069:t}function One(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}var uT=class extends Td{device;presentationSize;_framebuffer=null;constructor(e,r){super(r),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new bh(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let r=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(r,e);return}}commit(){}};var Dne={spector:Kt.get("spector")||Kt.get("inspect")},Lne="https://spectorcdn.babylonjs.com/spector.bundle.js",Fne=1,Tc=null,Rz=!1;async function Bz(t){if(!globalThis.SPECTOR)try{await ux(Lne)}catch(e){Kt.warn(String(e))}}function Oz(t){if(t={...Dne,...t},!t?.spector||(!Tc&&globalThis.SPECTOR&&(Kt.probe(Fne,"SPECTOR found and initialized")(),Tc=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=Tc)),!Tc))return null;if(Rz||(Rz=!0,Tc.spyCanvases(),Tc?.onCaptureStarted.add(e=>Kt.info("Spector capture started:",e)()),Tc?.onCapture.add(e=>{Kt.info("Spector capture complete:",e)(),Tc?.getResultUI(),Tc?.resultView.display(),Tc?.resultView.addCapture(e)})),t?.canvas){if(typeof t.spector=="string"&&t.spector!==t.canvas.id)return Tc;Tc?.startCapture(t?.canvas,500),new Promise(e=>setTimeout(e,2e3)).then(e=>{Kt.info("Spector capture stopped after 2 seconds")(),Tc?.stopCapture()})}return Tc}var Nne="https://unpkg.com/webgl-debug@2.0.1/index.js";function Dz(t){return t.luma=t.luma||{},t.luma}async function Lz(){Ol()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await ux(Nne))}function Fz(t,e={}){return t?e.debug?Une(t,e):kne(t):null}function kne(t){let e=Dz(t);return e.realContext?e.realContext:t}function Une(t,e){if(!globalThis.WebGLDebugUtils)return Kt.warn("webgl-debug not loaded")(),t;let r=Dz(t);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...yh,...t});let i=globalThis.WebGLDebugUtils.makeDebugContext(t,zne.bind(null,e),Vne.bind(null,e));for(let s in yh)!(s in i)&&typeof yh[s]=="number"&&(i[s]=yh[s]);class n{}Object.setPrototypeOf(i,Object.getPrototypeOf(t)),Object.setPrototypeOf(n,i);let o=Object.create(n);return r.realContext=t,r.debugContext=o,o.debug=!0,o}function V3(t,e){e=Array.from(e).map(i=>i===void 0?"undefined":i);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${t}(${r})`}function zne(t,e,r,i){i=Array.from(i).map(l=>l===void 0?"undefined":l);let n=globalThis.WebGLDebugUtils.glEnumToString(e),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),s=`${n} in gl.${r}(${o})`;Kt.error(s)();debugger;if(t.throwOnError)throw new Error(s)}function Vne(t,e,r){let i="";if(Kt.level>=1&&(i=V3(e,r),Kt.log(1,i)()),t.break&&t.break.length>0&&(i=i||V3(e,r),t.break.every(o=>i.indexOf(o)!==-1)))debugger;for(let n of r)if(n===void 0){if(i=i||V3(e,r),t.throwOnError)throw new Error(`Undefined argument: ${i}`);Kt.error(`Undefined argument: ${i}`)();debugger}}function kz(t){let e=t.split(/\r?\n/),r=[];for(let i of e){if(i.length<=1)continue;let n=i.split(":");if(n.length===2){let[T,E]=n;r.push({message:E.trim(),type:Nz(T),lineNum:0,linePos:0});continue}let[o,s,l,...u]=n,h=parseInt(l,10);isNaN(h)&&(h=0);let v=parseInt(s,10);isNaN(v)&&(v=0),r.push({message:u.join(":").trim(),type:Nz(o),lineNum:h,linePos:v})}return r}function Nz(t){let e=["warning","error","info"],r=t.toLowerCase();return e.includes(r)?r:"info"}var fT=class extends Sd{device;handle;constructor(e,r){switch(super(e,r),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return kz(e)}getTranslatedSource(){return this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders?.getTranslatedShaderSource(this.handle)}async _compile(e){e=(n=>n.startsWith("#version ")?n:`#version 100
553
+ ${n}`)(e);let{gl:i}=this.device;if(i.shaderSource(this.handle,e),i.compileShader(this.handle),Kt.level===0){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}Kt.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),Kt.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}};var jne=256,Hne=1024,Gne=16384,j3=6144,Wne=[1,2,4,8],hT=class extends O0{device;glParameters;constructor(e,r){super(e,r),this.device=e,Md(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){mp(this.device.gl)}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let r={...this.glParameters};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(r.viewport=e.viewport.slice(0,4),r.depthRange=[e.viewport[4],e.viewport[5]]):r.viewport=e.viewport),e.scissorRect&&(r.scissorTest=!0,r.scissor=e.scissorRect),e.blendConstant&&(r.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(r.colorMask=Wne.map(i=>Boolean(i&e.colorMask))),this.glParameters=r,Af(this.device.gl,r)}beginOcclusionQuery(e){this.props.occlusionQuerySet?.beginOcclusionQuery()}endOcclusionQuery(){this.props.occlusionQuerySet?.endOcclusionQuery()}clear(){let e={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Gne,e.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=jne,e.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Hne,e.clearStencil=this.props.clearStencil),r!==0&&Iu(this.device.gl,e,()=>{this.device.gl.clear(r)})}clearColorBuffer(e=0,r=[0,0,0,0]){Iu(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl.clearBufferiv(j3,e,r);break;case Uint32Array:this.device.gl.clearBufferuiv(j3,e,r);break;case Float32Array:default:this.device.gl.clearBufferfv(j3,e,r);break}})}};var qne="Failed to deduce GL constant from typed array";function Uz(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(qne)}}function _x(t,e){let{clamped:r=!0}=e||{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var Xne={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Yne={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Id=class{offset;stride;type;size;divisor;normalized;integer;buffer;index;static getBytesPerElement(e){return _x(e.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(e){return Yi(e.size),_x(e.type||5126).BYTES_PER_ELEMENT*e.size}static resolve(...e){return new Id(Xne,...e)}constructor(...e){e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Id.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Id.getBytesPerVertex(this)}_assign(e={}){return e=T3("Accessor",e,Yne),e.type!==void 0&&(this.type=e.type,(e.type===5124||e.type===5125)&&(this.integer=!0)),e.size!==void 0&&(this.size=e.size),e.offset!==void 0&&(this.offset=e.offset),e.stride!==void 0&&(this.stride=e.stride),e.normalize!==void 0&&(this.normalized=e.normalize),e.normalized!==void 0&&(this.normalized=e.normalized),e.integer!==void 0&&(this.integer=e.integer),e.divisor!==void 0&&(this.divisor=e.divisor),e.buffer!==void 0&&(this.buffer=e.buffer),e.index!==void 0&&(typeof e.index=="boolean"?this.index=e.index?1:0:this.index=e.index),e.instanced!==void 0&&(this.divisor=e.instanced?1:0),e.isInstanced!==void 0&&(this.divisor=e.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function zz(t){return Kne.includes(t)}var Kne=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Vz={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function H3(t){let e=Vz[t];if(!e)throw new Error("uniform");let[r,i,,n]=e;return{format:n,components:i,glType:r}}function jz(t){let e=Vz[t];if(!e)throw new Error("attribute");let[,r,,i,n]=e;return{attributeType:i,vertexFormat:n,components:r}}function Hz(t,e){let r={attributes:[],bindings:[]};r.attributes=Zne(t,e);let i=$ne(t,e);for(let l of i){let u=l.uniforms.map(h=>({name:h.name,format:h.format,byteOffset:h.byteOffset,byteStride:h.byteStride,arrayLength:h.arrayLength}));r.bindings.push({type:"uniform",name:l.name,location:l.location,visibility:(l.vertex?1:0)&(l.fragment?2:0),minBindingSize:l.byteLength,uniforms:u})}let n=Qne(t,e),o=0;for(let l of n)if(zz(l.type)){let{viewDimension:u,sampleType:h}=toe(l.type);r.bindings.push({type:"texture",name:l.name,location:o,viewDimension:u,sampleType:h}),l.textureUnit=o,o+=1}n.length&&(r.uniforms=n);let s=Jne(t,e);return s?.length&&(r.varyings=s),r}function Zne(t,e){let r=[],i=t.getProgramParameter(e,35721);for(let n=0;n<i;n++){let o=t.getActiveAttrib(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l}=o,u=t.getAttribLocation(e,s);if(u>=0){let{attributeType:h}=jz(l),v=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:u,stepMode:v,type:h})}}return r.sort((n,o)=>n.location-o.location),r}function Jne(t,e){let r=[],i=t.getProgramParameter(e,35971);for(let n=0;n<i;n++){let o=t.getTransformFeedbackVarying(e,n);if(!o)throw new Error("activeInfo");let{name:s,type:l,size:u}=o,{glType:h,components:v}=H3(l),T=new Id({type:h,size:u*v}),E={location:n,name:s,accessor:T};r.push(E)}return r.sort((n,o)=>n.location-o.location),r}function Qne(t,e){let r=[],i=t.getProgramParameter(e,35718);for(let n=0;n<i;n++){let o=t.getActiveUniform(e,n);if(!o)throw new Error("activeInfo");let{name:s,size:l,type:u}=o,{name:h,isArray:v}=roe(s),T=t.getUniformLocation(e,h),E={location:T,name:h,size:l,type:u,isArray:v};if(r.push(E),E.size>1)for(let M=0;M<E.size;M++){let O=`${h}[${M}]`;T=t.getUniformLocation(e,O);let F={...E,name:O,location:T};r.push(F)}}return r}function $ne(t,e){let r=(o,s)=>t.getActiveUniformBlockParameter(e,o,s),i=[],n=t.getProgramParameter(e,35382);for(let o=0;o<n;o++){let s={name:t.getActiveUniformBlockName(e,o)||"",location:r(o,35391),byteLength:r(o,35392),vertex:r(o,35396),fragment:r(o,35398),uniformCount:r(o,35394),uniforms:[]},l=r(o,35395)||[],u=t.getActiveUniforms(e,l,35383),h=t.getActiveUniforms(e,l,35384),v=t.getActiveUniforms(e,l,35387),T=t.getActiveUniforms(e,l,35388);for(let E=0;E<s.uniformCount;++E){let M=t.getActiveUniform(e,l[E]);if(!M)throw new Error("activeInfo");s.uniforms.push({name:M.name,format:H3(u[E]).format,type:u[E],arrayLength:h[E],byteOffset:v[E],byteStride:T[E]})}i.push(s)}return i.sort((o,s)=>o.location-s.location),i}var eoe={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function toe(t){let e=eoe[t];if(!e)throw new Error("sampler");let[r,i]=e;return{viewDimension:r,sampleType:i}}function roe(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(t);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${t}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Gz(t,e,r,i){let n=t,o=i;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof i!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,i);case 5126:return t.uniform1fv(e,s);case 35664:return t.uniform2fv(e,s);case 35665:return t.uniform3fv(e,s);case 35666:return t.uniform4fv(e,s);case 5124:return t.uniform1iv(e,s);case 35667:return t.uniform2iv(e,s);case 35668:return t.uniform3iv(e,s);case 35669:return t.uniform4iv(e,s);case 35670:return t.uniform1iv(e,s);case 35671:return t.uniform2iv(e,s);case 35672:return t.uniform3iv(e,s);case 35673:return t.uniform4iv(e,s);case 5125:return n.uniform1uiv(e,s,1);case 36294:return n.uniform2uiv(e,s,2);case 36295:return n.uniform3uiv(e,s,3);case 36296:return n.uniform4uiv(e,s,4);case 35674:return t.uniformMatrix2fv(e,!1,s);case 35675:return t.uniformMatrix3fv(e,!1,s);case 35676:return t.uniformMatrix4fv(e,!1,s);case 35685:return n.uniformMatrix2x3fv(e,!1,s);case 35686:return n.uniformMatrix2x4fv(e,!1,s);case 35687:return n.uniformMatrix3x2fv(e,!1,s);case 35688:return n.uniformMatrix3x4fv(e,!1,s);case 35689:return n.uniformMatrix4x2fv(e,!1,s);case 35690:return n.uniformMatrix4x3fv(e,!1,s)}throw new Error("Illegal uniform")}function Wz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(t)}}function qz(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(t)}}var Xz=4,pT=class extends df{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,r){super(e,r),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=r.vs,this.fs=r.fs;let{varyings:i,bufferMode:n=35981}=r;switch(i&&i.length>0&&(this.varyings=i,this.device.gl.transformFeedbackVaryings(this.handle,i,n)),this._linkShaders(),Kt.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=Hz(this.device.gl,this.handle),Kt.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=g3(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":Kt.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,r){for(let[i,n]of Object.entries(e)){let o=this.shaderLayout.bindings.find(s=>s.name===i)||this.shaderLayout.bindings.find(s=>s.name===`${i}Uniforms`);if(!o){let s=this.shaderLayout.bindings.map(l=>`"${l.name}"`).join(", ");r?.disableWarnings||Kt.warn(`Unknown binding "${i}" in render pipeline "${this.id}", expected one of ${s}`)();continue}switch(n||Kt.warn(`Unsetting binding "${i}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof Ql)&&!(n.buffer instanceof Ql))throw new Error("buffer value");break;case"texture":if(!(n instanceof mf||n instanceof $l||n instanceof bh))throw new Error("texture value");break;case"sampler":Kt.warn(`Ignoring sampler ${i}`)();break;default:throw new Error(o.type)}this.bindings[i]=n}}draw(e){let{renderPass:r,parameters:i=this.props.parameters,topology:n=this.props.topology,vertexArray:o,vertexCount:s,instanceCount:l,isInstanced:u=!1,firstVertex:h=0,transformFeedback:v}=e,T=Wz(n),E=Boolean(o.indexBuffer),M=o.indexBuffer?.glIndexType;if(this.linkStatus!=="success")return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable()||s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;if(s===0)return Kt.info(2,`RenderPipeline:${this.id}.draw() aborted - no vertices to draw`)(),!0;this.device.gl.useProgram(this.handle),o.bindBeforeRender(r),v&&v.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let O=r;return Iz(this.device,i,O.glParameters,()=>{E&&u?this.device.gl.drawElementsInstanced(T,s||0,M,h,l||0):E?this.device.gl.drawElements(T,s||0,M,h):u?this.device.gl.drawArraysInstanced(T,h,s||0,l||0):this.device.gl.drawArrays(T,h,s||0),v&&v.end()}),o.unbindAfterRender(r),!0}setUniformsWebGL(e){let{bindings:r}=cx(e);Object.keys(r).forEach(i=>{Kt.warn(`Unsupported value "${JSON.stringify(r[i])}" used in setUniforms() for key ${i}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),Kt.time(Xz,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),Kt.timeEnd(Xz,`linkProgram for ${this.id}`)(),Kt.level,!this.device.features.has("compilation-status-async-webgl")){let i=this._getLinkStatus();this._reportLinkStatus(i);return}Kt.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),Kt.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let r=this._getLinkStatus();this._reportLinkStatus(r)}_reportLinkStatus(e){switch(e){case"success":return;default:throw this.vs.compilationStatus==="error"?(this.vs.debugShader(),new Error(`Error during compilation of shader ${this.vs.id}`)):this.fs?.compilationStatus==="error"?(this.fs.debugShader(),new Error(`Error during compilation of shader ${this.fs.id}`)):new Error(`Error during ${e}: ${this.device.gl.getProgramInfoLog(this.handle)}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation")):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async n=>await new Promise(o=>setTimeout(o,n));if(!this.device.features.has("compilation-status-async-webgl")){await e(10);return}let{gl:i}=this.device;for(;;){if(i.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let[,r]of Object.entries(this.bindings))r instanceof $l&&(r.update(),e=e&&r.loaded);return e}_applyBindings(){if(this.linkStatus!=="success")return;let{gl:e}=this.device;e.useProgram(this.handle);let r=0,i=0;for(let n of this.shaderLayout.bindings){let o=this.bindings[n.name]||this.bindings[n.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${n.name} in ${this.id}`);switch(n.type){case"uniform":let{name:s}=n,l=e.getUniformBlockIndex(this.handle,s);if(l===4294967295)throw new Error(`Invalid uniform block name ${s}`);e.uniformBlockBinding(this.handle,i,l),o instanceof Ql?e.bindBufferBase(35345,i,o.handle):e.bindBufferRange(35345,i,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),i+=1;break;case"texture":if(!(o instanceof mf||o instanceof $l||o instanceof bh))throw new Error("texture");let u;if(o instanceof mf)u=o.texture;else if(o instanceof $l)u=o;else if(o instanceof bh&&o.colorAttachments[0]instanceof mf)Kt.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),u=o.colorAttachments[0].texture;else throw new Error("No texture");e.activeTexture(33984+r),e.bindTexture(u.target,u.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${n.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:r,location:i,type:n,textureUnit:o}=e,s=this.uniforms[r]??o;s!==void 0&&Gz(this.device.gl,i,n,s)}}};var dT=class extends L0{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let r of e)switch(r.name){case"copy-buffer-to-buffer":ioe(this.device,r.options);break;case"copy-buffer-to-texture":noe(this.device,r.options);break;case"copy-texture-to-buffer":ooe(this.device,r.options);break;case"copy-texture-to-texture":soe(this.device,r.options);break}}};function ioe(t,e){let r=e.source,i=e.destination;t.gl.bindBuffer(36662,r.handle),t.gl.bindBuffer(36663,i.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function noe(t,e){throw new Error("Not implemented")}function ooe(t,e){let{source:r,mipLevel:i=0,aspect:n="all",width:o=e.source.width,height:s=e.source.height,depthOrArrayLayers:l=0,origin:u=[0,0],destination:h,byteOffset:v=0,bytesPerRow:T,rowsPerImage:E}=e;if(n!=="all")throw new Error("not supported");if(i!==0||l!==0||T||E)throw new Error("not implemented");let{framebuffer:M,destroyFramebuffer:O}=Yz(r),F;try{let z=h,W=o||M.width,J=s||M.height,K=V0(M.texture.props.format),ne=K.dataFormat,ge=K.type;t.gl.bindBuffer(35051,z.handle),F=t.gl.bindFramebuffer(36160,M.handle),t.gl.readPixels(u[0],u[1],W,J,ne,ge,v)}finally{t.gl.bindBuffer(35051,null),F!==void 0&&t.gl.bindFramebuffer(36160,F),O&&M.destroy()}}function soe(t,e){let{source:r,destinationMipLevel:i=0,origin:n=[0,0],destinationOrigin:o=[0,0],destination:s}=e,{width:l=e.destination.width,height:u=e.destination.height}=e,{framebuffer:h,destroyFramebuffer:v}=Yz(r),[T,E]=n,[M,O,F]=o,z=t.gl.bindFramebuffer(36160,h.handle),W=null,J;if(s instanceof $l)W=s,l=Number.isFinite(l)?l:W.width,u=Number.isFinite(u)?u:W.height,W.bind(0),J=W.target;else throw new Error("invalid destination");switch(J){case 3553:case 34067:t.gl.copyTexSubImage2D(J,i,M,O,T,E,l,u);break;case 35866:case 32879:t.gl.copyTexSubImage3D(J,i,M,O,F,T,E,l,u);break;default:}W&&W.unbind(),t.gl.bindFramebuffer(36160,z),v&&h.destroy()}function Yz(t){if(t instanceof bo){let{width:e,height:r,id:i}=t;return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${i}`,width:e,height:r,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}var AT=class extends D0{device;commandBuffer;constructor(e,r){super(e,r),this.device=e,this.commandBuffer=new dT(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,r,i){}};var j0=class extends F0{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return SP()==="Chrome"}constructor(e,r){super(e,r),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){let r=e;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r,this.device.gl.bindVertexArray(null)}setBuffer(e,r){let i=r;if(i.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:n,type:o,stride:s,offset:l,normalized:u,integer:h,divisor:v}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,i.handle),h?this.device.gl.vertexAttribIPointer(e,n,o,s,l):this.device.gl.vertexAttribPointer(e,n,o,u,s,l),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,v||0),this.attributes[e]=i,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,r){this._enable(e,!1),this.attributes[e]=r}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let r=this.attributes[e];ArrayBuffer.isView(r)&&this.device.setConstantAttributeWebGL(e,r)}}_getAccessor(e){let r=this.attributeInfos[e];if(!r)throw new Error(`Unknown attribute location ${e}`);let i=Q2(r.bufferDataType);return{size:r.bufferComponents,type:i,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(e,r=!0){let n=j0.isConstantAttributeZeroSupported(this.device)||e!==0;(r||n)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,r){let i=aoe(r),n=i.byteLength*e,o=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),s=s||!loe(i,this.bufferValue),s){let l=x3(r.constructor,o);b3({target:l,source:i,start:0,count:o}),this.buffer.write(l),this.bufferValue=r}return this.buffer}};function aoe(t){return Array.isArray(t)?new Float32Array(t):t}function loe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var mT=class extends N0{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,r){super(e,r),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(qz(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in e)this.setBuffer(r,e[r])})}setBuffer(e,r){let i=this._getVaryingIndex(e),{buffer:n,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(i<0){this.unusedBuffers[e]=n,Kt.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[i]={buffer:n,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(i,n,s,o)}getBuffer(e){if(Kz(e))return this.buffers[e]||null;let r=this._getVaryingIndex(e);return r>=0?this.buffers[r]:null}bind(e=this.handle){if(typeof e!="function")return this.gl.bindTransformFeedback(36386,e),this;let r;return this._bound?r=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,r=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof Ql)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:r,byteOffset:i=0,byteLength:n=e.buffer.byteLength}=e;return{buffer:r,byteOffset:i,byteLength:n}}_getVaryingIndex(e){if(Kz(e))return Number(e);for(let r of this.layout.varyings)if(e===r.name)return r.location;return-1}_bindBuffers(){for(let e in this.buffers){let{buffer:r,byteLength:i,byteOffset:n}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),r,n,i)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,r,i=0,n){let o=r&&r.handle;!o||n===void 0?this.gl.bindBufferBase(35982,e,o):this.gl.bindBufferRange(35982,e,o,i,n)}};function Kz(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}var gT=class extends k0{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,r){if(super(e,r),this.device=e,r.count>1)throw new Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){this._queryPending||this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=Number.POSITIVE_INFINITY){if(this._pollingPromise)return this._pollingPromise;let r=0;return this._pollingPromise=new Promise((i,n)=>{let o=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):r++>e?(n("Timed out"),this._pollingPromise=null):requestAnimationFrame(o)};requestAnimationFrame(o)}),this._pollingPromise}};function G3(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return Yi(!1),0}}function Zz(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return Yi(!1),0}}function Jz(t,e){let{sourceX:r=0,sourceY:i=0,sourceFormat:n=6408,sourceAttachment:o=36064}=e||{},{target:s=null,sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=$z(t);Yi(v);let{gl:E,handle:M}=v;l=l||v.width,u=u||v.height;let O=o-36064;h=h||v.colorAttachments[O]?.texture?.type||5121,s=uoe(s,h,n,l,u),h=h||Uz(s);let F=E.bindFramebuffer(36160,M);return E.readPixels(r,i,l,u,n,h,s),E.bindFramebuffer(36160,F||null),T&&v.destroy(),s}function Qz(t,e){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:o=6408,targetByteOffset:s=0}=e||{},{sourceWidth:l,sourceHeight:u,sourceType:h}=e||{},{framebuffer:v,deleteFramebuffer:T}=$z(t);Yi(v),l=l||v.width,u=u||v.height;let E=v;h=h||5121;let M=r;if(!M){let F=G3(o),z=Zz(h),W=s+l*u*F*z;M=E.device.createBuffer({byteLength:W})}let O=t.device.createCommandEncoder();return O.copyTextureToBuffer({source:t,width:l,height:u,origin:[i,n],destination:M,byteOffset:s}),O.destroy(),T&&v.destroy(),M}function $z(t){return t instanceof _h?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:coe(t),deleteFramebuffer:!0}}function coe(t,e){let{device:r,width:i,height:n,id:o}=t;return r.createFramebuffer({...e,id:`framebuffer-for-${o}`,width:i,height:n,colorAttachments:[t]})}function uoe(t,e,r,i,n){if(t)return t;e=e||5121;let o=_x(e,{clamped:!1}),s=G3(r);return new o(i*n*s)}var foe=256,hoe=1024,poe=16384;var doe="clear: bad arguments";function e5(t,e){let{framebuffer:r=null,color:i=null,depth:n=null,stencil:o=null}=e||{},s={};r&&(s.framebuffer=r);let l=0;i&&(l|=poe,i!==!0&&(s.clearColor=i)),n&&(l|=foe,n!==!0&&(s.clearDepth=n)),o&&(l|=hoe,n!==!0&&(s.clearStencil=n)),Yi(l!==0,doe);let u=t.gl;Iu(u,s,()=>{u.clear(l)})}var yx=1,H0=class extends bc{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;static isSupported(){return typeof WebGL2RenderingContext<"u"}static attach(e){if(e instanceof H0)return e;if(e?.device instanceof bc)return e.device;if(!Aoe(e))throw new Error("Invalid WebGL2RenderingContext");return new H0({gl:e})}static async create(e={}){Kt.groupCollapsed(yx,"WebGLDevice created")();let r=[];e.debug&&r.push(Lz()),e.spector&&r.push(Bz()),typeof e.canvas=="string"&&r.push(Td.pageLoaded);let i=await Promise.allSettled(r);for(let s of i)s.status==="rejected"&&Kt.error(`Failed to initialize debug libraries ${s.reason}`)();if(Kt.probe(yx+1,"DOM is loaded")(),e.gl?.device)return Kt.warn("reattaching existing device")(),H0.attach(e.gl);let n=new H0(e),o=`Created ${n.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return Kt.probe(yx,o)(),Kt.table(yx,n.info)(),Kt.groupEnd(yx)(),n}constructor(e){super({...e,id:e.id||oa("webgl-device")});let r=e.gl?.device;if(r)throw new Error(`WebGL context already attached to device ${r.id}`);let i=e.gl?.canvas||e.canvas;this.canvasContext=new uT(this,{...e,canvas:i}),this.lost=new Promise(l=>{this._resolveContextLost=l});let n=e.gl||null;if(n||=mz(this.canvasContext.canvas,{...e,onContextLost:l=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})}),!n)throw new Error("WebGL context creation failed");this.handle=n,this.gl=n,this.gl.device=this,this.gl._version=2,this.info=gz(this.gl,this._extensions),this.limits=new oT(this.gl),this.features=new nT(this.gl,this._extensions,this.props.disabledFeatures),this.props.initalizeFeatures&&this.features.initializeFeatures(),this.canvasContext.resize();let{enable:o=!0,copyState:s=!1}=e;B3(this.gl,{enable:o,copyState:s,log:(...l)=>Kt.log(1,...l)()}),e.debug&&(this.gl=Fz(this.gl,{...e,throwOnError:!0}),this.debug=!0,Kt.level=Math.max(Kt.level,1),Kt.warn("WebGL debug mode activated. Performance reduced.")()),e.spector&&(this.spectorJS=Oz({...this.props,canvas:this.handle.canvas}))}destroy(){}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(e){return iT(this.gl,e,this._extensions)}isTextureFormatFilterable(e){return Tz(this.gl,e,this._extensions)}isTextureFormatRenderable(e){return Ez(this.gl,e,this._extensions)}createCanvasContext(e){throw new Error("WebGL only supports a single canvas")}createBuffer(e){let r=this._getBufferProps(e);return new Ql(this,r)}_createTexture(e){return new $l(this,e)}createExternalTexture(e){throw new Error("createExternalTexture() not implemented")}createSampler(e){return new nm(this,e)}createShader(e){return new fT(this,e)}createFramebuffer(e){return new bh(this,e)}createVertexArray(e){return new j0(this,e)}createTransformFeedback(e){return new mT(this,e)}createQuerySet(e){return new gT(this,e)}createRenderPipeline(e){return new pT(this,e)}beginRenderPass(e){return new hT(this,e)}createComputePipeline(e){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw new Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e){return new AT(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,r){return Jz(e,r)}readPixelsToBufferWebGL(e,r){return Qz(e,r)}setParametersWebGL(e){Af(this.gl,e)}getParametersWebGL(e){return J2(this.gl,e)}withParametersWebGL(e,r){return Iu(this.gl,e,r)}clearWebGL(e){e5(this,e)}resetWebGL(){Kt.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),pz(this.gl)}gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;loseDevice(){let e=!1,i=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return i&&(e=!0,i.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){Md(this.gl)}popState(){mp(this.gl)}setSpectorMetadata(e,r){e.__SPECTOR_Metadata=r}getGLKey(e,r){r=r||this.gl2||this.gl;let i=Number(e);for(let n in r)if(r[n]===i)return`GL.${n}`;return String(e)}_constants;setConstantAttributeWebGL(e,r){let i=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(i).fill(null);let n=this._constants[e];switch(n&&yoe(n,r)&&Kt.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=r,r.constructor){case Float32Array:moe(this,e,r);break;case Int32Array:goe(this,e,r);break;case Uint32Array:_oe(this,e,r);break;default:Yi(!1)}}getExtension(e){return Mu(this.gl,e,this._extensions),this._extensions}},wh=H0;Yr(wh,"type","webgl");function Aoe(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:Boolean(t&&Number.isFinite(t._version))}function moe(t,e,r){switch(r.length){case 1:t.gl.vertexAttrib1fv(e,r);break;case 2:t.gl.vertexAttrib2fv(e,r);break;case 3:t.gl.vertexAttrib3fv(e,r);break;case 4:t.gl.vertexAttrib4fv(e,r);break;default:Yi(!1)}}function goe(t,e,r){t.gl.vertexAttribI4iv(e,r)}function _oe(t,e,r){t.gl.vertexAttribI4uiv(e,r)}function yoe(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var t5,r5,n5={fontFamily:'"Helvetica Neue", Helvetica, Arial, sans-serif',display:"flex",flex:"wrap",maxWidth:"500px",flexDirection:"column",zIndex:2};function _T(){return document.createElement("div")}function voe(t){if(!t.picked)return null;if(t.object===t5)return r5;let e={html:boe(t.object),style:n5};return r5=e,t5=t.object,e}var xoe=new Set(["position","index"]);function boe(t){let e=_T();for(let r in t){if(xoe.has(r))continue;let i=_T();i.className="header",i.textContent=r;let n=_T();n.className="value",n.textContent=Toe(t[r]);let o=_T();woe(o,i,n),o.appendChild(i),o.appendChild(n),e.appendChild(o)}return e.innerHTML}function woe(t,e,r){Object.assign(e.style,{fontWeight:700,marginRight:"10px",flex:"1 1 0%"}),Object.assign(r.style,{flex:"none",maxWidth:"250px",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}),Object.assign(t.style,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"stretch"})}function Toe(t){let e;if(Array.isArray(t)&&t.length>4)e=`Array<${t.length}>`;else if(typeof t=="string")e=t;else if(typeof t=="number")e=String(t);else try{e=JSON.stringify(t)}catch{e="<Non-Serializable Object>"}let r=50;return e.length>r&&(e=e.slice(0,r)),e}function i5(t,e){let r,i=t,n="properties",o=/{[^}]*}/g,s=u=>u.replace(/[{}]/g,""),l=[...new Set(t.match(o).map(s))];for(let u of l){if(u.includes(".")){r=e;let h=u.split(".");for(let v of h)if(r.hasOwnProperty(v))r=r[v];else{r=void 0;break}}else e.hasOwnProperty(u)?r=e[u]:e[n]&&e[n].hasOwnProperty(u)?r=e[n][u]:r=void 0;i=i.replaceAll(`{${u}}`,r)}return i}function W3(t){return t?t.html||t.text?e=>{if(!e.picked)return null;let r={style:t.style||n5};return t.html?r.html=i5(t.html,e.object):r.text=i5(t.text,e.object),r}:voe:null}function o5(t){let e=document.createElement("link");e.type="text/css",e.rel="stylesheet",e.href=t,document.getElementsByTagName("head")[0].appendChild(e)}function s5(t,e){let r=document.createElement("div");return r.style.width=Number.isFinite(t)?`${t}px`:t,r.style.height=`${e}px`,r.style.position="relative",r}var l5=ga(a5()),Eoe="https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.2/mapbox-gl.css",Y3=l5.default;function c5(t=Eoe){o5(t)}function u5(){let t=["mapboxgl-missing-css"];for(let e of t){let r=document.getElementsByClassName(e)[0];r&&r.style&&(r.style.display="none")}}var K3={};function f5(t){if(!K3[t]){let e=document.createElement("script");e.type="text/javascript",e.src=t,document.querySelector("head").appendChild(e),K3[t]=new Promise(i=>{e.onload=i})}return K3[t]}var h5="4.2.0-beta.2";var Soe=globalThis.loaders?.parseImageNode,Z3=typeof Image<"u",J3=typeof ImageBitmap<"u",Coe=Boolean(Soe),Q3=Ap?!0:Coe;function p5(t){switch(t){case"auto":return J3||Z3||Q3;case"imagebitmap":return J3;case"image":return Z3;case"data":return Q3;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function d5(){if(J3)return"imagebitmap";if(Z3)return"image";if(Q3)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function A5(t){let e=Moe(t);if(!e)throw new Error("Not an image");return e}function vx(t){switch(A5(t)){case"data":return t;case"image":case"imagebitmap":let e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function Moe(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}var Ioe=/^data:image\/svg\+xml/,Poe=/\.svg((\?|#).*)?$/;function yT(t){return t&&(Ioe.test(t)||Poe.test(t))}function m5(t,e){if(yT(e)){let i=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(o){throw new Error(o.message)}return`data:image/svg+xml;base64,${btoa(i)}`}return $3(t,e)}function $3(t,e){if(yT(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function vT(t,e,r){let i=m5(t,r),n=self.URL||self.webkitURL,o=typeof i!="string"&&n.createObjectURL(i);try{return await Roe(o||i,e)}finally{o&&n.revokeObjectURL(o)}}async function Roe(t,e){let r=new Image;return r.src=t,e.image&&e.image.decode&&r.decode?(await r.decode(),r):await new Promise((i,n)=>{try{r.onload=()=>i(r),r.onerror=o=>{let s=o instanceof Error?o.message:"error";n(new Error(s))}}catch(o){n(o)}})}var Boe={},g5=!0;async function _5(t,e,r){let i;yT(r)?i=await vT(t,e,r):i=$3(t,r);let n=e&&e.imagebitmap;return await Ooe(i,n)}async function Ooe(t,e=null){if((Doe(e)||!g5)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(r){console.warn(r),g5=!1}return await createImageBitmap(t)}function Doe(t){for(let e in t||Boe)return!1;return!0}function y5(t){return!koe(t,"ftyp",4)||!(t[8]&96)?null:Loe(t)}function Loe(t){switch(Foe(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Foe(t,e,r){return String.fromCharCode(...t.slice(e,r))}function Noe(t){return[...t].map(e=>e.charCodeAt(0))}function koe(t,e,r=0){let i=Noe(e);for(let n=0;n<i.length;++n)if(i[n]!==t[n+r])return!1;return!0}var Th=!1,xx=!0;function om(t){let e=bx(t);return zoe(e)||Hoe(e)||Voe(e)||joe(e)||Uoe(e)}function Uoe(t){let e=new Uint8Array(t instanceof DataView?t.buffer:t),r=y5(e);return r?{mimeType:r.mimeType,width:0,height:0}:null}function zoe(t){let e=bx(t);return e.byteLength>=24&&e.getUint32(0,Th)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Th),height:e.getUint32(20,Th)}:null}function Voe(t){let e=bx(t);return e.byteLength>=10&&e.getUint32(0,Th)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,xx),height:e.getUint16(8,xx)}:null}function joe(t){let e=bx(t);return e.byteLength>=14&&e.getUint16(0,Th)===16973&&e.getUint32(2,xx)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,xx),height:e.getUint32(22,xx)}:null}function Hoe(t){let e=bx(t);if(!(e.byteLength>=3&&e.getUint16(0,Th)===65496&&e.getUint8(2)===255))return null;let{tableMarkers:i,sofMarkers:n}=Goe(),o=2;for(;o+9<e.byteLength;){let s=e.getUint16(o,Th);if(n.has(s))return{mimeType:"image/jpeg",height:e.getUint16(o+5,Th),width:e.getUint16(o+7,Th)};if(!i.has(s))return null;o+=2,o+=e.getUint16(o,Th)}return null}function Goe(){let t=new Set([65499,65476,65484,65501,65534]);for(let r=65504;r<65520;++r)t.add(r);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function bx(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function v5(t,e){let{mimeType:r}=om(t)||{},i=globalThis.loaders?.parseImageNode;return On(i),await i(t,r)}async function x5(t,e,r){e=e||{};let n=(e.image||{}).type||"auto",{url:o}=r||{},s=Woe(n),l;switch(s){case"imagebitmap":l=await _5(t,e,o);break;case"image":l=await vT(t,e,o);break;case"data":l=await v5(t,e);break;default:On(!1)}return n==="data"&&(l=vx(l)),l}function Woe(t){switch(t){case"auto":case"data":return d5();default:return p5(t),t}}var qoe=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],Xoe=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Yoe={image:{type:"auto",decode:!0}},Eh={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:h5,mimeTypes:Xoe,extensions:qoe,parse:x5,tests:[t=>Boolean(om(new DataView(t)))],options:Yoe};var eR={};function tR(t){if(eR[t]===void 0){let e=Ap?Zoe(t):Koe(t);eR[t]=e}return eR[t]}function Koe(t){let e=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||e,i=globalThis.loaders?.parseImageNode;return Boolean(i)&&r.includes(t)}function Zoe(t){switch(t){case"image/avif":case"image/webp":return Joe(t);default:return!0}}function Joe(t){try{return document.createElement("canvas").toDataURL(t).indexOf(`data:${t}`)===0}catch{return!1}}var Qoe=new xc({id:"deck"}),ur=Qoe;var rR={};function b5(t){rR=t}function Ks(t,e,r,i){ur.level>0&&rR[t]&&rR[t].call(null,e,r,i)}function $oe(t){let e=t[0],r=t[t.length-1];return e==="{"&&r==="}"||e==="["&&r==="]"}var w5={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:$oe,parseTextSync:JSON.parse};function ese(){let t="9.0.9",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(ur.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:ur,_registerLoggers:b5},em([w5,[Eh,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}var xT=ese();function Sh(t,e){if(!t)throw new Error(e||"shadertools: assertion failed.")}var iR={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function E5(t){let e={};for(let[r,i]of Object.entries(t))e[r]=tse(i);return e}function S5(t,e,r){let i={};for(let[n,o]of Object.entries(e))t&&n in t&&!o.private?(o.validate&&Sh(o.validate(t[n],o),`${r}: invalid ${n}`),i[n]=t[n]):i[n]=o.value;return i}function tse(t){let e=T5(t);if(e!=="object")return{value:t,...iR[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...iR[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=T5(t.value),{...t,...iR[e],type:e}):{type:"object",value:null};throw new Error("props")}function T5(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}var C5=`#ifdef MODULE_LOGDEPTH
554
554
  logdepth_adjustPosition(gl_Position);
555
555
  #endif
556
556
  `,M5=`#ifdef MODULE_MATERIAL
@@ -1684,7 +1684,7 @@ vec4 shadow_filterShadowColor(vec4 color) {
1684
1684
 
1685
1685
  // use picking color if rendering to picking FBO.
1686
1686
  color = picking_filterPickingColor(color);
1687
- `}}};var Jce=[kd],Qce=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function o_(){let t=Pd.getDefaultShaderAssembler();for(let e of Jce)t.addDefaultModule(e);for(let e of Qce)t.addShaderHook(e);return t}var $ce=[255,255,255],eue=1,tue=0,s_=class{constructor(e={}){this.type="ambient";let{color:r=$ce}=e,{intensity:i=eue}=e;this.id=e.id||`ambient-${tue++}`,this.color=r,this.intensity=i}};var rue=[255,255,255],iue=1,nue=[0,0,-1],oue=0,vp=class{constructor(e={}){this.type="directional";let{color:r=rue}=e,{intensity:i=iue}=e,{direction:n=nue}=e,{_shadow:o=!1}=e;this.id=e.id||`directional-${oue++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new ot(n).normalize().toArray(),this.shadow=o}getProjectedLight(e){return this}};var Am=class{constructor(e,r={id:"pass"}){let{id:i}=r;this.id=i,this.device=e,this.props={...r}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}};var xf=class extends Am{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){let[r,i]=this.device.canvasContext.getDrawingBufferSize(),n=e.clearCanvas??!0,o=e.clearColor??(n?[0,0,0,0]:!1),s=n?1:!1,l=e.colorMask??15,u={viewport:[0,0,r,i]};e.colorMask&&(u.colorMask=l),e.scissorRect&&(u.scissorRect=e.scissorRect);let h=this.device.beginRenderPass({framebuffer:e.target,parameters:u,clearColor:o,clearDepth:s});try{return this._drawLayers(h,e)}finally{h.end()}}_drawLayers(e,r){let{target:i,moduleParameters:n,viewports:o,views:s,onViewportActive:l,clearStack:u=!0}=r;r.pass=r.pass||"unknown",u&&(this._lastRenderIndex=-1);let h=[];for(let v of o){let T=s&&s[v.id];l?.(v);let E=this._getDrawLayerParams(v,r),M=v.subViewports||[v];for(let O of M){let F=this._drawLayersInViewport(e,{target:i,moduleParameters:n,viewport:O,view:T,pass:r.pass,layers:r.layers},E);h.push(F)}}return h}_getDrawLayerParams(e,{layers:r,pass:i,isPicking:n=!1,layerFilter:o,cullRect:s,effects:l,moduleParameters:u},h=!1){let v=[],T=yV(this._lastRenderIndex+1),E={layer:r[0],viewport:e,isPicking:n,renderPass:i,cullRect:s},M={};for(let O=0;O<r.length;O++){let F=r[O],z=this._shouldDrawLayer(F,E,o,M),W={shouldDrawLayer:z};z&&!h&&(W.layerRenderIndex=T(F,z),W.moduleParameters=this._getModuleParameters(F,l,i,u),W.layerParameters={...F.context.deck?.props.parameters,...this.getLayerParameters(F,O,e)}),v[O]=W}return v}_drawLayersInViewport(e,{layers:r,moduleParameters:i,pass:n,target:o,viewport:s,view:l},u){let h=sue(this.device,{moduleParameters:i,target:o,viewport:s});if(l&&l.props.clear){let T=l.props.clear===!0?{color:!0,depth:!0}:l.props.clear;this.device.withParametersWebGL({scissorTest:!0,scissor:h},()=>this.device.clearWebGL(T))}let v={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:h});for(let T=0;T<r.length;T++){let E=r[T],{shouldDrawLayer:M,layerRenderIndex:O,moduleParameters:F,layerParameters:z}=u[T];if(M&&E.props.pickable&&v.pickableCount++,E.isComposite)v.compositeCount++;else if(M){v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,O),F.viewport=s,E.context.renderPass=e;try{E._drawLayer({renderPass:e,moduleParameters:F,uniforms:{layerIndex:O},parameters:z})}catch(W){E.raiseError(W,`drawing ${E} to ${n}`)}}}return v}shouldDrawLayer(e){return!0}getModuleParameters(e,r){return null}getLayerParameters(e,r,i){return e.props.parameters}_shouldDrawLayer(e,r,i,n){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;r.layer=e;let s=e.parent;for(;s;){if(!s.props.visible||!s.filterSubLayer(r))return!1;r.layer=s,s=s.parent}if(i){let l=r.layer.id;if(l in n||(n[l]=i(r)),!n[l])return!1}return e.activateViewport(r.viewport),!0}_getModuleParameters(e,r,i,n){let o=this.device.canvasContext.cssToDeviceRatio(),s=Object.assign(Object.create(e.internalState?.propsInTransition||e.props),{autoWrapLongitude:e.wrapLongitude,viewport:e.context.viewport,mousePosition:e.context.mousePosition,picking:{isActive:0},devicePixelRatio:o});if(r)for(let l of r)Object.assign(s,l.getModuleParameters?.(e));return Object.assign(s,this.getModuleParameters(e,r),n)}};function yV(t=0,e={}){let r={},i=(n,o)=>{let s=n.props._offset,l=n.id,u=n.parent&&n.parent.id,h;if(u&&!(u in e)&&i(n.parent,!1),u in r){let v=r[u]=r[u]||yV(e[u],e);h=v(n,o),r[l]=v}else Number.isFinite(s)?(h=s+(e[u]||0),r[l]=null):h=t;return o&&h>=t&&(t=h+1),e[l]=h,h};return i}function sue(t,{moduleParameters:e,target:r,viewport:i}){let n=e&&e.devicePixelRatio||t.canvasContext.cssToDeviceRatio(),[,o]=t.canvasContext.getDrawingBufferSize(),s=r?r.height:o,l=i;return[l.x*n,s-(l.y+l.height)*n,l.width*n,l.height*n]}var Hx=class extends xf{constructor(e,r){super(e,r),this.shadowMap=e.createTexture({width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.depthBuffer=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1,dataFormat:6402,type:5125}),this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[this.shadowMap],depthStencilAttachment:this.depthBuffer})}render(e){let r=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),n=e.viewports[0],o=n.width*i,s=n.height*i,l=[1,1,1,1];(o!==r.width||s!==r.height)&&r.resize({width:o,height:s}),super.render({...e,clearColor:l,target:r,pass:"shadow"})}getLayerParameters(e,r,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.shadowMap&&(this.shadowMap.destroy(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.destroy(),this.depthBuffer=null)}};var aue={color:[255,255,255],intensity:1},vV=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],lue=[0,0,0,200/255],zd=class{constructor(e={}){this.id="lighting-effect",this.shadowColor=lue,this.shadow=!1,this.ambientLight=null,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.shadowMaps=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;let{device:r,deck:i}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(r),i._addDefaultShaderModule(n_),this.dummyShadowMap=r.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in e){let i=e[r];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let s=0;s<this.shadowPasses.length;s++)this.shadowPasses[s].render({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o,moduleParameters:{shadowLightId:s,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}getModuleParameters(e){let r=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return r.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(i=>i.getProjectedLight({layer:e})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:e}))},r}cleanup(e){for(let r of this.shadowPasses)r.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(n_))}_calculateMatrices(){let e=[];for(let r of this.directionalLights){let i=new Kr().lookAt({eye:new ot(r.direction).negate()});e.push(i)}return e}_createShadowPasses(e){for(let r=0;r<this.directionalLights.length;r++){let i=new Hx(e);this.shadowPasses[r]=i,this.shadowMaps[r]=i.shadowMap}}_applyDefaultLights(){let{ambientLight:e,pointLights:r,directionalLights:i}=this;!e&&r.length===0&&i.length===0&&(this.ambientLight=new s_(aue),this.directionalLights.push(new vp(vV[0]),new vp(vV[1])))}};var YB=class{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,r,{size:i=1,type:n,padding:o=0,copy:s=!1,initialize:l=!1,maxCount:u}){let h=n||e&&e.constructor||Float32Array,v=r*i+o;if(ArrayBuffer.isView(e)){if(v<=e.length)return e;if(v*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new h(e.buffer,0,v)}let T=1/0;u&&(T=u*i+o);let E=this._allocate(h,v,l,T);return e&&s?E.set(e):l||E.fill(0,0,4),this._release(e),E}release(e){this._release(e)}_allocate(e,r,i,n){let o=Math.max(Math.ceil(r*this.opts.overAlloc),1);o>n&&(o=n);let s=this._pool,l=e.BYTES_PER_ELEMENT*o,u=s.findIndex(h=>h.byteLength>=l);if(u>=0){let h=new e(s.splice(u,1)[0],0,o);return i&&h.fill(0),h}return new e(o)}_release(e){if(!ArrayBuffer.isView(e))return;let r=this._pool,{buffer:i}=e,{byteLength:n}=i,o=r.findIndex(s=>s.byteLength>=n);o<0?r.push(i):(o>0||r.length<this.opts.poolSize)&&r.splice(o,0,i),r.length>this.opts.poolSize&&r.shift()}},bf=new YB;function l_(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function mm(t,e){let r=t%e;return r<0?e+r:r}function bV(t){return[t[12],t[13],t[14]]}function wV(t){return{left:a_(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:a_(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:a_(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:a_(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:a_(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:a_(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}var xV=new ot;function a_(t,e,r,i){xV.set(t,e,r);let n=xV.len();return{distance:i/n,normal:new ot(-t/n,-e/n,-r/n)}}function Vd(t){return t-Math.fround(t)}var Gx;function aE(t,e){let{size:r=1,startIndex:i=0}=e,n=e.endIndex!==void 0?e.endIndex:t.length,o=(n-i)/r;Gx=bf.allocate(Gx,o,{type:Float32Array,size:r*2});let s=i,l=0;for(;s<n;){for(let u=0;u<r;u++){let h=t[s++];Gx[l+u]=h,Gx[l+u+r]=Vd(h)}l+=r*2}return Gx.subarray(0,o*r*2)}function TV(t){let e=null,r=!1;for(let i of t)i&&(e?(r||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],r=!0),e[0][0]=Math.min(e[0][0],i[0][0]),e[0][1]=Math.min(e[0][1],i[0][1]),e[1][0]=Math.max(e[1][0],i[1][0]),e[1][1]=Math.max(e[1][1],i[1][1])):e=i);return e}var cue=Math.PI/180,uue=l_(),EV=[0,0,0],fue={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function hue({width:t,height:e,orthographic:r,fovyRadians:i,focalDistance:n,padding:o,near:s,far:l}){let u=t/e,h=r?new Kr().orthographic({fovy:i,aspect:u,focalDistance:n,near:s,far:l}):new Kr().perspective({fovy:i,aspect:u,near:s,far:l});if(o){let{left:v=0,right:T=0,top:E=0,bottom:M=0}=o,O=Zn((v+t-T)/2,0,t)-t/2,F=Zn((E+e-M)/2,0,e)-e/2;h[8]-=O*2/t,h[9]+=F*2/e}return h}var lE=class{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||fue,this.focalDistance=e.focalDistance||1,this.position=e.position||EV,this.modelMatrix=e.modelMatrix||null;let{longitude:r,latitude:i}=e;this.isGeospatial=Number.isFinite(i)&&Number.isFinite(r),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?Fl.WEB_MERCATOR:Fl.WEB_MERCATOR_AUTO_OFFSET:Fl.IDENTITY}equals(e){return e instanceof lE?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&Cs(e.projectionMatrix,this.projectionMatrix)&&Cs(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:r=!0}={}){let i=this.projectPosition(e),n=i_(i,this.pixelProjectionMatrix),[o,s]=n,l=r?s:this.height-s;return e.length===2?[o,l]:[o,l,n[2]]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,u=i&&i*this.distanceScales.unitsPerMeter[2],h=Uu([n,l,s],this.pixelUnprojectionMatrix,u),[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i]=this.projectFlat(e),n=(e[2]||0)*this.distanceScales.unitsPerMeter[2];return[r,i,n]}unprojectPosition(e){let[r,i]=this.unprojectFlat(e),n=(e[2]||0)*this.distanceScales.metersPerUnit[2];return[r,i,n]}projectFlat(e){if(this.isGeospatial){let r=La(e);return r[1]=Zn(r[1],-318,830),r}return e}unprojectFlat(e){return this.isGeospatial?xl(e):e}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,0],r),n=this.unproject([this.width,0],r),o=this.unproject([0,this.height],r),s=this.unproject([this.width,this.height],r);return[Math.min(i[0],n[0],o[0],s[0]),Math.min(i[1],n[1],o[1],s[1]),Math.max(i[0],n[0],o[0],s[0]),Math.max(i[1],n[1],o[1],s[1])]}getDistanceScales(e){return e?r_({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:r,width:i=1,height:n=1}){return e<this.x+this.width&&this.x<e+i&&r<this.y+this.height&&this.y<r+n}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,wV(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(e,r){return null}_initProps(e){let r=e.longitude,i=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=zx({latitude:i})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||r_({latitude:i,longitude:r}));let n=Math.pow(2,this.zoom);this.scale=n;let{position:o,modelMatrix:s}=e,l=EV;if(o&&(l=s?new Kr(s).transformAsVector(o,[]):o),this.isGeospatial){let u=this.projectPosition([r,i,0]);this.center=new ot(l).scale(this.distanceScales.unitsPerMeter).add(u)}else this.center=this.projectPosition(l)}_initMatrices(e){let{viewMatrix:r=uue,projectionMatrix:i=null,orthographic:n=!1,fovyRadians:o,fovy:s=75,near:l=.1,far:u=1e3,padding:h=null,focalDistance:v=1}=e;this.viewMatrixUncentered=r,this.viewMatrix=new Kr().multiplyRight(r).translate(new ot(this.center).negate()),this.projectionMatrix=i||hue({width:this.width,height:this.height,orthographic:n,fovyRadians:o||s*cue,focalDistance:v,padding:h,near:l,far:u});let T=l_();Zs.multiply(T,T,this.projectionMatrix),Zs.multiply(T,T,this.viewMatrix),this.viewProjectionMatrix=T,this.viewMatrixInverse=Zs.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=bV(this.viewMatrixInverse);let E=l_(),M=l_();Zs.scale(E,E,[this.width/2,-this.height/2,1]),Zs.translate(E,E,[1,-1,0]),Zs.multiply(M,E,this.viewProjectionMatrix),this.pixelProjectionMatrix=M,this.pixelUnprojectionMatrix=Zs.invert(l_(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||ur.warn("Pixel project matrix not invertible")()}},bl=lE;(()=>{lE.displayName="Viewport"})();var Wx=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,pitch:o=0,bearing:s=0,nearZMultiplier:l=.1,farZMultiplier:u=1.01,nearZ:h,farZ:v,orthographic:T=!1,projectionMatrix:E,repeat:M=!1,worldOffset:O=0,position:F,padding:z,legacyMeterSizes:W=!1}=e,{width:J,height:K,altitude:ne=1.5}=e,ge=Math.pow(2,n);J=J||1,K=K||1;let H,me=null;if(E)ne=E[5]/2,H=pm(ne);else{e.fovy?(H=e.fovy,ne=dm(H)):H=pm(ne);let $;if(z){let{top:Z=0,bottom:we=0}=z;$=[0,Zn((Z+K-we)/2,0,K)-K/2]}me=GB({width:J,height:K,scale:ge,center:F&&[0,0,F[2]*Vx(r)],offset:$,pitch:o,fovy:H,nearZMultiplier:l,farZMultiplier:u}),Number.isFinite(h)&&(me.near=h),Number.isFinite(v)&&(me.far=v)}let fe=nE({height:K,pitch:o,bearing:s,scale:ge,altitude:ne});O&&(fe=new Kr().translate([512*O,0,0]).multiplyLeft(fe)),super({...e,width:J,height:K,viewMatrix:fe,longitude:i,latitude:r,zoom:n,...me,fovy:H,focalDistance:ne}),this.latitude=r,this.longitude=i,this.zoom=n,this.pitch=o,this.bearing=s,this.altitude=ne,this.fovy=H,this.orthographic=T,this._subViewports=M?[]:null,this._pseudoMeters=W,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let e=this.getBounds(),r=Math.floor((e[0]+180)/360),i=Math.ceil((e[2]-180)/360);for(let n=r;n<=i;n++){let o=n?new Wx({...this,worldOffset:n}):this;this._subViewports.push(o)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);let[r,i]=this.projectFlat(e),n=(e[2]||0)*Vx(e[1]);return[r,i,n]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);let[r,i]=this.unprojectFlat(e),n=(e[2]||0)/Vx(i);return[r,i,n]}addMetersToLngLat(e,r){return jx(e,r)}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o),[l,u]=this.unprojectFlat(s);return{longitude:l,latitude:u}}getBounds(e={}){let r=sE(this,e.z||0);return[Math.min(r[0][0],r[1][0],r[2][0],r[3][0]),Math.min(r[0][1],r[1][1],r[2][1],r[3][1]),Math.max(r[0][0],r[1][0],r[2][0],r[3][0]),Math.max(r[0][1],r[1][1],r[2][1],r[3][1])]}fitBounds(e,r={}){let{width:i,height:n}=this,{longitude:o,latitude:s,zoom:l}=oE({width:i,height:n,bounds:e,...r});return new Wx({width:i,height:n,longitude:o,latitude:s,zoom:l})}},Ec=Wx;(()=>{Wx.displayName="WebMercatorViewport"})();var SV=[0,0,0];function KB(t,e,r=!1){let i=e.projectPosition(t);if(r&&e instanceof Ec){let[n,o,s=0]=t,l=e.getDistanceScales([n,o]);i[2]=s*l.unitsPerMeter[2]}return i}function pue(t){let{viewport:e,modelMatrix:r,coordinateOrigin:i}=t,{coordinateSystem:n,fromCoordinateSystem:o,fromCoordinateOrigin:s}=t;return n===Zr.DEFAULT&&(n=e.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN),o===void 0&&(o=n),s===void 0&&(s=i),{viewport:e,coordinateSystem:n,coordinateOrigin:i,modelMatrix:r,fromCoordinateSystem:o,fromCoordinateOrigin:s}}function ZB(t,{viewport:e,modelMatrix:r,coordinateSystem:i,coordinateOrigin:n,offsetMode:o}){let[s,l,u=0]=t;switch(r&&([s,l,u]=ec.transformMat4([],[s,l,u,1],r)),i){case Zr.LNGLAT:return KB([s,l,u],e,o);case Zr.LNGLAT_OFFSETS:return KB([s+n[0],l+n[1],u+(n[2]||0)],e,o);case Zr.METER_OFFSETS:return KB(jx(n,[s,l,u]),e,o);case Zr.CARTESIAN:default:return e.isGeospatial?[s+n[0],l+n[1],u+n[2]]:e.projectPosition([s,l,u])}}function cE(t,e){let{viewport:r,coordinateSystem:i,coordinateOrigin:n,modelMatrix:o,fromCoordinateSystem:s,fromCoordinateOrigin:l}=pue(e),{autoOffset:u=!0}=e,{geospatialOrigin:h=SV,shaderCoordinateOrigin:v=SV,offsetMode:T=!1}=u?zB(r,i,n):{},E=ZB(t,{viewport:r,modelMatrix:o,coordinateSystem:s,coordinateOrigin:l,offsetMode:T});if(T){let M=r.projectPosition(h||v);Da.sub(E,E,M)}return E}var due=[255,255,255],Aue=1,mue=[0,0,1],gue=[0,0,1],_ue=0,c_=class{constructor(e={}){this.type="point";let{color:r=due}=e,{intensity:i=Aue}=e,{position:n=gue}=e;this.id=e.id||`point-${_ue++}`,this.color=r,this.intensity=i,this.type="point",this.position=n,this.attenuation=yue(e),this.projectedLight={...this}}getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o}=e.props,s=cE(this.position,{viewport:i,coordinateSystem:n,coordinateOrigin:o,fromCoordinateSystem:i.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN,fromCoordinateOrigin:[0,0,0]});return r.color=this.color,r.intensity=this.intensity,r.position=s,r}};function yue(t){return t.attenuation?t.attenuation:"intensity"in t?[0,0,t.intensity||0]:mue}var qx=class extends c_{getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o,modelMatrix:s}=e.props,{project_uCameraPosition:l}=tE({viewport:i,modelMatrix:s,coordinateSystem:n,coordinateOrigin:o});return r.color=this.color,r.intensity=this.intensity,r.position=l,r}};var gm=Math.PI/180,vue=1e3*60*60*24,xue=2440588,bue=2451545,uE=gm*23.4397,wue=357.5291,Tue=.98560028,Eue=280.147,Sue=360.9856235;function CV(t,e,r){let i=gm*-r,n=gm*e,o=Mue(t),s=Fue(o),l=Oue(o,i)-s.rightAscension;return{azimuth:Rue(l,n,s.declination),altitude:Bue(l,n,s.declination)}}function fE(t,e,r){let{azimuth:i,altitude:n}=CV(t,e,r);return[Math.sin(i)*Math.cos(n),Math.cos(i)*Math.cos(n),-Math.sin(n)]}function Cue(t){return(typeof t=="number"?t:t.getTime())/vue-.5+xue}function Mue(t){return Cue(t)-bue}function Iue(t,e){let r=t;return Math.atan2(Math.sin(r)*Math.cos(uE)-Math.tan(e)*Math.sin(uE),Math.cos(r))}function Pue(t,e){let r=t;return Math.asin(Math.sin(e)*Math.cos(uE)+Math.cos(e)*Math.sin(uE)*Math.sin(r))}function Rue(t,e,r){let i=t,n=e,o=r;return Math.atan2(Math.sin(i),Math.cos(i)*Math.sin(n)-Math.tan(o)*Math.cos(n))}function Bue(t,e,r){let i=t,n=e,o=r;return Math.asin(Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos(i))}function Oue(t,e){return gm*(Eue+Sue*t)-e}function Due(t){return gm*(wue+Tue*t)}function Lue(t){let e=t,r=gm*(1.9148*Math.sin(e)+.02*Math.sin(2*e)+3e-4*Math.sin(3*e)),i=gm*102.9372;return e+r+i+Math.PI}function Fue(t){let e=Due(t),r=Lue(e);return{declination:Pue(r,0),rightAscension:Iue(r,0)}}var Xx=class extends vp{constructor(e){super(e),this.timestamp=e.timestamp}getProjectedLight({layer:e}){let{viewport:r}=e.context;if(r.resolution&&r.resolution>0){let[n,o,s]=fE(this.timestamp,0,0);this.direction=[n,-s,o]}else{let{latitude:n,longitude:o}=r;this.direction=fE(this.timestamp,n,o)}return this}};var Nue=1,kue=1,_m=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:n=1,repeat:o=1}=e,s=Nue++,l={time:0,delay:r,duration:i,rate:n,repeat:o};return this._setChannelTime(l,this.time),this.channels.set(s,l),s}removeChannel(e){this.channels.delete(e);for(let[r,i]of this.animations)i.channel===e&&this.detachAnimation(r)}isFinished(e){let r=this.channels.get(e);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(e){if(e===void 0)return this.time;let r=this.channels.get(e);return r===void 0?-1:r.time}setTime(e){this.time=Math.max(0,e);let r=this.channels.values();for(let n of r)this._setChannelTime(n,this.time);let i=this.animations.values();for(let n of i){let{animation:o,channel:s}=n;o.setTime(this.getTime(s))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,r){let i=kue++;return this.animations.set(i,{animation:e,channel:r}),e.setTime(this.getTime(r)),i}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,r){let i=r-e.delay,n=e.duration*e.repeat;i>=n?e.time=e.duration*e.rate:(e.time=Math.max(0,i)%e.duration,e.time*=e.rate)}};var Uue=0,zue={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:wc.stats.get(`animation-loop-${Uue++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},Yx=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;constructor(e){if(this.props={...zue,...e},e=this.props,!e.device)throw new Error("No device provided");let{useDevicePixels:r=!0}=this.props;this.stats=e.stats||new Dl({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport,autoResizeDrawingBuffer:e.autoResizeDrawingBuffer,useDevicePixels:r}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),"autoResizeDrawingBuffer"in e&&(this.props.autoResizeDrawingBuffer=e.autoResizeDrawingBuffer||!1),"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let r=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(r),r}}stop(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=S3(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(C3(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:this.device?.canvasContext?.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:r,aspect:i}=this._getSizeAndAspect();(e!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.canvasContext?.canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let r=document.createElement("div");r.style.position="absolute",r.style.left="10px",r.style.bottom="10px",r.style.width="300px",r.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,r]=this.device?.canvasContext?.getPixelSize()||[1,1],i=1,n=this.device?.canvasContext?.canvas;return n&&n.clientHeight?i=n.clientWidth/n.clientHeight:e>0&&r>0&&(i=e/r),{width:e,height:r,aspect:i}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.props.autoResizeDrawingBuffer&&this.device?.canvasContext?.resize({useDevicePixels:this.props.useDevicePixels})}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}};var hE=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){this.id=e.id||oa("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&Yi(this.indices.usage===Xi.INDEX)}destroy(){this.indices?.destroy();for(let e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function MV(t,e){if(e instanceof hE)return e;let r=Vue(t,e),{attributes:i,bufferLayout:n}=jue(t,e);return new hE({topology:e.topology||"triangle-list",bufferLayout:n,vertexCount:e.vertexCount,indices:r,attributes:i})}function Vue(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:Xi.INDEX,data:r})}function jue(t,e){let r=[],i={};for(let[o,s]of Object.entries(e.attributes)){let l=o;switch(o){case"POSITION":l="positions";break;case"NORMAL":l="normals";break;case"TEXCOORD_0":l="texCoords";break;case"COLOR_0":l="colors";break}i[l]=t.createBuffer({data:s.value,id:`${o}-buffer`});let{value:u,size:h,normalized:v}=s;r.push({name:l,format:w3(u,h,v)})}let n=e._calculateVertexCount(e.attributes,e.indices);return{attributes:i,bufferLayout:r,vertexCount:n}}var pE=class{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(e){let r=sm(Object.values(e));Kt.log(1,"Creating ShaderInputs with modules",r.map(i=>i.name))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[i,n]of Object.entries(e)){let o=i;this.moduleUniforms[o]=n.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(e){for(let r of Object.keys(e)){let i=r,n=e[i],o=this.modules[i];if(!o){Kt.warn(`Module ${r} not found`)();continue}let s=this.moduleUniforms[i],l=o.getUniforms?.(n,this.moduleUniforms[i])||n;this.moduleUniforms[i]={...s,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[r,i]of Object.entries(this.moduleUniforms))for(let[n,o]of Object.entries(i))e[`${r}.${n}`]={type:this.modules[r].uniformTypes?.[n],value:String(o)};return e}};var JB=class{device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new JB(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=e}createRenderPipeline(e){let r={...df.defaultProps,...e},i=this._hashRenderPipeline(r);if(!this._renderPipelineCache[i]){let n=this.device.createRenderPipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._renderPipelineCache[i]={pipeline:n,useCount:0}}return this._renderPipelineCache[i].useCount++,this._renderPipelineCache[i].pipeline}createComputePipeline(e){let r={...tm.defaultProps,...e},i=this._hashComputePipeline(r);if(!this._computePipelineCache[i]){let n=this.device.createComputePipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._computePipelineCache[i]={pipeline:n,useCount:0}}return this._computePipelineCache[i].useCount++,this._computePipelineCache[i].pipeline}release(e){let r=e.hash,i=e instanceof tm?this._computePipelineCache:this._renderPipelineCache;i[r].useCount--,i[r].useCount===0&&(i[r].pipeline.destroy(),delete i[r])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){let r=this._getHash(e.vs.source),i=e.fs?this._getHash(e.fs.source):0,n="-",o=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${r}/${i}V${n}BL${o}`;default:let s=this._getHash(JSON.stringify(e.parameters));return`${r}/${i}V${n}T${e.topology}P${s}BL${o}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}},Kx=JB;Yr(Kx,"defaultProps",{...df.defaultProps});var QB=class{device;_cache={};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new QB(e),e._lumaData.defaultShaderFactory}constructor(e){this.device=e}createShader(e){let r=this._hashShader(e),i=this._cache[r];if(!i){let n=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[r]=i={shader:n,useCount:0}}return i.useCount++,i.shader}release(e){let r=this._hashShader(e),i=this._cache[r];i&&(i.useCount--,i.useCount===0&&(delete this._cache[r],i.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}},Zx=QB;Yr(Zx,"defaultProps",{...Sd.defaultProps});function IV(t,e){let r={},i="Values";if(t.attributes.length===0&&!t.varyings?.length)return{"No attributes or varyings":{[i]:"N/A"}};for(let n of t.attributes)if(n){let o=`${n.location} ${n.name}: ${n.type}`;r[`in ${o}`]={[i]:n.stepMode||"vertex"}}for(let n of t.varyings||[]){let o=`${n.location} ${n.name}`;r[`out ${o}`]={[i]:JSON.stringify(n.accessor)}}return r}var Qa=null,$B=null;function PV(t,{id:e,minimap:r,opaque:i,top:n="0",left:o="0",rgbaScale:s=1}){Qa||(Qa=document.createElement("canvas"),Qa.id=e,Qa.title=e,Qa.style.zIndex="100",Qa.style.position="absolute",Qa.style.top=n,Qa.style.left=o,Qa.style.border="blue 1px solid",Qa.style.transform="scaleY(-1)",document.body.appendChild(Qa),$B=Qa.getContext("2d")),(Qa.width!==t.width||Qa.height!==t.height)&&(Qa.width=t.width/2,Qa.height=t.height/2,Qa.style.width="400px",Qa.style.height="400px");let l=t.device.readPixelsToArrayWebGL(t),u=$B.createImageData(t.width,t.height),h=0;for(let v=0;v<l.length;v+=4)u.data[h+v+0]=l[v+0]*s,u.data[h+v+1]=l[v+1]*s,u.data[h+v+2]=l[v+2]*s,u.data[h+v+3]=i?255:l[v+3]*s;$B.putImageData(u,0,0)}var u_=2,Hue=1e4,eO=class{device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;vertexCount;instanceCount=0;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};uniforms={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;_getModuleUniforms;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;constructor(e,r){this.props={...eO.defaultProps,...r},r=this.props,this.id=r.id||oa("model"),this.device=e,Object.assign(this.userData,r.userData);let i=Object.fromEntries(this.props.modules?.map(l=>[l.name,l])||[]);this.setShaderInputs(r.shaderInputs||new pE(i));let n=Gue(e),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){this.props.shaderLayout||=qR(this.props.source);let{source:l,getUniforms:u}=this.props.shaderAssembler.assembleShader({platformInfo:n,...this.props,modules:o});this.source=l,this._getModuleUniforms=u}else{let{vs:l,fs:u,getUniforms:h}=this.props.shaderAssembler.assembleShaderPair({platformInfo:n,...this.props,modules:o});this.vs=l,this.fs=u,this._getModuleUniforms=h}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&this.setGeometry(r.geometry),this.pipelineFactory=r.pipelineFactory||Kx.getDefaultPipelineFactory(this.device),this.shaderFactory=r.shaderFactory||Zx.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&this.updateModuleSettings(r.moduleSettings),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){this.predraw();let r;try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),wd(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);let{indexBuffer:i}=this.vertexArray,n=i?i.byteLength/(i.indexType==="uint32"?4:2):void 0;r=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:n,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(e),r?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",r}setGeometry(e){this._gpuGeometry?.destroy();let r=e&&MV(this.device,e);r&&(this.setTopology(r.topology||"triangle-list"),this.bufferLayout=RV(r.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r)),this._gpuGeometry=r}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?RV(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){fx(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setInstanceCount(e){this.instanceCount=e,this.setNeedsRedraw("instanceCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new ax(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let i=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,r){e.indices&&Kt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,n]of Object.entries(e)){let o=this.bufferLayout.find(u=>BV(u).includes(i));if(!o){Kt.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let s=BV(o),l=!1;for(let u of s){let h=this._attributeInfos[u];h&&(this.vertexArray.setBuffer(h.location,n),l=!0)}!l&&!(r?.disableWarnings??this.props.disableWarnings)&&Kt.warn(`Model(${this.id}): Ignoring buffer "${n.id}" for unknown attribute "${i}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,r){for(let[i,n]of Object.entries(e)){let o=this._attributeInfos[i];o?this.vertexArray.setConstantWebGL(o.location,n):(r?.disableWarnings??this.props.disableWarnings)||Kt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){wd(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettings(e){let{bindings:r,uniforms:i}=cx(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,i),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let e=0;for(let r of Object.values(this.bindings))r instanceof Ed?e=Math.max(e,r.texture.updateTimestamp):r instanceof Xi||r instanceof bo?e=Math.max(e,r.updateTimestamp):r instanceof Cd||(e=Math.max(e,r.buffer.updateTimestamp));return e}_setGeometryAttributes(e){let r={...e.attributes};for(let[i]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(n=>n.name===i)&&i!=="positions"&&delete r[i];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(r,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,r=null;this.pipeline&&(Kt.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,r=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders}),n=null;this.source?n=i:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:i,fs:n}),this._attributeInfos=W2(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),r&&this.shaderFactory.release(r)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=Kt.level>3?0:Hue;Kt.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,Kt.group(u_,`>>> DRAWING MODEL ${this.id}`,{collapsed:Kt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=IV(this.pipeline.shaderLayout,this.id);Kt.table(u_,e)();let r=this.shaderInputs.getDebugTable();for(let[n,o]of Object.entries(this.uniforms))r[n]={value:o};Kt.table(u_,r)();let i=this._getAttributeDebugTable();Kt.table(u_,this._attributeInfos)(),Kt.table(u_,i)(),Kt.groupEnd(u_)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let r=Kt.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let i=e.props.framebuffer;i&&PV(i,{id:i.id,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[r,i]of Object.entries(this._attributeInfos))e[i.location]={name:r,type:i.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[i.location],i.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,i=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);e.indices={name:"indices",type:r.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,r){let i=lx(r);return(e instanceof Xi?new i(e.debugData):e).toString()}},Ni=eO;Yr(Ni,"defaultProps",{...df.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:Pd.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});function RV(t,e){let r=[...t];for(let i of e){let n=r.findIndex(o=>o.name===i.name);n<0?r.push(i):r[n]=i}return r}function Gue(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function BV(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}var wf=class{device;model;transformFeedback;static isSupported(e){return e?.info?.type==="webgl"}constructor(e,r=Ni.defaultProps){Yi(wf.isSupported(e),"BufferTransform not yet implemented on WebGPU"),this.device=e,this.model=new Ni(this.device,{id:r.id||"buffer-transform-model",fs:r.fs||Ex(),topology:r.topology||"point-list",...r}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:r.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){let r=this.device.beginRenderPass(e);this.model.draw(r),r.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let r=this.getBuffer(e);if(r instanceof Xi)return r.readAsync();let{buffer:i,byteOffset:n=0,byteLength:o=i.byteLength}=r;return i.readAsync(n,o)}};var Wue="transform_output",Mh=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,r){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Ni(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Ex({input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Wue}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(e){let{framebuffer:r}=this.bindings[this.currentIndex],i=this.device.beginRenderPass({framebuffer:r,...e});this.model.draw(i),i.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getData({packed:e=!1}={}){throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:e}=this.bindings[this.currentIndex];return e}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(e){this._updateBindings(e)}_updateBindings(e){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e)}_updateBinding(e,{sourceBuffers:r,sourceTextures:i,targetTexture:n}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,i),Object.assign(e.sourceBuffers,r),n){e.targetTexture=n;let{width:o,height:s}=n;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:o,height:s,colorAttachments:[n]}),e.framebuffer.resize({width:o,height:s})}return e}_setSourceTextureParameters(){let e=this.currentIndex,{sourceTextures:r}=this.bindings[e];for(let i in r)r[i].sampler=this.sampler}};var Mn=class{id;topology;vertexCount;indices;attributes;userData={};constructor(e){let{attributes:r={},indices:i=null,vertexCount:n=null}=e;this.id=e.id||oa("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={};for(let[o,s]of Object.entries(r)){let l=ArrayBuffer.isView(s)?{value:s}:s;Yi(ArrayBuffer.isView(l.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!l.size&&(l.size=3),o==="indices"?(Yi(!this.indices),this.indices=l):this.attributes[o]=l}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let i=1/0;for(let n of Object.values(e)){let{value:o,size:s,constant:l}=n;!l&&o&&s>=1&&(i=Math.min(i,o.length/s))}return Yi(Number.isFinite(i)),i}};var que=`#version 300 es
1687
+ `}}};var Jce=[kd],Qce=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function o_(){let t=Pd.getDefaultShaderAssembler();for(let e of Jce)t.addDefaultModule(e);for(let e of Qce)t.addShaderHook(e);return t}var $ce=[255,255,255],eue=1,tue=0,s_=class{constructor(e={}){this.type="ambient";let{color:r=$ce}=e,{intensity:i=eue}=e;this.id=e.id||`ambient-${tue++}`,this.color=r,this.intensity=i}};var rue=[255,255,255],iue=1,nue=[0,0,-1],oue=0,vp=class{constructor(e={}){this.type="directional";let{color:r=rue}=e,{intensity:i=iue}=e,{direction:n=nue}=e,{_shadow:o=!1}=e;this.id=e.id||`directional-${oue++}`,this.color=r,this.intensity=i,this.type="directional",this.direction=new ot(n).normalize().toArray(),this.shadow=o}getProjectedLight(e){return this}};var Am=class{constructor(e,r={id:"pass"}){let{id:i}=r;this.id=i,this.device=e,this.props={...r}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}};var xf=class extends Am{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){let[r,i]=this.device.canvasContext.getDrawingBufferSize(),n=e.clearCanvas??!0,o=e.clearColor??(n?[0,0,0,0]:!1),s=n?1:!1,l=e.colorMask??15,u={viewport:[0,0,r,i]};e.colorMask&&(u.colorMask=l),e.scissorRect&&(u.scissorRect=e.scissorRect);let h=this.device.beginRenderPass({framebuffer:e.target,parameters:u,clearColor:o,clearDepth:s});try{return this._drawLayers(h,e)}finally{h.end()}}_drawLayers(e,r){let{target:i,moduleParameters:n,viewports:o,views:s,onViewportActive:l,clearStack:u=!0}=r;r.pass=r.pass||"unknown",u&&(this._lastRenderIndex=-1);let h=[];for(let v of o){let T=s&&s[v.id];l?.(v);let E=this._getDrawLayerParams(v,r),M=v.subViewports||[v];for(let O of M){let F=this._drawLayersInViewport(e,{target:i,moduleParameters:n,viewport:O,view:T,pass:r.pass,layers:r.layers},E);h.push(F)}}return h}_getDrawLayerParams(e,{layers:r,pass:i,isPicking:n=!1,layerFilter:o,cullRect:s,effects:l,moduleParameters:u},h=!1){let v=[],T=yV(this._lastRenderIndex+1),E={layer:r[0],viewport:e,isPicking:n,renderPass:i,cullRect:s},M={};for(let O=0;O<r.length;O++){let F=r[O],z=this._shouldDrawLayer(F,E,o,M),W={shouldDrawLayer:z};z&&!h&&(W.layerRenderIndex=T(F,z),W.moduleParameters=this._getModuleParameters(F,l,i,u),W.layerParameters={...F.context.deck?.props.parameters,...this.getLayerParameters(F,O,e)}),v[O]=W}return v}_drawLayersInViewport(e,{layers:r,moduleParameters:i,pass:n,target:o,viewport:s,view:l},u){let h=sue(this.device,{moduleParameters:i,target:o,viewport:s});if(l&&l.props.clear){let T=l.props.clear===!0?{color:!0,depth:!0}:l.props.clear;this.device.withParametersWebGL({scissorTest:!0,scissor:h},()=>this.device.clearWebGL(T))}let v={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:h});for(let T=0;T<r.length;T++){let E=r[T],{shouldDrawLayer:M,layerRenderIndex:O,moduleParameters:F,layerParameters:z}=u[T];if(M&&E.props.pickable&&v.pickableCount++,E.isComposite)v.compositeCount++;else if(M){v.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,O),F.viewport=s,E.context.renderPass=e;try{E._drawLayer({renderPass:e,moduleParameters:F,uniforms:{layerIndex:O},parameters:z})}catch(W){E.raiseError(W,`drawing ${E} to ${n}`)}}}return v}shouldDrawLayer(e){return!0}getModuleParameters(e,r){return null}getLayerParameters(e,r,i){return e.props.parameters}_shouldDrawLayer(e,r,i,n){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;r.layer=e;let s=e.parent;for(;s;){if(!s.props.visible||!s.filterSubLayer(r))return!1;r.layer=s,s=s.parent}if(i){let l=r.layer.id;if(l in n||(n[l]=i(r)),!n[l])return!1}return e.activateViewport(r.viewport),!0}_getModuleParameters(e,r,i,n){let o=this.device.canvasContext.cssToDeviceRatio(),s=Object.assign(Object.create(e.internalState?.propsInTransition||e.props),{autoWrapLongitude:e.wrapLongitude,viewport:e.context.viewport,mousePosition:e.context.mousePosition,picking:{isActive:0},devicePixelRatio:o});if(r)for(let l of r)Object.assign(s,l.getModuleParameters?.(e));return Object.assign(s,this.getModuleParameters(e,r),n)}};function yV(t=0,e={}){let r={},i=(n,o)=>{let s=n.props._offset,l=n.id,u=n.parent&&n.parent.id,h;if(u&&!(u in e)&&i(n.parent,!1),u in r){let v=r[u]=r[u]||yV(e[u],e);h=v(n,o),r[l]=v}else Number.isFinite(s)?(h=s+(e[u]||0),r[l]=null):h=t;return o&&h>=t&&(t=h+1),e[l]=h,h};return i}function sue(t,{moduleParameters:e,target:r,viewport:i}){let n=e&&e.devicePixelRatio||t.canvasContext.cssToDeviceRatio(),[,o]=t.canvasContext.getDrawingBufferSize(),s=r?r.height:o,l=i;return[l.x*n,s-(l.y+l.height)*n,l.width*n,l.height*n]}var Hx=class extends xf{constructor(e,r){super(e,r),this.shadowMap=e.createTexture({width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),this.depthBuffer=e.createTexture({format:"depth16unorm",width:1,height:1,mipmaps:!1,dataFormat:6402,type:5125}),this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[this.shadowMap],depthStencilAttachment:this.depthBuffer})}render(e){let r=this.fbo,i=this.device.canvasContext.cssToDeviceRatio(),n=e.viewports[0],o=n.width*i,s=n.height*i,l=[1,1,1,1];(o!==r.width||s!==r.height)&&r.resize({width:o,height:s}),super.render({...e,clearColor:l,target:r,pass:"shadow"})}getLayerParameters(e,r,i){return{...e.props.parameters,blend:!1,depthRange:[0,1],depthTest:!0}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.shadowMap&&(this.shadowMap.destroy(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.destroy(),this.depthBuffer=null)}};var aue={color:[255,255,255],intensity:1},vV=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],lue=[0,0,0,200/255],zd=class{constructor(e={}){this.id="lighting-effect",this.shadowColor=lue,this.shadow=!1,this.ambientLight=null,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.shadowMaps=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;let{device:r,deck:i}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(r),i._addDefaultShaderModule(n_),this.dummyShadowMap=r.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(let r in e){let i=e[r];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i);break;default:}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(r=>r.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let s=0;s<this.shadowPasses.length;s++)this.shadowPasses[s].render({layers:e,layerFilter:r,viewports:i,onViewportActive:n,views:o,moduleParameters:{shadowLightId:s,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}getModuleParameters(e){let r=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return r.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(i=>i.getProjectedLight({layer:e})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:e}))},r}cleanup(e){for(let r of this.shadowPasses)r.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(n_))}_calculateMatrices(){let e=[];for(let r of this.directionalLights){let i=new Kr().lookAt({eye:new ot(r.direction).negate()});e.push(i)}return e}_createShadowPasses(e){for(let r=0;r<this.directionalLights.length;r++){let i=new Hx(e);this.shadowPasses[r]=i,this.shadowMaps[r]=i.shadowMap}}_applyDefaultLights(){let{ambientLight:e,pointLights:r,directionalLights:i}=this;!e&&r.length===0&&i.length===0&&(this.ambientLight=new s_(aue),this.directionalLights.push(new vp(vV[0]),new vp(vV[1])))}};var YB=class{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,r,{size:i=1,type:n,padding:o=0,copy:s=!1,initialize:l=!1,maxCount:u}){let h=n||e&&e.constructor||Float32Array,v=r*i+o;if(ArrayBuffer.isView(e)){if(v<=e.length)return e;if(v*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new h(e.buffer,0,v)}let T=1/0;u&&(T=u*i+o);let E=this._allocate(h,v,l,T);return e&&s?E.set(e):l||E.fill(0,0,4),this._release(e),E}release(e){this._release(e)}_allocate(e,r,i,n){let o=Math.max(Math.ceil(r*this.opts.overAlloc),1);o>n&&(o=n);let s=this._pool,l=e.BYTES_PER_ELEMENT*o,u=s.findIndex(h=>h.byteLength>=l);if(u>=0){let h=new e(s.splice(u,1)[0],0,o);return i&&h.fill(0),h}return new e(o)}_release(e){if(!ArrayBuffer.isView(e))return;let r=this._pool,{buffer:i}=e,{byteLength:n}=i,o=r.findIndex(s=>s.byteLength>=n);o<0?r.push(i):(o>0||r.length<this.opts.poolSize)&&r.splice(o,0,i),r.length>this.opts.poolSize&&r.shift()}},bf=new YB;function l_(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function mm(t,e){let r=t%e;return r<0?e+r:r}function bV(t){return[t[12],t[13],t[14]]}function wV(t){return{left:a_(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:a_(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:a_(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:a_(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:a_(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:a_(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}var xV=new ot;function a_(t,e,r,i){xV.set(t,e,r);let n=xV.len();return{distance:i/n,normal:new ot(-t/n,-e/n,-r/n)}}function Vd(t){return t-Math.fround(t)}var Gx;function aE(t,e){let{size:r=1,startIndex:i=0}=e,n=e.endIndex!==void 0?e.endIndex:t.length,o=(n-i)/r;Gx=bf.allocate(Gx,o,{type:Float32Array,size:r*2});let s=i,l=0;for(;s<n;){for(let u=0;u<r;u++){let h=t[s++];Gx[l+u]=h,Gx[l+u+r]=Vd(h)}l+=r*2}return Gx.subarray(0,o*r*2)}function TV(t){let e=null,r=!1;for(let i of t)i&&(e?(r||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],r=!0),e[0][0]=Math.min(e[0][0],i[0][0]),e[0][1]=Math.min(e[0][1],i[0][1]),e[1][0]=Math.max(e[1][0],i[1][0]),e[1][1]=Math.max(e[1][1],i[1][1])):e=i);return e}var cue=Math.PI/180,uue=l_(),EV=[0,0,0],fue={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function hue({width:t,height:e,orthographic:r,fovyRadians:i,focalDistance:n,padding:o,near:s,far:l}){let u=t/e,h=r?new Kr().orthographic({fovy:i,aspect:u,focalDistance:n,near:s,far:l}):new Kr().perspective({fovy:i,aspect:u,near:s,far:l});if(o){let{left:v=0,right:T=0,top:E=0,bottom:M=0}=o,O=Zn((v+t-T)/2,0,t)-t/2,F=Zn((E+e-M)/2,0,e)-e/2;h[8]-=O*2/t,h[9]+=F*2/e}return h}var lE=class{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||fue,this.focalDistance=e.focalDistance||1,this.position=e.position||EV,this.modelMatrix=e.modelMatrix||null;let{longitude:r,latitude:i}=e;this.isGeospatial=Number.isFinite(i)&&Number.isFinite(r),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?Fl.WEB_MERCATOR:Fl.WEB_MERCATOR_AUTO_OFFSET:Fl.IDENTITY}equals(e){return e instanceof lE?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&Cs(e.projectionMatrix,this.projectionMatrix)&&Cs(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:r=!0}={}){let i=this.projectPosition(e),n=i_(i,this.pixelProjectionMatrix),[o,s]=n,l=r?s:this.height-s;return e.length===2?[o,l]:[o,l,n[2]]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,u=i&&i*this.distanceScales.unitsPerMeter[2],h=Uu([n,l,s],this.pixelUnprojectionMatrix,u),[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i]=this.projectFlat(e),n=(e[2]||0)*this.distanceScales.unitsPerMeter[2];return[r,i,n]}unprojectPosition(e){let[r,i]=this.unprojectFlat(e),n=(e[2]||0)*this.distanceScales.metersPerUnit[2];return[r,i,n]}projectFlat(e){if(this.isGeospatial){let r=La(e);return r[1]=Zn(r[1],-318,830),r}return e}unprojectFlat(e){return this.isGeospatial?xl(e):e}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,0],r),n=this.unproject([this.width,0],r),o=this.unproject([0,this.height],r),s=this.unproject([this.width,this.height],r);return[Math.min(i[0],n[0],o[0],s[0]),Math.min(i[1],n[1],o[1],s[1]),Math.max(i[0],n[0],o[0],s[0]),Math.max(i[1],n[1],o[1],s[1])]}getDistanceScales(e){return e?r_({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:r,width:i=1,height:n=1}){return e<this.x+this.width&&this.x<e+i&&r<this.y+this.height&&this.y<r+n}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,wV(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(e,r){return null}_initProps(e){let r=e.longitude,i=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=zx({latitude:i})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||r_({latitude:i,longitude:r}));let n=Math.pow(2,this.zoom);this.scale=n;let{position:o,modelMatrix:s}=e,l=EV;if(o&&(l=s?new Kr(s).transformAsVector(o,[]):o),this.isGeospatial){let u=this.projectPosition([r,i,0]);this.center=new ot(l).scale(this.distanceScales.unitsPerMeter).add(u)}else this.center=this.projectPosition(l)}_initMatrices(e){let{viewMatrix:r=uue,projectionMatrix:i=null,orthographic:n=!1,fovyRadians:o,fovy:s=75,near:l=.1,far:u=1e3,padding:h=null,focalDistance:v=1}=e;this.viewMatrixUncentered=r,this.viewMatrix=new Kr().multiplyRight(r).translate(new ot(this.center).negate()),this.projectionMatrix=i||hue({width:this.width,height:this.height,orthographic:n,fovyRadians:o||s*cue,focalDistance:v,padding:h,near:l,far:u});let T=l_();Zs.multiply(T,T,this.projectionMatrix),Zs.multiply(T,T,this.viewMatrix),this.viewProjectionMatrix=T,this.viewMatrixInverse=Zs.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=bV(this.viewMatrixInverse);let E=l_(),M=l_();Zs.scale(E,E,[this.width/2,-this.height/2,1]),Zs.translate(E,E,[1,-1,0]),Zs.multiply(M,E,this.viewProjectionMatrix),this.pixelProjectionMatrix=M,this.pixelUnprojectionMatrix=Zs.invert(l_(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||ur.warn("Pixel project matrix not invertible")()}},bl=lE;(()=>{lE.displayName="Viewport"})();var Wx=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,pitch:o=0,bearing:s=0,nearZMultiplier:l=.1,farZMultiplier:u=1.01,nearZ:h,farZ:v,orthographic:T=!1,projectionMatrix:E,repeat:M=!1,worldOffset:O=0,position:F,padding:z,legacyMeterSizes:W=!1}=e,{width:J,height:K,altitude:ne=1.5}=e,ge=Math.pow(2,n);J=J||1,K=K||1;let H,me=null;if(E)ne=E[5]/2,H=pm(ne);else{e.fovy?(H=e.fovy,ne=dm(H)):H=pm(ne);let $;if(z){let{top:Z=0,bottom:we=0}=z;$=[0,Zn((Z+K-we)/2,0,K)-K/2]}me=GB({width:J,height:K,scale:ge,center:F&&[0,0,F[2]*Vx(r)],offset:$,pitch:o,fovy:H,nearZMultiplier:l,farZMultiplier:u}),Number.isFinite(h)&&(me.near=h),Number.isFinite(v)&&(me.far=v)}let fe=nE({height:K,pitch:o,bearing:s,scale:ge,altitude:ne});O&&(fe=new Kr().translate([512*O,0,0]).multiplyLeft(fe)),super({...e,width:J,height:K,viewMatrix:fe,longitude:i,latitude:r,zoom:n,...me,fovy:H,focalDistance:ne}),this.latitude=r,this.longitude=i,this.zoom=n,this.pitch=o,this.bearing=s,this.altitude=ne,this.fovy=H,this.orthographic=T,this._subViewports=M?[]:null,this._pseudoMeters=W,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let e=this.getBounds(),r=Math.floor((e[0]+180)/360),i=Math.ceil((e[2]-180)/360);for(let n=r;n<=i;n++){let o=n?new Wx({...this,worldOffset:n}):this;this._subViewports.push(o)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);let[r,i]=this.projectFlat(e),n=(e[2]||0)*Vx(e[1]);return[r,i,n]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);let[r,i]=this.unprojectFlat(e),n=(e[2]||0)/Vx(i);return[r,i,n]}addMetersToLngLat(e,r){return jx(e,r)}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o),[l,u]=this.unprojectFlat(s);return{longitude:l,latitude:u}}getBounds(e={}){let r=sE(this,e.z||0);return[Math.min(r[0][0],r[1][0],r[2][0],r[3][0]),Math.min(r[0][1],r[1][1],r[2][1],r[3][1]),Math.max(r[0][0],r[1][0],r[2][0],r[3][0]),Math.max(r[0][1],r[1][1],r[2][1],r[3][1])]}fitBounds(e,r={}){let{width:i,height:n}=this,{longitude:o,latitude:s,zoom:l}=oE({width:i,height:n,bounds:e,...r});return new Wx({width:i,height:n,longitude:o,latitude:s,zoom:l})}},Ec=Wx;(()=>{Wx.displayName="WebMercatorViewport"})();var SV=[0,0,0];function KB(t,e,r=!1){let i=e.projectPosition(t);if(r&&e instanceof Ec){let[n,o,s=0]=t,l=e.getDistanceScales([n,o]);i[2]=s*l.unitsPerMeter[2]}return i}function pue(t){let{viewport:e,modelMatrix:r,coordinateOrigin:i}=t,{coordinateSystem:n,fromCoordinateSystem:o,fromCoordinateOrigin:s}=t;return n===Zr.DEFAULT&&(n=e.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN),o===void 0&&(o=n),s===void 0&&(s=i),{viewport:e,coordinateSystem:n,coordinateOrigin:i,modelMatrix:r,fromCoordinateSystem:o,fromCoordinateOrigin:s}}function ZB(t,{viewport:e,modelMatrix:r,coordinateSystem:i,coordinateOrigin:n,offsetMode:o}){let[s,l,u=0]=t;switch(r&&([s,l,u]=ec.transformMat4([],[s,l,u,1],r)),i){case Zr.LNGLAT:return KB([s,l,u],e,o);case Zr.LNGLAT_OFFSETS:return KB([s+n[0],l+n[1],u+(n[2]||0)],e,o);case Zr.METER_OFFSETS:return KB(jx(n,[s,l,u]),e,o);case Zr.CARTESIAN:default:return e.isGeospatial?[s+n[0],l+n[1],u+n[2]]:e.projectPosition([s,l,u])}}function cE(t,e){let{viewport:r,coordinateSystem:i,coordinateOrigin:n,modelMatrix:o,fromCoordinateSystem:s,fromCoordinateOrigin:l}=pue(e),{autoOffset:u=!0}=e,{geospatialOrigin:h=SV,shaderCoordinateOrigin:v=SV,offsetMode:T=!1}=u?zB(r,i,n):{},E=ZB(t,{viewport:r,modelMatrix:o,coordinateSystem:s,coordinateOrigin:l,offsetMode:T});if(T){let M=r.projectPosition(h||v);Da.sub(E,E,M)}return E}var due=[255,255,255],Aue=1,mue=[0,0,1],gue=[0,0,1],_ue=0,c_=class{constructor(e={}){this.type="point";let{color:r=due}=e,{intensity:i=Aue}=e,{position:n=gue}=e;this.id=e.id||`point-${_ue++}`,this.color=r,this.intensity=i,this.type="point",this.position=n,this.attenuation=yue(e),this.projectedLight={...this}}getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o}=e.props,s=cE(this.position,{viewport:i,coordinateSystem:n,coordinateOrigin:o,fromCoordinateSystem:i.isGeospatial?Zr.LNGLAT:Zr.CARTESIAN,fromCoordinateOrigin:[0,0,0]});return r.color=this.color,r.intensity=this.intensity,r.position=s,r}};function yue(t){return t.attenuation?t.attenuation:"intensity"in t?[0,0,t.intensity||0]:mue}var qx=class extends c_{getProjectedLight({layer:e}){let{projectedLight:r}=this,i=e.context.viewport,{coordinateSystem:n,coordinateOrigin:o,modelMatrix:s}=e.props,{project_uCameraPosition:l}=tE({viewport:i,modelMatrix:s,coordinateSystem:n,coordinateOrigin:o});return r.color=this.color,r.intensity=this.intensity,r.position=l,r}};var gm=Math.PI/180,vue=1e3*60*60*24,xue=2440588,bue=2451545,uE=gm*23.4397,wue=357.5291,Tue=.98560028,Eue=280.147,Sue=360.9856235;function CV(t,e,r){let i=gm*-r,n=gm*e,o=Mue(t),s=Fue(o),l=Oue(o,i)-s.rightAscension;return{azimuth:Rue(l,n,s.declination),altitude:Bue(l,n,s.declination)}}function fE(t,e,r){let{azimuth:i,altitude:n}=CV(t,e,r);return[Math.sin(i)*Math.cos(n),Math.cos(i)*Math.cos(n),-Math.sin(n)]}function Cue(t){return(typeof t=="number"?t:t.getTime())/vue-.5+xue}function Mue(t){return Cue(t)-bue}function Iue(t,e){let r=t;return Math.atan2(Math.sin(r)*Math.cos(uE)-Math.tan(e)*Math.sin(uE),Math.cos(r))}function Pue(t,e){let r=t;return Math.asin(Math.sin(e)*Math.cos(uE)+Math.cos(e)*Math.sin(uE)*Math.sin(r))}function Rue(t,e,r){let i=t,n=e,o=r;return Math.atan2(Math.sin(i),Math.cos(i)*Math.sin(n)-Math.tan(o)*Math.cos(n))}function Bue(t,e,r){let i=t,n=e,o=r;return Math.asin(Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos(i))}function Oue(t,e){return gm*(Eue+Sue*t)-e}function Due(t){return gm*(wue+Tue*t)}function Lue(t){let e=t,r=gm*(1.9148*Math.sin(e)+.02*Math.sin(2*e)+3e-4*Math.sin(3*e)),i=gm*102.9372;return e+r+i+Math.PI}function Fue(t){let e=Due(t),r=Lue(e);return{declination:Pue(r,0),rightAscension:Iue(r,0)}}var Xx=class extends vp{constructor(e){super(e),this.timestamp=e.timestamp}getProjectedLight({layer:e}){let{viewport:r}=e.context;if(r.resolution&&r.resolution>0){let[n,o,s]=fE(this.timestamp,0,0);this.direction=[n,-s,o]}else{let{latitude:n,longitude:o}=r;this.direction=fE(this.timestamp,n,o)}return this}};var Nue=1,kue=1,_m=class{time=0;channels=new Map;animations=new Map;playing=!1;lastEngineTime=-1;constructor(){}addChannel(e){let{delay:r=0,duration:i=Number.POSITIVE_INFINITY,rate:n=1,repeat:o=1}=e,s=Nue++,l={time:0,delay:r,duration:i,rate:n,repeat:o};return this._setChannelTime(l,this.time),this.channels.set(s,l),s}removeChannel(e){this.channels.delete(e);for(let[r,i]of this.animations)i.channel===e&&this.detachAnimation(r)}isFinished(e){let r=this.channels.get(e);return r===void 0?!1:this.time>=r.delay+r.duration*r.repeat}getTime(e){if(e===void 0)return this.time;let r=this.channels.get(e);return r===void 0?-1:r.time}setTime(e){this.time=Math.max(0,e);let r=this.channels.values();for(let n of r)this._setChannelTime(n,this.time);let i=this.animations.values();for(let n of i){let{animation:o,channel:s}=n;o.setTime(this.getTime(s))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,r){let i=kue++;return this.animations.set(i,{animation:e,channel:r}),e.setTime(this.getTime(r)),i}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,r){let i=r-e.delay,n=e.duration*e.repeat;i>=n?e.time=e.duration*e.rate:(e.time=Math.max(0,i)%e.duration,e.time*=e.rate)}};var Uue=0,zue={device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:t=>console.error(t),stats:wc.stats.get(`animation-loop-${Uue++}`),useDevicePixels:!0,autoResizeViewport:!1,autoResizeDrawingBuffer:!1},Yx=class{device=null;canvas=null;props;animationProps=null;timeline=null;stats;cpuTime;gpuTime;frameRate;display;needsRedraw="initialized";_initialized=!1;_running=!1;_animationFrameId=null;_nextFramePromise=null;_resolveNextFrame=null;_cpuStartTime=0;constructor(e){if(this.props={...zue,...e},e=this.props,!e.device)throw new Error("No device provided");let{useDevicePixels:r=!0}=this.props;this.stats=e.stats||new Dl({id:"animation-loop-stats"}),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this.setProps({autoResizeViewport:e.autoResizeViewport,autoResizeDrawingBuffer:e.autoResizeDrawingBuffer,useDevicePixels:r}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){this.stop(),this._setDisplay(null)}delete(){this.destroy()}setNeedsRedraw(e){return this.needsRedraw=this.needsRedraw||e,this}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),"autoResizeDrawingBuffer"in e&&(this.props.autoResizeDrawingBuffer=e.autoResizeDrawingBuffer||!1),"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1),this}async start(){if(this._running)return this;this._running=!0;try{let e;return this._initialized||(this._initialized=!0,await this._initDevice(),this._initialize(),await this.props.onInitialize(this._getAnimationProps())),this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){let r=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(r),r}}stop(){return this._running&&(this.animationProps&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1),this}redraw(){return this.device?.isLost?this:(this._beginFrameTimers(),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=S3(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(C3(this._animationFrameId),this._animationFrameId=null)}_animationFrame(){this._running&&(this.redraw(),this._requestAnimationFrame())}_renderFrame(e){if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),this.device.submit()}_clearNeedsRedraw(){this.needsRedraw=!1}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport()}_initializeAnimationProps(){if(!this.device)throw new Error("loop");this.animationProps={animationLoop:this,device:this.device,canvas:this.device?.canvasContext?.canvas,timeline:this.timeline,useDevicePixels:this.props.useDevicePixels,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;let{width:e,height:r,aspect:i}=this._getSizeAndAspect();(e!==this.animationProps.width||r!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=r,this.animationProps.aspect=i,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.canvasContext?.canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){let e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";let r=document.createElement("div");r.style.position="absolute",r.style.left="10px",r.style.bottom="10px",r.style.width="300px",r.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(r);let i=this.props.onAddHTML(r);i&&(r.innerHTML=i)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};let[e,r]=this.device?.canvasContext?.getPixelSize()||[1,1],i=1,n=this.device?.canvasContext?.canvas;return n&&n.clientHeight?i=n.clientWidth/n.clientHeight:e>0&&r>0&&(i=e/r),{width:e,height:r,aspect:i}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.props.autoResizeDrawingBuffer&&this.device?.canvasContext?.resize({useDevicePixels:this.props.useDevicePixels})}_beginFrameTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this.cpuTime.timeStart()}_endFrameTimers(){this.cpuTime.timeEnd()}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}};var hE=class{id;userData={};topology;bufferLayout=[];vertexCount;indices;attributes;constructor(e){this.id=e.id||oa("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&Yi(this.indices.usage===Xi.INDEX)}destroy(){this.indices?.destroy();for(let e of Object.values(this.attributes))e.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(e){return e.byteLength/12}};function MV(t,e){if(e instanceof hE)return e;let r=Vue(t,e),{attributes:i,bufferLayout:n}=jue(t,e);return new hE({topology:e.topology||"triangle-list",bufferLayout:n,vertexCount:e.vertexCount,indices:r,attributes:i})}function Vue(t,e){if(!e.indices)return;let r=e.indices.value;return t.createBuffer({usage:Xi.INDEX,data:r})}function jue(t,e){let r=[],i={};for(let[o,s]of Object.entries(e.attributes)){let l=o;switch(o){case"POSITION":l="positions";break;case"NORMAL":l="normals";break;case"TEXCOORD_0":l="texCoords";break;case"COLOR_0":l="colors";break}i[l]=t.createBuffer({data:s.value,id:`${o}-buffer`});let{value:u,size:h,normalized:v}=s;r.push({name:l,format:w3(u,h,v)})}let n=e._calculateVertexCount(e.attributes,e.indices);return{attributes:i,bufferLayout:r,vertexCount:n}}var pE=class{modules;moduleUniforms;moduleBindings;moduleUniformsChanged;constructor(e){let r=sm(Object.values(e));Kt.log(1,"Creating ShaderInputs with modules",r.map(i=>i.name))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(let[i,n]of Object.entries(e)){let o=i;this.moduleUniforms[o]=n.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(e){for(let r of Object.keys(e)){let i=r,n=e[i],o=this.modules[i];if(!o){Kt.warn(`Module ${r} not found`)();continue}let s=this.moduleUniforms[i],l=o.getUniforms?.(n,this.moduleUniforms[i])||n;this.moduleUniforms[i]={...s,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let e={};for(let r of Object.values(this.moduleBindings))Object.assign(e,r);return e}getDebugTable(){let e={};for(let[r,i]of Object.entries(this.moduleUniforms))for(let[n,o]of Object.entries(i))e[`${r}.${n}`]={type:this.modules[r].uniformTypes?.[n],value:String(o)};return e}};var JB=class{device;_hashCounter=0;_hashes={};_renderPipelineCache={};_computePipelineCache={};static getDefaultPipelineFactory(e){return e._lumaData.defaultPipelineFactory=e._lumaData.defaultPipelineFactory||new JB(e),e._lumaData.defaultPipelineFactory}constructor(e){this.device=e}createRenderPipeline(e){let r={...df.defaultProps,...e},i=this._hashRenderPipeline(r);if(!this._renderPipelineCache[i]){let n=this.device.createRenderPipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._renderPipelineCache[i]={pipeline:n,useCount:0}}return this._renderPipelineCache[i].useCount++,this._renderPipelineCache[i].pipeline}createComputePipeline(e){let r={...tm.defaultProps,...e},i=this._hashComputePipeline(r);if(!this._computePipelineCache[i]){let n=this.device.createComputePipeline({...r,id:r.id?`${r.id}-cached`:void 0});n.hash=i,this._computePipelineCache[i]={pipeline:n,useCount:0}}return this._computePipelineCache[i].useCount++,this._computePipelineCache[i].pipeline}release(e){let r=e.hash,i=e instanceof tm?this._computePipelineCache:this._renderPipelineCache;i[r].useCount--,i[r].useCount===0&&(i[r].pipeline.destroy(),delete i[r])}_hashComputePipeline(e){return`${this._getHash(e.shader.source)}`}_hashRenderPipeline(e){let r=this._getHash(e.vs.source),i=e.fs?this._getHash(e.fs.source):0,n="-",o=this._getHash(JSON.stringify(e.bufferLayout));switch(this.device.type){case"webgl":return`${r}/${i}V${n}BL${o}`;default:let s=this._getHash(JSON.stringify(e.parameters));return`${r}/${i}V${n}T${e.topology}P${s}BL${o}`}}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}},Kx=JB;Yr(Kx,"defaultProps",{...df.defaultProps});var QB=class{device;_cache={};static getDefaultShaderFactory(e){return e._lumaData.defaultShaderFactory||=new QB(e),e._lumaData.defaultShaderFactory}constructor(e){this.device=e}createShader(e){let r=this._hashShader(e),i=this._cache[r];if(!i){let n=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[r]=i={shader:n,useCount:0}}return i.useCount++,i.shader}release(e){let r=this._hashShader(e),i=this._cache[r];i&&(i.useCount--,i.useCount===0&&(delete this._cache[r],i.shader.destroy()))}_hashShader(e){return`${e.stage}:${e.source}`}},Zx=QB;Yr(Zx,"defaultProps",{...Sd.defaultProps});function IV(t,e){let r={},i="Values";if(t.attributes.length===0&&!t.varyings?.length)return{"No attributes or varyings":{[i]:"N/A"}};for(let n of t.attributes)if(n){let o=`${n.location} ${n.name}: ${n.type}`;r[`in ${o}`]={[i]:n.stepMode||"vertex"}}for(let n of t.varyings||[]){let o=`${n.location} ${n.name}`;r[`out ${o}`]={[i]:JSON.stringify(n.accessor)}}return r}var Qa=null,$B=null;function PV(t,{id:e,minimap:r,opaque:i,top:n="0",left:o="0",rgbaScale:s=1}){Qa||(Qa=document.createElement("canvas"),Qa.id=e,Qa.title=e,Qa.style.zIndex="100",Qa.style.position="absolute",Qa.style.top=n,Qa.style.left=o,Qa.style.border="blue 1px solid",Qa.style.transform="scaleY(-1)",document.body.appendChild(Qa),$B=Qa.getContext("2d")),(Qa.width!==t.width||Qa.height!==t.height)&&(Qa.width=t.width/2,Qa.height=t.height/2,Qa.style.width="400px",Qa.style.height="400px");let l=t.device.readPixelsToArrayWebGL(t),u=$B.createImageData(t.width,t.height),h=0;for(let v=0;v<l.length;v+=4)u.data[h+v+0]=l[v+0]*s,u.data[h+v+1]=l[v+1]*s,u.data[h+v+2]=l[v+2]*s,u.data[h+v+3]=i?255:l[v+3]*s;$B.putImageData(u,0,0)}var u_=2,Hue=1e4,eO=class{device;id;source;vs;fs;pipelineFactory;shaderFactory;userData={};parameters;topology;bufferLayout;isInstanced=void 0;instanceCount=0;vertexCount;indexBuffer=null;bufferAttributes={};constantAttributes={};bindings={};uniforms={};vertexArray;transformFeedback=null;pipeline;shaderInputs;_uniformStore;_attributeInfos={};_gpuGeometry=null;_getModuleUniforms;props;_pipelineNeedsUpdate="newly created";_needsRedraw="initializing";_destroyed=!1;_lastDrawTimestamp=-1;constructor(e,r){this.props={...eO.defaultProps,...r},r=this.props,this.id=r.id||oa("model"),this.device=e,Object.assign(this.userData,r.userData);let i=Object.fromEntries(this.props.modules?.map(l=>[l.name,l])||[]);this.setShaderInputs(r.shaderInputs||new pE(i));let n=Gue(e),o=(this.props.modules?.length>0?this.props.modules:this.shaderInputs?.getModules())||[];if(this.device.type==="webgpu"&&this.props.source){this.props.shaderLayout||=qR(this.props.source);let{source:l,getUniforms:u}=this.props.shaderAssembler.assembleShader({platformInfo:n,...this.props,modules:o});this.source=l,this._getModuleUniforms=u}else{let{vs:l,fs:u,getUniforms:h}=this.props.shaderAssembler.assembleShaderPair({platformInfo:n,...this.props,modules:o});this.vs=l,this.fs=u,this._getModuleUniforms=h}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&this.setGeometry(r.geometry),this.pipelineFactory=r.pipelineFactory||Kx.getDefaultPipelineFactory(this.device),this.shaderFactory=r.shaderFactory||Zx.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in r&&(this.isInstanced=r.isInstanced),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.vertexCount&&this.setVertexCount(r.vertexCount),r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&this.updateModuleSettings(r.moduleSettings),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),this._gpuGeometry?.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");let e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||=e}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){this.predraw();let r;try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings,{disableWarnings:this.props.disableWarnings}),wd(this.uniforms)||this.pipeline.setUniformsWebGL(this.uniforms);let{indexBuffer:i}=this.vertexArray,n=i?i.byteLength/(i.indexType==="uint32"?4:2):void 0;r=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:n,transformFeedback:this.transformFeedback||void 0,parameters:this.parameters,topology:this.topology})}finally{this._logDrawCallEnd()}return this._logFramebuffer(e),r?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):this._needsRedraw="waiting for resource initialization",r}setGeometry(e){this._gpuGeometry?.destroy();let r=e&&MV(this.device,e);r&&(this.setTopology(r.topology||"triangle-list"),this.bufferLayout=RV(r.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r)),this._gpuGeometry=r}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){this.bufferLayout=this._gpuGeometry?RV(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){fx(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,this.isInstanced===void 0&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){this.shaderInputs=e,this._uniformStore=new ax(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let i=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=i}this.setNeedsRedraw("shaderInputs")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,r){e.indices&&Kt.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,n]of Object.entries(e)){let o=this.bufferLayout.find(u=>BV(u).includes(i));if(!o){Kt.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let s=BV(o),l=!1;for(let u of s){let h=this._attributeInfos[u];h&&(this.vertexArray.setBuffer(h.location,n),l=!0)}!l&&!(r?.disableWarnings??this.props.disableWarnings)&&Kt.warn(`Model(${this.id}): Ignoring buffer "${n.id}" for unknown attribute "${i}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,r){for(let[i,n]of Object.entries(e)){let o=this._attributeInfos[i];o?this.vertexArray.setConstantWebGL(o.location,n):(r?.disableWarnings??this.props.disableWarnings)||Kt.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${i}"`)()}this.setNeedsRedraw("constants")}setUniforms(e){wd(e)||(this.pipeline.setUniformsWebGL(e),Object.assign(this.uniforms,e)),this.setNeedsRedraw("uniforms")}updateModuleSettings(e){let{bindings:r,uniforms:i}=cx(this._getModuleUniforms(e));Object.assign(this.bindings,r),Object.assign(this.uniforms,i),this.setNeedsRedraw("moduleSettings")}_getBindingsUpdateTimestamp(){let e=0;for(let r of Object.values(this.bindings))r instanceof Ed?e=Math.max(e,r.texture.updateTimestamp):r instanceof Xi||r instanceof bo?e=Math.max(e,r.updateTimestamp):r instanceof Cd||(e=Math.max(e,r.buffer.updateTimestamp));return e}_setGeometryAttributes(e){let r={...e.attributes};for(let[i]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(n=>n.name===i)&&i!=="positions"&&delete r[i];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(r,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||=e,this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,r=null;this.pipeline&&(Kt.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,r=this.pipeline.fs),this._pipelineNeedsUpdate=!1;let i=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debug:this.props.debugShaders}),n=null;this.source?n=i:this.fs&&(n=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debug:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:i,fs:n}),this._attributeInfos=W2(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),r&&this.shaderFactory.release(r)}return this.pipeline}_lastLogTime=0;_logOpen=!1;_logDrawCallStart(){let e=Kt.level>3?0:Hue;Kt.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,Kt.group(u_,`>>> DRAWING MODEL ${this.id}`,{collapsed:Kt.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let e=IV(this.pipeline.shaderLayout,this.id);Kt.table(u_,e)();let r=this.shaderInputs.getDebugTable();for(let[n,o]of Object.entries(this.uniforms))r[n]={value:o};Kt.table(u_,r)();let i=this._getAttributeDebugTable();Kt.table(u_,this._attributeInfos)(),Kt.table(u_,i)(),Kt.groupEnd(u_)(),this._logOpen=!1}}_drawCount=0;_logFramebuffer(e){let r=Kt.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let i=e.props.framebuffer;i&&PV(i,{id:i.id,minimap:!0})}_getAttributeDebugTable(){let e={};for(let[r,i]of Object.entries(this._attributeInfos))e[i.location]={name:r,type:i.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[i.location],i.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,i=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);e.indices={name:"indices",type:r.indexType,values:i.toString()}}return e}_getBufferOrConstantValues(e,r){let i=lx(r);return(e instanceof Xi?new i(e.debugData):e).toString()}},Ni=eO;Yr(Ni,"defaultProps",{...df.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:Pd.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});function RV(t,e){let r=[...t];for(let i of e){let n=r.findIndex(o=>o.name===i.name);n<0?r.push(i):r[n]=i}return r}function Gue(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}function BV(t){return t.attributes?t.attributes?.map(e=>e.attribute):[t.name]}var wf=class{device;model;transformFeedback;static isSupported(e){return e?.info?.type==="webgl"}constructor(e,r=Ni.defaultProps){Yi(wf.isSupported(e),"BufferTransform not yet implemented on WebGPU"),this.device=e,this.model=new Ni(this.device,{id:r.id||"buffer-transform-model",fs:r.fs||Ex(),topology:r.topology||"point-list",...r}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:r.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){let r=this.device.beginRenderPass(e);this.model.draw(r),r.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){let r=this.getBuffer(e);if(r instanceof Xi)return r.readAsync();let{buffer:i,byteOffset:n=0,byteLength:o=i.byteLength}=r;return i.readAsync(n,o)}};var Wue="transform_output",Mh=class{device;model;sampler;currentIndex=0;samplerTextureMap=null;bindings=[];resources={};constructor(e,r){this.device=e,this.sampler=e.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Ni(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Ex({input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Wue}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(e){let{framebuffer:r}=this.bindings[this.currentIndex],i=this.device.beginRenderPass({framebuffer:r,...e});this.model.draw(i),i.end()}update(...e){console.warn("TextureTransform#update() not implemented")}getData({packed:e=!1}={}){throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:e}=this.bindings[this.currentIndex];return e}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(e){this._updateBindings(e)}_updateBindings(e){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],e)}_updateBinding(e,{sourceBuffers:r,sourceTextures:i,targetTexture:n}){if(e||(e={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(e.sourceTextures,i),Object.assign(e.sourceBuffers,r),n){e.targetTexture=n;let{width:o,height:s}=n;e.framebuffer&&e.framebuffer.destroy(),e.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:o,height:s,colorAttachments:[n]}),e.framebuffer.resize({width:o,height:s})}return e}_setSourceTextureParameters(){let e=this.currentIndex,{sourceTextures:r}=this.bindings[e];for(let i in r)r[i].sampler=this.sampler}};var Mn=class{id;topology;vertexCount;indices;attributes;userData={};constructor(e){let{attributes:r={},indices:i=null,vertexCount:n=null}=e;this.id=e.id||oa("geometry"),this.topology=e.topology,i&&(this.indices=ArrayBuffer.isView(i)?{value:i,size:1}:i),this.attributes={};for(let[o,s]of Object.entries(r)){let l=ArrayBuffer.isView(s)?{value:s}:s;Yi(ArrayBuffer.isView(l.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!l.size&&(l.size=3),o==="indices"?(Yi(!this.indices),this.indices=l):this.attributes[o]=l}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=n||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,r){return this}_calculateVertexCount(e,r){if(r)return r.value.length;let i=1/0;for(let n of Object.values(e)){let{value:o,size:s,constant:l}=n;!l&&o&&s>=1&&(i=Math.min(i,o.length/s))}return Yi(Number.isFinite(i)),i}};var que=`#version 300 es
1688
1688
  in vec2 aClipSpacePosition;
1689
1689
  in vec2 aTexCoord;
1690
1690
  in vec2 aCoordinate;
@@ -1768,7 +1768,7 @@ void main(void) {
1768
1768
  discard;
1769
1769
  }
1770
1770
  fragColor = vec4(1.0);
1771
- }`;function ehe(t,e){let r=TE(e.size),i=EE(e.size);return new wf(t,{vs:Qfe,fs:$fe,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function the(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function rhe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var ihe={interpolation:y1,spring:v1},x1=class{constructor(e,{id:r,timeline:i}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in e){let o=e[n],s=o.getTransitionSetting(r);s&&this._updateAttribute(n,o,s)}for(let n in this.transitions){let o=e[n];(!o||!o.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(e[r]=i.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,i){let n=this.transitions[e],o=!n||n.type!==i.type;if(o){n&&this._removeTransition(e);let s=ihe[i.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(ur.error(`unsupported transition type '${i.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}};var v9="attributeManager.invalidate",nhe="attributeManager.updateStart",ohe="attributeManager.updateEnd",she="attribute.updateStart",ahe="attribute.allocate",lhe="attribute.updateEnd",Mf=class{constructor(e,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=Nu(TV),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new x1(e,{id:`${r}-transitions`,timeline:n}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{instanced:1})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let i=this._invalidateTrigger(e,r);Ks(v9,this,e,i)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Ks(v9,this,"all")}update({data:e,numInstances:r,startIndices:i=null,transitions:n,props:o={},buffers:s={},context:l={}}){let u=!1;Ks(nhe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let v=this.attributes[h],T=v.settings.accessor;v.startIndices=i,v.numInstances=r,o[h]&&ur.removed(`props.${h}`,`data.attributes.${h}`)(),v.setExternalBuffer(s[h])||v.setBinaryValue(typeof T=="string"?s[T]:void 0,e.startIndices)||typeof T=="string"&&!s[T]&&v.setConstantValue(o[T])||v.needsUpdate()&&(u=!0,this._updateAttribute({attribute:v,numInstances:r,data:e,props:o,context:l})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}u&&Ks(ohe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(i=>this.attributes[i]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let o in r){let s=r[o];s.needsRedraw(e)&&!i.hasAttribute(o)&&(n[o]=s)}return n}getBufferLayouts(e,r={}){e||(e=this.getAttributes());let i=[];for(let n in e)r[n]||i.push(e[n].getBufferLayout());return i}_add(e,r={}){for(let i in e){let n=e[i];this.attributes[i]=this._createAttribute(i,n,r)}this._mapUpdateTriggersToAttributes()}_createAttribute(e,r,i){let n={...r,id:e,size:r.isIndexed&&1||r.size||1,divisor:i.instanced?1:r.divisor||0};return new Pp(this.device,n)}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(n=>{e[n]||(e[n]=[]),e[n].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:i,updateTriggers:n}=this,o=n[e];return o&&o.forEach(s=>{let l=i[s];l&&l.setNeedsUpdate(l.id,r)}),o}_updateAttribute(e){let{attribute:r,numInstances:i}=e;if(Ks(she,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ks(ahe,r,i),r.updateBuffer(e)&&(this.needsRedraw=!0,Ks(lhe,r,i))}};var b1=class extends Ef{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:i,duration:n,easing:o}}=this,s=o(e/n);this._value=Oa(r,i,s)}};var x9=1e-5;function b9(t,e,r,i,n){let o=e-t,l=(r-e)*n,u=-o*i;return l+u+o+e}function che(t,e,r,i,n){if(Array.isArray(r)){let o=[];for(let s=0;s<r.length;s++)o[s]=b9(t[s],e[s],r[s],i,n);return o}return b9(t,e,r,i,n)}function w9(t,e){if(Array.isArray(t)){let r=0;for(let i=0;i<t.length;i++){let n=t[i]-e[i];r+=n*n}return Math.sqrt(r)}return Math.abs(t-e)}var w1=class extends Ef{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:r,damping:i,stiffness:n}=this.settings,{_prevValue:o=e,_currValue:s=e}=this,l=che(o,s,r,i,n),u=w9(l,r),h=w9(l,s);u<x9&&h<x9&&(l=r,this.end()),this._prevValue=s,this._currValue=l}};var uhe={interpolation:b1,spring:w1},T1=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,r,i,n){let{transitions:o}=this;if(o.has(e)){let u=o.get(e),{value:h=u.settings.fromValue}=u;r=h,this.remove(e)}if(n=wE(n),!n)return;let s=uhe[n.type];if(!s){ur.error(`unsupported transition type '${n.type}'`)();return}let l=new s(this.timeline);l.start({...n,fromValue:r,toValue:i}),o.set(e,l)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,i]of this.transitions)i.update(),e[r]=i.value,i.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function E9(t){let e=t[Vu];for(let r in e){let i=e[r],{validate:n}=i;if(n&&!n(t[r],i))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function S9(t,e){let r=m_({newProps:t,oldProps:e,propTypes:t[Vu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=hhe(t,e),n=!1;return i||(n=phe(t,e)),{dataChanged:i,propsChanged:r,updateTriggersChanged:n,extensionsChanged:dhe(t,e),transitionsChanged:fhe(t,e)}}function fhe(t,e){if(!t.transitions)return!1;let r={},i=t[Vu],n=!1;for(let o in t.transitions){let s=i[o],l=s&&s.type;(l==="number"||l==="color"||l==="array")&&cO(t[o],e[o],s)&&(r[o]=!0,n=!0)}return n?r:!1}function m_({newProps:t,oldProps:e,ignoreProps:r={},propTypes:i={},triggerName:n="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${n} changed shallowly`;if(typeof e!="object"||e===null)return`${n} changed shallowly`;for(let o of Object.keys(t))if(!(o in r)){if(!(o in e))return`${n}.${o} added`;let s=cO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}for(let o of Object.keys(e))if(!(o in r)){if(!(o in t))return`${n}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let s=cO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}}return!1}function cO(t,e,r){let i=r&&r.equal;return i&&!i(t,e,r)||!i&&(i=t&&e&&t.equals,i&&!i.call(t,e))?"changed deeply":!i&&e!==t?"changed shallowly":null}function hhe(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:i,_dataDiff:n}=t;return i?i(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&n&&(r=n(t.data,e.data)||r),r}function phe(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&T9(t,e,"all"))return{all:!0};let r={},i=!1;for(let n in t.updateTriggers)n!=="all"&&T9(t,e,n)&&(r[n]=!0,i=!0);return i?r:!1}function dhe(t,e){if(e===null)return!0;let r=e.extensions,{extensions:i}=t;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let n=0;n<i.length;n++)if(!i[n].equals(r[n]))return!0;return!1}function T9(t,e,r){let i=t.updateTriggers[r];i=i??{};let n=e.updateTriggers[r];return n=n??{},m_({oldProps:n,newProps:i,triggerName:r})}var Ahe="count(): argument not an object",mhe="count(): argument not a container";function IE(t){if(!_he(t))throw new Error(Ahe);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(ghe(t))return Object.keys(t).length;throw new Error(mhe)}function ghe(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function _he(t){return t!==null&&typeof t=="object"}function Em(t,e){if(!e)return t;let r={...t,...e};if("defines"in e&&(r.defines={...t.defines,...e.defines}),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some(i=>i.name==="project64"))){let i=r.modules.findIndex(n=>n.name==="project32");i>=0&&r.modules.splice(i,1)}if("inject"in e)if(!t.inject)r.inject=e.inject;else{let i={...t.inject};for(let n in e.inject)i[n]=(i[n]||"")+e.inject[n];r.inject=i}return r}var yhe={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},uO={};function C9(t,e,r,i){if(r instanceof bo)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let n=null;r.compressed&&(n={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let o=e.createTexture({...r,sampler:{...yhe,...n,...i}});return uO[o.id]=t,o}function M9(t,e){!e||!(e instanceof bo)||uO[e.id]===t&&(e.delete(),delete uO[e.id])}var vhe={boolean:{validate(t,e){return!0},equal(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||fO(t)&&(t.length===3||t.length===4)},equal(t,e,r){return Ls(t,e,1)}},accessor:{validate(t,e){let r=PE(t);return r==="function"||r===PE(e.value)},equal(t,e,r){return typeof e=="function"?!0:Ls(t,e,1)}},array:{validate(t,e){return e.optional&&!t||fO(t)},equal(t,e,r){let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:i}=r.props;return i?i(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let i=r.context;return!i||!i.device?null:C9(r.id,i.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{M9(r.id,t)}}};function I9(t){let e={},r={},i={};for(let[n,o]of Object.entries(t)){let s=o?.deprecatedFor;if(s)i[n]=Array.isArray(s)?s:[s];else{let l=xhe(n,o);e[n]=l,r[n]=l.value}}return{propTypes:e,defaultProps:r,deprecatedProps:i}}function xhe(t,e){switch(PE(e)){case"object":return E1(t,e);case"array":return E1(t,{type:"array",value:e,compare:!1});case"boolean":return E1(t,{type:"boolean",value:e});case"number":return E1(t,{type:"number",value:e});case"function":return E1(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function E1(t,e){return"type"in e?{name:t,...vhe[e.type],...e}:"value"in e?{name:t,type:PE(e.value),...e}:{name:t,type:"object",value:e}}function fO(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function PE(t){return fO(t)?"array":t===null?"null":typeof t}function P9(t,e){let r;for(let o=e.length-1;o>=0;o--){let s=e[o];"extensions"in s&&(r=s.extensions)}let i=hO(t.constructor,r),n=Object.create(i);n[f_]=t,n[Ph]={},n[Tf]={};for(let o=0;o<e.length;++o){let s=e[o];for(let l in s)n[l]=s[l]}return Object.freeze(n),n}var bhe="_mergedDefaultProps";function hO(t,e){let r=bhe;if(e)for(let n of e){let o=n.constructor;o&&(r+=`:${o.extensionName||o.name}`)}let i=R9(t,r);return i||(t[r]=whe(t,e||[]))}function whe(t,e){if(!t.prototype)return null;let i=Object.getPrototypeOf(t),n=hO(i),o=R9(t,"defaultProps")||{},s=I9(o),l=Object.assign(Object.create(null),n,s.defaultProps),u=Object.assign(Object.create(null),n?.[Vu],s.propTypes),h=Object.assign(Object.create(null),n?.[dE],s.deprecatedProps);for(let v of e){let T=hO(v.constructor);T&&(Object.assign(l,T),Object.assign(u,T[Vu]),Object.assign(h,T[dE]))}return The(l,t),She(l,u),Ehe(l,h),l[Vu]=u,l[dE]=h,e.length===0&&!pO(t,"_propTypes")&&(t._propTypes=u),l}function The(t,e){let r=Mhe(e);Object.defineProperties(t,{id:{writable:!0,value:r}})}function Ehe(t,e){for(let r in e)Object.defineProperty(t,r,{enumerable:!1,set(i){let n=`${this.id}: ${r}`;for(let o of e[r])pO(this,o)||(this[o]=i);ur.deprecated(n,e[r].join("/"))()}})}function She(t,e){let r={},i={};for(let n in e){let o=e[n],{name:s,value:l}=o;o.async&&(r[s]=l,i[s]=Che(s))}t[wp]=r,t[Ph]={},Object.defineProperties(t,i)}function Che(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||xE(e)?this[Ph][t]=e:this[Tf][t]=e},get(){if(this[Tf]){if(t in this[Tf])return this[Tf][t]||this[wp][t];if(t in this[Ph]){let e=this[f_]&&this[f_].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[wp][t]}}return this[wp][t]}}}function pO(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function R9(t,e){return pO(t,e)&&t[e]}function Mhe(t){let e=t.componentName;return e||ur.warn(`${t.name}.componentName not specified`)(),e||t.name}var Ihe=0,RE=class{constructor(...e){this.props=P9(this,e),this.id=this.props.id,this.count=Ihe++}clone(e){let{props:r}=this,i={};for(let n in r[wp])n in r[Tf]?i[n]=r[Tf][n]:n in r[Ph]&&(i[n]=r[Ph][n]);return new this.constructor({...r,...i,...e})}},Sm=RE;(()=>{RE.componentName="Component"})(),(()=>{RE.defaultProps={}})();var Phe=Object.freeze({}),Cm=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||Phe}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return Boolean(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[f_]||this.component;let r=e[Tf]||{},i=e[Ph]||e,n=e[wp]||{};for(let o in r){let s=r[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s),r[o]=this.getAsyncProp(o)}for(let o in i){let s=i[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s)}}_fetch(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(xE(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let i=this.asyncProps[e];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let i=this.asyncProps[e];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(e,r,i){let n=this.asyncProps[e];n&&i>=n.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let i=this.asyncProps[e];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(o=>{this.component&&(o=this._postProcessValue(i,o),this._setAsyncPropValue(e,o,n),this._onResolve(e,o))}).catch(o=>{this._onError(e,o)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let i=this.asyncProps[e];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,o=[],s=0;for await(let l of r){if(!this.component)return;let{dataTransform:u}=this.component.props;u?o=u(l,o):o=o.concat(l),Object.defineProperty(o,"__diff",{enumerable:!1,value:[{startRow:s,endRow:o.length}]}),s=o.length,this._setAsyncPropValue(e,o,n)}this._onResolve(e,o)}_postProcessValue(e,r){let i=e.type;return i&&this.component&&(i.release&&i.release(e.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let n=this.component&&this.component.props[Vu];this.asyncProps[e]={type:n&&n[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var S1=class extends Cm{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:e,layer:i}):super._fetch(e,r)}_onResolve(e,r){let i=this.layer;if(i){let n=i.props.onDataLoad;e==="data"&&n&&n(r,{propName:e,layer:i})}}_onError(e,r){let i=this.layer;i&&i.raiseError(r,`loading ${e} of ${this.layer}`)}};var Rhe="layer.changeFlag",Bhe="layer.initialize",Ohe="layer.update",Dhe="layer.finalize",Lhe="layer.matched",B9=2**24-1,Fhe=Object.freeze([]),Nhe=Nu(({oldViewport:t,viewport:e})=>t.equals(e)),Bh=new Uint8ClampedArray(0),khe={data:{type:"data",value:Fhe,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:r,loaders:i,loadOptions:n,signal:o})=>{let{resourceManager:s}=r.context;n=n||r.getLoadOptions(),i=i||r.props.loaders,o&&(n={...n,fetch:{...n?.fetch,signal:o}});let l=s.contains(t);return!l&&!n&&(s.add({resourceId:t,data:_a(t,i),persistent:!1}),l=!0),l?s.subscribe({resourceId:t,onChange:u=>r.internalState?.reloadAsyncProp(e,u),consumerId:r.id,requestId:e}):_a(t,i,n)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Zr.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},BE=class extends Sm{constructor(){super(...arguments),this.internalState=null,this.lifecycle=jd.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){os(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=ZB(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[n,o,s]=i_(i,r.pixelProjectionMatrix);return e.length===2?[n,o]:[n,o,s]}unproject(e){return os(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){os(this.internalState);let i=this.internalState.viewport||this.context.viewport;return cE(e,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setModuleParameters(e){for(let r of this.getModels())r.updateModuleSettings(e)}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Zr.DEFAULT||e===Zr.LNGLAT||e===Zr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){os(e instanceof Uint8Array);let[r,i,n]=e;return r+i*256+n*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:IE(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=Em(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=Em(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:i}=e.changeFlags;if(i&&r)if(Array.isArray(i))for(let n of i)r.invalidateAll(n);else r.invalidateAll();if(r){let{props:n}=e,o=this.internalState.hasPickingBuffer,s=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some(l=>l.getNeedsPickingBuffer.call(this,l));if(o!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:l,instancePickingColors:u}=r.attributes,h=l||u;h&&(s&&h.constant&&(h.constant=!1,r.invalidate(h.id)),!h.value&&!s&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(let i of this.getModels())i.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let r of this.getModels())r.draw(e)}getPickingInfo({info:e,mode:r,sourceLayer:i}){let{index:n}=e;return n>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[n]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!Nhe({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let i in e)e[i].layoutChanged()&&(r=!0);for(let i of this.getModels())this._setModelAttributes(i,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();e.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let o=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(o)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),i=Object.create(this.props);for(let n in r)Object.defineProperty(i,n,{value:r[n]});return i}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let i=Math.floor(Bh.length/4);if(this.internalState.usesPickingColorCache=!0,i<r){r>B9&&ur.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Bh=bf.allocate(Bh,r,{size:4,copy:!0,maxCount:Math.max(r,B9)});let n=Math.floor(Bh.length/4),o=[];for(let s=i;s<n;s++)this.encodePickingColor(s,o),Bh[s*4+0]=o[0],Bh[s*4+1]=o[1],Bh[s*4+2]=o[2]}e.value=Bh.subarray(0,r*4)}_setModelAttributes(e,r,i=!1){if(!Object.keys(r).length)return;if(i){let l=this.getAttributeManager();e.setBufferLayout(l.getBufferLayouts()),r=l.getAttributes()}let n=e.userData?.excludeAttributes||{},o={},s={};for(let l in r){if(n[l])continue;let u=r[l].getValue();for(let h in u){let v=u[h];v instanceof Xi?r[l].settings.isIndexed?e.setIndexBuffer(v):o[h]=v:v&&(s[h]=v)}}e.setAttributes(o),e.setConstantAttributes(s)}disablePickingIndex(e){let r=this.props.data;if(!("attributes"in r)){this._disablePickingIndex(e);return}let{pickingColors:i,instancePickingColors:n}=this.getAttributeManager().attributes,o=i||n,s=o&&r.attributes&&r.attributes[o.id];if(s&&s.value){let l=s.value,u=this.encodePickingColor(e);for(let h=0;h<r.length;h++){let v=o.getVertexOffset(h);l[v]===u[0]&&l[v+1]===u[1]&&l[v+2]===u[2]&&this._disablePickingIndex(h)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:r,instancePickingColors:i}=this.getAttributeManager().attributes,n=r||i;if(!n)return;let o=n.getVertexOffset(e),s=n.getVertexOffset(e+1);n.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let{pickingColors:e,instancePickingColors:r}=this.getAttributeManager().attributes,i=e||r;i&&(this.internalState.usesPickingColorCache&&i.value.buffer!==Bh.buffer&&(i.value=Bh.subarray(0,i.value.length)),i.updateSubBuffer({startOffset:0}))}_initialize(){os(!this.internalState),os(Number.isFinite(this.props.coordinateSystem)),Ks(Bhe,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new S1({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(ur.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new T1(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Ks(Lhe,this,this===e);let{state:r,internalState:i}=e;this!==e&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Ks(Ohe,this,e),!e)return;let r=this.props,i=this.context,n=this.internalState,o=i.viewport,s=this._updateUniformTransition();n.propsInTransition=s,i.viewport=n.viewport||o,this.props=s;try{let l=this._getUpdateParams(),u=this.getModels();if(i.device)this.updateState(l);else try{this.updateState(l)}catch{}for(let v of this.props.extensions)v.updateState.call(this,l,v);let h=this.getModels()[0]!==u[0];this._postUpdate(l,h)}finally{i.viewport=o,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){Ks(Dhe,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,moduleParameters:r=null,uniforms:i={},parameters:n={}}){this._updateAttributeTransition();let o=this.props,s=this.context;this.props=this.internalState.propsInTransition||o;let l=this.props.opacity;i.opacity=Math.pow(l,1/2.2);try{if(r){let{isActive:v,isAttribute:T}=r.picking;this.setModuleParameters(r),this.setShaderModuleProps({picking:{isActive:v,isAttribute:T}})}let{getPolygonOffset:u}=this.props,h=u&&u(i)||[0,0];s.device.setParametersWebGL({polygonOffset:h});for(let v of this.getModels())v.setParameters(n);s.device.withParametersWebGL(n,()=>{let v={renderPass:e,moduleParameters:r,uniforms:i,parameters:n,context:s};for(let T of this.props.extensions)T.draw.call(this,v,T);this.draw(v)})}finally{this.props=o}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let n in e)if(e[n]){let o=!1;switch(n){case"dataChanged":let s=e[n],l=r[n];s&&Array.isArray(l)&&(r.dataChanged=Array.isArray(s)?l.concat(s):s,o=!0);default:r[n]||(r[n]=e[n],o=!0)}o&&Ks(Rhe,this,n,e)}let i=Boolean(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,r){let i=S9(e,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged)this.internalState.uniformTransitions.add(n,r[n],e[n],e.transitions?.[n]);return this.setChangeFlags(i)}validateProps(){E9(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:i}=this.props;e.picked&&typeof i=="function"&&(r.highlightColor=i(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new Mf(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:i,oldProps:n}=e;this.setNeedsRedraw(),this._updateAttributes(),this.state.model?.setInstanceCount(this.getNumInstances());let{autoHighlight:s,highlightedObjectIndex:l,highlightColor:u}=i;if(r||n.autoHighlight!==s||n.highlightedObjectIndex!==l||n.highlightColor!==u){let h={};s||(h.highlightedObjectColor=null),Array.isArray(u)&&(h.highlightColor=u),(r||l!==n.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(l)&&l>=0?this.encodePickingColor(l):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=i?i.getNeedsRedraw(e):!1;if(r=r||n,r)for(let o of this.props.extensions)o.onNeedsRedraw.call(this,o);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}},Dn=BE;(()=>{BE.defaultProps=khe})(),(()=>{BE.layerName="Layer"})();var Uhe="compositeLayer.renderLayers",dO=class extends Dn{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:i}=this.props;return i&&i[e]&&i[e].type||r}getSubLayerRow(e,r,i){return e.__source={parent:this,object:r,index:i},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,e(i.__source.object,r)):e(i,n)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W,_subLayerProps:J}=this.props,K={id:"",updateTriggers:{},opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W},ne=J&&e.id&&J[e.id],ge=ne&&ne.updateTriggers,H=e.id||"sublayer";if(ne){let me=this.props[Vu],fe=e.type?e.type._propTypes:{};for(let $ in ne){let Z=fe[$]||me[$];Z&&Z.type==="accessor"&&(ne[$]=this.getSubLayerAccessor(ne[$]))}}Object.assign(K,e,ne),K.id=`${this.props.id}-${H}`,K.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...ge};for(let me of F){let fe=me.getSubLayerProps.call(this,me);fe&&Object.assign(K,fe,{updateTriggers:Object.assign(K.updateTriggers,fe.updateTriggers)})}return K}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();if(n){let o=this.renderLayers();i=Rh(o,Boolean),this.internalState.subLayers=i}Ks(Uhe,this,n,i);for(let o of i)o.parent=this}},es=dO;(()=>{dO.layerName="CompositeLayer"})();var OE=Math.PI/180,O9=180/Math.PI,DE=6370972,g_=256;function zhe(){let t=g_/DE,e=Math.PI/180*g_;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var Rp=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,nearZMultiplier:o=.1,farZMultiplier:s=2,resolution:l=10}=e,{height:u,altitude:h=1.5}=e;u=u||1,h=Math.max(.75,h);let v=new Kr().lookAt({eye:[0,-h,0],up:[0,0,1]}),T=Math.pow(2,n);v.rotateX(r*OE),v.rotateZ(-i*OE),v.scale(T/u);let E=Math.atan(.5/h),M=g_*2*T/u;super({...e,height:u,viewMatrix:v,longitude:i,latitude:r,zoom:n,distanceScales:zhe(),fovyRadians:E*2,focalDistance:h,near:o,far:Math.min(2,1/M+1)*h*s}),this.latitude=r,this.longitude=i,this.resolution=l}get projectionMode(){return Fl.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,this.height/2],r),n=this.unproject([this.width/2,0],r),o=this.unproject([this.width,this.height/2],r),s=this.unproject([this.width/2,this.height],r);return o[0]<this.longitude&&(o[0]+=360),i[0]>this.longitude&&(i[0]-=360),[Math.min(i[0],o[0],n[0],s[0]),Math.min(i[1],o[1],n[1],s[1]),Math.max(i[0],o[0],n[0],s[0]),Math.max(i[1],o[1],n[1],s[1])]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,{pixelUnprojectionMatrix:u}=this,h;if(Number.isFinite(s))h=AO(u,[n,l,s,1]);else{let M=AO(u,[n,l,-1,1]),O=AO(u,[n,l,1,1]),F=((i||0)/DE+1)*g_,z=Da.sqrLen(Da.sub([],M,O)),W=Da.sqrLen(M),J=Da.sqrLen(O),ne=4*((4*W*J-(z-W-J)**2)/16)/z,ge=Math.sqrt(W-ne),H=Math.sqrt(Math.max(0,F*F-ne)),me=(ge-H)/Math.sqrt(z);h=Da.lerp([],M,O,me)}let[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i,n=0]=e,o=r*OE,s=i*OE,l=Math.cos(s),u=(n/DE+1)*g_;return[Math.sin(o)*l*u,-Math.cos(o)*l*u,Math.sin(s)*u]}unprojectPosition(e){let[r,i,n]=e,o=Da.len(e),s=Math.asin(n/o),u=Math.atan2(r,-i)*O9,h=s*O9,v=(o/g_-1)*DE;return[u,h,v]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let i=this.unproject(r);return{longitude:e[0]-i[0]+this.longitude,latitude:e[1]-i[1]+this.latitude}}};function AO(t,e){let r=ec.transformMat4([],e,t);return ec.scale(r,r,1/r[3]),r}var mO=Math.PI/180;function Vhe({height:t,focalDistance:e,orbitAxis:r,rotationX:i,rotationOrbit:n,zoom:o}){let s=r==="Z"?[0,0,1]:[0,1,0],l=r==="Z"?[0,-e,0]:[0,0,e],u=new Kr().lookAt({eye:l,up:s});u.rotateX(i*mO),r==="Z"?u.rotateZ(n*mO):u.rotateY(n*mO);let h=Math.pow(2,o)/t;return u.scale(h),u}var Mm=class extends bl{constructor(e){let{height:r,projectionMatrix:i,fovy:n=50,orbitAxis:o="Z",target:s=[0,0,0],rotationX:l=0,rotationOrbit:u=0,zoom:h=0}=e,v=i?i[5]/2:dm(n);super({...e,longitude:void 0,viewMatrix:Vhe({height:r||1,focalDistance:v,orbitAxis:o,rotationX:l,rotationOrbit:u,zoom:h}),fovy:n,focalDistance:v,position:s,zoom:h}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:r=!0}={}){let[i,n,o=this.projectedCenter[2]]=e,s=r?n:this.height-n,[l,u,h]=Uu([i,s,o],this.pixelUnprojectionMatrix);return[l,u,h]}panByPosition(e,r){let i=this.project(e),n=[this.width/2+i[0]-r[0],this.height/2+i[1]-r[1],this.projectedCenter[2]];return{target:this.unproject(n)}}};var jhe=new Kr().lookAt({eye:[0,0,1]});function Hhe({width:t,height:e,near:r,far:i,padding:n}){let o=-t/2,s=t/2,l=-e/2,u=e/2;if(n){let{left:h=0,right:v=0,top:T=0,bottom:E=0}=n,M=Zn((h+t-v)/2,0,t)-t/2,O=Zn((T+e-E)/2,0,e)-e/2;o-=M,s-=M,l+=O,u+=O}return new Kr().ortho({left:o,right:s,bottom:l,top:u,near:r,far:i})}var Im=class extends bl{constructor(e){let{width:r,height:i,near:n=.1,far:o=1e3,zoom:s=0,target:l=[0,0,0],padding:u=null,flipY:h=!0}=e,v=Array.isArray(s)?s[0]:s,T=Array.isArray(s)?s[1]:s,E=Math.min(v,T),M=Math.pow(2,E),O;if(v!==T){let F=Math.pow(2,v),z=Math.pow(2,T);O={unitsPerMeter:[F/M,z/M,1],metersPerUnit:[M/F,M/z,1]}}super({...e,longitude:void 0,position:l,viewMatrix:jhe.clone().scale([M,M*(h?-1:1),M]),projectionMatrix:Hhe({width:r||1,height:i||1,padding:u,near:n,far:o}),zoom:E,distanceScales:O})}projectFlat([e,r]){let{unitsPerMeter:i}=this.distanceScales;return[e*i[0],r*i[1]]}unprojectFlat([e,r]){let{metersPerUnit:i}=this.distanceScales;return[e*i[0],r*i[1]]}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o);return{target:this.unprojectFlat(s)}}};var Pm=class extends bl{constructor(e){let{longitude:r,latitude:i,modelMatrix:n,bearing:o=0,pitch:s=0,up:l=[0,0,1]}=e,h=new _f({bearing:o,pitch:s===-90?1e-4:90+s}).toVector3().normalize(),v=n?new Kr(n).transformAsVector(h):h,T=Number.isFinite(i)?zx({latitude:i}):0,E=Math.pow(2,T),M=new Kr().lookAt({eye:[0,0,0],center:v,up:l}).scale(E);super({...e,zoom:T,viewMatrix:M}),this.latitude=i,this.longitude=r}};var Rm=20,D9=500,C1=class extends Cp{constructor(e){let{width:r,height:i,position:n=[0,0,0],bearing:o=0,pitch:s=0,longitude:l=null,latitude:u=null,maxPitch:h=90,minPitch:v=-90,startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}=e;super({width:r,height:i,position:n,bearing:o,pitch:s,longitude:l,latitude:u,maxPitch:h,minPitch:v},{startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:r}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:r})}pan({pos:e}){if(!e)return this;let{startPanPos:r=[0,0],startPanPosition:i=[0,0]}=this.getState(),{width:n,height:o,bearing:s,pitch:l}=this.getViewportProps(),u=D9*(e[0]-r[0])/n,h=D9*(e[1]-r[1])/o,v=new _f({bearing:s,pitch:l}),T=new _f({bearing:s,pitch:-90}),E=v.toVector3().normalize(),M=T.toVector3().cross(E).normalize();return this._getUpdatedState({position:new ot(i).add(M.scale(u)).add(E.scale(h))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;h={bearing:o-v*180,pitch:s-T*90}}else h={bearing:o-r,pitch:s-i};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:r}){let i=this.getViewportProps(),n=this.getState().startZoomPosition||i.position,o=this.makeViewport(i),{projectionMatrix:s,width:l}=o,h=2*Math.atan(1/s[0])*(e[0]/l-.5),v=this.getDirection(!0);return this._move(v.rotateZ({radians:-h}),Math.log2(r)*Rm,n)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=Rm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:Math.PI/2}),e)}moveRight(e=Rm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=Rm){let r=this.getDirection(!0);return this._move(r,e)}moveDown(e=Rm){let r=this.getDirection(!0);return this._move(r.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=Rm){return this._move(new ot(0,0,1),e)}zoomOut(e=Rm){return this._move(new ot(0,0,-1),e)}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),o!==null&&r.longitude!==null&&Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}_move(e,r,i=this.getViewportProps().position){let n=e.scale(r);return this._getUpdatedState({position:new ot(i).add(n)})}getDirection(e=!1){return new _f({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new C1({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:r,maxPitch:i,minPitch:n,longitude:o,bearing:s}=e;return e.pitch=Zn(r,n,i),o!==null&&(o<-180||o>180)&&(e.longitude=mm(o+180,360)-180),(s<-180||s>180)&&(e.bearing=mm(s+180,360)-180),e}},Bm=class extends rc{constructor(){super(...arguments),this.ControllerState=C1,this.transition={transitionDuration:300,transitionInterpolator:new wl(["position","pitch","bearing"])}}};var gO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Pm}get ControllerType(){return Bm}},M1=gO;(()=>{gO.displayName="FirstPersonView"})();var I1=class extends Cp{constructor(e){let{width:r,height:i,rotationX:n=0,rotationOrbit:o=0,target:s=[0,0,0],zoom:l=0,minRotationX:u=-90,maxRotationX:h=90,minZoom:v=-1/0,maxZoom:T=1/0,startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}=e;super({width:r,height:i,rotationX:n,rotationOrbit:o,target:s,zoom:l,minRotationX:u,maxRotationX:h,minZoom:v,maxZoom:T},{startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:r}){let i=this.getState().startPanPosition||r;if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startRotationX:o,startRotationOrbit:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;(o<-90||o>90)&&(v*=-1),h={rotationX:o+T*180,rotationOrbit:s+v*180}}else h={rotationX:o+i,rotationOrbit:s+r};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{rotationOrbit:n}=i;return Math.abs(n-r.rotationOrbit)>180&&(i.rotationOrbit=n<0?n+360:n-360),i}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomPosition:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let s=this._calculateNewZoom({scale:i,startZoom:n}),l=this.makeViewport({...this.getViewportProps(),zoom:s});return this._getUpdatedState({zoom:s,...l.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=r+Math.log2(e);return Zn(o,n,i)}_panFromCenter(e){let{width:r,height:i,target:n}=this.getViewportProps();return this.pan({startPosition:n,pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n,maxRotationX:o,minRotationX:s,rotationOrbit:l}=e;return e.zoom=Array.isArray(n)?[Zn(n[0],i,r),Zn(n[1],i,r)]:Zn(n,i,r),e.rotationX=Zn(e.rotationX,s,o),(l<-180||l>180)&&(e.rotationOrbit=mm(l+180,360)-180),e}},Om=class extends rc{constructor(){super(...arguments),this.ControllerState=I1,this.transition={transitionDuration:300,transitionInterpolator:new wl({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var _O=class extends tc{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}get ViewportType(){return Mm}get ControllerType(){return Om}},P1=_O;(()=>{_O.displayName="OrbitView"})();var yO=class extends I1{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=Math.log2(e);if(Array.isArray(r)){let[s,l]=r;switch(this.zoomAxis){case"X":s=Zn(s+o,n,i);break;case"Y":l=Zn(l+o,n,i);break;default:let u=Math.min(s+o,l+o);u<n&&(o+=n-u),u=Math.max(s+o,l+o),u>i&&(o+=i-u),s+=o,l+=o}return[s,l]}return Zn(r+o,n,i)}},Dm=class extends rc{constructor(){super(...arguments),this.ControllerState=yO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var vO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Im}get ControllerType(){return Dm}},R1=vO;(()=>{vO.displayName="OrthographicView"})();var xO=class extends s1{applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=Zn(n,i,r);let{longitude:o,latitude:s}=e;return(o<-180||o>180)&&(e.longitude=mm(o+180,360)-180),e.latitude=Zn(s,-89,89),e}},Lm=class extends rc{constructor(){super(...arguments),this.ControllerState=xO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var bO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Rp}get ControllerType(){return Lm}},B1=bO;(()=>{bO.displayName="GlobeView"})();var LE=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&Ls(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.constructor,i={updateTriggers:{}};for(let n in r)if(n in this.props){let o=r[n],s=this.props[n];i[n]=s,o&&o.type==="accessor"&&(i.updateTriggers[n]=this.props.updateTriggers[n],typeof s=="function"&&(i[n]=this.getSubLayerAccessor(s)))}return i}initializeState(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}},Fm=LE;(()=>{LE.defaultProps={}})(),(()=>{LE.extensionName="LayerExtension"})();var wO={bearing:0,pitch:0,position:[0,0,0]},Ghe={speed:1.2,curve:1.414},O1=class extends Sp{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...Ghe,...e}}interpolateProps(e,r,i){let n=qB(e,r,i,this.opts);for(let o in wO)n[o]=Oa(e[o]||wO[o],r[o]||wO[o],i);return n}getDuration(e,r){let{transitionDuration:i}=r;return i==="auto"&&(i=XB(e,r,this.opts)),i}};var Bp=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=bf,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:o,positionFormat:s,dataChanged:l,normalize:u=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=o&&o.size||(s==="XY"?2:3),this.buffers=i,this.normalize=u,o&&(os(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(o),u||(i.vertexPositions=o)),this.geometryBuffer=i.vertexPositions,Array.isArray(l))for(let h of l)this._rebuildGeometry(h);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?bE(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,r){let{attributes:i,buffers:n,_attributeDefs:o,typedArrayManager:s}=this;for(let l in o)if(l in n)s.release(i[l]),i[l]=null;else{let u=o[l];u.copy=r,i[l]=s.allocate(i[l],e,u)}}_forEachGeometry(e,r,i){let{data:n,getGeometry:o}=this,{iterable:s,objectInfo:l}=Js(n,r,i);for(let u of s){l.index++;let h=o?o(u,l):null;e(h,l.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:o,geometryBuffer:s}=this,{startRow:l=0,endRow:u=1/0}=e||{},h={};if(e||(r=[0],i=[0]),this.normalize||!s)this._forEachGeometry((T,E)=>{let M=T&&this.normalizeGeometry(T);h[E]=M,i[E+1]=i[E]+(M?this.getGeometrySize(M):0)},l,u),n=i[i.length-1];else if(i=o.startIndices,n=i[o.length]||0,ArrayBuffer.isView(s))n=n||s.length/this.positionSize;else if(s instanceof Xi){let T=this.positionSize*4;n=n||s.byteLength/T}else if(s.buffer){let T=s.stride||this.positionSize*4;n=n||s.buffer.byteLength/T}else if(s.value){let T=s.value,E=s.stride/T.BYTES_PER_ELEMENT||this.positionSize;n=n||T.length/E}this._allocate(n,Boolean(e)),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let v={};this._forEachGeometry((T,E)=>{let M=h[E]||T;v.vertexStart=i[E],v.indexStart=r[E];let O=E<i.length-1?i[E+1]:n;v.geometrySize=O-i[E],v.geometryIndex=E,this.updateGeometryAttributes(M,v)},l,u),this.vertexCount=r[r.length-1]}};var TO=85.05113;function SO(t,e,r,i){if(r){if(r.userData._googleMap===t)return r;FE(r)}let n={click:null,rightclick:null,dblclick:null,mousemove:null,mouseout:null},o=new Ip({...i,useDevicePixels:i.interleaved?!0:i.useDevicePixels,style:i.interleaved?null:{pointerEvents:"none"},parent:Whe(e,i.style),views:new Mp({repeat:!0}),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1});for(let s in n)n[s]=t.addListener(s,l=>Xhe(o,s,l));return o.userData._googleMap=t,o.userData._eventListeners=n,o}function Whe(t,e){let r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),"getPanes"in t?t.getPanes()?.overlayLayer.appendChild(r):t.getMap()?.getDiv().appendChild(r),r}function FE(t){let{_eventListeners:e}=t.userData;for(let r in e)e[r]&&e[r].remove();t.finalize()}function L9(t,e){let{width:r,height:i}=F9(t),n=e.getProjection(),o=t.getBounds();if(!o)return{width:r,height:i,left:0,top:0};let s=o.getNorthEast(),l=o.getSouthWest(),u=n.fromLatLngToDivPixel(s),h=n.fromLatLngToDivPixel(l),v=EO(n,r/2,i/2),T=new google.maps.LatLng(0,v[0]),E=n.fromLatLngToContainerPixel(T),M=n.fromLatLngToDivPixel(T);if(!u||!h||!M||!E)return{width:r,height:i,left:0,top:0};let O=Math.round(M.x-E.x),F=M.y-E.y,z=EO(n,r/2,0),W=EO(n,r/2,i),J=v[1],K=v[0];if(Math.abs(J)>TO){J=J>0?TO:-TO;let $=new google.maps.LatLng(J,K),Z=n.fromLatLngToContainerPixel($);F+=Z.y-i/2}F=Math.round(F);let ge=180*new gf(z).sub(W).verticalAngle()/Math.PI;ge<0&&(ge+=360);let H=t.getHeading()||0,me=t.getZoom()-1,fe;if(ge===0)fe=i?(h.y-u.y)/i:1;else if(ge===H){let $=new gf([u.x,u.y]).sub([h.x,h.y]).len(),Z=new gf([r,-i]).len();fe=Z?$/Z:1}return me+=Math.log2(fe||1),{width:r,height:i,left:O,top:F,zoom:me,bearing:ge,pitch:t.getTilt(),latitude:J,longitude:K}}function CO(t,e){let{width:r,height:i}=F9(t),{center:n,heading:o,tilt:s,zoom:l}=e.getCameraParams(),u=25,h=i?r/i:1,v=.75,T=3e14,E=new Kr().perspective({fovy:u*Math.PI/180,aspect:h,near:v,far:T}),M=.5*E[5];return{width:r,height:i,viewState:{altitude:M,bearing:o,latitude:n.lat(),longitude:n.lng(),pitch:s,projectionMatrix:E,repeat:!0,zoom:l-1}}}function F9(t){let e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function EO(t,e,r){let i=new google.maps.Point(e,r),n=t.fromContainerPixelToLatLng(i);return[n.lng(),n.lat()]}function qhe(t,e){if(t.pixel)return t.pixel;let r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function Xhe(t,e,r){if(!t.isInitialized)return;let i={type:e,offsetCenter:qhe(r,t),srcEvent:r};switch(e){case"click":case"rightclick":i.type="click",i.tapCount=1,t._onPointerDown(i),t._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,t._onEvent(i);break;case"mousemove":i.type="pointermove",t._onPointerMove(i);break;case"mouseout":i.type="pointerleave",t._onPointerMove(i);break;default:return}}var Yhe=()=>!1,Khe={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774};function N9(){}var Zhe={interleaved:!0},Nm=class{constructor(e){this.props={},this._map=null,this._deck=null,this._overlay=null,this.setProps({...Zhe,...e})}setMap(e){if(e===this._map)return;let{VECTOR:r,UNINITIALIZED:i}=google.maps.RenderingType;this._map&&(!e&&this._map.getRenderingType()===r&&this.props.interleaved&&this._overlay.requestRedraw(),this._overlay?.setMap(null),this._map=null),e&&(this._map=e,e.getRenderingType()!==i?this._createOverlay(e):e.addListener("renderingtype_changed",()=>{this._createOverlay(e)}))}setProps(e){if(Object.assign(this.props,e),this._deck){let r=this._deck.getCanvas();if(e.style&&r?.parentElement){let i=r.parentElement.style;Object.assign(i,e.style),e.style=null}this._deck.setProps(e)}}pickObject(e){return this._deck&&this._deck.pickObject(e)}pickMultipleObjects(e){return this._deck&&this._deck.pickMultipleObjects(e)}pickObjects(e){return this._deck&&this._deck.pickObjects(e)}finalize(){this.setMap(null),this._deck&&(FE(this._deck),this._deck=null)}_createOverlay(e){let{interleaved:r}=this.props,{VECTOR:i,UNINITIALIZED:n}=google.maps.RenderingType,o=e.getRenderingType();if(o===n)return;let l=o===i&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView,u=new l;u instanceof google.maps.WebGLOverlayView?(r?(u.onAdd=N9,u.onContextRestored=this._onContextRestored.bind(this),u.onDraw=this._onDrawVectorInterleaved.bind(this)):(u.onAdd=this._onAdd.bind(this),u.onContextRestored=N9,u.onDraw=this._onDrawVectorOverlay.bind(this)),u.onContextLost=this._onContextLost.bind(this)):(u.onAdd=this._onAdd.bind(this),u.draw=this._onDrawRaster.bind(this)),u.onRemove=this._onRemove.bind(this),this._overlay=u,this._overlay.setMap(e)}_onAdd(){this._deck=SO(this._map,this._overlay,this._deck,this.props)}_onContextRestored({gl:e}){if(!this._map||!this._overlay)return;let r=()=>{this._overlay&&this._overlay.requestRedraw()},i=SO(this._map,this._overlay,this._deck,{gl:e,_customRender:r,...this.props});this._deck=i;let n=i.animationLoop;n._renderFrame=()=>{let o=e.getParameter(34964);i.device.withParametersWebGL({},()=>{n.props.onRender(n.animationProps)}),e.bindBuffer(34962,o)}}_onContextLost(){this._deck&&(FE(this._deck),this._deck=null)}_onRemove(){this._deck?.setProps({layerFilter:Yhe})}_onDrawRaster(){if(!this._deck||!this._map)return;let e=this._deck,{width:r,height:i,left:n,top:o,...s}=L9(this._map,this._overlay),l=e.getCanvas();if(l?.parentElement){let h=l.parentElement.style;h.left=`${n}px`,h.top=`${o}px`}let u=1e4;e.setProps({width:r,height:i,viewState:{altitude:u,...s}}),e.redraw()}_onDrawVectorInterleaved({gl:e,transformer:r}){if(!this._deck||!this._map)return;let i=this._deck;if(i.setProps({...CO(this._map,r),width:null,height:null}),i.isInitialized){let n=i.device,o=n.getParametersWebGL(36006);i.setProps({_framebuffer:o}),n.getCanvasContext().resize(),i.needsRedraw({clearRedrawFlags:!0}),n.setParametersWebGL({viewport:[0,0,e.canvas.width,e.canvas.height],scissor:[0,0,e.canvas.width,e.canvas.height],stencilFunc:[519,0,255,519,0,255]}),n.withParametersWebGL(Khe,()=>{i._drawLayers("google-vector",{clearCanvas:!1})})}}_onDrawVectorOverlay({transformer:e}){if(!this._deck||!this._map)return;let r=this._deck;r.setProps({...CO(this._map,e)}),r.redraw()}};function k9({container:t,onClick:e,onComplete:r,getTooltip:i,googleMapsKey:n,layers:o,mapStyle:s="satellite",initialViewState:l={latitude:0,longitude:0,zoom:1}}){if(!n)return ur.warn("No Google Maps API key set")(),null;let u=new Nm({layers:o}),h={center:{lat:l.latitude,lng:l.longitude},mapTypeId:s,zoom:l.zoom},v=new window.google.maps.Map(t,h);return u.setMap(v),u}var U9={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1};var MO=class{constructor({container:e,props:r}){let{description:i}=r,n=document.createElement("div");n.className="deck-json-description-box",Object.assign(n.style,U9),this.el=n;let o=document.createElement("div");o.innerHTML=i,n.appendChild(o),e.append(n)}remove(){this.el.remove(),this.description=null}static get stringName(){return"description"}},z9=MO;function IO(t,e){let r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);let i=[];for(let n of Object.keys(e))switch(n){case"description":let o=new z9({container:r,props:e});i.push(o);break;default:break}return i}var Kb={};As(Kb,{AGGREGATION_OPERATION:()=>Wo,AmbientLight:()=>s_,ArcLayer:()=>km,Attribute:()=>Pp,AttributeManager:()=>Mf,BitmapLayer:()=>Um,COORDINATE_SYSTEM:()=>Zr,CPUGridLayer:()=>Jd,ColumnLayer:()=>If,CompositeLayer:()=>es,ContourLayer:()=>sb,Controller:()=>rc,Deck:()=>Ip,DeckRenderer:()=>bm,DirectionalLight:()=>vp,FirstPersonController:()=>Bm,FirstPersonView:()=>M1,FirstPersonViewport:()=>Pm,FlyToInterpolator:()=>O1,GPUGridLayer:()=>Qd,GeoJsonLayer:()=>Oh,GeohashLayer:()=>qb,GoogleMapsOverlay:()=>Nm,GreatCircleLayer:()=>mb,GridCellLayer:()=>Wm,GridLayer:()=>lb,H3ClusterLayer:()=>Sb,H3HexagonLayer:()=>og,HeatmapLayer:()=>ub,HexagonLayer:()=>nb,IconLayer:()=>Op,JSONConfiguration:()=>Xp,JSONConverter:()=>vg,Layer:()=>Dn,LayerExtension:()=>Fm,LayerManager:()=>ym,LightingEffect:()=>zd,LineLayer:()=>zm,LinearInterpolator:()=>wl,MVTLayer:()=>Wb,MapController:()=>xm,MapView:()=>Mp,OPERATION:()=>oV,OrbitController:()=>Om,OrbitView:()=>P1,OrbitViewport:()=>Mm,OrthographicController:()=>Dm,OrthographicView:()=>R1,OrthographicViewport:()=>Im,PathLayer:()=>Pf,PointCloudLayer:()=>Vm,PointLight:()=>c_,PolygonLayer:()=>Bf,PostProcessEffect:()=>e1,QuadkeyLayer:()=>yb,S2Layer:()=>_b,ScatterplotLayer:()=>jm,ScenegraphLayer:()=>cg,ScreenGridLayer:()=>ib,SimpleMeshLayer:()=>Nh,SolidPolygonLayer:()=>Rf,TRANSITION_EVENTS:()=>n1,TerrainLayer:()=>Hb,Tesselator:()=>Bp,TextLayer:()=>Zm,Tile3DLayer:()=>Ub,TileLayer:()=>Fh,TransitionInterpolator:()=>Sp,Transport:()=>zh,TripsLayer:()=>wb,UNIT:()=>ms,VERSION:()=>xT,View:()=>tc,Viewport:()=>bl,WebMercatorViewport:()=>Ec,_AggregationLayer:()=>$c,_BinSorter:()=>Dp,_CPUAggregator:()=>Fp,_CameraLight:()=>qx,_Component:()=>Sm,_ComponentState:()=>Cm,_GPUGridAggregator:()=>Fa,_GeoCellLayer:()=>eu,_GlobeController:()=>Lm,_GlobeView:()=>B1,_GlobeViewport:()=>Rp,_LayersPass:()=>xf,_MultiIconLayer:()=>Xm,_PickLayersPass:()=>bp,_SunLight:()=>Xx,_TextBackgroundLayer:()=>Km,_Tile2DHeader:()=>tg,_Tileset2D:()=>rg,_WMSLayer:()=>US,_compareProps:()=>m_,_convertFunctions:()=>Ay,_count:()=>IE,_deepEqual:()=>Ls,_fillArray:()=>AE,_flatten:()=>Rh,_getURLFromTemplate:()=>Lh,_memoize:()=>Nu,_mergeShaders:()=>Em,_parseExpressionString:()=>yg,_shallowEqualObjects:()=>HY,assert:()=>os,createIterable:()=>Js,fp64LowPart:()=>Vd,getShaderAssembler:()=>o_,gouraudLighting:()=>Fu,log:()=>ur,phongLighting:()=>Nd,picking:()=>go,project:()=>kd,project32:()=>no,shadow:()=>n_});var V9=`#version 300 es
1771
+ }`;function ehe(t,e){let r=TE(e.size),i=EE(e.size);return new wf(t,{vs:Qfe,fs:$fe,bufferLayout:[{name:"aPrev",format:i},{name:"aCur",format:i},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],defines:{ATTRIBUTE_TYPE:r},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function the(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",mipmaps:!1,width:1,height:1})}function rhe(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}var ihe={interpolation:y1,spring:v1},x1=class{constructor(e,{id:r,timeline:i}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=r,this.device=e,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(let e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:r,numInstances:i}){this.numInstances=i||1;for(let n in e){let o=e[n],s=o.getTransitionSetting(r);s&&this._updateAttribute(n,o,s)}for(let n in this.transitions){let o=e[n];(!o||!o.getTransitionSetting(r))&&this._removeTransition(n)}}hasAttribute(e){let r=this.transitions[e];return r&&r.inProgress}getAttributes(){let e={};for(let r in this.transitions){let i=this.transitions[r];i.inProgress&&(e[r]=i.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(let r in this.transitions)this.transitions[r].update()&&(this.needsRedraw=!0);let e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,r,i){let n=this.transitions[e],o=!n||n.type!==i.type;if(o){n&&this._removeTransition(e);let s=ihe[i.type];s?this.transitions[e]=new s({attribute:r,timeline:this.timeline,device:this.device}):(ur.error(`unsupported transition type '${i.type}'`)(),o=!1)}(o||r.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(i,this.numInstances))}};var v9="attributeManager.invalidate",nhe="attributeManager.updateStart",ohe="attributeManager.updateEnd",she="attribute.updateStart",ahe="attribute.allocate",lhe="attribute.updateEnd",Mf=class{constructor(e,{id:r="attribute-manager",stats:i,timeline:n}={}){this.mergeBoundsMemoized=Nu(TV),this.id=r,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new x1(e,{id:`${r}-transitions`,timeline:n}),Object.seal(this)}finalize(){for(let e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){let r=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,r&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{instanced:1})}remove(e){for(let r of e)this.attributes[r]!==void 0&&(this.attributes[r].delete(),delete this.attributes[r])}invalidate(e,r){let i=this._invalidateTrigger(e,r);Ks(v9,this,e,i)}invalidateAll(e){for(let r in this.attributes)this.attributes[r].setNeedsUpdate(r,e);Ks(v9,this,"all")}update({data:e,numInstances:r,startIndices:i=null,transitions:n,props:o={},buffers:s={},context:l={}}){let u=!1;Ks(nhe,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(let h in this.attributes){let v=this.attributes[h],T=v.settings.accessor;v.startIndices=i,v.numInstances=r,o[h]&&ur.removed(`props.${h}`,`data.attributes.${h}`)(),v.setExternalBuffer(s[h])||v.setBinaryValue(typeof T=="string"?s[T]:void 0,e.startIndices)||typeof T=="string"&&!s[T]&&v.setConstantValue(o[T])||v.needsUpdate()&&(u=!0,this._updateAttribute({attribute:v,numInstances:r,data:e,props:o,context:l})),this.needsRedraw=this.needsRedraw||v.needsRedraw()}u&&Ks(ohe,this,r),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:r,transitions:n})}updateTransition(){let{attributeTransitionManager:e}=this,r=e.run();return this.needsRedraw=this.needsRedraw||r,r}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){let r=e.map(i=>this.attributes[i]?.getBounds());return this.mergeBoundsMemoized(r)}getChangedAttributes(e={clearChangedFlags:!1}){let{attributes:r,attributeTransitionManager:i}=this,n={...i.getAttributes()};for(let o in r){let s=r[o];s.needsRedraw(e)&&!i.hasAttribute(o)&&(n[o]=s)}return n}getBufferLayouts(e,r={}){e||(e=this.getAttributes());let i=[];for(let n in e)r[n]||i.push(e[n].getBufferLayout());return i}_add(e,r={}){for(let i in e){let n=e[i];this.attributes[i]=this._createAttribute(i,n,r)}this._mapUpdateTriggersToAttributes()}_createAttribute(e,r,i){let n={...r,id:e,size:r.isIndexed&&1||r.size||1,divisor:i.instanced?1:r.divisor||0};return new Pp(this.device,n)}_mapUpdateTriggersToAttributes(){let e={};for(let r in this.attributes)this.attributes[r].getUpdateTriggers().forEach(n=>{e[n]||(e[n]=[]),e[n].push(r)});this.updateTriggers=e}_invalidateTrigger(e,r){let{attributes:i,updateTriggers:n}=this,o=n[e];return o&&o.forEach(s=>{let l=i[s];l&&l.setNeedsUpdate(l.id,r)}),o}_updateAttribute(e){let{attribute:r,numInstances:i}=e;if(Ks(she,r),r.constant){r.setConstantValue(r.value);return}r.allocate(i)&&Ks(ahe,r,i),r.updateBuffer(e)&&(this.needsRedraw=!0,Ks(lhe,r,i))}};var b1=class extends Ef{get value(){return this._value}_onUpdate(){let{time:e,settings:{fromValue:r,toValue:i,duration:n,easing:o}}=this,s=o(e/n);this._value=Oa(r,i,s)}};var x9=1e-5;function b9(t,e,r,i,n){let o=e-t,l=(r-e)*n,u=-o*i;return l+u+o+e}function che(t,e,r,i,n){if(Array.isArray(r)){let o=[];for(let s=0;s<r.length;s++)o[s]=b9(t[s],e[s],r[s],i,n);return o}return b9(t,e,r,i,n)}function w9(t,e){if(Array.isArray(t)){let r=0;for(let i=0;i<t.length;i++){let n=t[i]-e[i];r+=n*n}return Math.sqrt(r)}return Math.abs(t-e)}var w1=class extends Ef{get value(){return this._currValue}_onUpdate(){let{fromValue:e,toValue:r,damping:i,stiffness:n}=this.settings,{_prevValue:o=e,_currValue:s=e}=this,l=che(o,s,r,i,n),u=w9(l,r),h=w9(l,s);u<x9&&h<x9&&(l=r,this.end()),this._prevValue=s,this._currValue=l}};var uhe={interpolation:b1,spring:w1},T1=class{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,r,i,n){let{transitions:o}=this;if(o.has(e)){let u=o.get(e),{value:h=u.settings.fromValue}=u;r=h,this.remove(e)}if(n=wE(n),!n)return;let s=uhe[n.type];if(!s){ur.error(`unsupported transition type '${n.type}'`)();return}let l=new s(this.timeline);l.start({...n,fromValue:r,toValue:i}),o.set(e,l)}remove(e){let{transitions:r}=this;r.has(e)&&(r.get(e).cancel(),r.delete(e))}update(){let e={};for(let[r,i]of this.transitions)i.update(),e[r]=i.value,i.inProgress||this.remove(r);return e}clear(){for(let e of this.transitions.keys())this.remove(e)}};function E9(t){let e=t[Vu];for(let r in e){let i=e[r],{validate:n}=i;if(n&&!n(t[r],i))throw new Error(`Invalid prop ${r}: ${t[r]}`)}}function S9(t,e){let r=m_({newProps:t,oldProps:e,propTypes:t[Vu],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=hhe(t,e),n=!1;return i||(n=phe(t,e)),{dataChanged:i,propsChanged:r,updateTriggersChanged:n,extensionsChanged:dhe(t,e),transitionsChanged:fhe(t,e)}}function fhe(t,e){if(!t.transitions)return!1;let r={},i=t[Vu],n=!1;for(let o in t.transitions){let s=i[o],l=s&&s.type;(l==="number"||l==="color"||l==="array")&&cO(t[o],e[o],s)&&(r[o]=!0,n=!0)}return n?r:!1}function m_({newProps:t,oldProps:e,ignoreProps:r={},propTypes:i={},triggerName:n="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${n} changed shallowly`;if(typeof e!="object"||e===null)return`${n} changed shallowly`;for(let o of Object.keys(t))if(!(o in r)){if(!(o in e))return`${n}.${o} added`;let s=cO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}for(let o of Object.keys(e))if(!(o in r)){if(!(o in t))return`${n}.${o} dropped`;if(!Object.hasOwnProperty.call(t,o)){let s=cO(t[o],e[o],i[o]);if(s)return`${n}.${o} ${s}`}}return!1}function cO(t,e,r){let i=r&&r.equal;return i&&!i(t,e,r)||!i&&(i=t&&e&&t.equals,i&&!i.call(t,e))?"changed deeply":!i&&e!==t?"changed shallowly":null}function hhe(t,e){if(e===null)return"oldProps is null, initial diff";let r=!1,{dataComparator:i,_dataDiff:n}=t;return i?i(t.data,e.data)||(r="Data comparator detected a change"):t.data!==e.data&&(r="A new data container was supplied"),r&&n&&(r=n(t.data,e.data)||r),r}function phe(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&T9(t,e,"all"))return{all:!0};let r={},i=!1;for(let n in t.updateTriggers)n!=="all"&&T9(t,e,n)&&(r[n]=!0,i=!0);return i?r:!1}function dhe(t,e){if(e===null)return!0;let r=e.extensions,{extensions:i}=t;if(i===r)return!1;if(!r||!i||i.length!==r.length)return!0;for(let n=0;n<i.length;n++)if(!i[n].equals(r[n]))return!0;return!1}function T9(t,e,r){let i=t.updateTriggers[r];i=i??{};let n=e.updateTriggers[r];return n=n??{},m_({oldProps:n,newProps:i,triggerName:r})}var Ahe="count(): argument not an object",mhe="count(): argument not a container";function IE(t){if(!_he(t))throw new Error(Ahe);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(ghe(t))return Object.keys(t).length;throw new Error(mhe)}function ghe(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function _he(t){return t!==null&&typeof t=="object"}function Em(t,e){if(!e)return t;let r={...t,...e};if("defines"in e&&(r.defines={...t.defines,...e.defines}),"modules"in e&&(r.modules=(t.modules||[]).concat(e.modules),e.modules.some(i=>i.name==="project64"))){let i=r.modules.findIndex(n=>n.name==="project32");i>=0&&r.modules.splice(i,1)}if("inject"in e)if(!t.inject)r.inject=e.inject;else{let i={...t.inject};for(let n in e.inject)i[n]=(i[n]||"")+e.inject[n];r.inject=i}return r}var yhe={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},uO={};function C9(t,e,r,i){if(r instanceof bo)return r;r.constructor&&r.constructor.name!=="Object"&&(r={data:r});let n=null;r.compressed&&(n={minFilter:"linear",mipmapFilter:r.data.length>1?"nearest":"linear"});let o=e.createTexture({...r,sampler:{...yhe,...n,...i}});return uO[o.id]=t,o}function M9(t,e){!e||!(e instanceof bo)||uO[e.id]===t&&(e.delete(),delete uO[e.id])}var vhe={boolean:{validate(t,e){return!0},equal(t,e,r){return Boolean(t)===Boolean(e)}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||fO(t)&&(t.length===3||t.length===4)},equal(t,e,r){return Ls(t,e,1)}},accessor:{validate(t,e){let r=PE(t);return r==="function"||r===PE(e.value)},equal(t,e,r){return typeof e=="function"?!0:Ls(t,e,1)}},array:{validate(t,e){return e.optional&&!t||fO(t)},equal(t,e,r){let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},object:{equal(t,e,r){if(r.ignore)return!0;let{compare:i}=r,n=Number.isInteger(i)?i:i?1:0;return i?Ls(t,e,n):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,r){return!r.compare&&r.ignore!==!1||t===e}},data:{transform:(t,e,r)=>{if(!t)return t;let{dataTransform:i}=r.props;return i?i(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,r)=>{let i=r.context;return!i||!i.device?null:C9(r.id,i.device,t,{...e.parameters,...r.props.textureParameters})},release:(t,e,r)=>{M9(r.id,t)}}};function I9(t){let e={},r={},i={};for(let[n,o]of Object.entries(t)){let s=o?.deprecatedFor;if(s)i[n]=Array.isArray(s)?s:[s];else{let l=xhe(n,o);e[n]=l,r[n]=l.value}}return{propTypes:e,defaultProps:r,deprecatedProps:i}}function xhe(t,e){switch(PE(e)){case"object":return E1(t,e);case"array":return E1(t,{type:"array",value:e,compare:!1});case"boolean":return E1(t,{type:"boolean",value:e});case"number":return E1(t,{type:"number",value:e});case"function":return E1(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function E1(t,e){return"type"in e?{name:t,...vhe[e.type],...e}:"value"in e?{name:t,type:PE(e.value),...e}:{name:t,type:"object",value:e}}function fO(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function PE(t){return fO(t)?"array":t===null?"null":typeof t}function P9(t,e){let r;for(let o=e.length-1;o>=0;o--){let s=e[o];"extensions"in s&&(r=s.extensions)}let i=hO(t.constructor,r),n=Object.create(i);n[f_]=t,n[Ph]={},n[Tf]={};for(let o=0;o<e.length;++o){let s=e[o];for(let l in s)n[l]=s[l]}return Object.freeze(n),n}var bhe="_mergedDefaultProps";function hO(t,e){let r=bhe;if(e)for(let n of e){let o=n.constructor;o&&(r+=`:${o.extensionName||o.name}`)}let i=R9(t,r);return i||(t[r]=whe(t,e||[]))}function whe(t,e){if(!t.prototype)return null;let i=Object.getPrototypeOf(t),n=hO(i),o=R9(t,"defaultProps")||{},s=I9(o),l=Object.assign(Object.create(null),n,s.defaultProps),u=Object.assign(Object.create(null),n?.[Vu],s.propTypes),h=Object.assign(Object.create(null),n?.[dE],s.deprecatedProps);for(let v of e){let T=hO(v.constructor);T&&(Object.assign(l,T),Object.assign(u,T[Vu]),Object.assign(h,T[dE]))}return The(l,t),She(l,u),Ehe(l,h),l[Vu]=u,l[dE]=h,e.length===0&&!pO(t,"_propTypes")&&(t._propTypes=u),l}function The(t,e){let r=Mhe(e);Object.defineProperties(t,{id:{writable:!0,value:r}})}function Ehe(t,e){for(let r in e)Object.defineProperty(t,r,{enumerable:!1,set(i){let n=`${this.id}: ${r}`;for(let o of e[r])pO(this,o)||(this[o]=i);ur.deprecated(n,e[r].join("/"))()}})}function She(t,e){let r={},i={};for(let n in e){let o=e[n],{name:s,value:l}=o;o.async&&(r[s]=l,i[s]=Che(s))}t[wp]=r,t[Ph]={},Object.defineProperties(t,i)}function Che(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||xE(e)?this[Ph][t]=e:this[Tf][t]=e},get(){if(this[Tf]){if(t in this[Tf])return this[Tf][t]||this[wp][t];if(t in this[Ph]){let e=this[f_]&&this[f_].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[wp][t]}}return this[wp][t]}}}function pO(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function R9(t,e){return pO(t,e)&&t[e]}function Mhe(t){let e=t.componentName;return e||ur.warn(`${t.name}.componentName not specified`)(),e||t.name}var Ihe=0,RE=class{constructor(...e){this.props=P9(this,e),this.id=this.props.id,this.count=Ihe++}clone(e){let{props:r}=this,i={};for(let n in r[wp])n in r[Tf]?i[n]=r[Tf][n]:n in r[Ph]&&(i[n]=r[Ph][n]);return new this.constructor({...r,...i,...e})}},Sm=RE;(()=>{RE.componentName="Component"})(),(()=>{RE.defaultProps={}})();var Phe=Object.freeze({}),Cm=class{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(let e in this.asyncProps){let r=this.asyncProps[e];r&&r.type&&r.type.release&&r.type.release(r.resolvedValue,r.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||Phe}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){let r=this.asyncProps[e];return r&&r.resolvedValue}isAsyncPropLoading(e){if(e){let r=this.asyncProps[e];return Boolean(r&&r.pendingLoadCount>0&&r.pendingLoadCount!==r.resolvedLoadCount)}for(let r in this.asyncProps)if(this.isAsyncPropLoading(r))return!0;return!1}reloadAsyncProp(e,r){this._watchPromise(e,Promise.resolve(r))}setAsyncProps(e){this.component=e[f_]||this.component;let r=e[Tf]||{},i=e[Ph]||e,n=e[wp]||{};for(let o in r){let s=r[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s),r[o]=this.getAsyncProp(o)}for(let o in i){let s=i[o];this._createAsyncPropData(o,n[o]),this._updateAsyncProp(o,s)}}_fetch(e,r){return null}_onResolve(e,r){}_onError(e,r){}_updateAsyncProp(e,r){if(this._didAsyncInputValueChange(e,r)){if(typeof r=="string"&&(r=this._fetch(e,r)),r instanceof Promise){this._watchPromise(e,r);return}if(xE(r)){this._resolveAsyncIterable(e,r);return}this._setPropValue(e,r)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(let e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,r){let i=this.asyncProps[e];return r===i.resolvedValue||r===i.lastValue?!1:(i.lastValue=r,!0)}_setPropValue(e,r){this._freezeAsyncOldProps();let i=this.asyncProps[e];i&&(r=this._postProcessValue(i,r),i.resolvedValue=r,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(e,r,i){let n=this.asyncProps[e];n&&i>=n.resolvedLoadCount&&r!==void 0&&(this._freezeAsyncOldProps(),n.resolvedValue=r,n.resolvedLoadCount=i,this.onAsyncPropUpdated(e,r))}_watchPromise(e,r){let i=this.asyncProps[e];if(i){i.pendingLoadCount++;let n=i.pendingLoadCount;r.then(o=>{this.component&&(o=this._postProcessValue(i,o),this._setAsyncPropValue(e,o,n),this._onResolve(e,o))}).catch(o=>{this._onError(e,o)})}}async _resolveAsyncIterable(e,r){if(e!=="data"){this._setPropValue(e,r);return}let i=this.asyncProps[e];if(!i)return;i.pendingLoadCount++;let n=i.pendingLoadCount,o=[],s=0;for await(let l of r){if(!this.component)return;let{dataTransform:u}=this.component.props;u?o=u(l,o):o=o.concat(l),Object.defineProperty(o,"__diff",{enumerable:!1,value:[{startRow:s,endRow:o.length}]}),s=o.length,this._setAsyncPropValue(e,o,n)}this._onResolve(e,o)}_postProcessValue(e,r){let i=e.type;return i&&this.component&&(i.release&&i.release(e.resolvedValue,i,this.component),i.transform)?i.transform(r,i,this.component):r}_createAsyncPropData(e,r){if(!this.asyncProps[e]){let n=this.component&&this.component.props[Vu];this.asyncProps[e]={type:n&&n[e],lastValue:null,resolvedValue:r,pendingLoadCount:0,resolvedLoadCount:0}}}};var S1=class extends Cm{constructor({attributeManager:e,layer:r}){super(r),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,r){let i=this.layer,n=i?.props.fetch;return n?n(r,{propName:e,layer:i}):super._fetch(e,r)}_onResolve(e,r){let i=this.layer;if(i){let n=i.props.onDataLoad;e==="data"&&n&&n(r,{propName:e,layer:i})}}_onError(e,r){let i=this.layer;i&&i.raiseError(r,`loading ${e} of ${this.layer}`)}};var Rhe="layer.changeFlag",Bhe="layer.initialize",Ohe="layer.update",Dhe="layer.finalize",Lhe="layer.matched",B9=2**24-1,Fhe=Object.freeze([]),Nhe=Nu(({oldViewport:t,viewport:e})=>t.equals(e)),Bh=new Uint8ClampedArray(0),khe={data:{type:"data",value:Fhe,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:r,loaders:i,loadOptions:n,signal:o})=>{let{resourceManager:s}=r.context;n=n||r.getLoadOptions(),i=i||r.props.loaders,o&&(n={...n,fetch:{...n?.fetch,signal:o}});let l=s.contains(t);return!l&&!n&&(s.add({resourceId:t,data:_a(t,i),persistent:!1}),l=!0),l?s.subscribe({resourceId:t,onChange:u=>r.internalState?.reloadAsyncProp(e,u),consumerId:r.id,requestId:e}):_a(t,i,n)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:Zr.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}},BE=class extends Sm{constructor(){super(...arguments),this.internalState=null,this.lifecycle=jd.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){os(this.internalState);let r=this.internalState.viewport||this.context.viewport,i=ZB(e,{viewport:r,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[n,o,s]=i_(i,r.pixelProjectionMatrix);return e.length===2?[n,o]:[n,o,s]}unproject(e){return os(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,r){os(this.internalState);let i=this.internalState.viewport||this.context.viewport;return cE(e,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...r})}get isComposite(){return!1}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){let e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setModuleParameters(e){for(let r of this.getModels())r.updateModuleSettings(e)}setShaderModuleProps(...e){for(let r of this.getModels())r.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){let{coordinateSystem:e}=this.props;return e===Zr.DEFAULT||e===Zr.LNGLAT||e===Zr.CARTESIAN}onHover(e,r){return this.props.onHover&&this.props.onHover(e,r)||!1}onClick(e,r){return this.props.onClick&&this.props.onClick(e,r)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,r=[]){return r[0]=e+1&255,r[1]=e+1>>8&255,r[2]=e+1>>8>>8&255,r}decodePickingColor(e){os(e instanceof Uint8Array);let[r,i,n]=e;return r+i*256+n*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:IE(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){return this.getAttributeManager()?.getBounds(["positions","instancePositions"])}getShaders(e){e=Em(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(let r of this.props.extensions)e=Em(e,r.getShaders.call(this,r));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){let r=this.getAttributeManager(),{dataChanged:i}=e.changeFlags;if(i&&r)if(Array.isArray(i))for(let n of i)r.invalidateAll(n);else r.invalidateAll();if(r){let{props:n}=e,o=this.internalState.hasPickingBuffer,s=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some(l=>l.getNeedsPickingBuffer.call(this,l));if(o!==s){this.internalState.hasPickingBuffer=s;let{pickingColors:l,instancePickingColors:u}=r.attributes,h=l||u;h&&(s&&h.constant&&(h.constant=!1,r.invalidate(h.id)),!h.value&&!s&&(h.constant=!0,h.value=[0,0,0]))}}}finalizeState(e){for(let i of this.getModels())i.destroy();let r=this.getAttributeManager();r&&r.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(let r of this.getModels())r.draw(e)}getPickingInfo({info:e,mode:r,sourceLayer:i}){let{index:n}=e;return n>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[n]),e}raiseError(e,r){r&&(e=new Error(`${r}: ${e.message}`,{cause:e})),this.props.onError?.(e)||this.context?.onError?.(e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){return this.internalState?.uniformTransitions.active||!1}activateViewport(e){if(!this.internalState)return;let r=this.internalState.viewport;this.internalState.viewport=e,(!r||!Nhe({oldViewport:r,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){let r=this.getAttributeManager();r&&(e==="all"?r.invalidateAll():r.invalidate(e))}updateAttributes(e){let r=!1;for(let i in e)e[i].layoutChanged()&&(r=!0);for(let i of this.getModels())this._setModelAttributes(i,e,r)}_updateAttributes(){let e=this.getAttributeManager();if(!e)return;let r=this.props,i=this.getNumInstances(),n=this.getStartIndices();e.update({data:r.data,numInstances:i,startIndices:n,props:r,transitions:r.transitions,buffers:r.data.attributes,context:this});let o=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(o)}_updateAttributeTransition(){let e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){let{uniformTransitions:e}=this.internalState;if(e.active){let r=e.update(),i=Object.create(this.props);for(let n in r)Object.defineProperty(i,n,{value:r[n]});return i}return this.props}calculateInstancePickingColors(e,{numInstances:r}){if(e.constant)return;let i=Math.floor(Bh.length/4);if(this.internalState.usesPickingColorCache=!0,i<r){r>B9&&ur.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),Bh=bf.allocate(Bh,r,{size:4,copy:!0,maxCount:Math.max(r,B9)});let n=Math.floor(Bh.length/4),o=[];for(let s=i;s<n;s++)this.encodePickingColor(s,o),Bh[s*4+0]=o[0],Bh[s*4+1]=o[1],Bh[s*4+2]=o[2]}e.value=Bh.subarray(0,r*4)}_setModelAttributes(e,r,i=!1){if(!Object.keys(r).length)return;if(i){let l=this.getAttributeManager();e.setBufferLayout(l.getBufferLayouts()),r=l.getAttributes()}let n=e.userData?.excludeAttributes||{},o={},s={};for(let l in r){if(n[l])continue;let u=r[l].getValue();for(let h in u){let v=u[h];v instanceof Xi?r[l].settings.isIndexed?e.setIndexBuffer(v):o[h]=v:v&&(s[h]=v)}}e.setAttributes(o),e.setConstantAttributes(s)}disablePickingIndex(e){let r=this.props.data;if(!("attributes"in r)){this._disablePickingIndex(e);return}let{pickingColors:i,instancePickingColors:n}=this.getAttributeManager().attributes,o=i||n,s=o&&r.attributes&&r.attributes[o.id];if(s&&s.value){let l=s.value,u=this.encodePickingColor(e);for(let h=0;h<r.length;h++){let v=o.getVertexOffset(h);l[v]===u[0]&&l[v+1]===u[1]&&l[v+2]===u[2]&&this._disablePickingIndex(h)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){let{pickingColors:r,instancePickingColors:i}=this.getAttributeManager().attributes,n=r||i;if(!n)return;let o=n.getVertexOffset(e),s=n.getVertexOffset(e+1);n.buffer.write(new Uint8Array(s-o),o)}restorePickingColors(){let{pickingColors:e,instancePickingColors:r}=this.getAttributeManager().attributes,i=e||r;i&&(this.internalState.usesPickingColorCache&&i.value.buffer!==Bh.buffer&&(i.value=Bh.subarray(0,i.value.length)),i.updateSubBuffer({startOffset:0}))}_initialize(){os(!this.internalState),os(Number.isFinite(this.props.coordinateSystem)),Ks(Bhe,this);let e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new S1({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(ur.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new T1(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(let r of this.props.extensions)r.initializeState.call(this,this.context,r);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){Ks(Lhe,this,this===e);let{state:r,internalState:i}=e;this!==e&&(this.internalState=i,this.state=r,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){let e=this.needsUpdate();if(Ks(Ohe,this,e),!e)return;let r=this.props,i=this.context,n=this.internalState,o=i.viewport,s=this._updateUniformTransition();n.propsInTransition=s,i.viewport=n.viewport||o,this.props=s;try{let l=this._getUpdateParams(),u=this.getModels();if(i.device)this.updateState(l);else try{this.updateState(l)}catch{}for(let v of this.props.extensions)v.updateState.call(this,l,v);let h=this.getModels()[0]!==u[0];this._postUpdate(l,h)}finally{i.viewport=o,this.props=r,this._clearChangeFlags(),n.needsUpdate=!1,n.resetOldProps()}}_finalize(){Ks(Dhe,this),this.finalizeState(this.context);for(let e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,moduleParameters:r=null,uniforms:i={},parameters:n={}}){this._updateAttributeTransition();let o=this.props,s=this.context;this.props=this.internalState.propsInTransition||o;let l=this.props.opacity;i.opacity=Math.pow(l,1/2.2);try{if(r){let{isActive:v,isAttribute:T}=r.picking;this.setModuleParameters(r),this.setShaderModuleProps({picking:{isActive:v,isAttribute:T}})}let{getPolygonOffset:u}=this.props,h=u&&u(i)||[0,0];s.device.setParametersWebGL({polygonOffset:h});for(let v of this.getModels())v.setParameters(n);s.device.withParametersWebGL(n,()=>{let v={renderPass:e,moduleParameters:r,uniforms:i,parameters:n,context:s};for(let T of this.props.extensions)T.draw.call(this,v,T);this.draw(v)})}finally{this.props=o}}getChangeFlags(){return this.internalState?.changeFlags}setChangeFlags(e){if(!this.internalState)return;let{changeFlags:r}=this.internalState;for(let n in e)if(e[n]){let o=!1;switch(n){case"dataChanged":let s=e[n],l=r[n];s&&Array.isArray(l)&&(r.dataChanged=Array.isArray(s)?l.concat(s):s,o=!0);default:r[n]||(r[n]=e[n],o=!0)}o&&Ks(Rhe,this,n,e)}let i=Boolean(r.dataChanged||r.updateTriggersChanged||r.propsChanged||r.extensionsChanged);r.propsOrDataChanged=i,r.somethingChanged=i||r.viewportChanged||r.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,r){let i=S9(e,r);if(i.updateTriggersChanged)for(let n in i.updateTriggersChanged)i.updateTriggersChanged[n]&&this.invalidateAttribute(n);if(i.transitionsChanged)for(let n in i.transitionsChanged)this.internalState.uniformTransitions.add(n,r[n],e[n],e.transitions?.[n]);return this.setChangeFlags(i)}validateProps(){E9(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){let r={highlightedObjectColor:e.picked?e.color:null},{highlightColor:i}=this.props;e.picked&&typeof i=="function"&&(r.highlightColor=i(e)),this.setShaderModuleProps({picking:r}),this.setNeedsRedraw()}_getAttributeManager(){let e=this.context;return new Mf(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,r){let{props:i,oldProps:n}=e;this.setNeedsRedraw(),this._updateAttributes();let o=this.state.model;o?.isInstanced&&o.setInstanceCount(this.getNumInstances());let{autoHighlight:s,highlightedObjectIndex:l,highlightColor:u}=i;if(r||n.autoHighlight!==s||n.highlightedObjectIndex!==l||n.highlightColor!==u){let h={};s||(h.highlightedObjectColor=null),Array.isArray(u)&&(h.highlightColor=u),(r||l!==n.highlightedObjectIndex)&&(h.highlightedObjectColor=Number.isFinite(l)&&l>=0?this.encodePickingColor(l):null),this.setShaderModuleProps({picking:h})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let r=!1;r=r||this.internalState.needsRedraw&&this.id;let i=this.getAttributeManager(),n=i?i.getNeedsRedraw(e):!1;if(r=r||n,r)for(let o of this.props.extensions)o.onNeedsRedraw.call(this,o);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,r}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}},Dn=BE;(()=>{BE.defaultProps=khe})(),(()=>{BE.layerName="Layer"})();var Uhe="compositeLayer.renderLayers",dO=class extends Dn{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every(e=>e.isLoaded)}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(e){}setState(e){super.setState(e),this.setNeedsUpdate()}getPickingInfo({info:e}){let{object:r}=e;return r&&r.__source&&r.__source.parent&&r.__source.parent.id===this.id&&(e.object=r.__source.object,e.index=r.__source.index),e}filterSubLayer(e){return!0}shouldRenderSubLayer(e,r){return r&&r.length}getSubLayerClass(e,r){let{_subLayerProps:i}=this.props;return i&&i[e]&&i[e].type||r}getSubLayerRow(e,r,i){return e.__source={parent:this,object:r,index:i},e}getSubLayerAccessor(e){if(typeof e=="function"){let r={index:-1,data:this.props.data,target:[]};return(i,n)=>i&&i.__source?(r.index=i.__source.index,e(i.__source.object,r)):e(i,n)}return e}getSubLayerProps(e={}){let{opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W,_subLayerProps:J}=this.props,K={id:"",updateTriggers:{},opacity:r,pickable:i,visible:n,parameters:o,getPolygonOffset:s,highlightedObjectIndex:l,autoHighlight:u,highlightColor:h,coordinateSystem:v,coordinateOrigin:T,wrapLongitude:E,positionFormat:M,modelMatrix:O,extensions:F,fetch:z,operation:W},ne=J&&e.id&&J[e.id],ge=ne&&ne.updateTriggers,H=e.id||"sublayer";if(ne){let me=this.props[Vu],fe=e.type?e.type._propTypes:{};for(let $ in ne){let Z=fe[$]||me[$];Z&&Z.type==="accessor"&&(ne[$]=this.getSubLayerAccessor(ne[$]))}}Object.assign(K,e,ne),K.id=`${this.props.id}-${H}`,K.updateTriggers={all:this.props.updateTriggers?.all,...e.updateTriggers,...ge};for(let me of F){let fe=me.getSubLayerProps.call(this,me);fe&&Object.assign(K,fe,{updateTriggers:Object.assign(K.updateTriggers,fe.updateTriggers)})}return K}_updateAutoHighlight(e){for(let r of this.getSubLayers())r.updateAutoHighlight(e)}_getAttributeManager(){return null}_postUpdate(e,r){let i=this.internalState.subLayers,n=!i||this.needsUpdate();if(n){let o=this.renderLayers();i=Rh(o,Boolean),this.internalState.subLayers=i}Ks(Uhe,this,n,i);for(let o of i)o.parent=this}},es=dO;(()=>{dO.layerName="CompositeLayer"})();var OE=Math.PI/180,O9=180/Math.PI,DE=6370972,g_=256;function zhe(){let t=g_/DE,e=Math.PI/180*g_;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}var Rp=class extends bl{constructor(e={}){let{latitude:r=0,longitude:i=0,zoom:n=0,nearZMultiplier:o=.1,farZMultiplier:s=2,resolution:l=10}=e,{height:u,altitude:h=1.5}=e;u=u||1,h=Math.max(.75,h);let v=new Kr().lookAt({eye:[0,-h,0],up:[0,0,1]}),T=Math.pow(2,n);v.rotateX(r*OE),v.rotateZ(-i*OE),v.scale(T/u);let E=Math.atan(.5/h),M=g_*2*T/u;super({...e,height:u,viewMatrix:v,longitude:i,latitude:r,zoom:n,distanceScales:zhe(),fovyRadians:E*2,focalDistance:h,near:o,far:Math.min(2,1/M+1)*h*s}),this.latitude=r,this.longitude=i,this.resolution=l}get projectionMode(){return Fl.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){let r={targetZ:e.z||0},i=this.unproject([0,this.height/2],r),n=this.unproject([this.width/2,0],r),o=this.unproject([this.width,this.height/2],r),s=this.unproject([this.width/2,this.height],r);return o[0]<this.longitude&&(o[0]+=360),i[0]>this.longitude&&(i[0]-=360),[Math.min(i[0],o[0],n[0],s[0]),Math.min(i[1],o[1],n[1],s[1]),Math.max(i[0],o[0],n[0],s[0]),Math.max(i[1],o[1],n[1],s[1])]}unproject(e,{topLeft:r=!0,targetZ:i}={}){let[n,o,s]=e,l=r?o:this.height-o,{pixelUnprojectionMatrix:u}=this,h;if(Number.isFinite(s))h=AO(u,[n,l,s,1]);else{let M=AO(u,[n,l,-1,1]),O=AO(u,[n,l,1,1]),F=((i||0)/DE+1)*g_,z=Da.sqrLen(Da.sub([],M,O)),W=Da.sqrLen(M),J=Da.sqrLen(O),ne=4*((4*W*J-(z-W-J)**2)/16)/z,ge=Math.sqrt(W-ne),H=Math.sqrt(Math.max(0,F*F-ne)),me=(ge-H)/Math.sqrt(z);h=Da.lerp([],M,O,me)}let[v,T,E]=this.unprojectPosition(h);return Number.isFinite(s)?[v,T,E]:Number.isFinite(i)?[v,T,i]:[v,T]}projectPosition(e){let[r,i,n=0]=e,o=r*OE,s=i*OE,l=Math.cos(s),u=(n/DE+1)*g_;return[Math.sin(o)*l*u,-Math.cos(o)*l*u,Math.sin(s)*u]}unprojectPosition(e){let[r,i,n]=e,o=Da.len(e),s=Math.asin(n/o),u=Math.atan2(r,-i)*O9,h=s*O9,v=(o/g_-1)*DE;return[u,h,v]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition(e,r){let i=this.unproject(r);return{longitude:e[0]-i[0]+this.longitude,latitude:e[1]-i[1]+this.latitude}}};function AO(t,e){let r=ec.transformMat4([],e,t);return ec.scale(r,r,1/r[3]),r}var mO=Math.PI/180;function Vhe({height:t,focalDistance:e,orbitAxis:r,rotationX:i,rotationOrbit:n,zoom:o}){let s=r==="Z"?[0,0,1]:[0,1,0],l=r==="Z"?[0,-e,0]:[0,0,e],u=new Kr().lookAt({eye:l,up:s});u.rotateX(i*mO),r==="Z"?u.rotateZ(n*mO):u.rotateY(n*mO);let h=Math.pow(2,o)/t;return u.scale(h),u}var Mm=class extends bl{constructor(e){let{height:r,projectionMatrix:i,fovy:n=50,orbitAxis:o="Z",target:s=[0,0,0],rotationX:l=0,rotationOrbit:u=0,zoom:h=0}=e,v=i?i[5]/2:dm(n);super({...e,longitude:void 0,viewMatrix:Vhe({height:r||1,focalDistance:v,orbitAxis:o,rotationX:l,rotationOrbit:u,zoom:h}),fovy:n,focalDistance:v,position:s,zoom:h}),this.projectedCenter=this.project(this.center)}unproject(e,{topLeft:r=!0}={}){let[i,n,o=this.projectedCenter[2]]=e,s=r?n:this.height-n,[l,u,h]=Uu([i,s,o],this.pixelUnprojectionMatrix);return[l,u,h]}panByPosition(e,r){let i=this.project(e),n=[this.width/2+i[0]-r[0],this.height/2+i[1]-r[1],this.projectedCenter[2]];return{target:this.unproject(n)}}};var jhe=new Kr().lookAt({eye:[0,0,1]});function Hhe({width:t,height:e,near:r,far:i,padding:n}){let o=-t/2,s=t/2,l=-e/2,u=e/2;if(n){let{left:h=0,right:v=0,top:T=0,bottom:E=0}=n,M=Zn((h+t-v)/2,0,t)-t/2,O=Zn((T+e-E)/2,0,e)-e/2;o-=M,s-=M,l+=O,u+=O}return new Kr().ortho({left:o,right:s,bottom:l,top:u,near:r,far:i})}var Im=class extends bl{constructor(e){let{width:r,height:i,near:n=.1,far:o=1e3,zoom:s=0,target:l=[0,0,0],padding:u=null,flipY:h=!0}=e,v=Array.isArray(s)?s[0]:s,T=Array.isArray(s)?s[1]:s,E=Math.min(v,T),M=Math.pow(2,E),O;if(v!==T){let F=Math.pow(2,v),z=Math.pow(2,T);O={unitsPerMeter:[F/M,z/M,1],metersPerUnit:[M/F,M/z,1]}}super({...e,longitude:void 0,position:l,viewMatrix:jhe.clone().scale([M,M*(h?-1:1),M]),projectionMatrix:Hhe({width:r||1,height:i||1,padding:u,near:n,far:o}),zoom:E,distanceScales:O})}projectFlat([e,r]){let{unitsPerMeter:i}=this.distanceScales;return[e*i[0],r*i[1]]}unprojectFlat([e,r]){let{metersPerUnit:i}=this.distanceScales;return[e*i[0],r*i[1]]}panByPosition(e,r){let i=Uu(r,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=xa.add([],n,xa.negate([],i)),s=xa.add([],this.center,o);return{target:this.unprojectFlat(s)}}};var Pm=class extends bl{constructor(e){let{longitude:r,latitude:i,modelMatrix:n,bearing:o=0,pitch:s=0,up:l=[0,0,1]}=e,h=new _f({bearing:o,pitch:s===-90?1e-4:90+s}).toVector3().normalize(),v=n?new Kr(n).transformAsVector(h):h,T=Number.isFinite(i)?zx({latitude:i}):0,E=Math.pow(2,T),M=new Kr().lookAt({eye:[0,0,0],center:v,up:l}).scale(E);super({...e,zoom:T,viewMatrix:M}),this.latitude=i,this.longitude=r}};var Rm=20,D9=500,C1=class extends Cp{constructor(e){let{width:r,height:i,position:n=[0,0,0],bearing:o=0,pitch:s=0,longitude:l=null,latitude:u=null,maxPitch:h=90,minPitch:v=-90,startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}=e;super({width:r,height:i,position:n,bearing:o,pitch:s,longitude:l,latitude:u,maxPitch:h,minPitch:v},{startRotatePos:T,startBearing:E,startPitch:M,startZoomPosition:O,startPanPos:F,startPanPosition:z}),this.makeViewport=e.makeViewport}panStart({pos:e}){let{position:r}=this.getViewportProps();return this._getUpdatedState({startPanPos:e,startPanPosition:r})}pan({pos:e}){if(!e)return this;let{startPanPos:r=[0,0],startPanPosition:i=[0,0]}=this.getState(),{width:n,height:o,bearing:s,pitch:l}=this.getViewportProps(),u=D9*(e[0]-r[0])/n,h=D9*(e[1]-r[1])/o,v=new _f({bearing:s,pitch:l}),T=new _f({bearing:s,pitch:-90}),E=v.toVector3().normalize(),M=T.toVector3().cross(E).normalize();return this._getUpdatedState({position:new ot(i).add(M.scale(u)).add(E.scale(h))})}panEnd(){return this._getUpdatedState({startPanPos:null,startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startBearing:o,startPitch:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;h={bearing:o-v*180,pitch:s-T*90}}else h={bearing:o-r,pitch:s-i};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startBearing:null,startPitch:null})}zoomStart(){return this._getUpdatedState({startZoomPosition:this.getViewportProps().position})}zoom({pos:e,scale:r}){let i=this.getViewportProps(),n=this.getState().startZoomPosition||i.position,o=this.makeViewport(i),{projectionMatrix:s,width:l}=o,h=2*Math.atan(1/s[0])*(e[0]/l-.5),v=this.getDirection(!0);return this._move(v.rotateZ({radians:-h}),Math.log2(r)*Rm,n)}zoomEnd(){return this._getUpdatedState({startZoomPosition:null})}moveLeft(e=Rm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:Math.PI/2}),e)}moveRight(e=Rm){let r=this.getDirection(!0);return this._move(r.rotateZ({radians:-Math.PI/2}),e)}moveUp(e=Rm){let r=this.getDirection(!0);return this._move(r,e)}moveDown(e=Rm){let r=this.getDirection(!0);return this._move(r.negate(),e)}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}zoomIn(e=Rm){return this._move(new ot(0,0,1),e)}zoomOut(e=Rm){return this._move(new ot(0,0,-1),e)}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{bearing:n,longitude:o}=i;return Math.abs(n-r.bearing)>180&&(i.bearing=n<0?n+360:n-360),o!==null&&r.longitude!==null&&Math.abs(o-r.longitude)>180&&(i.longitude=o<0?o+360:o-360),i}_move(e,r,i=this.getViewportProps().position){let n=e.scale(r);return this._getUpdatedState({position:new ot(i).add(n)})}getDirection(e=!1){return new _f({bearing:this.getViewportProps().bearing,pitch:e?90:90+this.getViewportProps().pitch}).toVector3().normalize()}_getUpdatedState(e){return new C1({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{pitch:r,maxPitch:i,minPitch:n,longitude:o,bearing:s}=e;return e.pitch=Zn(r,n,i),o!==null&&(o<-180||o>180)&&(e.longitude=mm(o+180,360)-180),(s<-180||s>180)&&(e.bearing=mm(s+180,360)-180),e}},Bm=class extends rc{constructor(){super(...arguments),this.ControllerState=C1,this.transition={transitionDuration:300,transitionInterpolator:new wl(["position","pitch","bearing"])}}};var gO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Pm}get ControllerType(){return Bm}},M1=gO;(()=>{gO.displayName="FirstPersonView"})();var I1=class extends Cp{constructor(e){let{width:r,height:i,rotationX:n=0,rotationOrbit:o=0,target:s=[0,0,0],zoom:l=0,minRotationX:u=-90,maxRotationX:h=90,minZoom:v=-1/0,maxZoom:T=1/0,startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}=e;super({width:r,height:i,rotationX:n,rotationOrbit:o,target:s,zoom:l,minRotationX:u,maxRotationX:h,minZoom:v,maxZoom:T},{startPanPosition:E,startRotatePos:M,startRotationX:O,startRotationOrbit:F,startZoomPosition:z,startZoom:W}),this.makeViewport=e.makeViewport}panStart({pos:e}){return this._getUpdatedState({startPanPosition:this._unproject(e)})}pan({pos:e,startPosition:r}){let i=this.getState().startPanPosition||r;if(!i)return this;let o=this.makeViewport(this.getViewportProps()).panByPosition(i,e);return this._getUpdatedState(o)}panEnd(){return this._getUpdatedState({startPanPosition:null})}rotateStart({pos:e}){return this._getUpdatedState({startRotatePos:e,startRotationX:this.getViewportProps().rotationX,startRotationOrbit:this.getViewportProps().rotationOrbit})}rotate({pos:e,deltaAngleX:r=0,deltaAngleY:i=0}){let{startRotatePos:n,startRotationX:o,startRotationOrbit:s}=this.getState(),{width:l,height:u}=this.getViewportProps();if(!n||o===void 0||s===void 0)return this;let h;if(e){let v=(e[0]-n[0])/l,T=(e[1]-n[1])/u;(o<-90||o>90)&&(v*=-1),h={rotationX:o+T*180,rotationOrbit:s+v*180}}else h={rotationX:o+i,rotationOrbit:s+r};return this._getUpdatedState(h)}rotateEnd(){return this._getUpdatedState({startRotationX:null,startRotationOrbit:null})}shortestPathFrom(e){let r=e.getViewportProps(),i={...this.getViewportProps()},{rotationOrbit:n}=i;return Math.abs(n-r.rotationOrbit)>180&&(i.rotationOrbit=n<0?n+360:n-360),i}zoomStart({pos:e}){return this._getUpdatedState({startZoomPosition:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:r,scale:i}){let{startZoom:n,startZoomPosition:o}=this.getState();if(o||(n=this.getViewportProps().zoom,o=this._unproject(r)||this._unproject(e)),!o)return this;let s=this._calculateNewZoom({scale:i,startZoom:n}),l=this.makeViewport({...this.getViewportProps(),zoom:s});return this._getUpdatedState({zoom:s,...l.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomPosition:null,startZoom:null})}zoomIn(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:e})})}zoomOut(e=2){return this._getUpdatedState({zoom:this._calculateNewZoom({scale:1/e})})}moveLeft(e=50){return this._panFromCenter([-e,0])}moveRight(e=50){return this._panFromCenter([e,0])}moveUp(e=50){return this._panFromCenter([0,-e])}moveDown(e=50){return this._panFromCenter([0,e])}rotateLeft(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit-e})}rotateRight(e=15){return this._getUpdatedState({rotationOrbit:this.getViewportProps().rotationOrbit+e})}rotateUp(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX-e})}rotateDown(e=10){return this._getUpdatedState({rotationX:this.getViewportProps().rotationX+e})}_unproject(e){let r=this.makeViewport(this.getViewportProps());return e&&r.unproject(e)}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=r+Math.log2(e);return Zn(o,n,i)}_panFromCenter(e){let{width:r,height:i,target:n}=this.getViewportProps();return this.pan({startPosition:n,pos:[r/2+e[0],i/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...e})}applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n,maxRotationX:o,minRotationX:s,rotationOrbit:l}=e;return e.zoom=Array.isArray(n)?[Zn(n[0],i,r),Zn(n[1],i,r)]:Zn(n,i,r),e.rotationX=Zn(e.rotationX,s,o),(l<-180||l>180)&&(e.rotationOrbit=mm(l+180,360)-180),e}},Om=class extends rc{constructor(){super(...arguments),this.ControllerState=I1,this.transition={transitionDuration:300,transitionInterpolator:new wl({transitionProps:{compare:["target","zoom","rotationX","rotationOrbit"],required:["target","zoom"]}})}}};var _O=class extends tc{constructor(e={}){super(e),this.props.orbitAxis=e.orbitAxis||"Z"}get ViewportType(){return Mm}get ControllerType(){return Om}},P1=_O;(()=>{_O.displayName="OrbitView"})();var yO=class extends I1{constructor(e){super(e),this.zoomAxis=e.zoomAxis||"all"}_calculateNewZoom({scale:e,startZoom:r}){let{maxZoom:i,minZoom:n}=this.getViewportProps();r===void 0&&(r=this.getViewportProps().zoom);let o=Math.log2(e);if(Array.isArray(r)){let[s,l]=r;switch(this.zoomAxis){case"X":s=Zn(s+o,n,i);break;case"Y":l=Zn(l+o,n,i);break;default:let u=Math.min(s+o,l+o);u<n&&(o+=n-u),u=Math.max(s+o,l+o),u>i&&(o+=i-u),s+=o,l+=o}return[s,l]}return Zn(r+o,n,i)}},Dm=class extends rc{constructor(){super(...arguments),this.ControllerState=yO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["target","zoom"])},this.dragMode="pan"}_onPanRotate(){return!1}};var vO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Im}get ControllerType(){return Dm}},R1=vO;(()=>{vO.displayName="OrthographicView"})();var xO=class extends s1{applyConstraints(e){let{maxZoom:r,minZoom:i,zoom:n}=e;e.zoom=Zn(n,i,r);let{longitude:o,latitude:s}=e;return(o<-180||o>180)&&(e.longitude=mm(o+180,360)-180),e.latitude=Zn(s,-89,89),e}},Lm=class extends rc{constructor(){super(...arguments),this.ControllerState=xO,this.transition={transitionDuration:300,transitionInterpolator:new wl(["longitude","latitude","zoom"])},this.dragMode="pan"}setProps(e){super.setProps(e),this.dragRotate=!1,this.touchRotate=!1}};var bO=class extends tc{constructor(e={}){super(e)}get ViewportType(){return Rp}get ControllerType(){return Lm}},B1=bO;(()=>{bO.displayName="GlobeView"})();var LE=class{static get componentName(){return Object.prototype.hasOwnProperty.call(this,"extensionName")?this.extensionName:""}constructor(e){e&&(this.opts=e)}equals(e){return this===e?!0:this.constructor===e.constructor&&Ls(this.opts,e.opts,1)}getShaders(e){return null}getSubLayerProps(e){let{defaultProps:r}=e.constructor,i={updateTriggers:{}};for(let n in r)if(n in this.props){let o=r[n],s=this.props[n];i[n]=s,o&&o.type==="accessor"&&(i.updateTriggers[n]=this.props.updateTriggers[n],typeof s=="function"&&(i[n]=this.getSubLayerAccessor(s)))}return i}initializeState(e,r){}updateState(e,r){}onNeedsRedraw(e){}getNeedsPickingBuffer(e){return!1}draw(e,r){}finalizeState(e,r){}},Fm=LE;(()=>{LE.defaultProps={}})(),(()=>{LE.extensionName="LayerExtension"})();var wO={bearing:0,pitch:0,position:[0,0,0]},Ghe={speed:1.2,curve:1.414},O1=class extends Sp{constructor(e={}){super({compare:["longitude","latitude","zoom","bearing","pitch","position"],extract:["width","height","longitude","latitude","zoom","bearing","pitch","position"],required:["width","height","latitude","longitude","zoom"]}),this.opts={...Ghe,...e}}interpolateProps(e,r,i){let n=qB(e,r,i,this.opts);for(let o in wO)n[o]=Oa(e[o]||wO[o],r[o]||wO[o],i);return n}getDuration(e,r){let{transitionDuration:i}=r;return i==="auto"&&(i=XB(e,r,this.opts)),i}};var Bp=class{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;let{attributes:r={}}=e;this.typedArrayManager=bf,this.attributes={},this._attributeDefs=r,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);let{data:r,buffers:i={},getGeometry:n,geometryBuffer:o,positionFormat:s,dataChanged:l,normalize:u=!0}=this.opts;if(this.data=r,this.getGeometry=n,this.positionSize=o&&o.size||(s==="XY"?2:3),this.buffers=i,this.normalize=u,o&&(os(r.startIndices),this.getGeometry=this.getGeometryFromBuffer(o),u||(i.vertexPositions=o)),this.geometryBuffer=i.vertexPositions,Array.isArray(l))for(let h of l)this._rebuildGeometry(h);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:r}){this._rebuildGeometry({startRow:e,endRow:r})}getGeometryFromBuffer(e){let r=e.value||e;return ArrayBuffer.isView(r)?bE(r,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,r){let{attributes:i,buffers:n,_attributeDefs:o,typedArrayManager:s}=this;for(let l in o)if(l in n)s.release(i[l]),i[l]=null;else{let u=o[l];u.copy=r,i[l]=s.allocate(i[l],e,u)}}_forEachGeometry(e,r,i){let{data:n,getGeometry:o}=this,{iterable:s,objectInfo:l}=Js(n,r,i);for(let u of s){l.index++;let h=o?o(u,l):null;e(h,l.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:r,vertexStarts:i,instanceCount:n}=this,{data:o,geometryBuffer:s}=this,{startRow:l=0,endRow:u=1/0}=e||{},h={};if(e||(r=[0],i=[0]),this.normalize||!s)this._forEachGeometry((T,E)=>{let M=T&&this.normalizeGeometry(T);h[E]=M,i[E+1]=i[E]+(M?this.getGeometrySize(M):0)},l,u),n=i[i.length-1];else if(i=o.startIndices,n=i[o.length]||0,ArrayBuffer.isView(s))n=n||s.length/this.positionSize;else if(s instanceof Xi){let T=this.positionSize*4;n=n||s.byteLength/T}else if(s.buffer){let T=s.stride||this.positionSize*4;n=n||s.buffer.byteLength/T}else if(s.value){let T=s.value,E=s.stride/T.BYTES_PER_ELEMENT||this.positionSize;n=n||T.length/E}this._allocate(n,Boolean(e)),this.indexStarts=r,this.vertexStarts=i,this.instanceCount=n;let v={};this._forEachGeometry((T,E)=>{let M=h[E]||T;v.vertexStart=i[E],v.indexStart=r[E];let O=E<i.length-1?i[E+1]:n;v.geometrySize=O-i[E],v.geometryIndex=E,this.updateGeometryAttributes(M,v)},l,u),this.vertexCount=r[r.length-1]}};var TO=85.05113;function SO(t,e,r,i){if(r){if(r.userData._googleMap===t)return r;FE(r)}let n={click:null,rightclick:null,dblclick:null,mousemove:null,mouseout:null},o=new Ip({...i,useDevicePixels:i.interleaved?!0:i.useDevicePixels,style:i.interleaved?null:{pointerEvents:"none"},parent:Whe(e,i.style),views:new Mp({repeat:!0}),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1});for(let s in n)n[s]=t.addListener(s,l=>Xhe(o,s,l));return o.userData._googleMap=t,o.userData._eventListeners=n,o}function Whe(t,e){let r=document.createElement("div");return r.style.position="absolute",Object.assign(r.style,e),"getPanes"in t?t.getPanes()?.overlayLayer.appendChild(r):t.getMap()?.getDiv().appendChild(r),r}function FE(t){let{_eventListeners:e}=t.userData;for(let r in e)e[r]&&e[r].remove();t.finalize()}function L9(t,e){let{width:r,height:i}=F9(t),n=e.getProjection(),o=t.getBounds();if(!o)return{width:r,height:i,left:0,top:0};let s=o.getNorthEast(),l=o.getSouthWest(),u=n.fromLatLngToDivPixel(s),h=n.fromLatLngToDivPixel(l),v=EO(n,r/2,i/2),T=new google.maps.LatLng(0,v[0]),E=n.fromLatLngToContainerPixel(T),M=n.fromLatLngToDivPixel(T);if(!u||!h||!M||!E)return{width:r,height:i,left:0,top:0};let O=Math.round(M.x-E.x),F=M.y-E.y,z=EO(n,r/2,0),W=EO(n,r/2,i),J=v[1],K=v[0];if(Math.abs(J)>TO){J=J>0?TO:-TO;let $=new google.maps.LatLng(J,K),Z=n.fromLatLngToContainerPixel($);F+=Z.y-i/2}F=Math.round(F);let ge=180*new gf(z).sub(W).verticalAngle()/Math.PI;ge<0&&(ge+=360);let H=t.getHeading()||0,me=t.getZoom()-1,fe;if(ge===0)fe=i?(h.y-u.y)/i:1;else if(ge===H){let $=new gf([u.x,u.y]).sub([h.x,h.y]).len(),Z=new gf([r,-i]).len();fe=Z?$/Z:1}return me+=Math.log2(fe||1),{width:r,height:i,left:O,top:F,zoom:me,bearing:ge,pitch:t.getTilt(),latitude:J,longitude:K}}function CO(t,e){let{width:r,height:i}=F9(t),{center:n,heading:o,tilt:s,zoom:l}=e.getCameraParams(),u=25,h=i?r/i:1,v=.75,T=3e14,E=new Kr().perspective({fovy:u*Math.PI/180,aspect:h,near:v,far:T}),M=.5*E[5];return{width:r,height:i,viewState:{altitude:M,bearing:o,latitude:n.lat(),longitude:n.lng(),pitch:s,projectionMatrix:E,repeat:!0,zoom:l-1}}}function F9(t){let e=t.getDiv().firstChild;return{width:e.offsetWidth,height:e.offsetHeight}}function EO(t,e,r){let i=new google.maps.Point(e,r),n=t.fromContainerPixelToLatLng(i);return[n.lng(),n.lat()]}function qhe(t,e){if(t.pixel)return t.pixel;let r=e.getViewports()[0].project([t.latLng.lng(),t.latLng.lat()]);return{x:r[0],y:r[1]}}function Xhe(t,e,r){if(!t.isInitialized)return;let i={type:e,offsetCenter:qhe(r,t),srcEvent:r};switch(e){case"click":case"rightclick":i.type="click",i.tapCount=1,t._onPointerDown(i),t._onEvent(i);break;case"dblclick":i.type="click",i.tapCount=2,t._onEvent(i);break;case"mousemove":i.type="pointermove",t._onPointerMove(i);break;case"mouseout":i.type="pointerleave",t._onPointerMove(i);break;default:return}}var Yhe=()=>!1,Khe={depthMask:!0,depthTest:!0,blend:!0,blendFunc:[770,771,1,771],blendEquation:32774};function N9(){}var Zhe={interleaved:!0},Nm=class{constructor(e){this.props={},this._map=null,this._deck=null,this._overlay=null,this.setProps({...Zhe,...e})}setMap(e){if(e===this._map)return;let{VECTOR:r,UNINITIALIZED:i}=google.maps.RenderingType;this._map&&(!e&&this._map.getRenderingType()===r&&this.props.interleaved&&this._overlay.requestRedraw(),this._overlay?.setMap(null),this._map=null),e&&(this._map=e,e.getRenderingType()!==i?this._createOverlay(e):e.addListener("renderingtype_changed",()=>{this._createOverlay(e)}))}setProps(e){if(Object.assign(this.props,e),this._deck){let r=this._deck.getCanvas();if(e.style&&r?.parentElement){let i=r.parentElement.style;Object.assign(i,e.style),e.style=null}this._deck.setProps(e)}}pickObject(e){return this._deck&&this._deck.pickObject(e)}pickMultipleObjects(e){return this._deck&&this._deck.pickMultipleObjects(e)}pickObjects(e){return this._deck&&this._deck.pickObjects(e)}finalize(){this.setMap(null),this._deck&&(FE(this._deck),this._deck=null)}_createOverlay(e){let{interleaved:r}=this.props,{VECTOR:i,UNINITIALIZED:n}=google.maps.RenderingType,o=e.getRenderingType();if(o===n)return;let l=o===i&&google.maps.WebGLOverlayView?google.maps.WebGLOverlayView:google.maps.OverlayView,u=new l;u instanceof google.maps.WebGLOverlayView?(r?(u.onAdd=N9,u.onContextRestored=this._onContextRestored.bind(this),u.onDraw=this._onDrawVectorInterleaved.bind(this)):(u.onAdd=this._onAdd.bind(this),u.onContextRestored=N9,u.onDraw=this._onDrawVectorOverlay.bind(this)),u.onContextLost=this._onContextLost.bind(this)):(u.onAdd=this._onAdd.bind(this),u.draw=this._onDrawRaster.bind(this)),u.onRemove=this._onRemove.bind(this),this._overlay=u,this._overlay.setMap(e)}_onAdd(){this._deck=SO(this._map,this._overlay,this._deck,this.props)}_onContextRestored({gl:e}){if(!this._map||!this._overlay)return;let r=()=>{this._overlay&&this._overlay.requestRedraw()},i=SO(this._map,this._overlay,this._deck,{gl:e,_customRender:r,...this.props});this._deck=i;let n=i.animationLoop;n._renderFrame=()=>{let o=e.getParameter(34964);i.device.withParametersWebGL({},()=>{n.props.onRender(n.animationProps)}),e.bindBuffer(34962,o)}}_onContextLost(){this._deck&&(FE(this._deck),this._deck=null)}_onRemove(){this._deck?.setProps({layerFilter:Yhe})}_onDrawRaster(){if(!this._deck||!this._map)return;let e=this._deck,{width:r,height:i,left:n,top:o,...s}=L9(this._map,this._overlay),l=e.getCanvas();if(l?.parentElement){let h=l.parentElement.style;h.left=`${n}px`,h.top=`${o}px`}let u=1e4;e.setProps({width:r,height:i,viewState:{altitude:u,...s}}),e.redraw()}_onDrawVectorInterleaved({gl:e,transformer:r}){if(!this._deck||!this._map)return;let i=this._deck;if(i.setProps({...CO(this._map,r),width:null,height:null}),i.isInitialized){let n=i.device,o=n.getParametersWebGL(36006);i.setProps({_framebuffer:o}),n.getCanvasContext().resize(),i.needsRedraw({clearRedrawFlags:!0}),n.setParametersWebGL({viewport:[0,0,e.canvas.width,e.canvas.height],scissor:[0,0,e.canvas.width,e.canvas.height],stencilFunc:[519,0,255,519,0,255]}),n.withParametersWebGL(Khe,()=>{i._drawLayers("google-vector",{clearCanvas:!1})})}}_onDrawVectorOverlay({transformer:e}){if(!this._deck||!this._map)return;let r=this._deck;r.setProps({...CO(this._map,e)}),r.redraw()}};function k9({container:t,onClick:e,onComplete:r,getTooltip:i,googleMapsKey:n,layers:o,mapStyle:s="satellite",initialViewState:l={latitude:0,longitude:0,zoom:1}}){if(!n)return ur.warn("No Google Maps API key set")(),null;let u=new Nm({layers:o}),h={center:{lat:l.latitude,lng:l.longitude},mapTypeId:s,zoom:l.zoom},v=new window.google.maps.Map(t,h);return u.setMap(v),u}var U9={position:"absolute",top:"0px",left:"0px",width:344,padding:"12px 24px",margin:24,overflowX:"hidden",overflowY:"overlay",outline:"none",maxHeight:"94%",boxSizing:"border-box",backgroundColor:"rgb(255, 255, 255)",fontFamily:'"Fira Sans", sans-serif',zIndex:1};var MO=class{constructor({container:e,props:r}){let{description:i}=r,n=document.createElement("div");n.className="deck-json-description-box",Object.assign(n.style,U9),this.el=n;let o=document.createElement("div");o.innerHTML=i,n.appendChild(o),e.append(n)}remove(){this.el.remove(),this.description=null}static get stringName(){return"description"}},z9=MO;function IO(t,e){let r=document.createElement("div");r.className="deckgl-ui-elements-overlay",r.style.zIndex=1,t.insertAdjacentElement("beforebegin",r);let i=[];for(let n of Object.keys(e))switch(n){case"description":let o=new z9({container:r,props:e});i.push(o);break;default:break}return i}var Kb={};As(Kb,{AGGREGATION_OPERATION:()=>Wo,AmbientLight:()=>s_,ArcLayer:()=>km,Attribute:()=>Pp,AttributeManager:()=>Mf,BitmapLayer:()=>Um,COORDINATE_SYSTEM:()=>Zr,CPUGridLayer:()=>Jd,ColumnLayer:()=>If,CompositeLayer:()=>es,ContourLayer:()=>sb,Controller:()=>rc,Deck:()=>Ip,DeckRenderer:()=>bm,DirectionalLight:()=>vp,FirstPersonController:()=>Bm,FirstPersonView:()=>M1,FirstPersonViewport:()=>Pm,FlyToInterpolator:()=>O1,GPUGridLayer:()=>Qd,GeoJsonLayer:()=>Oh,GeohashLayer:()=>qb,GoogleMapsOverlay:()=>Nm,GreatCircleLayer:()=>mb,GridCellLayer:()=>Wm,GridLayer:()=>lb,H3ClusterLayer:()=>Sb,H3HexagonLayer:()=>og,HeatmapLayer:()=>ub,HexagonLayer:()=>nb,IconLayer:()=>Op,JSONConfiguration:()=>Xp,JSONConverter:()=>vg,Layer:()=>Dn,LayerExtension:()=>Fm,LayerManager:()=>ym,LightingEffect:()=>zd,LineLayer:()=>zm,LinearInterpolator:()=>wl,MVTLayer:()=>Wb,MapController:()=>xm,MapView:()=>Mp,OPERATION:()=>oV,OrbitController:()=>Om,OrbitView:()=>P1,OrbitViewport:()=>Mm,OrthographicController:()=>Dm,OrthographicView:()=>R1,OrthographicViewport:()=>Im,PathLayer:()=>Pf,PointCloudLayer:()=>Vm,PointLight:()=>c_,PolygonLayer:()=>Bf,PostProcessEffect:()=>e1,QuadkeyLayer:()=>yb,S2Layer:()=>_b,ScatterplotLayer:()=>jm,ScenegraphLayer:()=>cg,ScreenGridLayer:()=>ib,SimpleMeshLayer:()=>Nh,SolidPolygonLayer:()=>Rf,TRANSITION_EVENTS:()=>n1,TerrainLayer:()=>Hb,Tesselator:()=>Bp,TextLayer:()=>Zm,Tile3DLayer:()=>Ub,TileLayer:()=>Fh,TransitionInterpolator:()=>Sp,Transport:()=>zh,TripsLayer:()=>wb,UNIT:()=>ms,VERSION:()=>xT,View:()=>tc,Viewport:()=>bl,WebMercatorViewport:()=>Ec,_AggregationLayer:()=>$c,_BinSorter:()=>Dp,_CPUAggregator:()=>Fp,_CameraLight:()=>qx,_Component:()=>Sm,_ComponentState:()=>Cm,_GPUGridAggregator:()=>Fa,_GeoCellLayer:()=>eu,_GlobeController:()=>Lm,_GlobeView:()=>B1,_GlobeViewport:()=>Rp,_LayersPass:()=>xf,_MultiIconLayer:()=>Xm,_PickLayersPass:()=>bp,_SunLight:()=>Xx,_TextBackgroundLayer:()=>Km,_Tile2DHeader:()=>tg,_Tileset2D:()=>rg,_WMSLayer:()=>US,_compareProps:()=>m_,_convertFunctions:()=>Ay,_count:()=>IE,_deepEqual:()=>Ls,_fillArray:()=>AE,_flatten:()=>Rh,_getURLFromTemplate:()=>Lh,_memoize:()=>Nu,_mergeShaders:()=>Em,_parseExpressionString:()=>yg,_shallowEqualObjects:()=>HY,assert:()=>os,createIterable:()=>Js,fp64LowPart:()=>Vd,getShaderAssembler:()=>o_,gouraudLighting:()=>Fu,log:()=>ur,phongLighting:()=>Nd,picking:()=>go,project:()=>kd,project32:()=>no,shadow:()=>n_});var V9=`#version 300 es
1772
1772
  #define SHADER_NAME arc-layer-vertex-shader
1773
1773
  in vec3 positions;
1774
1774
  in vec4 instanceSourceColors;
@@ -2815,7 +2815,7 @@ void main(void) {
2815
2815
  fragColor = vColor;
2816
2816
  DECKGL_FILTER_COLOR(fragColor, geometry);
2817
2817
  }
2818
- `;var aS=[0,0,0,255],Ade={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:aS},getLineColor:{type:"accessor",value:aS},material:!0},sS={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},lS=class extends Dn{getShaders(e){return super.getShaders({vs:e==="top"?Nj:kj,fs:Uj,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[no,Fu,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:r}=this.props,{_full3d:i}=this.props;e.isGeospatial&&r===Zr.DEFAULT&&(r=Zr.LNGLAT);let n;r===Zr.LNGLAT&&(i?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new J1({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let o=this.getAttributeManager(),s=!0;o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},vertexPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:sS,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{instancePositions:{vertexOffset:0,divisor:1},instanceNextPositions:{vertexOffset:1,divisor:1}}},instanceVertexValid:{size:1,type:"uint16",divisor:1,update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,transition:sS,accessor:"getElevation",shaderAttributes:{instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:sS,accessor:"getFillColor",defaultValue:aS,shaderAttributes:{instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:sS,accessor:"getLineColor",defaultValue:aS,shaderAttributes:{instanceLineColors:{divisor:1}}},pickingColors:{size:4,type:"uint8",accessor:(l,{index:u,target:h})=>this.encodePickingColor(l&&l.__source?l.__source.index:u,h),shaderAttributes:{instancePickingColors:{divisor:1}}}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:r,filled:i,wireframe:n,elevationScale:o}=this.props,{topModel:s,sideModel:l,wireframeModel:u,polygonTesselator:h}=this.state,v={...e,extruded:Boolean(r),elevationScale:o};u&&n&&(u.setInstanceCount(h.instanceCount-1),u.setUniforms(v),u.draw(this.context.renderPass)),l&&i&&(l.setInstanceCount(h.instanceCount-1),l.setUniforms(v),l.draw(this.context.renderPass)),s&&i&&(s.setVertexCount(h.vertexCount),s.setUniforms(v),s.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),o.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:o}=this.state,s=e.data.attributes||{};o.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:s.getPolygon,buffers:s,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,o,s,l=this.getAttributeManager().getBufferLayouts();if(r){let u=this.getShaders("top");u.defines.NON_INSTANCED_MODEL=1,n=new Ni(this.context.device,{...u,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:l,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}return i&&(o=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:l,uniforms:{isWireframe:!1},geometry:new Mn({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:1,userData:{excludeAttributes:{indices:!0}}}),s=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:l,uniforms:{isWireframe:!0},geometry:new Mn({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:1,userData:{excludeAttributes:{indices:!0}}})),{models:[o,s,n].filter(Boolean),topModel:n,sideModel:o,wireframeModel:s}}calculateIndices(e){let{polygonTesselator:r}=this.state;e.startIndices=r.indexStarts,e.value=r.get("indices")}calculatePositions(e){let{polygonTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}},Rf=lS;(()=>{lS.defaultProps=Ade})(),(()=>{lS.layerName="SolidPolygonLayer"})();function cS({data:t,getIndex:e,dataRange:r,replace:i}){let{startRow:n=0,endRow:o=1/0}=r,s=t.length,l=s,u=s;for(let E=0;E<s;E++){let M=e(t[E]);if(l>E&&M>=n&&(l=E),M>=o){u=E;break}}let h=l,T=u-l!==i.length?t.slice(u):void 0;for(let E=0;E<i.length;E++)t[h++]=i[E];if(T){for(let E=0;E<T.length;E++)t[h++]=T[E];t.length=h}return{startRow:l,endRow:l+i.length}}var zj=[0,0,0,255],mde=[0,0,0,255],gde={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:mde},getLineColor:{type:"accessor",value:zj},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},uS=class extends es{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&ur.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(r&&Array.isArray(e.dataChanged)){let i=this.state.paths.slice(),n=e.dataChanged.map(o=>cS({data:i,getIndex:s=>s.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:i,pathsDiff:n})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:o}=this.props,s=[],l=n==="XY"?2:3,{startRow:u,endRow:h}=e,{iterable:v,objectInfo:T}=Js(r,u,h);for(let E of v){T.index++;let M=i(E,T);o&&(M=nS(M,l));let{holeIndices:O}=M,F=M.positions||M;if(O)for(let z=0;z<=O.length;z++){let W=F.slice(O[z-1]||0,O[z]||F.length);s.push(this.getSubLayerRow({path:W},E,T.index))}else s.push(this.getSubLayerRow({path:F},E,T.index))}return s}renderLayers(){let{data:e,_dataDiff:r,stroked:i,filled:n,extruded:o,wireframe:s,_normalize:l,_windingOrder:u,elevationScale:h,transitions:v,positionFormat:T}=this.props,{lineWidthUnits:E,lineWidthScale:M,lineWidthMinPixels:O,lineWidthMaxPixels:F,lineJointRounded:z,lineMiterLimit:W,lineDashJustified:J}=this.props,{getFillColor:K,getLineColor:ne,getLineWidth:ge,getLineDashArray:H,getElevation:me,getPolygon:fe,updateTriggers:$,material:Z}=this.props,{paths:we,pathsDiff:Oe}=this.state,he=this.getSubLayerClass("fill",Rf),Le=this.getSubLayerClass("stroke",Pf),ft=this.shouldRenderSubLayer("fill",we)&&new he({_dataDiff:r,extruded:o,elevationScale:h,filled:n,wireframe:s,_normalize:l,_windingOrder:u,getElevation:me,getFillColor:K,getLineColor:o&&s?ne:zj,material:Z,transitions:v},this.getSubLayerProps({id:"fill",updateTriggers:$&&{getPolygon:$.getPolygon,getElevation:$.getElevation,getFillColor:$.getFillColor,lineColors:o&&s,getLineColor:$.getLineColor}}),{data:e,positionFormat:T,getPolygon:fe}),Vt=!o&&i&&this.shouldRenderSubLayer("stroke",we)&&new Le({_dataDiff:Oe&&(()=>Oe),widthUnits:E,widthScale:M,widthMinPixels:O,widthMaxPixels:F,jointRounded:z,miterLimit:W,dashJustified:J,_pathType:"loop",transitions:v&&{getWidth:v.getLineWidth,getColor:v.getLineColor,getPath:v.getPolygon},getColor:this.getSubLayerAccessor(ne),getWidth:this.getSubLayerAccessor(ge),getDashArray:this.getSubLayerAccessor(H)},this.getSubLayerProps({id:"stroke",updateTriggers:$&&{getWidth:$.getLineWidth,getColor:$.getLineColor,getDashArray:$.getLineDashArray}}),{data:we,positionFormat:T,getPath:Yt=>Yt.path});return[!o&&ft,Vt,o&&ft]}},Bf=uS;(()=>{uS.layerName="PolygonLayer"})(),(()=>{uS.defaultProps=gde})();function Vj(t,e){if(!t)return null;let r="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[r];return r!==-1?_de(t,i,r):null}function _de(t,e,r){let i={properties:{...t.properties[e]}};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[r];return i}function jj(t,e){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let o=[];for(let s=0;s<n.length;s++)e(n[s],o),r[i][s*3+0]=o[0],r[i][s*3+1]=o[1],r[i][s*3+2]=o[2]}return r}var Hj=`#version 300 es
2818
+ `;var aS=[0,0,0,255],Ade={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:aS},getLineColor:{type:"accessor",value:aS},material:!0},sS={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t},lS=class extends Dn{getShaders(e){return super.getShaders({vs:e==="top"?Nj:kj,fs:Uj,defines:{RING_WINDING_ORDER_CW:!this.props._normalize&&this.props._windingOrder==="CCW"?0:1},modules:[no,Fu,go]})}get wrapLongitude(){return!1}getBounds(){return this.getAttributeManager()?.getBounds(["vertexPositions"])}initializeState(){let{viewport:e}=this.context,{coordinateSystem:r}=this.props,{_full3d:i}=this.props;e.isGeospatial&&r===Zr.DEFAULT&&(r=Zr.LNGLAT);let n;r===Zr.LNGLAT&&(i?n=e.projectPosition.bind(e):n=e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new J1({preproject:n,fp64:this.use64bitPositions(),IndexType:Uint32Array})});let o=this.getAttributeManager(),s=!0;o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},vertexPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:sS,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{instancePositions:{vertexOffset:0,divisor:1},instanceNextPositions:{vertexOffset:1,divisor:1}}},instanceVertexValid:{size:1,type:"uint16",divisor:1,update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,transition:sS,accessor:"getElevation",shaderAttributes:{instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:sS,accessor:"getFillColor",defaultValue:aS,shaderAttributes:{instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:sS,accessor:"getLineColor",defaultValue:aS,shaderAttributes:{instanceLineColors:{divisor:1}}},pickingColors:{size:4,type:"uint8",accessor:(l,{index:u,target:h})=>this.encodePickingColor(l&&l.__source?l.__source.index:u,h),shaderAttributes:{instancePickingColors:{divisor:1}}}})}getPickingInfo(e){let r=super.getPickingInfo(e),{index:i}=r,n=this.props.data;return n[0]&&n[0].__source&&(r.object=n.find(o=>o.__source.index===i)),r}disablePickingIndex(e){let r=this.props.data;if(r[0]&&r[0].__source)for(let i=0;i<r.length;i++)r[i].__source.index===e&&this._disablePickingIndex(i);else super.disablePickingIndex(e)}draw({uniforms:e}){let{extruded:r,filled:i,wireframe:n,elevationScale:o}=this.props,{topModel:s,sideModel:l,wireframeModel:u,polygonTesselator:h}=this.state,v={...e,extruded:Boolean(r),elevationScale:o};u&&n&&(u.setInstanceCount(h.instanceCount-1),u.setUniforms(v),u.draw(this.context.renderPass)),l&&i&&(l.setInstanceCount(h.instanceCount-1),l.setUniforms(v),l.draw(this.context.renderPass)),s&&i&&(s.setVertexCount(h.vertexCount),s.setUniforms(v),s.draw(this.context.renderPass))}updateState(e){super.updateState(e),this.updateGeometry(e);let{props:r,oldProps:i,changeFlags:n}=e,o=this.getAttributeManager();(n.extensionsChanged||r.filled!==i.filled||r.extruded!==i.extruded)&&(this.state.models?.forEach(l=>l.destroy()),this.setState(this._getModels()),o.invalidateAll())}updateGeometry({props:e,oldProps:r,changeFlags:i}){if(i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPolygon)){let{polygonTesselator:o}=this.state,s=e.data.attributes||{};o.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:s.getPolygon,buffers:s,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:i.dataChanged,full3d:e._full3d}),this.setState({numInstances:o.instanceCount,startIndices:o.vertexStarts}),i.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(){let{id:e,filled:r,extruded:i}=this.props,n,o,s,l=this.getAttributeManager().getBufferLayouts();if(r){let u=this.getShaders("top");u.defines.NON_INSTANCED_MODEL=1,n=new Ni(this.context.device,{...u,id:`${e}-top`,topology:"triangle-list",uniforms:{isWireframe:!1},bufferLayout:l,isIndexed:!0,userData:{excludeAttributes:{instanceVertexValid:!0}}})}return i&&(o=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-side`,bufferLayout:l,uniforms:{isWireframe:!1},geometry:new Mn({topology:"triangle-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,1,1,0,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}}),s=new Ni(this.context.device,{...this.getShaders("side"),id:`${e}-wireframe`,bufferLayout:l,uniforms:{isWireframe:!0},geometry:new Mn({topology:"line-strip",attributes:{positions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),isInstanced:!0,userData:{excludeAttributes:{indices:!0}}})),{models:[o,s,n].filter(Boolean),topModel:n,sideModel:o,wireframeModel:s}}calculateIndices(e){let{polygonTesselator:r}=this.state;e.startIndices=r.indexStarts,e.value=r.get("indices")}calculatePositions(e){let{polygonTesselator:r}=this.state;e.startIndices=r.vertexStarts,e.value=r.get("positions")}calculateVertexValid(e){e.value=this.state.polygonTesselator.get("vertexValid")}},Rf=lS;(()=>{lS.defaultProps=Ade})(),(()=>{lS.layerName="SolidPolygonLayer"})();function cS({data:t,getIndex:e,dataRange:r,replace:i}){let{startRow:n=0,endRow:o=1/0}=r,s=t.length,l=s,u=s;for(let E=0;E<s;E++){let M=e(t[E]);if(l>E&&M>=n&&(l=E),M>=o){u=E;break}}let h=l,T=u-l!==i.length?t.slice(u):void 0;for(let E=0;E<i.length;E++)t[h++]=i[E];if(T){for(let E=0;E<T.length;E++)t[h++]=T[E];t.length=h}return{startRow:l,endRow:l+i.length}}var zj=[0,0,0,255],mde=[0,0,0,255],gde={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:t=>t.polygon},getFillColor:{type:"accessor",value:mde},getLineColor:{type:"accessor",value:zj},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0},uS=class extends es{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&ur.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:e}){let r=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getPolygon);if(r&&Array.isArray(e.dataChanged)){let i=this.state.paths.slice(),n=e.dataChanged.map(o=>cS({data:i,getIndex:s=>s.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:i,pathsDiff:n})}else r&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(e={}){let{data:r,getPolygon:i,positionFormat:n,_normalize:o}=this.props,s=[],l=n==="XY"?2:3,{startRow:u,endRow:h}=e,{iterable:v,objectInfo:T}=Js(r,u,h);for(let E of v){T.index++;let M=i(E,T);o&&(M=nS(M,l));let{holeIndices:O}=M,F=M.positions||M;if(O)for(let z=0;z<=O.length;z++){let W=F.slice(O[z-1]||0,O[z]||F.length);s.push(this.getSubLayerRow({path:W},E,T.index))}else s.push(this.getSubLayerRow({path:F},E,T.index))}return s}renderLayers(){let{data:e,_dataDiff:r,stroked:i,filled:n,extruded:o,wireframe:s,_normalize:l,_windingOrder:u,elevationScale:h,transitions:v,positionFormat:T}=this.props,{lineWidthUnits:E,lineWidthScale:M,lineWidthMinPixels:O,lineWidthMaxPixels:F,lineJointRounded:z,lineMiterLimit:W,lineDashJustified:J}=this.props,{getFillColor:K,getLineColor:ne,getLineWidth:ge,getLineDashArray:H,getElevation:me,getPolygon:fe,updateTriggers:$,material:Z}=this.props,{paths:we,pathsDiff:Oe}=this.state,he=this.getSubLayerClass("fill",Rf),Le=this.getSubLayerClass("stroke",Pf),ft=this.shouldRenderSubLayer("fill",we)&&new he({_dataDiff:r,extruded:o,elevationScale:h,filled:n,wireframe:s,_normalize:l,_windingOrder:u,getElevation:me,getFillColor:K,getLineColor:o&&s?ne:zj,material:Z,transitions:v},this.getSubLayerProps({id:"fill",updateTriggers:$&&{getPolygon:$.getPolygon,getElevation:$.getElevation,getFillColor:$.getFillColor,lineColors:o&&s,getLineColor:$.getLineColor}}),{data:e,positionFormat:T,getPolygon:fe}),Vt=!o&&i&&this.shouldRenderSubLayer("stroke",we)&&new Le({_dataDiff:Oe&&(()=>Oe),widthUnits:E,widthScale:M,widthMinPixels:O,widthMaxPixels:F,jointRounded:z,miterLimit:W,dashJustified:J,_pathType:"loop",transitions:v&&{getWidth:v.getLineWidth,getColor:v.getLineColor,getPath:v.getPolygon},getColor:this.getSubLayerAccessor(ne),getWidth:this.getSubLayerAccessor(ge),getDashArray:this.getSubLayerAccessor(H)},this.getSubLayerProps({id:"stroke",updateTriggers:$&&{getWidth:$.getLineWidth,getColor:$.getLineColor,getDashArray:$.getLineDashArray}}),{data:we,positionFormat:T,getPath:Yt=>Yt.path});return[!o&&ft,Vt,o&&ft]}},Bf=uS;(()=>{uS.layerName="PolygonLayer"})(),(()=>{uS.defaultProps=gde})();function Vj(t,e){if(!t)return null;let r="startIndices"in t?t.startIndices[e]:e,i=t.featureIds.value[r];return r!==-1?_de(t,i,r):null}function _de(t,e,r){let i={properties:{...t.properties[e]}};for(let n in t.numericProps)i.properties[n]=t.numericProps[n].value[r];return i}function jj(t,e){let r={points:null,lines:null,polygons:null};for(let i in r){let n=t[i].globalFeatureIds.value;r[i]=new Uint8ClampedArray(n.length*3);let o=[];for(let s=0;s<n.length;s++)e(n[s],o),r[i][s*3+0]=o[0],r[i][s*3+1]=o[1],r[i][s*3+2]=o[2]}return r}var Hj=`#version 300 es
2819
2819
  #define SHADER_NAME multi-icon-layer-fragment-shader
2820
2820
  precision highp float;
2821
2821
  uniform float opacity;
@@ -3104,7 +3104,7 @@ discard;
3104
3104
  fragColor = vColor;
3105
3105
  DECKGL_FILTER_COLOR(fragColor, geometry);
3106
3106
  }
3107
- `;var Jde=[0,0,0,0],Qde=[0,255,0,255],$de=["minColor","maxColor","colorRange","colorDomain"],eAe={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ju},yS=class extends Dn{getShaders(){return{vs:EH,fs:SH,modules:[go]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e);let{oldProps:r,props:i,changeFlags:n}=e,o=this.getAttributeManager();i.numInstances!==r.numInstances?o.invalidateAll():r.cellSizePixels!==i.cellSizePixels&&o.invalidate("instancePositions"),this._updateUniforms(r,i,n)}draw({uniforms:e}){let{parameters:r,maxTexture:i}=this.props,n=this.props.minColor||Jde,o=this.props.maxColor||Qde,s=this.props.colorDomain||[1,0],l=this.state.model;l.setUniforms(e),l.setBindings({maxTexture:i}),l.setUniforms({minColor:n,maxColor:o,colorDomain:s}),l.setParameters({depthWriteEnabled:!1,...r}),l.draw(this.context.renderPass)}calculateInstancePositions(e,{numInstances:r}){let{width:i,height:n}=this.context.viewport,{cellSizePixels:o}=this.props,s=Math.ceil(i/o),{value:l,size:u}=e;for(let h=0;h<r;h++){let v=h%s,T=Math.floor(h/s);l[h*u+0]=v*o/i*2-1,l[h*u+1]=1-T*o/n*2,l[h*u+2]=0}}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Mn({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:e,maxColor:r,colorDomain:i,colorRange:n}=this.props;return e||r?(ur.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||n)}_updateUniforms(e,r,i){let n=this.state.model;if($de.some(o=>e[o]!==r[o])&&n.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),e.colorRange!==r.colorRange&&n.setUniforms({colorRange:Zd(r.colorRange)}),e.cellMarginPixels!==r.cellMarginPixels||e.cellSizePixels!==r.cellSizePixels||i.viewportChanged){let{width:o,height:s}=this.context.viewport,{cellSizePixels:l,cellMarginPixels:u}=this.props,h=l>u?u:0,v=new Float32Array([(l-h)/o*2,-(l-h)/s*2,1]);n.setUniforms({cellScale:v})}}},S_=yS;(()=>{yS.layerName="ScreenGridCellLayer"})(),(()=>{yS.defaultProps=eAe})();function CH(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}var YO=class extends es{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:CH(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:r}=e;if(r.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:r,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:r,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,r={}){let{props:i,oldProps:n,changeFlags:o}=e,{compareAll:s=!1,dimension:l}=r,{ignoreProps:u}=this.state,{props:h,accessors:v=[]}=l,{updateTriggersChanged:T}=o;if(o.dataChanged)return!0;if(T){if(T.all)return!0;for(let E of v)if(T[E])return!0}if(s)return o.extensionsChanged?!0:m_({oldProps:n,newProps:i,ignoreProps:u,propTypes:this.constructor._propTypes});for(let E of h)if(i[E]!==n[E])return!0;return!1}isAttributeChanged(e){let{changedAttributes:r}=this.state;return e?r&&r[e]!==void 0:!tAe(r)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}},$c=YO;(()=>{YO.layerName="AggregationLayer"})();function tAe(t){let e=!0;for(let r in t){e=!1;break}return e}function vS(t,e,r){let i=r;return i.domain=()=>t,i.range=()=>e,i}function MH(t,e){return vS(t,e,i=>cAe(t,e,i))}function rAe(t,e){return vS(t,e,i=>uAe(t,e,i))}function iAe(t,e){let r=t.sort(IH),i=0,n=Math.max(1,e.length),o=new Array(n-1);for(;++i<n;)o[i-1]=nAe(r,i/n);let s=l=>sAe(o,e,l);return s.thresholds=()=>o,vS(t,e,s)}function IH(t,e){return t-e}function nAe(t,e){let r=t.length;if(e<=0||r<2)return t[0];if(e>=1)return t[r-1];let i=(r-1)*e,n=Math.floor(i),o=t[n],s=t[n+1];return o+(s-o)*(i-n)}function oAe(t,e){let r=0,i=t.length;for(;r<i;){let n=r+i>>>1;IH(t[n],e)>0?i=n:r=n+1}return r}function sAe(t,e,r){return e[oAe(t,r)]}function aAe(t,e,r,i){let n=`${i}`,o=e.get(n);return o===void 0&&(o=t.push(i),e.set(n,o)),r[(o-1)%r.length]}function lAe(t,e){let r=new Map,i=[];for(let o of t){let s=`${o}`;r.has(s)||r.set(s,i.push(o))}return vS(t,e,o=>aAe(i,r,e,o))}function cAe(t,e,r){let i=t[1]-t[0];if(i<=0)return ur.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];let n=i/e.length,o=Math.floor((r-t[0])/n),s=Math.max(Math.min(o,e.length-1),0);return e[s]}function uAe(t,e,r){return(r-t[0])/(t[1]-t[0])*(e[1]-e[0])+e[0]}function PH(t){return t!=null}function fAe(t){let e=[];return t.forEach(r=>{!e.includes(r)&&PH(r)&&e.push(r)}),e}function RH(t,e){return(typeof e=="function"?t.map(e):t).filter(PH)}function BH(t,e){return RH(t,e)}function OH(t,e){return fAe(RH(t,e))}function DH(t,e,r){return Math.max(e,Math.min(r,t))}function LH(t){switch(t){case"quantize":return MH;case"linear":return rAe;case"quantile":return iAe;case"ordinal":return lAe;default:return MH}}var NH=t=>t.length,hAe=3402823466e29,kH=t=>t.points,UH=t=>t.index,FH=(t,e)=>t<e?-1:t>e?1:t>=e?0:NaN,pAe={getValue:NH,getPoints:kH,getIndex:UH,filterData:null},Dp=class{constructor(e=[],r=pAe){this.aggregatedBins=this.getAggregatedBins(e,r),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(e,r){let{getValue:i=NH,getPoints:n=kH,getIndex:o=UH,filterData:s}=r,l=typeof s=="function",u=e.length,h=[],v=0;for(let T=0;T<u;T++){let E=e[T],M=n(E),O=o(E),F=l?M.filter(s):M;E.filteredPoints=l?F:null;let z=F.length?i(F):null;z!=null&&(h[v]={i:Number.isFinite(O)?O:T,value:z,counts:F.length},v++)}return h}_percentileToIndex(e){let r=this.sortedBins.length;if(r<2)return[0,0];let[i,n]=e.map(l=>DH(l,0,100)),o=Math.ceil(i/100*(r-1)),s=Math.floor(n/100*(r-1));return[o,s]}getBinMap(){let e={};for(let r of this.aggregatedBins)e[r.i]=r;return e}_updateMinMaxValues(){let e=0,r=0,i=hAe,n=0;for(let o of this.aggregatedBins)e=e>o.counts?e:o.counts,r=r>o.value?r:o.value,i=i<o.value?i:o.value,n+=o.counts;this.maxCount=e,this.maxValue=r,this.minValue=i,this.totalCount=n}getValueRange(e){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((n,o)=>FH(n.value,o.value))),!this.sortedBins.length)return[];let r=0,i=this.sortedBins.length-1;if(Array.isArray(e)){let n=this._percentileToIndex(e);r=n[0],i=n[1]}return[this.sortedBins[r].value,this.sortedBins[i].value]}getValueDomainByScale(e,[r=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((o,s)=>FH(o.value,s.value))),!this.sortedBins.length)return[];let n=this._percentileToIndex([r,i]);return this._getScaleDomain(e,n)}_getScaleDomain(e,[r,i]){let n=this.sortedBins;switch(e){case"quantize":case"linear":return[n[r].value,n[i].value];case"quantile":return BH(n.slice(r,i+1),o=>o.value);case"ordinal":return OH(n,o=>o.value);default:return[n[r].value,n[i].value]}}};var VH=6378e3;function xS(t){return Number.isFinite(t)?t:0}function bS(t,e){let r=t.positions.value,i=1/0,n=-1/0,o=1/0,s=-1/0,l,u;for(let v=0;v<e;v++)u=r[v*3],l=r[v*3+1],i=l<i?l:i,n=l>n?l:n,o=u<o?u:o,s=u>s?u:s;return{xMin:xS(o),xMax:xS(s),yMin:xS(i),yMax:xS(n)}}function dAe(t,e,r,i){let{width:n,height:o}=i,s=r===Zr.CARTESIAN?[-n/2,-o/2]:[-180,-90];ur.assert(r===Zr.CARTESIAN||r===Zr.LNGLAT||r===Zr.DEFAULT);let{xMin:l,yMin:u}=t;return[-1*(zH(l-s[0],e.xOffset)+s[0]),-1*(zH(u-s[1],e.yOffset)+s[1])]}function zH(t,e){let r=t<0?-1:1,i=r<0?Math.abs(t)+e:Math.abs(t);return i=Math.floor(i/e)*e,i*r}function KO(t,e,r=!0){if(!r)return{xOffset:e,yOffset:e};let{yMin:i,yMax:n}=t,o=(i+n)/2;return AAe(e,o)}function wS(t,e,r,i){let n=KO(t,e,i!==Zr.CARTESIAN),o=dAe(t,n,i,r),{xMin:s,yMin:l,xMax:u,yMax:h}=t,v=u-s+n.xOffset,T=h-l+n.yOffset,E=Math.ceil(v/n.xOffset),M=Math.ceil(T/n.yOffset);return{gridOffset:n,translation:o,width:v,height:T,numCol:E,numRow:M}}function AAe(t,e){let r=mAe(t),i=gAe(e,t);return{yOffset:r,xOffset:i}}function mAe(t){return t/VH*(180/Math.PI)}function gAe(t,e){return e/VH*(180/Math.PI)/Math.cos(t*Math.PI/180)}function C_(t,e){let r=_Ae(t,e),i=yAe(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:i}}function _Ae(t,e){let{data:r=[],cellSize:i}=t,{attributes:n,viewport:o,projectPoints:s,numInstances:l}=e,u=n.positions.value,{size:h}=n.positions.getAccessor(),v=e.boundingBox||vAe(n.positions,l),T=e.posOffset||[180,90],E=e.gridOffset||KO(v,i);if(E.xOffset<=0||E.yOffset<=0)return{gridHash:{},gridOffset:E,offsets:[0,0]};let{width:M,height:O}=o,F=Math.ceil(M/E.xOffset),z=Math.ceil(O/E.yOffset),W={},{iterable:J,objectInfo:K}=Js(r),ne=new Array(3);for(let ge of J){K.index++,ne[0]=u[K.index*h],ne[1]=u[K.index*h+1],ne[2]=h>=3?u[K.index*h+2]:0;let[H,me]=s?o.project(ne):ne;if(Number.isFinite(H)&&Number.isFinite(me)){let fe=Math.floor((me+T[1])/E.yOffset),$=Math.floor((H+T[0])/E.xOffset);if(!s||$>=0&&$<F&&fe>=0&&fe<z){let Z=`${fe}-${$}`;W[Z]=W[Z]||{count:0,points:[],lonIdx:$,latIdx:fe},W[Z].count+=1,W[Z].points.push({source:ge,index:K.index})}}}return{gridHash:W,gridOffset:E,offsets:[T[0]*-1,T[1]*-1]}}function yAe({gridHash:t,gridOffset:e,offsets:r}){let i=new Array(Object.keys(t).length),n=0;for(let o in t){let s=o.split("-"),l=parseInt(s[0],10),u=parseInt(s[1],10),h=n++;i[h]={index:h,position:[r[0]+e.xOffset*u,r[1]+e.yOffset*l],...t[o]}}return i}function vAe(t,e){let r=t.value,{size:i}=t.getAccessor(),n=1/0,o=-1/0,s=1/0,l=-1/0,u,h;for(let v=0;v<e;v++)h=r[v*i],u=r[v*i+1],Number.isFinite(h)&&Number.isFinite(u)&&(n=u<n?u:n,o=u>o?u:o,s=h<s?h:s,l=h>l?h:l);return{xMin:s,xMax:l,yMin:n,yMax:o}}var ZO=class extends $c{initializeAggregationLayer({dimensions:e}){super.initializeAggregationLayer(e),this.setState({layerData:{},gpuGridAggregator:new Fa(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:C_})}updateState(e){super.updateState(e),this.updateAggregationState(e);let{aggregationDataDirty:r,aggregationWeightsDirty:i,gpuAggregation:n}=this.state;if(this.getNumInstances()<=0)return;let o=!1;(r||n&&i)&&(this._updateAggregation(e),o=!0),!n&&(r||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),o=!0),this.setState({aggregationDirty:o})}finalizeState(e){let{count:r}=this.state.weights;r&&r.aggregationBuffer&&r.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(e)}updateShaders(e){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(e)}updateAggregationState(e){ur.assert(!1)}allocateResources(e,r){if(this.state.numRow!==e||this.state.numCol!==r){let i=r*e*4*4,{weights:n}=this.state;for(let o in n){let s=n[o];s.aggregationBuffer&&s.aggregationBuffer.delete(),s.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:5126,divisor:1}})}}}updateResults({aggregationData:e,maxMinData:r,maxData:i,minData:n}){let{count:o}=this.state.weights;o&&(o.aggregationData=e,o.maxMinData=r,o.maxData=i,o.minData=n)}_updateAggregation(e){let{cpuGridAggregator:r,gpuGridAggregator:i,gridOffset:n,posOffset:o,translation:s=[0,0],scaling:l=[0,0,0],boundingBox:u,projectPoints:h,gpuAggregation:v,numCol:T,numRow:E}=this.state,{props:M}=e,{viewport:O}=this.context,F=this.getAttributes(),z=this.getNumInstances();if(v){let{weights:W}=this.state;i.run({weights:W,cellSize:[n.xOffset,n.yOffset],numCol:T,numRow:E,translation:s,scaling:l,vertexCount:z,projectPoints:h,attributes:F,moduleSettings:this.getModuleSettings()})}else{let W=r(M,{gridOffset:n,projectPoints:h,attributes:F,viewport:O,posOffset:o,boundingBox:u});this.setState({layerData:W})}}_updateWeightBins(){let{getValue:e}=this.state,r=new Dp(this.state.layerData.data||[],{getValue:e});this.setState({sortedBins:r})}_uploadAggregationResults(){let{numCol:e,numRow:r}=this.state,{data:i}=this.state.layerData,{aggregatedBins:n,minValue:o,maxValue:s,totalCount:l}=this.state.sortedBins,u=4,h=e*r*u,v=new Float32Array(h).fill(0);for(let O of n){let{lonIdx:F,latIdx:z}=i[O.i],{value:W,counts:J}=O,K=(F+z*e)*u;v[K]=W,v[K+u-1]=J}let T=new Float32Array([s,0,0,o]),E=new Float32Array([s,0,0,l]),M=new Float32Array([o,0,0,l]);this.updateResults({aggregationData:v,maxMinData:T,maxData:E,minData:M})}},Lp=ZO;(()=>{ZO.layerName="GridAggregationLayer"})();var xAe={...S_.defaultProps,getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},jH="positions",bAe={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},TS=class extends Lp{initializeState(){super.initializeAggregationLayer({dimensions:bAe,getCellSize:i=>i.cellSizePixels});let e={count:{size:1,operation:Wo.SUM,needMax:!0,maxTexture:E_(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:e,subLayerData:{attributes:{}},maxTexture:e.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[jH]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return this.state.supported&&e.somethingChanged}updateState(e){super.updateState(e)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:e,numRow:r,numCol:i,weights:n}=this.state,{updateTriggers:o}=this.props,{aggregationBuffer:s}=n.count,l=this.getSubLayerClass("cells",S_);return new l(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:o}),{data:{attributes:{instanceCounts:s}},maxTexture:e,numInstances:r*i})}finalizeState(e){super.finalizeState(e);let{aggregationBuffer:r,maxBuffer:i,maxTexture:n}=this.state;r?.delete(),i?.delete(),n?.delete()}getPickingInfo({info:e}){let{index:r}=e;if(r>=0){let{gpuGridAggregator:i,gpuAggregation:n,weights:o}=this.state,s=n?i.getData("count"):o.count;e.object=Fa.getAggregationData({pixelIndex:r,...s})}return e}updateResults({aggregationData:e,maxData:r}){let{count:i}=this.state.weights;i.aggregationData=e,i.aggregationBuffer.write(e),i.maxData=r,i.maxTexture.setImageData({data:r})}updateAggregationState(e){let r=e.props.cellSizePixels,i=e.oldProps.cellSizePixels!==r,{viewportChanged:n}=e.changeFlags,o=e.props.gpuAggregation;this.state.gpuAggregation!==e.props.gpuAggregation&&o&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),o=!1);let s=o!==this.state.gpuAggregation;this.setState({gpuAggregation:o});let l=this.isAttributeChanged(jH),{dimensions:u}=this.state,{data:h,weights:v}=u,T=l||s||n||this.isAggregationDirty(e,{compareAll:o,dimension:h}),E=this.isAggregationDirty(e,{dimension:v});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:E});let{viewport:M}=this.context;if(n||i){let{width:O,height:F}=M,z=Math.ceil(O/r),W=Math.ceil(F/r);this.allocateResources(W,z),this.setState({scaling:[O/2,-F/2,1],gridOffset:{xOffset:r,yOffset:r},width:O,height:F,numCol:z,numRow:W})}E&&this._updateAccessors(e),(T||E)&&this._resetResults()}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}},ib=TS;(()=>{TS.layerName="ScreenGridLayer"})(),(()=>{TS.defaultProps=xAe})();function HH(){}var GH=["getBins","getDomain","getScaleFunc"],WH=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],wAe=t=>t.cellSize,Fp=class{constructor(e){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=e.getCellSize||wAe,this._getAggregator=e.getAggregator,this._addDimension(e.dimensions||WH)}static defaultDimensions(){return WH}updateState(e,r){let{oldProps:i,props:n,changeFlags:o}=e;this.updateGetValueFuncs(i,n,o);let s=this.needsReProjectPoints(i,n,o),l=!1;return o.dataChanged||s?(this.getAggregatedData(n,r),l=!0):((this.getDimensionChanges(i,n,o)||[]).forEach(h=>typeof h=="function"&&h()),l=!0),this.setState({aggregationDirty:l}),this.state}setState(e){this.state={...this.state,...e}}setDimensionState(e,r){this.setState({dimensions:{...this.state.dimensions,[e]:{...this.state.dimensions[e],...r}}})}normalizeResult(e={}){return e.hexagons?{data:e.hexagons,...e}:e.layerData?{data:e.layerData,...e}:e}getAggregatedData(e,r){let n=this._getAggregator(e)(e,r);this.setState({layerData:this.normalizeResult(n)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}updateGetValueFuncs(e,r,i){for(let n in this.dimensionUpdaters){let{value:o,weight:s,aggregation:l}=this.dimensionUpdaters[n].getBins.triggers,u=r[o.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[n].getBins,e,r,i)&&(u?u=dH(u,{data:r.data}):u=T_(r[l.prop],r[s.prop],{data:r.data})),u&&this.setDimensionState(n,{getValue:u})}}needsReProjectPoints(e,r,i){return this._getCellSize(e)!==this._getCellSize(r)||this._getAggregator(e)!==this._getAggregator(r)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(e){this._addDimension(e)}_addDimension(e=[]){e.forEach(r=>{let{key:i}=r;this.dimensionUpdaters[i]=this.getDimensionUpdaters(r),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:HH}})}getDimensionUpdaters({key:e,accessor:r,pickingInfo:i,getBins:n,getDomain:o,getScaleFunc:s,nullValue:l}){return{key:e,accessor:r,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...n},getDomain:{updater:this.getDimensionValueDomain.bind(this),...o},getScaleFunc:{updater:this.getDimensionScale.bind(this),...s},attributeAccessor:this.getSubLayerDimensionAttribute(e,l)}}needUpdateDimensionStep(e,r,i,n){return Object.values(e.triggers).some(o=>o.updateTrigger?n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged[o.updateTrigger]):r[o.prop]!==i[o.prop])}getDimensionChanges(e,r,i){let n=[];for(let o in this.dimensionUpdaters){let s=GH.find(l=>this.needUpdateDimensionStep(this.dimensionUpdaters[o][l],e,r,i));s&&n.push(this.dimensionUpdaters[o][s].updater.bind(this,r,this.dimensionUpdaters[o]))}return n.length?n:null}getUpdateTriggers(e){let r=e.updateTriggers||{},i={};for(let n in this.dimensionUpdaters){let{accessor:o}=this.dimensionUpdaters[n];i[o]={},GH.forEach(s=>{Object.values(this.dimensionUpdaters[n][s].triggers).forEach(({prop:l,updateTrigger:u})=>{if(u){let h=r[u];typeof h=="object"&&!Array.isArray(h)?Object.assign(i[o],h):h!==void 0&&(i[o][l]=h)}else i[o][l]=e[l]})})}return i}getSortedBins(e){for(let r in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[r])}getDimensionSortedBins(e,r){let{key:i}=r,{getValue:n}=this.state.dimensions[i],o=new Dp(this.state.layerData.data||[],{getValue:n,filterData:e._filterData});this.setDimensionState(i,{sortedBins:o}),this.getDimensionValueDomain(e,r)}getDimensionValueDomain(e,r){let{getDomain:i,key:n}=r,{triggers:{lowerPercentile:o,upperPercentile:s,scaleType:l}}=i,u=this.state.dimensions[n].sortedBins.getValueDomainByScale(e[l.prop],[e[o.prop],e[s.prop]]);this.setDimensionState(n,{valueDomain:u}),this.getDimensionScale(e,r)}getDimensionScale(e,r){let{key:i,getScaleFunc:n,getDomain:o}=r,{domain:s,range:l}=n.triggers,{scaleType:u}=o.triggers,{onSet:h}=n,v=e[l.prop],T=e[s.prop]||this.state.dimensions[i].valueDomain,M=LH(u&&e[u.prop])(T,v);typeof h=="object"&&typeof e[h.props]=="function"&&e[h.props](M.domain()),this.setDimensionState(i,{scaleFunc:M})}getSubLayerDimensionAttribute(e,r){return i=>{let{sortedBins:n,scaleFunc:o}=this.state.dimensions[e],s=n.binMap[i.index];if(s&&s.counts===0)return r;let l=s&&s.value,u=o.domain();return l>=u[0]&&l<=u[u.length-1]?o(l):r}}getSubLayerAccessors(e){let r={};for(let i in this.dimensionUpdaters){let{accessor:n}=this.dimensionUpdaters[i];r[n]=this.getSubLayerDimensionAttribute(e,i)}return r}getPickingInfo({info:e}){let r=e.picked&&e.index>-1,i=null;if(r){let n=this.state.layerData.data[e.index],o={};for(let s in this.dimensionUpdaters){let{pickingInfo:l}=this.dimensionUpdaters[s],{sortedBins:u}=this.state.dimensions[s],h=u.binMap[n.index]&&u.binMap[n.index].value;o[l]=h}i=Object.assign(o,n,{points:n.filteredPoints||n.points})}return e.picked=Boolean(i),e.object=i,e}getAccessor(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:HH}};function qH(){}var TAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:qH,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:qH,gridAggregator:C_,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:t=>t.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},ES=class extends $c{initializeState(){let e=new Fp({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:e,aggregatorState:e.state},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){super.updateState(e),this.setState({aggregatorState:this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,cellSize:i,coverage:n,material:o,transitions:s}=this.props,{cpuAggregator:l}=this.state,u=this.getSubLayerClass("grid-cell",Wm),h=this._getSublayerUpdateTriggers();return new u({cellSize:i,coverage:n,material:o,elevationScale:e,extruded:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:l.state.layerData.data})}},Jd=ES;(()=>{ES.layerName="CPUGridLayer"})(),(()=>{ES.defaultProps=TAe})();var M_=Math.PI/3,EAe=[0,M_,2*M_,3*M_,4*M_,5*M_];function SAe(t){return t[0]}function CAe(t){return t[1]}function JO(){var t=0,e=0,r=1,i=1,n=SAe,o=CAe,s,l,u;function h(T){var E={},M=[],O,F=T.length;for(O=0;O<F;++O)if(!(isNaN(W=+n.call(null,z=T[O],O,T))||isNaN(J=+o.call(null,z,O,T)))){var z,W,J,K=Math.round(J=J/u),ne=Math.round(W=W/l-(K&1)/2),ge=J-K;if(Math.abs(ge)*3>1){var H=W-ne,me=ne+(W<ne?-1:1)/2,fe=K+(J<K?-1:1),$=W-me,Z=J-fe;H*H+ge*ge>$*$+Z*Z&&(ne=me+(K&1?1:-1)/2,K=fe)}var we=ne+"-"+K,Oe=E[we];Oe?Oe.push(z):(M.push(Oe=E[we]=[z]),Oe.x=(ne+(K&1)/2)*l,Oe.y=K*u)}return M}function v(T){var E=0,M=0;return EAe.map(function(O){var F=Math.sin(O)*T,z=-Math.cos(O)*T,W=F-E,J=z-M;return E=F,M=z,[W,J]})}return h.hexagon=function(T){return"m"+v(T==null?s:+T).join("l")+"z"},h.centers=function(){for(var T=[],E=Math.round(e/u),M=Math.round(t/l),O=E*u;O<i+s;O+=u,++E)for(var F=M*l+(E&1)*l/2;F<r+l/2;F+=l)T.push([F,O]);return T},h.mesh=function(){var T=v(s).slice(0,4).join("l");return h.centers().map(function(E){return"M"+E+"m"+T}).join("")},h.x=function(T){return arguments.length?(n=T,h):n},h.y=function(T){return arguments.length?(o=T,h):o},h.radius=function(T){return arguments.length?(s=+T,l=s*2*Math.sin(M_),u=s*1.5,h):s},h.size=function(T){return arguments.length?(t=e=0,r=+T[0],i=+T[1],h):[r-t,i-e]},h.extent=function(T){return arguments.length?(t=+T[0][0],e=+T[0][1],r=+T[1][0],i=+T[1][1],h):[[t,e],[r,i]]},h.radius(1)}function XH(t,e){let{data:r,radius:i}=t,{viewport:n,attributes:o}=e,s=r.length?MAe(r,e):null,l=IAe(i,n,s),u=[],{iterable:h,objectInfo:v}=Js(r),T=o.positions.value,{size:E}=o.positions.getAccessor();for(let F of h){v.index++;let z=v.index*E,W=[T[z],T[z+1]];Number.isFinite(W[0])&&Number.isFinite(W[1])?u.push({screenCoord:n.projectFlat(W),source:F,index:v.index}):ur.warn("HexagonLayer: invalid position")()}return{hexagons:JO().radius(l).x(F=>F.screenCoord[0]).y(F=>F.screenCoord[1])(u).map((F,z)=>({position:n.unprojectFlat([F.x,F.y]),points:F,index:z})),radiusCommon:l}}function MAe(t,e){let{attributes:r}=e,i=r.positions.value,{size:n}=r.positions.getAccessor(),o=1/0,s=1/0,l=-1/0,u=-1/0,h;for(h=0;h<n*t.length;h+=n){let v=i[h],T=i[h+1];Number.isFinite(v)&&Number.isFinite(T)&&(o=Math.min(v,o),l=Math.max(v,l),s=Math.min(T,s),u=Math.max(T,u))}return[o,s,l,u].every(Number.isFinite)?[(o+l)/2,(s+u)/2]:null}function IAe(t,e,r){let{unitsPerMeter:i}=e.getDistanceScales(r);return t*i[0]}function YH(){}var PAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:YH,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:YH,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:XH,getPosition:{type:"accessor",value:t=>t.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},SS=class extends $c{initializeState(){let e=new Fp({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:e,aggregatorState:e.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){if(super.updateState(e),e.changeFlags.propsOrDataChanged){let r=this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==r.layerData){let{hexagonVertices:i}=r.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:r})}}convertLatLngToMeterOffset(e){let{viewport:r}=this.context;if(Array.isArray(e)&&e.length===6){let i=e[0],n=e[3],o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=r.projectFlat(o),{metersPerUnit:l}=r.getDistanceScales(o);return e.map(h=>{let v=r.projectFlat(h);return[(v[0]-s[0])*l[0],(v[1]-s[1])*l[1]]})}return ur.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,coverage:i,material:n,transitions:o}=this.props,{aggregatorState:s,vertices:l}=this.state,u=this.getSubLayerClass("hexagon-cell",If),h=this._getSublayerUpdateTriggers(),v=l?{vertices:l,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new u({...v,diskResolution:6,elevationScale:e,extruded:r,coverage:i,material:n,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:o&&{getFillColor:o.getColorValue||o.getColorWeight,getElevation:o.getElevationValue||o.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:h}),{data:s.layerData.data})}},nb=SS;(()=>{SS.layerName="HexagonLayer"})(),(()=>{SS.defaultProps=PAe})();var ri=.16666666666666666,Dt={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},I_=[Dt.W,Dt.SW,Dt.S],P_=[Dt.S,Dt.SE,Dt.E],R_=[Dt.E,Dt.NE,Dt.N],B_=[Dt.NW,Dt.W,Dt.N],O_=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5]],D_=[[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri]],L_=[[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],F_=[[-.5,ri],[-.5,-ri],[ri,.5],[-ri,.5]],KH=[Dt.W,Dt.SW,Dt.SE,Dt.E],ZH=[Dt.S,Dt.SE,Dt.NE,Dt.N],JH=[Dt.NW,Dt.W,Dt.E,Dt.NE],QH=[Dt.NW,Dt.SW,Dt.S,Dt.N],$H=[[-.5,ri],[-.5,-ri],[.5,-ri],[.5,ri]],e7=[[-ri,-.5],[ri,-.5],[ri,.5],[-ri,.5]],RAe=[Dt.NW,Dt.SW,Dt.SE,Dt.NE],t7=[Dt.NW,Dt.SW,Dt.SE,Dt.E,Dt.N],r7=[Dt.W,Dt.SW,Dt.SE,Dt.NE,Dt.N],i7=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.NE],n7=[Dt.NW,Dt.SW,Dt.S,Dt.E,Dt.NE],o7=[Dt.NW,Dt.W,[.5,-ri],[.5,ri],Dt.N],s7=[[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],a7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E],l7=[Dt.W,Dt.SW,Dt.S,[ri,.5],[-ri,.5]],c7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.N],u7=[[-.5,ri],[-.5,-ri],Dt.E,Dt.NE,Dt.N],f7=[Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],h7=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri]],p7=[Dt.W,Dt.SW,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],d7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.NE,Dt.N],A7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.E,Dt.NE],m7=[Dt.NW,Dt.SW,Dt.S,[.5,-ri],[.5,ri],Dt.N],N_=[Dt.W,Dt.SW,Dt.S,Dt.E,Dt.NE,Dt.N],k_=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.E,Dt.N],CS=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],MS=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],IS=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],Dt.N],PS=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],g7=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],_7={0:[],1:[[Dt.W,Dt.S]],2:[[Dt.S,Dt.E]],3:[[Dt.W,Dt.E]],4:[[Dt.N,Dt.E]],5:{0:[[Dt.W,Dt.S],[Dt.N,Dt.E]],1:[[Dt.W,Dt.N],[Dt.S,Dt.E]]},6:[[Dt.N,Dt.S]],7:[[Dt.W,Dt.N]],8:[[Dt.W,Dt.N]],9:[[Dt.N,Dt.S]],10:{0:[[Dt.W,Dt.N],[Dt.S,Dt.E]],1:[[Dt.W,Dt.S],[Dt.N,Dt.E]]},11:[[Dt.N,Dt.E]],12:[[Dt.W,Dt.E]],13:[[Dt.S,Dt.E]],14:[[Dt.W,Dt.S]],15:[]};function jr(t){return parseInt(t,4)}var y7={[jr("0000")]:[],[jr("2222")]:[],[jr("2221")]:[I_],[jr("2212")]:[P_],[jr("2122")]:[R_],[jr("1222")]:[B_],[jr("0001")]:[I_],[jr("0010")]:[P_],[jr("0100")]:[R_],[jr("1000")]:[B_],[jr("2220")]:[O_],[jr("2202")]:[D_],[jr("2022")]:[L_],[jr("0222")]:[F_],[jr("0002")]:[O_],[jr("0020")]:[D_],[jr("0200")]:[L_],[jr("2000")]:[F_],[jr("0011")]:[KH],[jr("0110")]:[ZH],[jr("1100")]:[JH],[jr("1001")]:[QH],[jr("2211")]:[KH],[jr("2112")]:[ZH],[jr("1122")]:[JH],[jr("1221")]:[QH],[jr("2200")]:[$H],[jr("2002")]:[e7],[jr("0022")]:[$H],[jr("0220")]:[e7],[jr("1111")]:[RAe],[jr("1211")]:[t7],[jr("2111")]:[r7],[jr("1112")]:[i7],[jr("1121")]:[n7],[jr("1011")]:[t7],[jr("0111")]:[r7],[jr("1110")]:[i7],[jr("1101")]:[n7],[jr("1200")]:[o7],[jr("0120")]:[s7],[jr("0012")]:[a7],[jr("2001")]:[l7],[jr("1022")]:[o7],[jr("2102")]:[s7],[jr("2210")]:[a7],[jr("0221")]:[l7],[jr("1002")]:[c7],[jr("2100")]:[u7],[jr("0210")]:[f7],[jr("0021")]:[h7],[jr("1220")]:[c7],[jr("0122")]:[u7],[jr("2012")]:[f7],[jr("2201")]:[h7],[jr("0211")]:[p7],[jr("2110")]:[d7],[jr("1102")]:[A7],[jr("1021")]:[m7],[jr("2011")]:[p7],[jr("0112")]:[d7],[jr("1120")]:[A7],[jr("1201")]:[m7],[jr("2101")]:[N_],[jr("0121")]:[N_],[jr("1012")]:[k_],[jr("1210")]:[k_],[jr("0101")]:{0:[I_,R_],1:[N_],2:[N_]},[jr("1010")]:{0:[B_,P_],1:[k_],2:[k_]},[jr("2121")]:{0:[N_],1:[N_],2:[I_,R_]},[jr("1212")]:{0:[k_],1:[k_],2:[B_,P_]},[jr("2120")]:{0:[CS],1:[CS],2:[O_,R_]},[jr("2021")]:{0:[MS],1:[MS],2:[I_,L_]},[jr("1202")]:{0:[IS],1:[IS],2:[B_,D_]},[jr("0212")]:{0:[PS],1:[PS],2:[P_,F_]},[jr("0102")]:{0:[O_,R_],1:[CS],2:[CS]},[jr("0201")]:{0:[I_,L_],1:[MS],2:[MS]},[jr("1020")]:{0:[B_,D_],1:[IS],2:[IS]},[jr("2010")]:{0:[P_,F_],1:[PS],2:[PS]},[jr("2020")]:{0:[F_,D_],1:[g7],2:[O_,L_]},[jr("0202")]:{0:[L_,O_],1:[g7],2:[F_,D_]}};var Jm={ISO_LINES:1,ISO_BANDS:2},BAe={zIndex:0,zOffset:.005};function ob(t,e){return Array.isArray(e)?t<e[0]?0:t<e[1]?1:2:t>=e?1:0}function v7(t){let{cellWeights:e,x:r,y:i,width:n,height:o}=t,s=t.threshold;t.thresholdValue&&(ur.deprecated("thresholdValue","threshold")(),s=t.thresholdValue);let l=r<0,u=r>=n-1,h=i<0,v=i>=o-1,T=l||u||h||v,E={},M={};l||v?M.top=0:(E.top=e[(i+1)*n+r],M.top=ob(E.top,s)),u||v?M.topRight=0:(E.topRight=e[(i+1)*n+r+1],M.topRight=ob(E.topRight,s)),u||h?M.right=0:(E.right=e[i*n+r+1],M.right=ob(E.right,s)),l||h?M.current=0:(E.current=e[i*n+r],M.current=ob(E.current,s));let{top:O,topRight:F,right:z,current:W}=M,J=-1;Number.isFinite(s)&&(J=O<<3|F<<2|z<<1|W),Array.isArray(s)&&(J=O<<6|F<<4|z<<2|W);let K=0;return T||(K=ob((E.top+E.topRight+E.right+E.current)/4,s)),{code:J,meanCode:K}}function QO(t){let{gridOrigin:e,cellSize:r,x:i,y:n,code:o,meanCode:s,type:l=Jm.ISO_LINES}=t,u={...BAe,...t.thresholdData},h=l===Jm.ISO_BANDS?y7[o]:_7[o];Array.isArray(h)||(h=h[s]);let v=u.zIndex*u.zOffset,T=(i+1)*r[0],E=(n+1)*r[1],M=e[0]+T,O=e[1]+E;if(l===Jm.ISO_BANDS){let z=[];return h.forEach(W=>{let J=[];W.forEach(K=>{let ne=M+K[0]*r[0],ge=O+K[1]*r[1];J.push([ne,ge,v])}),z.push(J)}),z}let F=[];return h.forEach(z=>{z.forEach(W=>{let J=M+W[0]*r[0],K=O+W[1]*r[1];F.push([J,K,v])})}),F}function x7({thresholdData:t,cellWeights:e,gridSize:r,gridOrigin:i,cellSize:n}){let o=[],s=[],l=r[0],u=r[1],h=0,v=0;for(let T of t){let{contour:E}=T,{threshold:M}=E;for(let O=-1;O<l;O++)for(let F=-1;F<u;F++){let{code:z,meanCode:W}=v7({cellWeights:e,threshold:M,x:O,y:F,width:l,height:u}),J={type:Jm.ISO_BANDS,gridOrigin:i,cellSize:n,x:O,y:F,width:l,height:u,code:z,meanCode:W,thresholdData:T};if(Array.isArray(M)){J.type=Jm.ISO_BANDS;let K=QO(J);for(let ne of K)s[v++]={vertices:ne,contour:E}}else{J.type=Jm.ISO_LINES;let K=QO(J);for(let ne=0;ne<K.length;ne+=2)o[h++]={start:K[ne],end:K[ne+1],contour:E}}}}return{contourSegments:o,contourPolygons:s}}var b7=[255,255,255,255],OAe=1,DAe=1,LAe={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:DAe}],optional:!0,compare:3},zOffset:.005},w7="positions",FAe={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},RS=class extends Lp{initializeState(){super.initializeAggregationLayer({dimensions:FAe}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:Wo.SUM}}}),this.getAttributeManager().add({[w7]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(e){super.updateState(e);let r=!1,{oldProps:i,props:n}=e,{aggregationDirty:o}=this.state;(i.contours!==n.contours||i.zOffset!==n.zOffset)&&(r=!0,this._updateThresholdData(e.props)),this.getNumInstances()>0&&(o||r)&&this._generateContours()}renderLayers(){let{contourSegments:e,contourPolygons:r}=this.state.contourData,i=this.getSubLayerClass("lines",zm),n=this.getSubLayerClass("bands",Rf),o=e&&e.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:l=>l.start,getTargetPosition:l=>l.end,getColor:l=>l.contour.color||b7,getWidth:l=>l.contour.strokeWidth||OAe}),s=r&&r.length>0&&new n(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:l=>l.vertices,getFillColor:l=>l.contour.color||b7});return[o,s]}updateAggregationState(e){let{props:r,oldProps:i}=e,{cellSize:n,coordinateSystem:o}=r,{viewport:s}=this.context,l=i.cellSize!==n,u=r.gpuAggregation;this.state.gpuAggregation!==r.gpuAggregation&&u&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);let h=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});let{dimensions:v}=this.state,T=this.isAttributeChanged(w7),{data:E,weights:M}=v,{boundingBox:O}=this.state;if(T&&(O=bS(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:O})),T||l){let{gridOffset:W,translation:J,width:K,height:ne,numCol:ge,numRow:H}=wS(O,n,s,o);this.allocateResources(H,ge),this.setState({gridOffset:W,boundingBox:O,translation:J,posOffset:J.slice(),gridOrigin:[-1*J[0],-1*J[1]],width:K,height:ne,numCol:ge,numRow:H})}let F=T||h||this.isAggregationDirty(e,{dimension:E,compareAll:u}),z=this.isAggregationDirty(e,{dimension:M});z&&this._updateAccessors(e),(F||z)&&this._resetResults(),this.setState({aggregationDataDirty:F,aggregationWeightsDirty:z})}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}_generateContours(){let{numCol:e,numRow:r,gridOrigin:i,gridOffset:n,thresholdData:o}=this.state,{count:s}=this.state.weights,{aggregationData:l}=s;l||(l=s.aggregationBuffer.readSyncWebGL(),s.aggregationData=l);let{cellWeights:u}=Fa.getCellData({countsData:l}),h=x7({thresholdData:o,cellWeights:u,gridSize:[e,r],gridOrigin:i,cellSize:[n.xOffset,n.yOffset]});this.setState({contourData:h})}_updateThresholdData(e){let{contours:r,zOffset:i}=e,n=r.length,o=new Array(n);for(let s=0;s<n;s++){let l=r[s];o[s]={contour:l,zIndex:l.zIndex||s,zOffset:i}}this.setState({thresholdData:o})}},sb=RS;(()=>{RS.layerName="ContourLayer"})(),(()=>{RS.defaultProps=LAe})();var T7=`#version 300 es
3107
+ `;var Jde=[0,0,0,0],Qde=[0,255,0,255],$de=["minColor","maxColor","colorRange","colorDomain"],eAe={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ju},yS=class extends Dn{getShaders(){return{vs:EH,fs:SH,modules:[go]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e);let{oldProps:r,props:i,changeFlags:n}=e,o=this.getAttributeManager();i.numInstances!==r.numInstances?o.invalidateAll():r.cellSizePixels!==i.cellSizePixels&&o.invalidate("instancePositions"),this._updateUniforms(r,i,n)}draw({uniforms:e}){let{parameters:r,maxTexture:i}=this.props,n=this.props.minColor||Jde,o=this.props.maxColor||Qde,s=this.props.colorDomain||[1,0],l=this.state.model;l.setUniforms(e),l.setBindings({maxTexture:i}),l.setUniforms({minColor:n,maxColor:o,colorDomain:s}),l.setParameters({depthWriteEnabled:!1,...r}),l.draw(this.context.renderPass)}calculateInstancePositions(e,{numInstances:r}){let{width:i,height:n}=this.context.viewport,{cellSizePixels:o}=this.props,s=Math.ceil(i/o),{value:l,size:u}=e;for(let h=0;h<r;h++){let v=h%s,T=Math.floor(h/s);l[h*u+0]=v*o/i*2-1,l[h*u+1]=1-T*o/n*2,l[h*u+2]=0}}_getModel(){return new Ni(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Mn({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}}),isInstanced:!0})}_shouldUseMinMax(){let{minColor:e,maxColor:r,colorDomain:i,colorRange:n}=this.props;return e||r?(ur.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||n)}_updateUniforms(e,r,i){let n=this.state.model;if($de.some(o=>e[o]!==r[o])&&n.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),e.colorRange!==r.colorRange&&n.setUniforms({colorRange:Zd(r.colorRange)}),e.cellMarginPixels!==r.cellMarginPixels||e.cellSizePixels!==r.cellSizePixels||i.viewportChanged){let{width:o,height:s}=this.context.viewport,{cellSizePixels:l,cellMarginPixels:u}=this.props,h=l>u?u:0,v=new Float32Array([(l-h)/o*2,-(l-h)/s*2,1]);n.setUniforms({cellScale:v})}}},S_=yS;(()=>{yS.layerName="ScreenGridCellLayer"})(),(()=>{yS.defaultProps=eAe})();function CH(t,e){let r={};for(let i in t)e.includes(i)||(r[i]=t[i]);return r}var YO=class extends es{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:CH(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:r}=e;if(r.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:r,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:r,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,r={}){let{props:i,oldProps:n,changeFlags:o}=e,{compareAll:s=!1,dimension:l}=r,{ignoreProps:u}=this.state,{props:h,accessors:v=[]}=l,{updateTriggersChanged:T}=o;if(o.dataChanged)return!0;if(T){if(T.all)return!0;for(let E of v)if(T[E])return!0}if(s)return o.extensionsChanged?!0:m_({oldProps:n,newProps:i,ignoreProps:u,propTypes:this.constructor._propTypes});for(let E of h)if(i[E]!==n[E])return!0;return!1}isAttributeChanged(e){let{changedAttributes:r}=this.state;return e?r&&r[e]!==void 0:!tAe(r)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}},$c=YO;(()=>{YO.layerName="AggregationLayer"})();function tAe(t){let e=!0;for(let r in t){e=!1;break}return e}function vS(t,e,r){let i=r;return i.domain=()=>t,i.range=()=>e,i}function MH(t,e){return vS(t,e,i=>cAe(t,e,i))}function rAe(t,e){return vS(t,e,i=>uAe(t,e,i))}function iAe(t,e){let r=t.sort(IH),i=0,n=Math.max(1,e.length),o=new Array(n-1);for(;++i<n;)o[i-1]=nAe(r,i/n);let s=l=>sAe(o,e,l);return s.thresholds=()=>o,vS(t,e,s)}function IH(t,e){return t-e}function nAe(t,e){let r=t.length;if(e<=0||r<2)return t[0];if(e>=1)return t[r-1];let i=(r-1)*e,n=Math.floor(i),o=t[n],s=t[n+1];return o+(s-o)*(i-n)}function oAe(t,e){let r=0,i=t.length;for(;r<i;){let n=r+i>>>1;IH(t[n],e)>0?i=n:r=n+1}return r}function sAe(t,e,r){return e[oAe(t,r)]}function aAe(t,e,r,i){let n=`${i}`,o=e.get(n);return o===void 0&&(o=t.push(i),e.set(n,o)),r[(o-1)%r.length]}function lAe(t,e){let r=new Map,i=[];for(let o of t){let s=`${o}`;r.has(s)||r.set(s,i.push(o))}return vS(t,e,o=>aAe(i,r,e,o))}function cAe(t,e,r){let i=t[1]-t[0];if(i<=0)return ur.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];let n=i/e.length,o=Math.floor((r-t[0])/n),s=Math.max(Math.min(o,e.length-1),0);return e[s]}function uAe(t,e,r){return(r-t[0])/(t[1]-t[0])*(e[1]-e[0])+e[0]}function PH(t){return t!=null}function fAe(t){let e=[];return t.forEach(r=>{!e.includes(r)&&PH(r)&&e.push(r)}),e}function RH(t,e){return(typeof e=="function"?t.map(e):t).filter(PH)}function BH(t,e){return RH(t,e)}function OH(t,e){return fAe(RH(t,e))}function DH(t,e,r){return Math.max(e,Math.min(r,t))}function LH(t){switch(t){case"quantize":return MH;case"linear":return rAe;case"quantile":return iAe;case"ordinal":return lAe;default:return MH}}var NH=t=>t.length,hAe=3402823466e29,kH=t=>t.points,UH=t=>t.index,FH=(t,e)=>t<e?-1:t>e?1:t>=e?0:NaN,pAe={getValue:NH,getPoints:kH,getIndex:UH,filterData:null},Dp=class{constructor(e=[],r=pAe){this.aggregatedBins=this.getAggregatedBins(e,r),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(e,r){let{getValue:i=NH,getPoints:n=kH,getIndex:o=UH,filterData:s}=r,l=typeof s=="function",u=e.length,h=[],v=0;for(let T=0;T<u;T++){let E=e[T],M=n(E),O=o(E),F=l?M.filter(s):M;E.filteredPoints=l?F:null;let z=F.length?i(F):null;z!=null&&(h[v]={i:Number.isFinite(O)?O:T,value:z,counts:F.length},v++)}return h}_percentileToIndex(e){let r=this.sortedBins.length;if(r<2)return[0,0];let[i,n]=e.map(l=>DH(l,0,100)),o=Math.ceil(i/100*(r-1)),s=Math.floor(n/100*(r-1));return[o,s]}getBinMap(){let e={};for(let r of this.aggregatedBins)e[r.i]=r;return e}_updateMinMaxValues(){let e=0,r=0,i=hAe,n=0;for(let o of this.aggregatedBins)e=e>o.counts?e:o.counts,r=r>o.value?r:o.value,i=i<o.value?i:o.value,n+=o.counts;this.maxCount=e,this.maxValue=r,this.minValue=i,this.totalCount=n}getValueRange(e){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((n,o)=>FH(n.value,o.value))),!this.sortedBins.length)return[];let r=0,i=this.sortedBins.length-1;if(Array.isArray(e)){let n=this._percentileToIndex(e);r=n[0],i=n[1]}return[this.sortedBins[r].value,this.sortedBins[i].value]}getValueDomainByScale(e,[r=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((o,s)=>FH(o.value,s.value))),!this.sortedBins.length)return[];let n=this._percentileToIndex([r,i]);return this._getScaleDomain(e,n)}_getScaleDomain(e,[r,i]){let n=this.sortedBins;switch(e){case"quantize":case"linear":return[n[r].value,n[i].value];case"quantile":return BH(n.slice(r,i+1),o=>o.value);case"ordinal":return OH(n,o=>o.value);default:return[n[r].value,n[i].value]}}};var VH=6378e3;function xS(t){return Number.isFinite(t)?t:0}function bS(t,e){let r=t.positions.value,i=1/0,n=-1/0,o=1/0,s=-1/0,l,u;for(let v=0;v<e;v++)u=r[v*3],l=r[v*3+1],i=l<i?l:i,n=l>n?l:n,o=u<o?u:o,s=u>s?u:s;return{xMin:xS(o),xMax:xS(s),yMin:xS(i),yMax:xS(n)}}function dAe(t,e,r,i){let{width:n,height:o}=i,s=r===Zr.CARTESIAN?[-n/2,-o/2]:[-180,-90];ur.assert(r===Zr.CARTESIAN||r===Zr.LNGLAT||r===Zr.DEFAULT);let{xMin:l,yMin:u}=t;return[-1*(zH(l-s[0],e.xOffset)+s[0]),-1*(zH(u-s[1],e.yOffset)+s[1])]}function zH(t,e){let r=t<0?-1:1,i=r<0?Math.abs(t)+e:Math.abs(t);return i=Math.floor(i/e)*e,i*r}function KO(t,e,r=!0){if(!r)return{xOffset:e,yOffset:e};let{yMin:i,yMax:n}=t,o=(i+n)/2;return AAe(e,o)}function wS(t,e,r,i){let n=KO(t,e,i!==Zr.CARTESIAN),o=dAe(t,n,i,r),{xMin:s,yMin:l,xMax:u,yMax:h}=t,v=u-s+n.xOffset,T=h-l+n.yOffset,E=Math.ceil(v/n.xOffset),M=Math.ceil(T/n.yOffset);return{gridOffset:n,translation:o,width:v,height:T,numCol:E,numRow:M}}function AAe(t,e){let r=mAe(t),i=gAe(e,t);return{yOffset:r,xOffset:i}}function mAe(t){return t/VH*(180/Math.PI)}function gAe(t,e){return e/VH*(180/Math.PI)/Math.cos(t*Math.PI/180)}function C_(t,e){let r=_Ae(t,e),i=yAe(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:i}}function _Ae(t,e){let{data:r=[],cellSize:i}=t,{attributes:n,viewport:o,projectPoints:s,numInstances:l}=e,u=n.positions.value,{size:h}=n.positions.getAccessor(),v=e.boundingBox||vAe(n.positions,l),T=e.posOffset||[180,90],E=e.gridOffset||KO(v,i);if(E.xOffset<=0||E.yOffset<=0)return{gridHash:{},gridOffset:E,offsets:[0,0]};let{width:M,height:O}=o,F=Math.ceil(M/E.xOffset),z=Math.ceil(O/E.yOffset),W={},{iterable:J,objectInfo:K}=Js(r),ne=new Array(3);for(let ge of J){K.index++,ne[0]=u[K.index*h],ne[1]=u[K.index*h+1],ne[2]=h>=3?u[K.index*h+2]:0;let[H,me]=s?o.project(ne):ne;if(Number.isFinite(H)&&Number.isFinite(me)){let fe=Math.floor((me+T[1])/E.yOffset),$=Math.floor((H+T[0])/E.xOffset);if(!s||$>=0&&$<F&&fe>=0&&fe<z){let Z=`${fe}-${$}`;W[Z]=W[Z]||{count:0,points:[],lonIdx:$,latIdx:fe},W[Z].count+=1,W[Z].points.push({source:ge,index:K.index})}}}return{gridHash:W,gridOffset:E,offsets:[T[0]*-1,T[1]*-1]}}function yAe({gridHash:t,gridOffset:e,offsets:r}){let i=new Array(Object.keys(t).length),n=0;for(let o in t){let s=o.split("-"),l=parseInt(s[0],10),u=parseInt(s[1],10),h=n++;i[h]={index:h,position:[r[0]+e.xOffset*u,r[1]+e.yOffset*l],...t[o]}}return i}function vAe(t,e){let r=t.value,{size:i}=t.getAccessor(),n=1/0,o=-1/0,s=1/0,l=-1/0,u,h;for(let v=0;v<e;v++)h=r[v*i],u=r[v*i+1],Number.isFinite(h)&&Number.isFinite(u)&&(n=u<n?u:n,o=u>o?u:o,s=h<s?h:s,l=h>l?h:l);return{xMin:s,xMax:l,yMin:n,yMax:o}}var ZO=class extends $c{initializeAggregationLayer({dimensions:e}){super.initializeAggregationLayer(e),this.setState({layerData:{},gpuGridAggregator:new Fa(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:C_})}updateState(e){super.updateState(e),this.updateAggregationState(e);let{aggregationDataDirty:r,aggregationWeightsDirty:i,gpuAggregation:n}=this.state;if(this.getNumInstances()<=0)return;let o=!1;(r||n&&i)&&(this._updateAggregation(e),o=!0),!n&&(r||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),o=!0),this.setState({aggregationDirty:o})}finalizeState(e){let{count:r}=this.state.weights;r&&r.aggregationBuffer&&r.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(e)}updateShaders(e){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(e)}updateAggregationState(e){ur.assert(!1)}allocateResources(e,r){if(this.state.numRow!==e||this.state.numCol!==r){let i=r*e*4*4,{weights:n}=this.state;for(let o in n){let s=n[o];s.aggregationBuffer&&s.aggregationBuffer.delete(),s.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:5126,divisor:1}})}}}updateResults({aggregationData:e,maxMinData:r,maxData:i,minData:n}){let{count:o}=this.state.weights;o&&(o.aggregationData=e,o.maxMinData=r,o.maxData=i,o.minData=n)}_updateAggregation(e){let{cpuGridAggregator:r,gpuGridAggregator:i,gridOffset:n,posOffset:o,translation:s=[0,0],scaling:l=[0,0,0],boundingBox:u,projectPoints:h,gpuAggregation:v,numCol:T,numRow:E}=this.state,{props:M}=e,{viewport:O}=this.context,F=this.getAttributes(),z=this.getNumInstances();if(v){let{weights:W}=this.state;i.run({weights:W,cellSize:[n.xOffset,n.yOffset],numCol:T,numRow:E,translation:s,scaling:l,vertexCount:z,projectPoints:h,attributes:F,moduleSettings:this.getModuleSettings()})}else{let W=r(M,{gridOffset:n,projectPoints:h,attributes:F,viewport:O,posOffset:o,boundingBox:u});this.setState({layerData:W})}}_updateWeightBins(){let{getValue:e}=this.state,r=new Dp(this.state.layerData.data||[],{getValue:e});this.setState({sortedBins:r})}_uploadAggregationResults(){let{numCol:e,numRow:r}=this.state,{data:i}=this.state.layerData,{aggregatedBins:n,minValue:o,maxValue:s,totalCount:l}=this.state.sortedBins,u=4,h=e*r*u,v=new Float32Array(h).fill(0);for(let O of n){let{lonIdx:F,latIdx:z}=i[O.i],{value:W,counts:J}=O,K=(F+z*e)*u;v[K]=W,v[K+u-1]=J}let T=new Float32Array([s,0,0,o]),E=new Float32Array([s,0,0,l]),M=new Float32Array([o,0,0,l]);this.updateResults({aggregationData:v,maxMinData:T,maxData:E,minData:M})}},Lp=ZO;(()=>{ZO.layerName="GridAggregationLayer"})();var xAe={...S_.defaultProps,getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},jH="positions",bAe={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},TS=class extends Lp{initializeState(){super.initializeAggregationLayer({dimensions:bAe,getCellSize:i=>i.cellSizePixels});let e={count:{size:1,operation:Wo.SUM,needMax:!0,maxTexture:E_(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:e,subLayerData:{attributes:{}},maxTexture:e.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[jH]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return this.state.supported&&e.somethingChanged}updateState(e){super.updateState(e)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:e,numRow:r,numCol:i,weights:n}=this.state,{updateTriggers:o}=this.props,{aggregationBuffer:s}=n.count,l=this.getSubLayerClass("cells",S_);return new l(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:o}),{data:{attributes:{instanceCounts:s}},maxTexture:e,numInstances:r*i})}finalizeState(e){super.finalizeState(e);let{aggregationBuffer:r,maxBuffer:i,maxTexture:n}=this.state;r?.delete(),i?.delete(),n?.delete()}getPickingInfo({info:e}){let{index:r}=e;if(r>=0){let{gpuGridAggregator:i,gpuAggregation:n,weights:o}=this.state,s=n?i.getData("count"):o.count;e.object=Fa.getAggregationData({pixelIndex:r,...s})}return e}updateResults({aggregationData:e,maxData:r}){let{count:i}=this.state.weights;i.aggregationData=e,i.aggregationBuffer.write(e),i.maxData=r,i.maxTexture.setImageData({data:r})}updateAggregationState(e){let r=e.props.cellSizePixels,i=e.oldProps.cellSizePixels!==r,{viewportChanged:n}=e.changeFlags,o=e.props.gpuAggregation;this.state.gpuAggregation!==e.props.gpuAggregation&&o&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),o=!1);let s=o!==this.state.gpuAggregation;this.setState({gpuAggregation:o});let l=this.isAttributeChanged(jH),{dimensions:u}=this.state,{data:h,weights:v}=u,T=l||s||n||this.isAggregationDirty(e,{compareAll:o,dimension:h}),E=this.isAggregationDirty(e,{dimension:v});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:E});let{viewport:M}=this.context;if(n||i){let{width:O,height:F}=M,z=Math.ceil(O/r),W=Math.ceil(F/r);this.allocateResources(W,z),this.setState({scaling:[O/2,-F/2,1],gridOffset:{xOffset:r,yOffset:r},width:O,height:F,numCol:z,numRow:W})}E&&this._updateAccessors(e),(T||E)&&this._resetResults()}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}},ib=TS;(()=>{TS.layerName="ScreenGridLayer"})(),(()=>{TS.defaultProps=xAe})();function HH(){}var GH=["getBins","getDomain","getScaleFunc"],WH=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],wAe=t=>t.cellSize,Fp=class{constructor(e){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=e.getCellSize||wAe,this._getAggregator=e.getAggregator,this._addDimension(e.dimensions||WH)}static defaultDimensions(){return WH}updateState(e,r){let{oldProps:i,props:n,changeFlags:o}=e;this.updateGetValueFuncs(i,n,o);let s=this.needsReProjectPoints(i,n,o),l=!1;return o.dataChanged||s?(this.getAggregatedData(n,r),l=!0):((this.getDimensionChanges(i,n,o)||[]).forEach(h=>typeof h=="function"&&h()),l=!0),this.setState({aggregationDirty:l}),this.state}setState(e){this.state={...this.state,...e}}setDimensionState(e,r){this.setState({dimensions:{...this.state.dimensions,[e]:{...this.state.dimensions[e],...r}}})}normalizeResult(e={}){return e.hexagons?{data:e.hexagons,...e}:e.layerData?{data:e.layerData,...e}:e}getAggregatedData(e,r){let n=this._getAggregator(e)(e,r);this.setState({layerData:this.normalizeResult(n)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}updateGetValueFuncs(e,r,i){for(let n in this.dimensionUpdaters){let{value:o,weight:s,aggregation:l}=this.dimensionUpdaters[n].getBins.triggers,u=r[o.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[n].getBins,e,r,i)&&(u?u=dH(u,{data:r.data}):u=T_(r[l.prop],r[s.prop],{data:r.data})),u&&this.setDimensionState(n,{getValue:u})}}needsReProjectPoints(e,r,i){return this._getCellSize(e)!==this._getCellSize(r)||this._getAggregator(e)!==this._getAggregator(r)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(e){this._addDimension(e)}_addDimension(e=[]){e.forEach(r=>{let{key:i}=r;this.dimensionUpdaters[i]=this.getDimensionUpdaters(r),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:HH}})}getDimensionUpdaters({key:e,accessor:r,pickingInfo:i,getBins:n,getDomain:o,getScaleFunc:s,nullValue:l}){return{key:e,accessor:r,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...n},getDomain:{updater:this.getDimensionValueDomain.bind(this),...o},getScaleFunc:{updater:this.getDimensionScale.bind(this),...s},attributeAccessor:this.getSubLayerDimensionAttribute(e,l)}}needUpdateDimensionStep(e,r,i,n){return Object.values(e.triggers).some(o=>o.updateTrigger?n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged[o.updateTrigger]):r[o.prop]!==i[o.prop])}getDimensionChanges(e,r,i){let n=[];for(let o in this.dimensionUpdaters){let s=GH.find(l=>this.needUpdateDimensionStep(this.dimensionUpdaters[o][l],e,r,i));s&&n.push(this.dimensionUpdaters[o][s].updater.bind(this,r,this.dimensionUpdaters[o]))}return n.length?n:null}getUpdateTriggers(e){let r=e.updateTriggers||{},i={};for(let n in this.dimensionUpdaters){let{accessor:o}=this.dimensionUpdaters[n];i[o]={},GH.forEach(s=>{Object.values(this.dimensionUpdaters[n][s].triggers).forEach(({prop:l,updateTrigger:u})=>{if(u){let h=r[u];typeof h=="object"&&!Array.isArray(h)?Object.assign(i[o],h):h!==void 0&&(i[o][l]=h)}else i[o][l]=e[l]})})}return i}getSortedBins(e){for(let r in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[r])}getDimensionSortedBins(e,r){let{key:i}=r,{getValue:n}=this.state.dimensions[i],o=new Dp(this.state.layerData.data||[],{getValue:n,filterData:e._filterData});this.setDimensionState(i,{sortedBins:o}),this.getDimensionValueDomain(e,r)}getDimensionValueDomain(e,r){let{getDomain:i,key:n}=r,{triggers:{lowerPercentile:o,upperPercentile:s,scaleType:l}}=i,u=this.state.dimensions[n].sortedBins.getValueDomainByScale(e[l.prop],[e[o.prop],e[s.prop]]);this.setDimensionState(n,{valueDomain:u}),this.getDimensionScale(e,r)}getDimensionScale(e,r){let{key:i,getScaleFunc:n,getDomain:o}=r,{domain:s,range:l}=n.triggers,{scaleType:u}=o.triggers,{onSet:h}=n,v=e[l.prop],T=e[s.prop]||this.state.dimensions[i].valueDomain,M=LH(u&&e[u.prop])(T,v);typeof h=="object"&&typeof e[h.props]=="function"&&e[h.props](M.domain()),this.setDimensionState(i,{scaleFunc:M})}getSubLayerDimensionAttribute(e,r){return i=>{let{sortedBins:n,scaleFunc:o}=this.state.dimensions[e],s=n.binMap[i.index];if(s&&s.counts===0)return r;let l=s&&s.value,u=o.domain();return l>=u[0]&&l<=u[u.length-1]?o(l):r}}getSubLayerAccessors(e){let r={};for(let i in this.dimensionUpdaters){let{accessor:n}=this.dimensionUpdaters[i];r[n]=this.getSubLayerDimensionAttribute(e,i)}return r}getPickingInfo({info:e}){let r=e.picked&&e.index>-1,i=null;if(r){let n=this.state.layerData.data[e.index],o={};for(let s in this.dimensionUpdaters){let{pickingInfo:l}=this.dimensionUpdaters[s],{sortedBins:u}=this.state.dimensions[s],h=u.binMap[n.index]&&u.binMap[n.index].value;o[l]=h}i=Object.assign(o,n,{points:n.filteredPoints||n.points})}return e.picked=Boolean(i),e.object=i,e}getAccessor(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:HH}};function qH(){}var TAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:qH,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:qH,gridAggregator:C_,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:t=>t.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},ES=class extends $c{initializeState(){let e=new Fp({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:e,aggregatorState:e.state},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){super.updateState(e),this.setState({aggregatorState:this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,cellSize:i,coverage:n,material:o,transitions:s}=this.props,{cpuAggregator:l}=this.state,u=this.getSubLayerClass("grid-cell",Wm),h=this._getSublayerUpdateTriggers();return new u({cellSize:i,coverage:n,material:o,elevationScale:e,extruded:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:l.state.layerData.data})}},Jd=ES;(()=>{ES.layerName="CPUGridLayer"})(),(()=>{ES.defaultProps=TAe})();var M_=Math.PI/3,EAe=[0,M_,2*M_,3*M_,4*M_,5*M_];function SAe(t){return t[0]}function CAe(t){return t[1]}function JO(){var t=0,e=0,r=1,i=1,n=SAe,o=CAe,s,l,u;function h(T){var E={},M=[],O,F=T.length;for(O=0;O<F;++O)if(!(isNaN(W=+n.call(null,z=T[O],O,T))||isNaN(J=+o.call(null,z,O,T)))){var z,W,J,K=Math.round(J=J/u),ne=Math.round(W=W/l-(K&1)/2),ge=J-K;if(Math.abs(ge)*3>1){var H=W-ne,me=ne+(W<ne?-1:1)/2,fe=K+(J<K?-1:1),$=W-me,Z=J-fe;H*H+ge*ge>$*$+Z*Z&&(ne=me+(K&1?1:-1)/2,K=fe)}var we=ne+"-"+K,Oe=E[we];Oe?Oe.push(z):(M.push(Oe=E[we]=[z]),Oe.x=(ne+(K&1)/2)*l,Oe.y=K*u)}return M}function v(T){var E=0,M=0;return EAe.map(function(O){var F=Math.sin(O)*T,z=-Math.cos(O)*T,W=F-E,J=z-M;return E=F,M=z,[W,J]})}return h.hexagon=function(T){return"m"+v(T==null?s:+T).join("l")+"z"},h.centers=function(){for(var T=[],E=Math.round(e/u),M=Math.round(t/l),O=E*u;O<i+s;O+=u,++E)for(var F=M*l+(E&1)*l/2;F<r+l/2;F+=l)T.push([F,O]);return T},h.mesh=function(){var T=v(s).slice(0,4).join("l");return h.centers().map(function(E){return"M"+E+"m"+T}).join("")},h.x=function(T){return arguments.length?(n=T,h):n},h.y=function(T){return arguments.length?(o=T,h):o},h.radius=function(T){return arguments.length?(s=+T,l=s*2*Math.sin(M_),u=s*1.5,h):s},h.size=function(T){return arguments.length?(t=e=0,r=+T[0],i=+T[1],h):[r-t,i-e]},h.extent=function(T){return arguments.length?(t=+T[0][0],e=+T[0][1],r=+T[1][0],i=+T[1][1],h):[[t,e],[r,i]]},h.radius(1)}function XH(t,e){let{data:r,radius:i}=t,{viewport:n,attributes:o}=e,s=r.length?MAe(r,e):null,l=IAe(i,n,s),u=[],{iterable:h,objectInfo:v}=Js(r),T=o.positions.value,{size:E}=o.positions.getAccessor();for(let F of h){v.index++;let z=v.index*E,W=[T[z],T[z+1]];Number.isFinite(W[0])&&Number.isFinite(W[1])?u.push({screenCoord:n.projectFlat(W),source:F,index:v.index}):ur.warn("HexagonLayer: invalid position")()}return{hexagons:JO().radius(l).x(F=>F.screenCoord[0]).y(F=>F.screenCoord[1])(u).map((F,z)=>({position:n.unprojectFlat([F.x,F.y]),points:F,index:z})),radiusCommon:l}}function MAe(t,e){let{attributes:r}=e,i=r.positions.value,{size:n}=r.positions.getAccessor(),o=1/0,s=1/0,l=-1/0,u=-1/0,h;for(h=0;h<n*t.length;h+=n){let v=i[h],T=i[h+1];Number.isFinite(v)&&Number.isFinite(T)&&(o=Math.min(v,o),l=Math.max(v,l),s=Math.min(T,s),u=Math.max(T,u))}return[o,s,l,u].every(Number.isFinite)?[(o+l)/2,(s+u)/2]:null}function IAe(t,e,r){let{unitsPerMeter:i}=e.getDistanceScales(r);return t*i[0]}function YH(){}var PAe={colorDomain:null,colorRange:ju,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:YH,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:YH,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:XH,getPosition:{type:"accessor",value:t=>t.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},SS=class extends $c{initializeState(){let e=new Fp({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:e,aggregatorState:e.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){if(super.updateState(e),e.changeFlags.propsOrDataChanged){let r=this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==r.layerData){let{hexagonVertices:i}=r.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:r})}}convertLatLngToMeterOffset(e){let{viewport:r}=this.context;if(Array.isArray(e)&&e.length===6){let i=e[0],n=e[3],o=[(i[0]+n[0])/2,(i[1]+n[1])/2],s=r.projectFlat(o),{metersPerUnit:l}=r.getDistanceScales(o);return e.map(h=>{let v=r.projectFlat(h);return[(v[0]-s[0])*l[0],(v[1]-s[1])*l[1]]})}return ur.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:r,coverage:i,material:n,transitions:o}=this.props,{aggregatorState:s,vertices:l}=this.state,u=this.getSubLayerClass("hexagon-cell",If),h=this._getSublayerUpdateTriggers(),v=l?{vertices:l,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new u({...v,diskResolution:6,elevationScale:e,extruded:r,coverage:i,material:n,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:o&&{getFillColor:o.getColorValue||o.getColorWeight,getElevation:o.getElevationValue||o.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:h}),{data:s.layerData.data})}},nb=SS;(()=>{SS.layerName="HexagonLayer"})(),(()=>{SS.defaultProps=PAe})();var ri=.16666666666666666,Dt={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},I_=[Dt.W,Dt.SW,Dt.S],P_=[Dt.S,Dt.SE,Dt.E],R_=[Dt.E,Dt.NE,Dt.N],B_=[Dt.NW,Dt.W,Dt.N],O_=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5]],D_=[[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri]],L_=[[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],F_=[[-.5,ri],[-.5,-ri],[ri,.5],[-ri,.5]],KH=[Dt.W,Dt.SW,Dt.SE,Dt.E],ZH=[Dt.S,Dt.SE,Dt.NE,Dt.N],JH=[Dt.NW,Dt.W,Dt.E,Dt.NE],QH=[Dt.NW,Dt.SW,Dt.S,Dt.N],$H=[[-.5,ri],[-.5,-ri],[.5,-ri],[.5,ri]],e7=[[-ri,-.5],[ri,-.5],[ri,.5],[-ri,.5]],RAe=[Dt.NW,Dt.SW,Dt.SE,Dt.NE],t7=[Dt.NW,Dt.SW,Dt.SE,Dt.E,Dt.N],r7=[Dt.W,Dt.SW,Dt.SE,Dt.NE,Dt.N],i7=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.NE],n7=[Dt.NW,Dt.SW,Dt.S,Dt.E,Dt.NE],o7=[Dt.NW,Dt.W,[.5,-ri],[.5,ri],Dt.N],s7=[[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],a7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E],l7=[Dt.W,Dt.SW,Dt.S,[ri,.5],[-ri,.5]],c7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.N],u7=[[-.5,ri],[-.5,-ri],Dt.E,Dt.NE,Dt.N],f7=[Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],h7=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri]],p7=[Dt.W,Dt.SW,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],d7=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.NE,Dt.N],A7=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],Dt.E,Dt.NE],m7=[Dt.NW,Dt.SW,Dt.S,[.5,-ri],[.5,ri],Dt.N],N_=[Dt.W,Dt.SW,Dt.S,Dt.E,Dt.NE,Dt.N],k_=[Dt.NW,Dt.W,Dt.S,Dt.SE,Dt.E,Dt.N],CS=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],Dt.E,Dt.NE,Dt.N],MS=[Dt.W,Dt.SW,Dt.S,[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],IS=[Dt.NW,Dt.W,[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],Dt.N],PS=[[-.5,ri],[-.5,-ri],Dt.S,Dt.SE,Dt.E,[ri,.5],[-ri,.5]],g7=[[-.5,ri],[-.5,-ri],[-ri,-.5],[ri,-.5],[.5,-ri],[.5,ri],[ri,.5],[-ri,.5]],_7={0:[],1:[[Dt.W,Dt.S]],2:[[Dt.S,Dt.E]],3:[[Dt.W,Dt.E]],4:[[Dt.N,Dt.E]],5:{0:[[Dt.W,Dt.S],[Dt.N,Dt.E]],1:[[Dt.W,Dt.N],[Dt.S,Dt.E]]},6:[[Dt.N,Dt.S]],7:[[Dt.W,Dt.N]],8:[[Dt.W,Dt.N]],9:[[Dt.N,Dt.S]],10:{0:[[Dt.W,Dt.N],[Dt.S,Dt.E]],1:[[Dt.W,Dt.S],[Dt.N,Dt.E]]},11:[[Dt.N,Dt.E]],12:[[Dt.W,Dt.E]],13:[[Dt.S,Dt.E]],14:[[Dt.W,Dt.S]],15:[]};function jr(t){return parseInt(t,4)}var y7={[jr("0000")]:[],[jr("2222")]:[],[jr("2221")]:[I_],[jr("2212")]:[P_],[jr("2122")]:[R_],[jr("1222")]:[B_],[jr("0001")]:[I_],[jr("0010")]:[P_],[jr("0100")]:[R_],[jr("1000")]:[B_],[jr("2220")]:[O_],[jr("2202")]:[D_],[jr("2022")]:[L_],[jr("0222")]:[F_],[jr("0002")]:[O_],[jr("0020")]:[D_],[jr("0200")]:[L_],[jr("2000")]:[F_],[jr("0011")]:[KH],[jr("0110")]:[ZH],[jr("1100")]:[JH],[jr("1001")]:[QH],[jr("2211")]:[KH],[jr("2112")]:[ZH],[jr("1122")]:[JH],[jr("1221")]:[QH],[jr("2200")]:[$H],[jr("2002")]:[e7],[jr("0022")]:[$H],[jr("0220")]:[e7],[jr("1111")]:[RAe],[jr("1211")]:[t7],[jr("2111")]:[r7],[jr("1112")]:[i7],[jr("1121")]:[n7],[jr("1011")]:[t7],[jr("0111")]:[r7],[jr("1110")]:[i7],[jr("1101")]:[n7],[jr("1200")]:[o7],[jr("0120")]:[s7],[jr("0012")]:[a7],[jr("2001")]:[l7],[jr("1022")]:[o7],[jr("2102")]:[s7],[jr("2210")]:[a7],[jr("0221")]:[l7],[jr("1002")]:[c7],[jr("2100")]:[u7],[jr("0210")]:[f7],[jr("0021")]:[h7],[jr("1220")]:[c7],[jr("0122")]:[u7],[jr("2012")]:[f7],[jr("2201")]:[h7],[jr("0211")]:[p7],[jr("2110")]:[d7],[jr("1102")]:[A7],[jr("1021")]:[m7],[jr("2011")]:[p7],[jr("0112")]:[d7],[jr("1120")]:[A7],[jr("1201")]:[m7],[jr("2101")]:[N_],[jr("0121")]:[N_],[jr("1012")]:[k_],[jr("1210")]:[k_],[jr("0101")]:{0:[I_,R_],1:[N_],2:[N_]},[jr("1010")]:{0:[B_,P_],1:[k_],2:[k_]},[jr("2121")]:{0:[N_],1:[N_],2:[I_,R_]},[jr("1212")]:{0:[k_],1:[k_],2:[B_,P_]},[jr("2120")]:{0:[CS],1:[CS],2:[O_,R_]},[jr("2021")]:{0:[MS],1:[MS],2:[I_,L_]},[jr("1202")]:{0:[IS],1:[IS],2:[B_,D_]},[jr("0212")]:{0:[PS],1:[PS],2:[P_,F_]},[jr("0102")]:{0:[O_,R_],1:[CS],2:[CS]},[jr("0201")]:{0:[I_,L_],1:[MS],2:[MS]},[jr("1020")]:{0:[B_,D_],1:[IS],2:[IS]},[jr("2010")]:{0:[P_,F_],1:[PS],2:[PS]},[jr("2020")]:{0:[F_,D_],1:[g7],2:[O_,L_]},[jr("0202")]:{0:[L_,O_],1:[g7],2:[F_,D_]}};var Jm={ISO_LINES:1,ISO_BANDS:2},BAe={zIndex:0,zOffset:.005};function ob(t,e){return Array.isArray(e)?t<e[0]?0:t<e[1]?1:2:t>=e?1:0}function v7(t){let{cellWeights:e,x:r,y:i,width:n,height:o}=t,s=t.threshold;t.thresholdValue&&(ur.deprecated("thresholdValue","threshold")(),s=t.thresholdValue);let l=r<0,u=r>=n-1,h=i<0,v=i>=o-1,T=l||u||h||v,E={},M={};l||v?M.top=0:(E.top=e[(i+1)*n+r],M.top=ob(E.top,s)),u||v?M.topRight=0:(E.topRight=e[(i+1)*n+r+1],M.topRight=ob(E.topRight,s)),u||h?M.right=0:(E.right=e[i*n+r+1],M.right=ob(E.right,s)),l||h?M.current=0:(E.current=e[i*n+r],M.current=ob(E.current,s));let{top:O,topRight:F,right:z,current:W}=M,J=-1;Number.isFinite(s)&&(J=O<<3|F<<2|z<<1|W),Array.isArray(s)&&(J=O<<6|F<<4|z<<2|W);let K=0;return T||(K=ob((E.top+E.topRight+E.right+E.current)/4,s)),{code:J,meanCode:K}}function QO(t){let{gridOrigin:e,cellSize:r,x:i,y:n,code:o,meanCode:s,type:l=Jm.ISO_LINES}=t,u={...BAe,...t.thresholdData},h=l===Jm.ISO_BANDS?y7[o]:_7[o];Array.isArray(h)||(h=h[s]);let v=u.zIndex*u.zOffset,T=(i+1)*r[0],E=(n+1)*r[1],M=e[0]+T,O=e[1]+E;if(l===Jm.ISO_BANDS){let z=[];return h.forEach(W=>{let J=[];W.forEach(K=>{let ne=M+K[0]*r[0],ge=O+K[1]*r[1];J.push([ne,ge,v])}),z.push(J)}),z}let F=[];return h.forEach(z=>{z.forEach(W=>{let J=M+W[0]*r[0],K=O+W[1]*r[1];F.push([J,K,v])})}),F}function x7({thresholdData:t,cellWeights:e,gridSize:r,gridOrigin:i,cellSize:n}){let o=[],s=[],l=r[0],u=r[1],h=0,v=0;for(let T of t){let{contour:E}=T,{threshold:M}=E;for(let O=-1;O<l;O++)for(let F=-1;F<u;F++){let{code:z,meanCode:W}=v7({cellWeights:e,threshold:M,x:O,y:F,width:l,height:u}),J={type:Jm.ISO_BANDS,gridOrigin:i,cellSize:n,x:O,y:F,width:l,height:u,code:z,meanCode:W,thresholdData:T};if(Array.isArray(M)){J.type=Jm.ISO_BANDS;let K=QO(J);for(let ne of K)s[v++]={vertices:ne,contour:E}}else{J.type=Jm.ISO_LINES;let K=QO(J);for(let ne=0;ne<K.length;ne+=2)o[h++]={start:K[ne],end:K[ne+1],contour:E}}}}return{contourSegments:o,contourPolygons:s}}var b7=[255,255,255,255],OAe=1,DAe=1,LAe={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:DAe}],optional:!0,compare:3},zOffset:.005},w7="positions",FAe={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},RS=class extends Lp{initializeState(){super.initializeAggregationLayer({dimensions:FAe}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:Wo.SUM}}}),this.getAttributeManager().add({[w7]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(e){super.updateState(e);let r=!1,{oldProps:i,props:n}=e,{aggregationDirty:o}=this.state;(i.contours!==n.contours||i.zOffset!==n.zOffset)&&(r=!0,this._updateThresholdData(e.props)),this.getNumInstances()>0&&(o||r)&&this._generateContours()}renderLayers(){let{contourSegments:e,contourPolygons:r}=this.state.contourData,i=this.getSubLayerClass("lines",zm),n=this.getSubLayerClass("bands",Rf),o=e&&e.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:l=>l.start,getTargetPosition:l=>l.end,getColor:l=>l.contour.color||b7,getWidth:l=>l.contour.strokeWidth||OAe}),s=r&&r.length>0&&new n(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:l=>l.vertices,getFillColor:l=>l.contour.color||b7});return[o,s]}updateAggregationState(e){let{props:r,oldProps:i}=e,{cellSize:n,coordinateSystem:o}=r,{viewport:s}=this.context,l=i.cellSize!==n,u=r.gpuAggregation;this.state.gpuAggregation!==r.gpuAggregation&&u&&!Fa.isSupported(this.context.device)&&(ur.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);let h=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});let{dimensions:v}=this.state,T=this.isAttributeChanged(w7),{data:E,weights:M}=v,{boundingBox:O}=this.state;if(T&&(O=bS(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:O})),T||l){let{gridOffset:W,translation:J,width:K,height:ne,numCol:ge,numRow:H}=wS(O,n,s,o);this.allocateResources(H,ge),this.setState({gridOffset:W,boundingBox:O,translation:J,posOffset:J.slice(),gridOrigin:[-1*J[0],-1*J[1]],width:K,height:ne,numCol:ge,numRow:H})}let F=T||h||this.isAggregationDirty(e,{dimension:E,compareAll:u}),z=this.isAggregationDirty(e,{dimension:M});z&&this._updateAccessors(e),(F||z)&&this._resetResults(),this.setState({aggregationDataDirty:F,aggregationWeightsDirty:z})}_updateAccessors(e){let{getWeight:r,aggregation:i,data:n}=e.props,{count:o}=this.state.weights;o&&(o.getWeight=r,o.operation=Wo[i]),this.setState({getValue:T_(i,r,{data:n})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}_generateContours(){let{numCol:e,numRow:r,gridOrigin:i,gridOffset:n,thresholdData:o}=this.state,{count:s}=this.state.weights,{aggregationData:l}=s;l||(l=s.aggregationBuffer.readSyncWebGL(),s.aggregationData=l);let{cellWeights:u}=Fa.getCellData({countsData:l}),h=x7({thresholdData:o,cellWeights:u,gridSize:[e,r],gridOrigin:i,cellSize:[n.xOffset,n.yOffset]});this.setState({contourData:h})}_updateThresholdData(e){let{contours:r,zOffset:i}=e,n=r.length,o=new Array(n);for(let s=0;s<n;s++){let l=r[s];o[s]={contour:l,zIndex:l.zIndex||s,zOffset:i}}this.setState({thresholdData:o})}},sb=RS;(()=>{RS.layerName="ContourLayer"})(),(()=>{RS.defaultProps=LAe})();var T7=`#version 300 es
3108
3108
  #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
3109
3109
  #define RANGE_COUNT 6
3110
3110
  in vec3 positions;
@@ -3312,7 +3312,7 @@ void main() {
3312
3312
  fragColor = outTexture;
3313
3313
  fragColor.g = outTexture.r / max(1.0, outTexture.a);
3314
3314
  }
3315
- `;var VAe=2,oD={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},F7=[0,0],jAe={SUM:0,MEAN:1},HAe={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ju,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},GAe=["float32-renderable-webgl","texture-blend-float-webgl"],WAe={data:{props:["radiusPixels"]}},LS=class extends $c{initializeState(){super.initializeAggregationLayer(WAe),this.setState({colorDomain:F7}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:s}=this.state,{updateTriggers:l,intensity:u,threshold:h,aggregation:v}=this.props,T=this.getSubLayerClass("triangle",cb);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:Zr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:jAe[v]||0,weightsTexture:e,intensity:u,threshold:h,colorDomain:s})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:s,triTexCoordBuffer:l,colorTexture:u,updateTimer:h}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),s?.destroy(),l?.destroy(),u?.destroy(),h&&clearTimeout(h)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...oD,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...oD,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=GAe.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",s=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:s}),n||ur.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new Mh(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,o=this.getShaders({vs:iD,fs:nD});this._createWeightsTransform(o);let s=this.getShaders({vs:D7,fs:L7}),l=new Mh(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...s,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:iD,fs:nD,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(l=>l.map(Math.fround)),n=M7(i),o={visibleWorldBounds:n,viewportCorners:i},s=!1;if(e||!this.state.worldBounds||!I7(this.state.worldBounds,n)){let l=this._worldToCommonBounds(n),u=this._commonToWorldBounds(l);this.props.coordinateSystem===Zr.LNGLAT&&(u[1]=Math.max(u[1],-85.051129),u[3]=Math.min(u[3],85.051129),u[0]=Math.max(u[0],-360),u[2]=Math.min(u[2],360));let h=this._worldToCommonBounds(u);o.worldBounds=u,o.normalizedCommonBounds=h,s=!0}return this.setState(o),s}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:o}=this.context;e.write(tD(n,3));let s=n.map(l=>R7(o.projectPosition(l),i));r.write(tD(s,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=Zd(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...oD,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:o,weightsScale:s}=this.state,l=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let u=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:F}=this.context,z=F.distanceScales.metersPerUnit[2]*(u[2]-u[0])/o;this.state.colorDomain=r.map(W=>W*z*s)}else this.state.colorDomain=r||F7;let v=this.getAttributeManager().getAttributes(),T=this.getModuleSettings(),E=v.positions.buffer,M={radiusPixels:e,commonBounds:u,textureWidth:o,weightsScale:s},O=v.weights.buffer;l.model.setAttributes({positions:E,weights:O}),l.model.setVertexCount(this.getNumInstances()),l.model.setUniforms(M),l.model.updateModuleSettings(T),l.run({parameters:{viewport:[0,0,o,o]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,o,s,l]=e,{viewport:u}=this.context,{textureSize:h}=this.state,{coordinateSystem:v}=this.props,T=i&&(v===Zr.LNGLAT_OFFSETS||v===Zr.METER_OFFSETS),E=T?u.projectPosition(this.props.coordinateOrigin):[0,0],M=h*VAe/u.scale,O,F;return i&&!T?(O=this.projectPosition([n,o,0]),F=this.projectPosition([s,l,0])):(O=u.projectPosition([n,o,0]),F=u.projectPosition([s,l,0])),P7([O[0]-E[0],O[1]-E[1],F[0]-E[0],F[1]-E[1]],M,M)}_commonToWorldBounds(e){let[r,i,n,o]=e,{viewport:s}=this.context,l=s.unprojectPosition([r,i]),u=s.unprojectPosition([n,o]);return l.slice(0,2).concat(u.slice(0,2))}},ub=LS;(()=>{LS.layerName="HeatmapLayer"})(),(()=>{LS.defaultProps=HAe})();function qAe(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function FS(t){if(Array.isArray(t))return t.map(e=>FS(e));if(t&&typeof t=="object"){let e={};for(let[r,i]of Object.entries(t))e[qAe(r)]=FS(i);return e}return t}var AG=ga(dG(),1);function dD(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(n,o,s,l)=>Boolean(e?.arrayPaths?.some(h=>o===h)),...e?._fastXML},i=tge(t,r);return e?.uncapitalizeKeys?FS(i):i}function tge(t,e){return new AG.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var rge="4.2.0-beta.2",Of={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:rge,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:ige,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>dD(new TextDecoder().decode(t),{...Of.options.xml,...e?.xml}),parseTextSync:(t,e)=>dD(t,{...Of.options.xml,...e?.xml})};function ige(t){return t.startsWith("<?xml")}function mG(t,e){let r=Of.parseTextSync?.(t,e),i=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof i=="string"?i:i.value||i.code||"Unknown error"}var nge="4.2.0-beta.2",pb={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:nge,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:oge,options:{wms:{throwOnError:!1}},parse:async(t,e)=>AD(new TextDecoder().decode(t),e),parseSync:(t,e)=>AD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>AD(t,e)};function oge(t){return t.startsWith("<?xml")}function AD(t,e){let r={...pb.options.wms,...e?.wms},i=mG(t,r),n=r.minimalErrors?i:`WMS Service error: ${i}`;if(r.throwOnError)throw new Error(n);return n}function $m(t){return Array.isArray(t)?t:t?[t]:[]}function db(t){let e=$m(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Ab(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function kS(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function eg(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function mD(t,e){let r=Of.parseTextSync?.(t,e),i=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,n=sge(i);if(e?.inheritedLayerProps)for(let o of n.layers)_G(o,null);return e?.includeRawJSON&&(n.json=i),e?.includeXMLText&&(n.xml=t),n}function sge(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:db(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:kS(t.Service?.LayerLimit),maxWidth:kS(t.Service?.maxWidth),maxHeight:kS(t.Service?.maxHeight),layers:[],requests:age(t.Capability?.Request),exceptions:lge(t.Exception)},r=$m(t.Capability?.Layer);for(let i of r)e.layers.push(gG(i));for(let[i,n]of Object.entries(e))n===void 0&&delete e[i];return e}function age(t){let e={};for(let[r,i]of Object.entries(t||{})){let n=db(i?.Format);e[r]={mimeTypes:n}}return e}function lge(t){if($m(t?.Format).length>0)return{mimeTypes:db(t)}}function gG(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:db(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(h=>typeof h=="string")&&(e.crs=r);let i=t?.EX_GeographicBoundingBox&&cge(t?.EX_GeographicBoundingBox);i&&(e.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&uge(t?.LatLonBoundingBox),i&&(e.geographicBoundingBox=i);let n=t?.BoundingBox&&fge(t?.BoundingBox);n&&n.length>0&&(e.boundingBoxes=n);let s=$m(t?.Dimension).map(h=>pge(h));s.length&&(e.dimensions=s),t?.opaque&&(e.opaque=eg(t?.opaque)),t?.cascaded&&(e.cascaded=eg(t?.cascaded)),t?.queryable&&(e.queryable=eg(t?.queryable));let l=$m(t?.Layer),u=[];for(let h of l)u.push(gG(h));u.length>0&&(e.layers=u);for(let[h,v]of Object.entries(e))v===void 0&&delete e[h];return e}function cge(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:i,southBoundLatitude:n}=t;return[[e,n],[i,r]]}function uge(t){let{minx:e,miny:r,maxx:i,maxy:n}=t;return[[e,r],[i,n]]}function fge(t){return $m(t).map(r=>hge(r))}function hge(t){let{CRS:e,SRS:r,minx:i,miny:n,maxx:o,maxy:s,resx:l,resy:u}=t,h={crs:e||r,boundingBox:[[Ab(i),Ab(n)],[Ab(o),Ab(s)]]};return l&&(h.xResolution=l),u&&(h.yResolution=u),h}function pge(t){let{name:e,units:r,value:i}=t,n={name:e,units:r,extent:i};return t.unitSymbol&&(n.unitSymbol=t.unitSymbol),t.default&&(n.defaultValue=t.default),t.multipleValues&&(n.multipleValues=eg(t.multipleValues)),t.nearestValue&&(n.nearestValue=eg(t.nearestValue)),t.current&&(n.current=eg(t.current)),n}function _G(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])_G(r,t)}var dge="4.2.0-beta.2",U_={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:dge,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Age,options:{wms:{}},parse:async(t,e)=>mD(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>mD(t,e?.wms)};function Age(t){return t.startsWith("<?xml")}function gD(t,e){let i=(Of.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(i)?i:[i]).map(o=>mge(o))}}function mge(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var yG={...U_,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>gD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>gD(t,e)};function _D(t,e){return Of.parseTextSync?.(t,e)}var vG={...U_,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>_D(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>_D(t,e)};function xG(t,e){let{type:r="auto"}=t,i=r==="auto"?_ge(t.url,e):gge(r,e);if(!i)throw new Error("Not a valid image source type");return i.create(t)}function gge(t,e){for(let r of e)if(r.type===t)return r;return null}function _ge(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var bG={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new yD(t)},yD=class extends Eu{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(e){super(e),this.url=e.url,this.data=e.url,this.substituteCRS84=e.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:i,...n}=e,o={bbox:r?[...r[0],...r[1]]:i,...n};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let i=this.getCapabilitiesURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);let s=await U_.parse(o,this.loadOptions);return this.capabilities=s,s}async getMap(e,r){let i=this.getMapURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await yG.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),new TextDecoder().decode(o)}async describeLayer(e,r){let i=this.describeLayerURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await vG.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let i=this.getLegendGraphicURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",i,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let i={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",i,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let{boundingBox:i,bbox:n}=e;e.bbox=i?[...i[0],...i[1]]:n;let o={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",i,r)}getLegendGraphicURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",i,r)}_parseWMSUrl(e){let[r,i]=e.split("?"),n=i.split("&"),o={};for(let s of n){let[l,u]=s.split("=");o[l]=u}return{url:r,parameters:o}}_getWMSUrl(e,r,i){let n=this.url,o=!0,s={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...i},l=["transparent","time","elevation"];for(let[u,h]of Object.entries(s))(!l.includes(u)||h)&&(n+=o?"?":"&",o=!1,n+=this._getURLParameter(u,h,r));return encodeURI(n)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,i){switch(e){case"crs":i.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":i.version==="1.3.0"&&(e="crs");break;case"bbox":let n=this._flipBoundingBox(r,i);n&&(r=n);break;case"x":i.version==="1.3.0"&&(e="i");break;case"y":i.version==="1.3.0"&&(e="j");break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let i=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),n=e;return i?[n[1],n[0],n[3],n[2]]:n}async _fetchArrayBuffer(e){let r=await this.fetch(e),i=await r.arrayBuffer();return this._checkResponse(r,i),i}_checkResponse(e,r){let i=e.headers["content-type"];if(!e.ok||pb.mimeTypes.includes(i)){let n=Wv(this.loadOptions,{wms:{throwOnError:!0}}),o=pb.parseSync?.(r,n);throw new Error(o)}}_parseError(e){let r=pb.parseSync?.(e,this.loadOptions);return new Error(r)}};var z_=class extends Eu{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),i=this.getURLFromTemplate(r),o=await(await this.fetch(i)).arrayBuffer();return await Eh.parse(o)}getGranularParameters(e){let[[r,i],[n,o]]=e.boundingBox;return{...e,east:r,north:i,south:o,west:n}}getURLFromTemplate(e){let r=this.props.url;for(let[i,n]of Object.entries(e))r=r.replace(`\${${i}}`,String(n)),r=r.replace(`{${i}}`,String(n));return r}};Yr(z_,"type","template"),Yr(z_,"testURL",e=>e.toLowerCase().includes("{"));var vD=class extends z_{data;constructor(e){super(e),this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,i=`size=${e.width},${e.height}`,n={...e,bbox:r,size:i};return delete n.width,delete n.height,this.getUrl("exportImage",n)}getUrl(e,r,i){let n=`${this.props.url}/${e}`,o=!0;for(let[s,l]of Object.entries(r))n+=o?"?":"&",o=!1,Array.isArray(l)?n+=`${s.toUpperCase()}=${l.join(",")}`:n+=`${s.toUpperCase()}=${l?String(l):""}`;return n}async checkResponse(e){if(!e.ok)throw new Error("error")}},wG={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new vD(t)};var yge=[bG,wG];function xD(t){return xG(t,yge)}var TG=6378137*Math.PI;function bD(t){let e=La(t);return e[0]=(e[0]/256-1)*TG,e[1]=(e[1]/256-1)*TG,e}var vge={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},zS=class extends es{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:i}){let{viewport:n}=this.context;e.dataChanged||r.serviceType!==i.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(n,"image source changed"),0)):Ls(r.layers,i.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(n,"viewport changed")):this.debounce(()=>this.loadImage(n,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:i}=this.state;return r&&new Um({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:i.srs==="EPSG:4326"?Zr.LNGLAT:Zr.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:i}=this.state;return i?await this.state.imageSource.getFeatureInfoText?.({...i,query_layers:i.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof Eu)return e.data;if(typeof e.data=="string")return xD({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:i,serviceType:n}=this.props;if(n==="wms"&&i.length===0)return;let o=e.getBounds(),{width:s,height:l}=e,u=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=e.resolution?"EPSG:4326":"EPSG:3857");let v={width:s,height:l,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:i,crs:h};if(h==="EPSG:3857"){let T=bD([o[0],o[1]]),E=bD([o[2],o[3]]);v.boundingBox=[T,E]}try{this.state.loadCounter++,this.props.onImageLoadStart(u);let T=await this.state.imageSource.getImage(v);this.state.lastRequestId<u&&(this.getCurrentLayer()?.props.onImageLoad(u),this.setState({image:T,bounds:o,lastRequestParameters:v,lastRequestId:u}))}catch(T){this.raiseError(T,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(u,T)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},US=zS;(()=>{zS.layerName="WMSLayer"})(),(()=>{zS.defaultProps=vge})();var xge={getHeight:{type:"accessor",value:0},greatCircle:!0},VS=class extends km{},mb=VS;(()=>{VS.layerName="GreatCircleLayer"})(),(()=>{VS.defaultProps=xge})();var bge={...Bf.defaultProps},jS=class extends es{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:i,filled:n,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z}=this.props,{updateTriggers:W,material:J,transitions:K}=this.props,ne=this.getSubLayerClass("cell",Bf),{updateTriggers:ge,...H}=this.indexToBounds()||{};return new ne({filled:n,wireframe:i,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,material:J,transitions:K,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z},this.getSubLayerProps({id:"cell",updateTriggers:W&&{...ge,getElevation:W.getElevation,getFillColor:W.getFillColor,getLineColor:W.getLineColor,getLineWidth:W.getLineWidth}}),H)}},eu=jS;(()=>{jS.layerName="GeoCellLayer"})(),(()=>{jS.defaultProps=bge})();var HS=ga(wD(),1),wge=3,Tge=30,Ege=2*Tge+1,SG=180/Math.PI;function MG(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function CG(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function IG(t){return[CG(t[0]),CG(t[1])]}function PG(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function RG([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*SG,i*SG]}function BG(t){let e=HS.default.fromString(t,!0,10).toString(2);for(;e.length<wge+Ege;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,s=HS.default.fromString(i,!0,2).toString(10),l=HS.default.fromString(n,!0,2).toString(4);for(;l.length<o;)l="0"+l;return`${s}/${l}`}function Sge(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function OG(t){let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=[0,0],s;for(let l=n-1;l>=0;l--){s=n-l;let u=i[l],h=0,v=0;u==="1"?v=1:u==="2"?(h=1,v=1):u==="3"&&(h=1);let T=Math.pow(2,s-1);Sge(T,o,h,v),o[0]+=T*h,o[1]+=T*v}if(r%2===1){let l=o[0];o[0]=o[1],o[1]=l}return{face:r,ij:o,level:s}}var DG=ga(wD(),1);function Cge(t){let e=t.padEnd(16,"0");return DG.default.fromString(e,16)}var Mge=100;function Ige({face:t,ij:e,level:r}){let i=[[0,0],[0,1],[1,1],[1,0],[0,0]],n=Math.max(1,Math.ceil(Mge*Math.pow(2,-r))),o=new Float64Array(4*n*2+2),s=0,l=0;for(let u=0;u<4;u++){let h=i[u].slice(0),v=i[u+1],T=(v[0]-h[0])/n,E=(v[1]-h[1])/n;for(let M=0;M<n;M++){h[0]+=T,h[1]+=E;let O=MG(e,r,h),F=IG(O),z=PG(t,F),W=RG(z);Math.abs(W[1])>89.999&&(W[0]=l);let J=W[0]-l;W[0]+=J>180?-360:J<-180?360:0,o[s++]=W[0],o[s++]=W[1],l=W[0]}}return o[s++]=o[0],o[s++]=o[1],o}function Pge(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=Cge(t)}return BG(t.toString())}function LG(t){let e=Pge(t),r=OG(e);return Ige(r)}var Rge={getS2Token:{type:"accessor",value:t=>t.token}},GS=class extends eu{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>LG(r(i,n))}}},_b=GS;(()=>{GS.layerName="S2Layer"})(),(()=>{GS.defaultProps=Rge})();var TD=512;function Bge(t,e){let r=0,i=0,n=1<<t.length,o=n/TD;for(let s=0;s<t.length;s++){n>>=1;let l=parseInt(t[s]);l%2&&(r|=n),l>1&&(i|=n)}return[[r/o,TD-i/o],[(r+e)/o,TD-(i+e)/o]]}function FG(t,e=1){let[r,i]=Bge(t,e),[n,o]=xl(r),[s,l]=xl(i);return[s,o,s,l,n,l,n,o,s,o]}var Oge={getQuadkey:{type:"accessor",value:t=>t.quadkey}},WS=class extends eu{indexToBounds(){let{data:e,extruded:r,getQuadkey:i}=this.props,n=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,s)=>FG(i(o,s),n),updateTriggers:{getPolygon:n}}}},yb=WS;(()=>{WS.layerName="QuadkeyLayer"})(),(()=>{WS.defaultProps=Oge})();var tg=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:o,id:s,bbox:l,userData:u,zoom:h}=this,v=this._loaderId;this._abortController=new AbortController;let{signal:T}=this._abortController,E=await r.scheduleRequest(this,F=>F.isSelected?1:-1);if(!E){this._isCancelled=!0;return}if(this._isCancelled){E.done();return}let M=null,O;try{M=await e({index:o,id:s,bbox:l,userData:u,zoom:h,signal:T})}catch(F){O=F||!0}finally{E.done()}if(v===this._loaderId){if(this._loader=void 0,this.content=M,this._isCancelled&&!M){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,O?n(O,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var sa={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var NG=new ot,Dge=new ot,eA=class{constructor(e=[0,0,0],r=[0,0,0],i){i=i||NG.copy(e).add(r).scale(.5),this.center=new ot(i),this.halfDiagonal=new ot(r).subtract(this.center),this.minimum=new ot(e),this.maximum=new ot(r)}clone(){return new eA(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=Dge.from(e.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),o=this.center.dot(i)+e.distance;return o-n>0?sa.INSIDE:o+n<0?sa.OUTSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=NG.from(e).subtract(this.center),{halfDiagonal:i}=this,n=0,o;return o=Math.abs(r.x)-i.x,o>0&&(n+=o*o),o=Math.abs(r.y)-i.y,o>0&&(n+=o*o),o=Math.abs(r.z)-i.z,o>0&&(n+=o*o),n}};var vb=new ot,kG=new ot,Hu=class{constructor(e=[0,0,0],r=0){this.radius=-0,this.center=new ot,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=vb.from(r),this.center=new ot().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Hu(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,o=e.radius,s=vb.copy(n).subtract(r),l=s.magnitude();if(i>=l+o)return this.clone();if(o>=l+i)return e.clone();let u=(i+l+o)*.5;return kG.copy(s).scale((-i+u)/l).add(r),this.center.copy(kG),this.radius=u,this}expand(e){let i=vb.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=Zs.getScaling(vb,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=vb.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,o=e.normal.dot(r)+e.distance;return o<-i?sa.OUTSIDE:o<i?sa.INTERSECTING:sa.INSIDE}};var Lge=new ot,Fge=new ot,qS=new ot,XS=new ot,YS=new ot,Nge=new ot,kge=new ot,kp={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Df=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new ot().from(e),this.halfAxes=new mo(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new ot(e).len(),new ot(r).len(),new ot(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new ot(e).normalize(),o=new ot(r).normalize(),s=new ot(i).normalize();return new Du().fromMatrix3(new mo([...n,...o,...s]))}fromCenterHalfSizeQuaternion(e,r,i){let n=new Du(i),o=new mo().fromQuaternion(n);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new ot().from(e),this.halfAxes=o,this}clone(){return new Df(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Hu){let r=this.halfAxes,i=r.getColumn(0,qS),n=r.getColumn(1,XS),o=r.getColumn(2,YS),s=Lge.copy(i).add(n).add(o);return e.center.copy(this.center),e.radius=s.magnitude(),e}intersectPlane(e){let r=this.center,i=e.normal,n=this.halfAxes,o=i.x,s=i.y,l=i.z,u=Math.abs(o*n[kp.COLUMN0ROW0]+s*n[kp.COLUMN0ROW1]+l*n[kp.COLUMN0ROW2])+Math.abs(o*n[kp.COLUMN1ROW0]+s*n[kp.COLUMN1ROW1]+l*n[kp.COLUMN1ROW2])+Math.abs(o*n[kp.COLUMN2ROW0]+s*n[kp.COLUMN2ROW1]+l*n[kp.COLUMN2ROW2]),h=i.dot(r)+e.distance;return h<=-u?sa.OUTSIDE:h>=u?sa.INSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=Fge.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,qS),o=i.getColumn(1,XS),s=i.getColumn(2,YS),l=n.magnitude(),u=o.magnitude(),h=s.magnitude();n.normalize(),o.normalize(),s.normalize();let v=0,T;return T=Math.abs(r.dot(n))-l,T>0&&(v+=T*T),T=Math.abs(r.dot(o))-u,T>0&&(v+=T*T),T=Math.abs(r.dot(s))-h,T>0&&(v+=T*T),v}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,l=this.halfAxes,u=l.getColumn(0,qS),h=l.getColumn(1,XS),v=l.getColumn(2,YS),T=Nge.copy(u).add(h).add(v).add(s),E=kge.copy(T).subtract(e),M=r.dot(E);return n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),i[0]=n,i[1]=o,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,qS);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,XS);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,YS);return n.transformAsPoint(e),this.halfAxes=new mo([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var UG=new ot,zG=new ot,$a=class{constructor(e=[0,0,1],r=0){this.normal=new ot,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return Ja(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=UG.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),Ja(Cs(this.normal.len(),1)),this.distance=n,this}clone(){return new $a(this.normal,this.distance)}equals(e){return Cs(this.distance,e.distance)&&Cs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=zG.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=UG.from(e),n=this.getPointDistance(i),o=zG.copy(this.normal).scale(n);return i.subtract(o).to(r)}};var VG=[new ot([1,0,0]),new ot([0,1,0]),new ot([0,0,1])],jG=new ot,Uge=new ot,wa=class{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*VG.length;let r=e.center,i=e.radius,n=0;for(let o of VG){let s=this.planes[n],l=this.planes[n+1];s||(s=this.planes[n]=new $a),l||(l=this.planes[n+1]=new $a);let u=jG.copy(o).scale(-i).add(r);s.fromPointNormal(u,o);let h=jG.copy(o).scale(i).add(r),v=Uge.copy(o).negate();l.fromPointNormal(h,v),n+=2}return this}computeVisibility(e){let r=sa.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case sa.OUTSIDE:return sa.OUTSIDE;case sa.INTERSECTING:r=sa.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(Ja(Number.isFinite(r),"parentPlaneMask is required."),r===wa.MASK_OUTSIDE||r===wa.MASK_INSIDE)return r;let i=wa.MASK_INSIDE,n=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&!(r&s))continue;let l=n[o],u=e.intersectPlane(l);if(u===sa.OUTSIDE)return wa.MASK_OUTSIDE;u===sa.INTERSECTING&&(i|=s)}return i}};wa.MASK_OUTSIDE=4294967295;wa.MASK_INSIDE=0;wa.MASK_INDETERMINATE=2147483647;var ptt=new ot,dtt=new ot,Att=new ot,mtt=new ot,gtt=new ot;var wtt=new ot,Ttt=new ot,Ett=new ot,Stt=new ot,Ctt=new ot,Mtt=new ot,Itt=new ot,Ptt=new ot,Rtt=new ot,Btt=new ot,Ott=new ot,Dtt=new ot;var Dh=new mo,Vge=new mo,jge=new mo,KS=new mo,HG=new mo;function CD(t,e={}){let r=Lu.EPSILON20,i=10,n=0,o=0,s=Vge,l=jge;s.identity(),l.copy(t);let u=r*Hge(l);for(;o<i&&Gge(l)>u;)Wge(l,KS),HG.copy(KS).transpose(),l.multiplyRight(KS),l.multiplyLeft(HG),s.multiplyRight(KS),++n>2&&(++o,n=0);return e.unitary=s.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function Hge(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var ED=[1,0,0],SD=[2,2,1];function Gge(t){let e=0;for(let r=0;r<3;++r){let i=t[Dh.getElementIndex(SD[r],ED[r])];e+=2*i*i}return Math.sqrt(e)}function Wge(t,e){let r=Lu.EPSILON15,i=0,n=1;for(let h=0;h<3;++h){let v=Math.abs(t[Dh.getElementIndex(SD[h],ED[h])]);v>i&&(n=h,i=v)}let o=ED[n],s=SD[n],l=1,u=0;if(Math.abs(t[Dh.getElementIndex(s,o)])>r){let h=t[Dh.getElementIndex(s,s)],v=t[Dh.getElementIndex(o,o)],T=t[Dh.getElementIndex(s,o)],E=(h-v)/2/T,M;E<0?M=-1/(-E+Math.sqrt(1+E*E)):M=1/(E+Math.sqrt(1+E*E)),l=1/Math.sqrt(1+M*M),u=M*l}return mo.IDENTITY.to(e),e[Dh.getElementIndex(o,o)]=e[Dh.getElementIndex(s,s)]=l,e[Dh.getElementIndex(s,o)]=u,e[Dh.getElementIndex(o,s)]=-u,e}var tA=new ot,qge=new ot,Xge=new ot,Yge=new ot,Kge=new ot,Zge=new mo,Jge={diagonal:new mo,unitary:new mo};function xb(t,e=new Df){if(!t||t.length===0)return e.halfAxes=new mo([0,0,0,0,0,0,0,0,0]),e.center=new ot,e;let r=t.length,i=new ot(0,0,0);for(let $ of t)i.add($);let n=1/r;i.multiplyByScalar(n);let o=0,s=0,l=0,u=0,h=0,v=0;for(let $ of t){let Z=tA.copy($).subtract(i);o+=Z.x*Z.x,s+=Z.x*Z.y,l+=Z.x*Z.z,u+=Z.y*Z.y,h+=Z.y*Z.z,v+=Z.z*Z.z}o*=n,s*=n,l*=n,u*=n,h*=n,v*=n;let T=Zge;T[0]=o,T[1]=s,T[2]=l,T[3]=s,T[4]=u,T[5]=h,T[6]=l,T[7]=h,T[8]=v;let{unitary:E}=CD(T,Jge),M=e.halfAxes.copy(E),O=M.getColumn(0,Xge),F=M.getColumn(1,Yge),z=M.getColumn(2,Kge),W=-Number.MAX_VALUE,J=-Number.MAX_VALUE,K=-Number.MAX_VALUE,ne=Number.MAX_VALUE,ge=Number.MAX_VALUE,H=Number.MAX_VALUE;for(let $ of t)tA.copy($),W=Math.max(tA.dot(O),W),J=Math.max(tA.dot(F),J),K=Math.max(tA.dot(z),K),ne=Math.min(tA.dot(O),ne),ge=Math.min(tA.dot(F),ge),H=Math.min(tA.dot(z),H);O=O.multiplyByScalar(.5*(ne+W)),F=F.multiplyByScalar(.5*(ge+J)),z=z.multiplyByScalar(.5*(H+K)),e.center.copy(O).add(F).add(z);let me=qge.set(W-ne,J-ge,K-H).multiplyByScalar(.5),fe=new mo([me[0],0,0,0,me[1],0,0,0,me[2]]);return e.halfAxes.multiplyRight(fe),e}var V_=512,GG=3,WG=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],qG=WG.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Qge=qG.concat([[.25,.5],[.75,.5]]),rA=class{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new rA(e,r,i),new rA(e,r+1,i),new rA(e+1,r,i),new rA(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:o,maxZ:s,bounds:l,offset:u,project:h}=e,v=this.getBoundingVolume(n,u,h);if(l&&!this.insideBounds(l)||i.computeVisibility(v)<0)return!1;if(!this.childVisible){let{z:E}=this;if(E<s&&E>=o){let M=v.distanceTo(r.cameraPosition)*r.scale/r.height;E+=Math.floor(Math.log2(M))}if(E>=s)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let E of this.children)E.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let o=Math.pow(2,this.z),s=V_/o;return this.x*s<i&&this.y*s<n&&(this.x+1)*s>e&&(this.y+1)*s>r}getBoundingVolume(e,r,i){if(i){let u=this.z<1?Qge:this.z<2?qG:WG,h=[];for(let v of u){let T=ZS(this.x+v[0],this.y+v[1],this.z);T[2]=e[0],h.push(i(T)),e[0]!==e[1]&&(T[2]=e[1],h.push(i(T)))}return xb(h)}let n=Math.pow(2,this.z),o=V_/n,s=this.x*o+r*V_,l=V_-(this.y+1)*o;return new eA([s,l,e[0]],[s+o,l+o,e[1]])}};function XG(t,e,r,i){let n=t instanceof Rp&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:M,distance:O})=>new $a(M.clone().negate(),O)),s=new wa(o),l=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*l||0,h=r&&r[1]*l||0,v=t instanceof Ec&&t.pitch<=60?e:0;if(i){let[M,O,F,z]=i,W=La([M,z]),J=La([F,O]);i=[W[0],V_-W[1],J[0],V_-J[1]]}let T=new rA(0,0,0),E={viewport:t,project:n,cullingVolume:s,elevationBounds:[u,h],minZ:v,maxZ:e,bounds:i,offset:0};if(T.update(E),t instanceof Ec&&t.subViewports&&t.subViewports.length>1){for(E.offset=-1;T.update(E)&&!(--E.offset<-GG););for(E.offset=1;T.update(E)&&!(++E.offset>GG););}return T.getSelected()}var Up=512,$ge=[-1/0,-1/0,1/0,1/0],iA={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}};function KG(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(n=>n[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function e0e(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function Lh(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let o=e0e(i)%t.length;t=t[o]}let n=t;for(let o of Object.keys(r)){let s=new RegExp(`{${o}}`,"g");n=n.replace(s,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function t0e(t,e,r){let i;if(e&&e.length===2){let[n,o]=e,s=t.getBounds({z:n}),l=t.getBounds({z:o});i=[Math.min(s[0],l[0]),Math.min(s[1],l[1]),Math.max(s[2],l[2]),Math.max(s[3],l[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function ZG({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>MD(n,e||0,r))}function MD(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,s=r.y-t.y,{width:l,height:u}=r,h={targetZ:e},v=t.unproject([o,s],h),T=t.unproject([o+l,s],h),E=t.unproject([o,s+u],h),M=t.unproject([o+l,s+u],h);return[Math.min(v[0],T[0],E[0],M[0]),Math.min(v[1],T[1],E[1],M[1]),Math.max(v[0],T[0],E[0],M[0]),Math.max(v[1],T[1],E[1],M[1])]}let i=MD(t,e[0],r),n=MD(t,e[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function r0e(t,e,r){return r?KG(t,r).map(n=>n*e/Up):t.map(i=>i*e/Up)}function ID(t,e){return Math.pow(2,t)*Up/e}function ZS(t,e,r){let i=ID(r,Up),n=t/i*360-180,o=Math.PI-2*Math.PI*e/i,s=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[n,s]}function YG(t,e,r,i){let n=ID(r,i);return[t/n*Up,e/n*Up]}function PD(t,e,r,i,n=Up){if(t.isGeospatial){let[h,v]=ZS(e,r,i),[T,E]=ZS(e+1,r+1,i);return{west:h,north:v,east:T,south:E}}let[o,s]=YG(e,r,i,n),[l,u]=YG(e+1,r+1,i,n);return{left:o,top:s,right:l,bottom:u}}function i0e(t,e,r,i,n){let o=t0e(t,null,i),s=ID(e,r),[l,u,h,v]=r0e(o,s,n),T=[];for(let E=Math.floor(l);E<h;E++)for(let M=Math.floor(u);M<v;M++)T.push({x:E,y:M,z:e});return T}function RD({viewport:t,maxZoom:e,minZoom:r,zRange:i,extent:n,tileSize:o=Up,modelMatrix:s,modelMatrixInverse:l,zoomOffset:u=0}){let h=t.isGeospatial?Math.round(t.zoom+Math.log2(Up/o))+u:Math.ceil(t.zoom)+u;if(typeof r=="number"&&Number.isFinite(r)&&h<r){if(!n)return[];h=r}typeof e=="number"&&Number.isFinite(e)&&h>e&&(h=e);let v=n;return s&&l&&n&&!t.isGeospatial&&(v=KG(n,s)),t.isGeospatial?XG(t,h,i,n):i0e(t,h,o,v||$ge,l)}function BD(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function OD(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function JG(t){let e={},r;return i=>{for(let n in i)if(!n0e(i[n],e[n])){r=t(i),e=i;break}return r}}function n0e(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}var QG=1,JS=2,o0e="never",s0e="no-overlap",bb="best-available",a0e=5,l0e={[bb]:u0e,[s0e]:f0e,[o0e]:()=>{}},c0e={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},rg=class{constructor(e){this._getCullBounds=JG(ZG),this.opts={...c0e,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new vd({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Kr,this._modelMatrixInverse=new Kr}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new Kr(i):new Kr,o=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!Cs(this._zRange,r)||o){o&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(u=>this._getTile(u,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l=>this._getTile(l.index,!0)));let s=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),s&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[o,s,l,u]of i){let h;if("west"in n)h=n.west<l&&n.east>o&&n.south<u&&n.north>s;else{let v=Math.min(n.top,n.bottom),T=Math.max(n.top,n.bottom);h=n.left<l&&n.right>o&&v<u&&T>s}if(h)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:o,modelMatrixInverse:s}){let{tileSize:l,extent:u,zoomOffset:h}=this.opts;return RD({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:l,extent:u,modelMatrix:o,modelMatrixInverse:s,zoomOffset:h})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:PD(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||bb,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof e=="function"?e:l0e[e])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:a0e*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[s,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?l.byteLength:0,e.delete(s),this.opts.onTileUnload?.(l)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((s,l)=>s.zoom-l.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),o=!1;return!n&&r?(n=new tg(e),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),o=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(o=!0),n&&o&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function u0e(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!$G(e)&&DD(e);for(let e of t)e.isVisible=Boolean(e.state&JS)}function f0e(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&$G(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&JS),r.children&&(r.isVisible||r.state&QG))for(let i of r.children)i.state=QG;else r.isSelected&&DD(r)}function $G(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=JS,!0;e=e.parent}return!1}function DD(t){for(let e of t.children)e.isLoaded||e.content?e.state|=JS:DD(e)}var h0e={TilesetClass:rg,data:{type:"data",value:[]},dataComparator:iA.equal,renderSubLayers:{type:"function",value:t=>new Oh(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:bb,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},QS=class extends es{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:o,maxZoom:s,minZoom:l,maxRequests:u,debounceTime:h,zoomOffset:v}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:s,minZoom:l,tileSize:e,refinementStrategy:n,extent:o,maxRequests:u,debounceTime:h,zoomOffset:v,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:o}=e,s=this.state.isLoaded!==o,l=this.state.frameNumber!==n;o&&(s||l)&&this._onViewportLoad(),l&&this.setState({frameNumber:n}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?Lh(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let r=e.sourceLayer.props.tile,i=e.info;return i.picked&&(i.tile=r),i.sourceTile=r,i}_updateAutoHighlight(e){let r=e.sourceTile;if(r&&r.layers)for(let i of r.layers)i.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=Rh(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}},Fh=QS;(()=>{QS.defaultProps=h0e})(),(()=>{QS.layerName="TileLayer"})();var p0e={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},$S=class extends Pf{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
3315
+ `;var VAe=2,oD={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},F7=[0,0],jAe={SUM:0,MEAN:1},HAe={getPosition:{type:"accessor",value:t=>t.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ju,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},GAe=["float32-renderable-webgl","texture-blend-float-webgl"],WAe={data:{props:["radiusPixels"]}},LS=class extends $c{initializeState(){super.initializeAggregationLayer(WAe),this.setState({colorDomain:F7}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:r,oldProps:i}=e,n=this._getChangeFlags(e);(n.dataChanged||n.viewportChanged)&&(n.boundsChanged=this._updateBounds(n.dataChanged),this._updateTextureRenderingBounds()),n.dataChanged||n.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):n.viewportZoomChanged&&this._debouncedUpdateWeightmap(),r.colorRange!==i.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:r,triTexCoordBuffer:i,maxWeightsTexture:n,colorTexture:o,colorDomain:s}=this.state,{updateTriggers:l,intensity:u,threshold:h,aggregation:v}=this.props,T=this.getSubLayerClass("triangle",cb);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:l}),{coordinateSystem:Zr.DEFAULT,data:{attributes:{positions:r,texCoords:i}},vertexCount:4,maxTexture:n,colorTexture:o,aggregationMode:jAe[v]||0,weightsTexture:e,intensity:u,threshold:h,colorDomain:s})}finalizeState(e){super.finalizeState(e);let{weightsTransform:r,weightsTexture:i,maxWeightTransform:n,maxWeightsTexture:o,triPositionBuffer:s,triTexCoordBuffer:l,colorTexture:u,updateTimer:h}=this.state;r?.destroy(),i?.destroy(),n?.destroy(),o?.destroy(),s?.destroy(),l?.destroy(),u?.destroy(),h&&clearTimeout(h)}_getAttributeManager(){return new Mf(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(e){let r={},{dimensions:i}=this.state;r.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",r.viewportChanged=e.changeFlags.viewportChanged;let{zoom:n}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==n)&&(r.viewportZoomChanged=!0),r}_createTextures(){let{textureSize:e,format:r}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...oD,width:e,height:e,format:r}),maxWeightsTexture:this.context.device.createTexture({...oD,width:1,height:1,format:r})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:r}=this.props,i=Math.min(r,e.limits.maxTextureDimension2D),n=GAe.every(l=>e.features.has(l)),o=n?"rgba32float":"rgba8unorm",s=n?1:1/255;this.setState({textureSize:i,format:o,weightsScale:s}),n||ur.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(e){let{weightsTransform:r}=this.state,{weightsTexture:i}=this.state,n=this.getAttributeManager();r?.destroy(),r=new Mh(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:n.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...e}),this.setState({weightsTransform:r})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:r,weightsTexture:i,maxWeightsTexture:n}=this.state,o=this.getShaders({vs:iD,fs:nD});this._createWeightsTransform(o);let s=this.getShaders({vs:D7,fs:L7}),l=new Mh(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:r},targetTexture:n,...s,vertexCount:r*r,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:n,maxWeightTransform:l,zoom:null,triPositionBuffer:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:iD,fs:nD,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:r}=this.context,i=[r.unproject([0,0]),r.unproject([r.width,0]),r.unproject([r.width,r.height]),r.unproject([0,r.height])].map(l=>l.map(Math.fround)),n=M7(i),o={visibleWorldBounds:n,viewportCorners:i},s=!1;if(e||!this.state.worldBounds||!I7(this.state.worldBounds,n)){let l=this._worldToCommonBounds(n),u=this._commonToWorldBounds(l);this.props.coordinateSystem===Zr.LNGLAT&&(u[1]=Math.max(u[1],-85.051129),u[3]=Math.min(u[3],85.051129),u[0]=Math.max(u[0],-360),u[2]=Math.min(u[2],360));let h=this._worldToCommonBounds(u);o.worldBounds=u,o.normalizedCommonBounds=h,s=!0}return this.setState(o),s}_updateTextureRenderingBounds(){let{triPositionBuffer:e,triTexCoordBuffer:r,normalizedCommonBounds:i,viewportCorners:n}=this.state,{viewport:o}=this.context;e.write(tD(n,3));let s=n.map(l=>R7(o.projectPosition(l),i));r.write(tD(s,2))}_updateColorTexture(e){let{colorRange:r}=e.props,{colorTexture:i}=this.state,n=Zd(r,!1,Uint8Array);i&&i?.width===r.length?i.setSubImageData({data:n}):(i?.destroy(),i=this.context.device.createTexture({...oD,data:n,width:r.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:e,colorDomain:r,aggregation:i}=this.props,{worldBounds:n,textureSize:o,weightsScale:s}=this.state,l=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let u=this._worldToCommonBounds(n,{useLayerCoordinateSystem:!0});if(r&&i==="SUM"){let{viewport:F}=this.context,z=F.distanceScales.metersPerUnit[2]*(u[2]-u[0])/o;this.state.colorDomain=r.map(W=>W*z*s)}else this.state.colorDomain=r||F7;let v=this.getAttributeManager().getAttributes(),T=this.getModuleSettings(),E=v.positions.buffer,M={radiusPixels:e,commonBounds:u,textureWidth:o,weightsScale:s},O=v.weights.buffer;l.model.setAttributes({positions:E,weights:O}),l.model.setVertexCount(this.getNumInstances()),l.model.setUniforms(M),l.model.updateModuleSettings(T),l.run({parameters:{viewport:[0,0,o,o]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(e=!1){let{updateTimer:r}=this.state,{debounceTimeout:i}=this.props;e?(r=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(r),r=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:r})}_worldToCommonBounds(e,r={}){let{useLayerCoordinateSystem:i=!1}=r,[n,o,s,l]=e,{viewport:u}=this.context,{textureSize:h}=this.state,{coordinateSystem:v}=this.props,T=i&&(v===Zr.LNGLAT_OFFSETS||v===Zr.METER_OFFSETS),E=T?u.projectPosition(this.props.coordinateOrigin):[0,0],M=h*VAe/u.scale,O,F;return i&&!T?(O=this.projectPosition([n,o,0]),F=this.projectPosition([s,l,0])):(O=u.projectPosition([n,o,0]),F=u.projectPosition([s,l,0])),P7([O[0]-E[0],O[1]-E[1],F[0]-E[0],F[1]-E[1]],M,M)}_commonToWorldBounds(e){let[r,i,n,o]=e,{viewport:s}=this.context,l=s.unprojectPosition([r,i]),u=s.unprojectPosition([n,o]);return l.slice(0,2).concat(u.slice(0,2))}},ub=LS;(()=>{LS.layerName="HeatmapLayer"})(),(()=>{LS.defaultProps=HAe})();function qAe(t){return typeof t=="string"?t.charAt(0).toLowerCase()+t.slice(1):t}function FS(t){if(Array.isArray(t))return t.map(e=>FS(e));if(t&&typeof t=="object"){let e={};for(let[r,i]of Object.entries(t))e[qAe(r)]=FS(i);return e}return t}var AG=ga(dG(),1);function dD(t,e){if(e?._parser&&e._parser!=="fast-xml-parser")throw new Error(e?._parser);let r={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:e?.removeNSPrefix,textNodeName:e?.textNodeName,isArray:(n,o,s,l)=>Boolean(e?.arrayPaths?.some(h=>o===h)),...e?._fastXML},i=tge(t,r);return e?.uncapitalizeKeys?FS(i):i}function tge(t,e){return new AG.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...e}).parse(t)}var rge="4.2.0-beta.2",Of={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:rge,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:ige,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(t,e)=>dD(new TextDecoder().decode(t),{...Of.options.xml,...e?.xml}),parseTextSync:(t,e)=>dD(t,{...Of.options.xml,...e?.xml})};function ige(t){return t.startsWith("<?xml")}function mG(t,e){let r=Of.parseTextSync?.(t,e),i=r?.ServiceExceptionReport?.ServiceException||r?.["ogc:ServiceExceptionReport"]?.["ogc:ServiceException"];return typeof i=="string"?i:i.value||i.code||"Unknown error"}var nge="4.2.0-beta.2",pb={dataType:null,batchType:null,id:"wms-error",name:"WMS Error",module:"wms",version:nge,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.se_xml","application/xml","text/xml"],testText:oge,options:{wms:{throwOnError:!1}},parse:async(t,e)=>AD(new TextDecoder().decode(t),e),parseSync:(t,e)=>AD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>AD(t,e)};function oge(t){return t.startsWith("<?xml")}function AD(t,e){let r={...pb.options.wms,...e?.wms},i=mG(t,r),n=r.minimalErrors?i:`WMS Service error: ${i}`;if(r.throwOnError)throw new Error(n);return n}function $m(t){return Array.isArray(t)?t:t?[t]:[]}function db(t){let e=$m(t);return e.length>0&&e.every(r=>typeof r=="string")?e:[]}function Ab(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseFloat(t);default:return}}function kS(t,e=void 0){switch(typeof t){case"number":return t;case"string":return parseInt(t,10);default:return}}function eg(t){switch(t){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1;default:return!1}}function mD(t,e){let r=Of.parseTextSync?.(t,e),i=r.WMT_MS_Capabilities||r.WMS_Capabilities||r,n=sge(i);if(e?.inheritedLayerProps)for(let o of n.layers)_G(o,null);return e?.includeRawJSON&&(n.json=i),e?.includeXMLText&&(n.xml=t),n}function sge(t){let e={version:String(t.version||""),name:String(t.Service?.Name||"unnamed"),title:t.Service?.Title?String(t.Service?.Title):void 0,abstract:t.Service?.Abstract?String(t.Service?.Abstract):void 0,keywords:db(t.Service?.KeywordList?.Keyword),fees:t.Service?.Fees?JSON.stringify(t.Service?.Fees):void 0,accessConstraints:t.Service?.AccessConstraints?JSON.stringify(t.Service?.AccessConstraints):void 0,layerLimit:kS(t.Service?.LayerLimit),maxWidth:kS(t.Service?.maxWidth),maxHeight:kS(t.Service?.maxHeight),layers:[],requests:age(t.Capability?.Request),exceptions:lge(t.Exception)},r=$m(t.Capability?.Layer);for(let i of r)e.layers.push(gG(i));for(let[i,n]of Object.entries(e))n===void 0&&delete e[i];return e}function age(t){let e={};for(let[r,i]of Object.entries(t||{})){let n=db(i?.Format);e[r]={mimeTypes:n}}return e}function lge(t){if($m(t?.Format).length>0)return{mimeTypes:db(t)}}function gG(t){let e={title:String(t?.Title||""),name:t?.Name&&String(t?.Name),abstract:t?.Name&&String(t?.Abstract),keywords:db(t.KeywordList?.Keyword)},r=t?.CRS||t?.SRS;r&&Array.isArray(r)&&r.every(h=>typeof h=="string")&&(e.crs=r);let i=t?.EX_GeographicBoundingBox&&cge(t?.EX_GeographicBoundingBox);i&&(e.geographicBoundingBox=i),i=t?.LatLonBoundingBox&&uge(t?.LatLonBoundingBox),i&&(e.geographicBoundingBox=i);let n=t?.BoundingBox&&fge(t?.BoundingBox);n&&n.length>0&&(e.boundingBoxes=n);let s=$m(t?.Dimension).map(h=>pge(h));s.length&&(e.dimensions=s),t?.opaque&&(e.opaque=eg(t?.opaque)),t?.cascaded&&(e.cascaded=eg(t?.cascaded)),t?.queryable&&(e.queryable=eg(t?.queryable));let l=$m(t?.Layer),u=[];for(let h of l)u.push(gG(h));u.length>0&&(e.layers=u);for(let[h,v]of Object.entries(e))v===void 0&&delete e[h];return e}function cge(t){let{westBoundLongitude:e,northBoundLatitude:r,eastBoundLongitude:i,southBoundLatitude:n}=t;return[[e,n],[i,r]]}function uge(t){let{minx:e,miny:r,maxx:i,maxy:n}=t;return[[e,r],[i,n]]}function fge(t){return $m(t).map(r=>hge(r))}function hge(t){let{CRS:e,SRS:r,minx:i,miny:n,maxx:o,maxy:s,resx:l,resy:u}=t,h={crs:e||r,boundingBox:[[Ab(i),Ab(n)],[Ab(o),Ab(s)]]};return l&&(h.xResolution=l),u&&(h.yResolution=u),h}function pge(t){let{name:e,units:r,value:i}=t,n={name:e,units:r,extent:i};return t.unitSymbol&&(n.unitSymbol=t.unitSymbol),t.default&&(n.defaultValue=t.default),t.multipleValues&&(n.multipleValues=eg(t.multipleValues)),t.nearestValue&&(n.nearestValue=eg(t.nearestValue)),t.current&&(n.current=eg(t.current)),n}function _G(t,e){e?.geographicBoundingBox&&!t.geographicBoundingBox&&(t.geographicBoundingBox=[...e.geographicBoundingBox]),e?.crs&&!t.crs&&(t.crs=[...e.crs]),e?.boundingBoxes&&!t.boundingBoxes&&(t.boundingBoxes=[...e.boundingBoxes]),e?.dimensions&&!t.dimensions&&(t.dimensions=[...e.dimensions]);for(let r of t.layers||[])_G(r,t)}var dge="4.2.0-beta.2",U_={dataType:null,batchType:null,id:"wms-capabilities",name:"WMS Capabilities",module:"wms",version:dge,worker:!1,extensions:["xml"],mimeTypes:["application/vnd.ogc.wms_xml","application/xml","text/xml"],testText:Age,options:{wms:{}},parse:async(t,e)=>mD(new TextDecoder().decode(t),e?.wms),parseTextSync:(t,e)=>mD(t,e?.wms)};function Age(t){return t.startsWith("<?xml")}function gD(t,e){let i=(Of.parseTextSync?.(t,e)).FeatureInfoResponse?.FIELDS||[];return{features:(Array.isArray(i)?i:[i]).map(o=>mge(o))}}function mge(t){return{attributes:t||{},type:"",bounds:{bottom:0,top:0,left:0,right:0}}}var yG={...U_,dataType:null,id:"wms-feature-info",name:"WMS FeatureInfo",parse:async(t,e)=>gD(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>gD(t,e)};function _D(t,e){return Of.parseTextSync?.(t,e)}var vG={...U_,dataType:null,id:"wms-layer-description",name:"WMS DescribeLayer",parse:async(t,e)=>_D(new TextDecoder().decode(t),e),parseTextSync:(t,e)=>_D(t,e)};function xG(t,e){let{type:r="auto"}=t,i=r==="auto"?_ge(t.url,e):gge(r,e);if(!i)throw new Error("Not a valid image source type");return i.create(t)}function gge(t,e){for(let r of e)if(r.type===t)return r;return null}function _ge(t,e){for(let r of e)if(r.testURL&&r.testURL(t))return r;return null}var bG={type:"wms",testURL:t=>t.toLowerCase().includes("wms"),create:t=>new yD(t)},yD=class extends Eu{url;data;substituteCRS84;flipCRS;wmsParameters;vendorParameters;capabilities=null;constructor(e){super(e),this.url=e.url,this.data=e.url,this.substituteCRS84=e.substituteCRS84??!1,this.flipCRS=["EPSG:4326"],this.wmsParameters={layers:void 0,query_layers:void 0,styles:void 0,version:"1.3.0",crs:"EPSG:4326",format:"image/png",info_format:"text/plain",transparent:void 0,time:void 0,elevation:void 0,...e.wmsParameters},this.vendorParameters=e.vendorParameters||{}}async getMetadata(){let e=await this.getCapabilities();return this.normalizeMetadata(e)}async getImage(e){let{boundingBox:r,bbox:i,...n}=e,o={bbox:r?[...r[0],...r[1]]:i,...n};return await this.getMap(o)}normalizeMetadata(e){return e}async getCapabilities(e,r){let i=this.getCapabilitiesURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);let s=await U_.parse(o,this.loadOptions);return this.capabilities=s,s}async getMap(e,r){let i=this.getMapURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}async getFeatureInfo(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await yG.parse(o,this.loadOptions)}async getFeatureInfoText(e,r){let i=this.getFeatureInfoURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),new TextDecoder().decode(o)}async describeLayer(e,r){let i=this.describeLayerURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();return this._checkResponse(n,o),await vG.parse(o,this.loadOptions)}async getLegendGraphic(e,r){let i=this.getLegendGraphicURL(e,r),n=await this.fetch(i),o=await n.arrayBuffer();this._checkResponse(n,o);try{return await Eh.parse(o,this.loadOptions)}catch{throw this._parseError(o)}}getCapabilitiesURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetCapabilities",i,r)}getMapURL(e,r){e=this._getWMS130Parameters(e);let i={version:this.wmsParameters.version,format:this.wmsParameters.format,transparent:this.wmsParameters.transparent,time:this.wmsParameters.time,elevation:this.wmsParameters.elevation,layers:this.wmsParameters.layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetMap",i,r)}getFeatureInfoURL(e,r){e=this._getWMS130Parameters(e);let{boundingBox:i,bbox:n}=e;e.bbox=i?[...i[0],...i[1]]:n;let o={version:this.wmsParameters.version,info_format:this.wmsParameters.info_format,layers:this.wmsParameters.layers,query_layers:this.wmsParameters.query_layers,styles:this.wmsParameters.styles,crs:this.wmsParameters.crs,...e};return this._getWMSUrl("GetFeatureInfo",o,r)}describeLayerURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("DescribeLayer",i,r)}getLegendGraphicURL(e,r){let i={version:this.wmsParameters.version,...e};return this._getWMSUrl("GetLegendGraphic",i,r)}_parseWMSUrl(e){let[r,i]=e.split("?"),n=i.split("&"),o={};for(let s of n){let[l,u]=s.split("=");o[l]=u}return{url:r,parameters:o}}_getWMSUrl(e,r,i){let n=this.url,o=!0,s={service:"WMS",version:r.version,request:e,...r,...this.vendorParameters,...i},l=["transparent","time","elevation"];for(let[u,h]of Object.entries(s))(!l.includes(u)||h)&&(n+=o?"?":"&",o=!1,n+=this._getURLParameter(u,h,r));return encodeURI(n)}_getWMS130Parameters(e){let r={...e};return r.srs&&(r.crs=r.crs||r.srs,delete r.srs),r}_getURLParameter(e,r,i){switch(e){case"crs":i.version!=="1.3.0"?e="srs":this.substituteCRS84&&r==="EPSG:4326"&&(r="CRS:84");break;case"srs":i.version==="1.3.0"&&(e="crs");break;case"bbox":let n=this._flipBoundingBox(r,i);n&&(r=n);break;case"x":i.version==="1.3.0"&&(e="i");break;case"y":i.version==="1.3.0"&&(e="j");break;default:}return e=e.toUpperCase(),Array.isArray(r)?`${e}=${r.join(",")}`:`${e}=${r?String(r):""}`}_flipBoundingBox(e,r){if(!Array.isArray(e)||e.length!==4)return null;let i=r.version==="1.3.0"&&this.flipCRS.includes(r.crs||"")&&!(this.substituteCRS84&&r.crs==="EPSG:4326"),n=e;return i?[n[1],n[0],n[3],n[2]]:n}async _fetchArrayBuffer(e){let r=await this.fetch(e),i=await r.arrayBuffer();return this._checkResponse(r,i),i}_checkResponse(e,r){let i=e.headers["content-type"];if(!e.ok||pb.mimeTypes.includes(i)){let n=Wv(this.loadOptions,{wms:{throwOnError:!0}}),o=pb.parseSync?.(r,n);throw new Error(o)}}_parseError(e){let r=pb.parseSync?.(e,this.loadOptions);return new Error(r)}};var z_=class extends Eu{constructor(e){super(e)}async getMetadata(){throw new Error("ImageSource.getMetadata not implemented")}async getImage(e){let r=this.getGranularParameters(e),i=this.getURLFromTemplate(r),o=await(await this.fetch(i)).arrayBuffer();return await Eh.parse(o)}getGranularParameters(e){let[[r,i],[n,o]]=e.boundingBox;return{...e,east:r,north:i,south:o,west:n}}getURLFromTemplate(e){let r=this.props.url;for(let[i,n]of Object.entries(e))r=r.replace(`\${${i}}`,String(n)),r=r.replace(`{${i}}`,String(n));return r}};Yr(z_,"type","template"),Yr(z_,"testURL",e=>e.toLowerCase().includes("{"));var vD=class extends z_{data;constructor(e){super(e),this.data=e.url}async getMetadata(){return await this.metadata()}async getImage(e){throw new Error("not implemented")}async metadata(){throw new Error("not implemented")}exportImage(e){throw new Error("not implemented")}metadataURL(e){return`${this.props.url}?f=pjson`}exportImageURL(e){let r=`bbox=${e.bbox[0]},${e.bbox[1]},${e.bbox[2]},${e.bbox[3]}`,i=`size=${e.width},${e.height}`,n={...e,bbox:r,size:i};return delete n.width,delete n.height,this.getUrl("exportImage",n)}getUrl(e,r,i){let n=`${this.props.url}/${e}`,o=!0;for(let[s,l]of Object.entries(r))n+=o?"?":"&",o=!1,Array.isArray(l)?n+=`${s.toUpperCase()}=${l.join(",")}`:n+=`${s.toUpperCase()}=${l?String(l):""}`;return n}async checkResponse(e){if(!e.ok)throw new Error("error")}},wG={type:"arcgis-image-server",testURL:t=>t.toLowerCase().includes("ImageServer"),create:t=>new vD(t)};var yge=[bG,wG];function xD(t){return xG(t,yge)}var TG=6378137*Math.PI;function bD(t){let e=La(t);return e[0]=(e[0]/256-1)*TG,e[1]=(e[1]/256-1)*TG,e}var vge={id:"imagery-layer",data:"",serviceType:"auto",srs:"auto",layers:{type:"array",compare:!0,value:[]},onMetadataLoad:{type:"function",value:()=>{}},onMetadataLoadError:{type:"function",value:console.error},onImageLoadStart:{type:"function",value:()=>{}},onImageLoad:{type:"function",value:()=>{}},onImageLoadError:{type:"function",compare:!1,value:(t,e)=>console.error(e,t)}},zS=class extends es{get isLoaded(){return this.state?.loadCounter===0&&super.isLoaded}shouldUpdateState(){return!0}initializeState(){this.state._nextRequestId=0,this.state.lastRequestId=-1,this.state.loadCounter=0}updateState({changeFlags:e,props:r,oldProps:i}){let{viewport:n}=this.context;e.dataChanged||r.serviceType!==i.serviceType?(this.state.imageSource=this._createImageSource(r),this._loadMetadata(),this.debounce(()=>this.loadImage(n,"image source changed"),0)):Ls(r.layers,i.layers,1)?e.viewportChanged&&this.debounce(()=>this.loadImage(n,"viewport changed")):this.debounce(()=>this.loadImage(n,"layers changed"),0)}finalizeState(){}renderLayers(){let{bounds:e,image:r,lastRequestParameters:i}=this.state;return r&&new Um({...this.getSubLayerProps({id:"bitmap"}),_imageCoordinateSystem:i.srs==="EPSG:4326"?Zr.LNGLAT:Zr.CARTESIAN,bounds:e,image:r})}async getFeatureInfoText(e,r){let{lastRequestParameters:i}=this.state;return i?await this.state.imageSource.getFeatureInfoText?.({...i,query_layers:i.layers,x:e,y:r,info_format:"application/vnd.ogc.gml"}):""}_createImageSource(e){if(e.data instanceof Eu)return e.data;if(typeof e.data=="string")return xD({url:e.data,loadOptions:e.loadOptions,type:e.serviceType});throw new Error("invalid image source in props.data")}async _loadMetadata(){let{imageSource:e}=this.state;try{this.state.loadCounter++;let r=await e.getMetadata();this.state.imageSource===e&&this.getCurrentLayer()?.props.onMetadataLoad(r)}catch(r){this.getCurrentLayer()?.props.onMetadataLoadError(r)}finally{this.state.loadCounter--}}async loadImage(e,r){let{layers:i,serviceType:n}=this.props;if(n==="wms"&&i.length===0)return;let o=e.getBounds(),{width:s,height:l}=e,u=this.getRequestId(),{srs:h}=this.props;h==="auto"&&(h=e.resolution?"EPSG:4326":"EPSG:3857");let v={width:s,height:l,boundingBox:[[o[0],o[1]],[o[2],o[3]]],layers:i,crs:h};if(h==="EPSG:3857"){let T=bD([o[0],o[1]]),E=bD([o[2],o[3]]);v.boundingBox=[T,E]}try{this.state.loadCounter++,this.props.onImageLoadStart(u);let T=await this.state.imageSource.getImage(v);this.state.lastRequestId<u&&(this.getCurrentLayer()?.props.onImageLoad(u),this.setState({image:T,bounds:o,lastRequestParameters:v,lastRequestId:u}))}catch(T){this.raiseError(T,"Load image"),this.getCurrentLayer()?.props.onImageLoadError(u,T)}finally{this.state.loadCounter--}}getRequestId(){return this.state._nextRequestId++}debounce(e,r=500){clearTimeout(this.state._timeoutId),this.state._timeoutId=setTimeout(()=>e(),r)}},US=zS;(()=>{zS.layerName="WMSLayer"})(),(()=>{zS.defaultProps=vge})();var xge={getHeight:{type:"accessor",value:0},greatCircle:!0},VS=class extends km{},mb=VS;(()=>{VS.layerName="GreatCircleLayer"})(),(()=>{VS.defaultProps=xge})();var bge={...Bf.defaultProps},jS=class extends es{indexToBounds(){return null}renderLayers(){let{elevationScale:e,extruded:r,wireframe:i,filled:n,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z}=this.props,{updateTriggers:W,material:J,transitions:K}=this.props,ne=this.getSubLayerClass("cell",Bf),{updateTriggers:ge,...H}=this.indexToBounds()||{};return new ne({filled:n,wireframe:i,extruded:r,elevationScale:e,stroked:o,lineWidthUnits:s,lineWidthScale:l,lineWidthMinPixels:u,lineWidthMaxPixels:h,lineJointRounded:v,lineMiterLimit:T,lineDashJustified:E,material:J,transitions:K,getElevation:M,getFillColor:O,getLineColor:F,getLineWidth:z},this.getSubLayerProps({id:"cell",updateTriggers:W&&{...ge,getElevation:W.getElevation,getFillColor:W.getFillColor,getLineColor:W.getLineColor,getLineWidth:W.getLineWidth}}),H)}},eu=jS;(()=>{jS.layerName="GeoCellLayer"})(),(()=>{jS.defaultProps=bge})();var HS=ga(wD(),1),wge=3,Tge=30,Ege=2*Tge+1,SG=180/Math.PI;function MG(t,e,r){let i=1<<e;return[(t[0]+r[0])/i,(t[1]+r[1])/i]}function CG(t){return t>=.5?1/3*(4*t*t-1):1/3*(1-4*(1-t)*(1-t))}function IG(t){return[CG(t[0]),CG(t[1])]}function PG(t,[e,r]){switch(t){case 0:return[1,e,r];case 1:return[-e,1,r];case 2:return[-e,-r,1];case 3:return[-1,-r,-e];case 4:return[r,-1,-e];case 5:return[r,e,-1];default:throw new Error("Invalid face")}}function RG([t,e,r]){let i=Math.atan2(r,Math.sqrt(t*t+e*e));return[Math.atan2(e,t)*SG,i*SG]}function BG(t){let e=HS.default.fromString(t,!0,10).toString(2);for(;e.length<wge+Ege;)e="0"+e;let r=e.lastIndexOf("1"),i=e.substring(0,3),n=e.substring(3,r),o=n.length/2,s=HS.default.fromString(i,!0,2).toString(10),l=HS.default.fromString(n,!0,2).toString(4);for(;l.length<o;)l="0"+l;return`${s}/${l}`}function Sge(t,e,r,i){if(i===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);let n=e[0];e[0]=e[1],e[1]=n}}function OG(t){let e=t.split("/"),r=parseInt(e[0],10),i=e[1],n=i.length,o=[0,0],s;for(let l=n-1;l>=0;l--){s=n-l;let u=i[l],h=0,v=0;u==="1"?v=1:u==="2"?(h=1,v=1):u==="3"&&(h=1);let T=Math.pow(2,s-1);Sge(T,o,h,v),o[0]+=T*h,o[1]+=T*v}if(r%2===1){let l=o[0];o[0]=o[1],o[1]=l}return{face:r,ij:o,level:s}}var DG=ga(wD(),1);function Cge(t){let e=t.padEnd(16,"0");return DG.default.fromString(e,16)}var Mge=100;function Ige({face:t,ij:e,level:r}){let i=[[0,0],[0,1],[1,1],[1,0],[0,0]],n=Math.max(1,Math.ceil(Mge*Math.pow(2,-r))),o=new Float64Array(4*n*2+2),s=0,l=0;for(let u=0;u<4;u++){let h=i[u].slice(0),v=i[u+1],T=(v[0]-h[0])/n,E=(v[1]-h[1])/n;for(let M=0;M<n;M++){h[0]+=T,h[1]+=E;let O=MG(e,r,h),F=IG(O),z=PG(t,F),W=RG(z);Math.abs(W[1])>89.999&&(W[0]=l);let J=W[0]-l;W[0]+=J>180?-360:J<-180?360:0,o[s++]=W[0],o[s++]=W[1],l=W[0]}}return o[s++]=o[0],o[s++]=o[1],o}function Pge(t){if(typeof t=="string"){if(t.indexOf("/")>0)return t;t=Cge(t)}return BG(t.toString())}function LG(t){let e=Pge(t),r=OG(e);return Ige(r)}var Rge={getS2Token:{type:"accessor",value:t=>t.token}},GS=class extends eu{indexToBounds(){let{data:e,getS2Token:r}=this.props;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(i,n)=>LG(r(i,n))}}},_b=GS;(()=>{GS.layerName="S2Layer"})(),(()=>{GS.defaultProps=Rge})();var TD=512;function Bge(t,e){let r=0,i=0,n=1<<t.length,o=n/TD;for(let s=0;s<t.length;s++){n>>=1;let l=parseInt(t[s]);l%2&&(r|=n),l>1&&(i|=n)}return[[r/o,TD-i/o],[(r+e)/o,TD-(i+e)/o]]}function FG(t,e=1){let[r,i]=Bge(t,e),[n,o]=xl(r),[s,l]=xl(i);return[s,o,s,l,n,l,n,o,s,o]}var Oge={getQuadkey:{type:"accessor",value:t=>t.quadkey}},WS=class extends eu{indexToBounds(){let{data:e,extruded:r,getQuadkey:i}=this.props,n=r?.99:1;return{data:e,_normalize:!1,positionFormat:"XY",getPolygon:(o,s)=>FG(i(o,s),n),updateTriggers:{getPolygon:n}}}},yb=WS;(()=>{WS.layerName="QuadkeyLayer"})(),(()=>{WS.defaultProps=Oge})();var tg=class{constructor(e){this.index=e,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(e){this._bbox||(this._bbox=e,"west"in e?this.boundingBox=[[e.west,e.south],[e.east,e.north]]:this.boundingBox=[[e.left,e.top],[e.right,e.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){let e=this.content?this.content.byteLength:0;return Number.isFinite(e)||console.error("byteLength not defined in tile data"),e}async _loadData({getData:e,requestScheduler:r,onLoad:i,onError:n}){let{index:o,id:s,bbox:l,userData:u,zoom:h}=this,v=this._loaderId;this._abortController=new AbortController;let{signal:T}=this._abortController,E=await r.scheduleRequest(this,F=>F.isSelected?1:-1);if(!E){this._isCancelled=!0;return}if(this._isCancelled){E.done();return}let M=null,O;try{M=await e({index:o,id:s,bbox:l,userData:u,zoom:h,signal:T})}catch(F){O=F||!0}finally{E.done()}if(v===this._loaderId){if(this._loader=void 0,this.content=M,this._isCancelled&&!M){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,O?n(O,this):i(this)}}loadData(e){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(e),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}};var sa={OUTSIDE:-1,INTERSECTING:0,INSIDE:1};var NG=new ot,Dge=new ot,eA=class{constructor(e=[0,0,0],r=[0,0,0],i){i=i||NG.copy(e).add(r).scale(.5),this.center=new ot(i),this.halfDiagonal=new ot(r).subtract(this.center),this.minimum=new ot(e),this.maximum=new ot(r)}clone(){return new eA(this.minimum,this.maximum,this.center)}equals(e){return this===e||Boolean(e)&&this.minimum.equals(e.minimum)&&this.maximum.equals(e.maximum)}transform(e){return this.center.transformAsPoint(e),this.halfDiagonal.transform(e),this.minimum.transform(e),this.maximum.transform(e),this}intersectPlane(e){let{halfDiagonal:r}=this,i=Dge.from(e.normal),n=r.x*Math.abs(i.x)+r.y*Math.abs(i.y)+r.z*Math.abs(i.z),o=this.center.dot(i)+e.distance;return o-n>0?sa.INSIDE:o+n<0?sa.OUTSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=NG.from(e).subtract(this.center),{halfDiagonal:i}=this,n=0,o;return o=Math.abs(r.x)-i.x,o>0&&(n+=o*o),o=Math.abs(r.y)-i.y,o>0&&(n+=o*o),o=Math.abs(r.z)-i.z,o>0&&(n+=o*o),n}};var vb=new ot,kG=new ot,Hu=class{constructor(e=[0,0,0],r=0){this.radius=-0,this.center=new ot,this.fromCenterRadius(e,r)}fromCenterRadius(e,r){return this.center.from(e),this.radius=r,this}fromCornerPoints(e,r){return r=vb.from(r),this.center=new ot().from(e).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.radius===e.radius}clone(){return new Hu(this.center,this.radius)}union(e){let r=this.center,i=this.radius,n=e.center,o=e.radius,s=vb.copy(n).subtract(r),l=s.magnitude();if(i>=l+o)return this.clone();if(o>=l+i)return e.clone();let u=(i+l+o)*.5;return kG.copy(s).scale((-i+u)/l).add(r),this.center.copy(kG),this.radius=u,this}expand(e){let i=vb.from(e).subtract(this.center).magnitude();return i>this.radius&&(this.radius=i),this}transform(e){this.center.transform(e);let r=Zs.getScaling(vb,e);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(e){let r=this.distanceTo(e);return r*r}distanceTo(e){let i=vb.from(e).subtract(this.center);return Math.max(0,i.len()-this.radius)}intersectPlane(e){let r=this.center,i=this.radius,o=e.normal.dot(r)+e.distance;return o<-i?sa.OUTSIDE:o<i?sa.INTERSECTING:sa.INSIDE}};var Lge=new ot,Fge=new ot,qS=new ot,XS=new ot,YS=new ot,Nge=new ot,kge=new ot,kp={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},Df=class{constructor(e=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new ot().from(e),this.halfAxes=new mo(r)}get halfSize(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2);return[new ot(e).len(),new ot(r).len(),new ot(i).len()]}get quaternion(){let e=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),i=this.halfAxes.getColumn(2),n=new ot(e).normalize(),o=new ot(r).normalize(),s=new ot(i).normalize();return new Du().fromMatrix3(new mo([...n,...o,...s]))}fromCenterHalfSizeQuaternion(e,r,i){let n=new Du(i),o=new mo().fromQuaternion(n);return o[0]=o[0]*r[0],o[1]=o[1]*r[0],o[2]=o[2]*r[0],o[3]=o[3]*r[1],o[4]=o[4]*r[1],o[5]=o[5]*r[1],o[6]=o[6]*r[2],o[7]=o[7]*r[2],o[8]=o[8]*r[2],this.center=new ot().from(e),this.halfAxes=o,this}clone(){return new Df(this.center,this.halfAxes)}equals(e){return this===e||Boolean(e)&&this.center.equals(e.center)&&this.halfAxes.equals(e.halfAxes)}getBoundingSphere(e=new Hu){let r=this.halfAxes,i=r.getColumn(0,qS),n=r.getColumn(1,XS),o=r.getColumn(2,YS),s=Lge.copy(i).add(n).add(o);return e.center.copy(this.center),e.radius=s.magnitude(),e}intersectPlane(e){let r=this.center,i=e.normal,n=this.halfAxes,o=i.x,s=i.y,l=i.z,u=Math.abs(o*n[kp.COLUMN0ROW0]+s*n[kp.COLUMN0ROW1]+l*n[kp.COLUMN0ROW2])+Math.abs(o*n[kp.COLUMN1ROW0]+s*n[kp.COLUMN1ROW1]+l*n[kp.COLUMN1ROW2])+Math.abs(o*n[kp.COLUMN2ROW0]+s*n[kp.COLUMN2ROW1]+l*n[kp.COLUMN2ROW2]),h=i.dot(r)+e.distance;return h<=-u?sa.OUTSIDE:h>=u?sa.INSIDE:sa.INTERSECTING}distanceTo(e){return Math.sqrt(this.distanceSquaredTo(e))}distanceSquaredTo(e){let r=Fge.from(e).subtract(this.center),i=this.halfAxes,n=i.getColumn(0,qS),o=i.getColumn(1,XS),s=i.getColumn(2,YS),l=n.magnitude(),u=o.magnitude(),h=s.magnitude();n.normalize(),o.normalize(),s.normalize();let v=0,T;return T=Math.abs(r.dot(n))-l,T>0&&(v+=T*T),T=Math.abs(r.dot(o))-u,T>0&&(v+=T*T),T=Math.abs(r.dot(s))-h,T>0&&(v+=T*T),v}computePlaneDistances(e,r,i=[-0,-0]){let n=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,l=this.halfAxes,u=l.getColumn(0,qS),h=l.getColumn(1,XS),v=l.getColumn(2,YS),T=Nge.copy(u).add(h).add(v).add(s),E=kge.copy(T).subtract(e),M=r.dot(E);return n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),T.copy(s).add(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).add(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).add(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),s.copy(T).subtract(u).subtract(h).subtract(v),E.copy(T).subtract(e),M=r.dot(E),n=Math.min(M,n),o=Math.max(M,o),i[0]=n,i[1]=o,i}transform(e){this.center.transformAsPoint(e);let r=this.halfAxes.getColumn(0,qS);r.transformAsPoint(e);let i=this.halfAxes.getColumn(1,XS);i.transformAsPoint(e);let n=this.halfAxes.getColumn(2,YS);return n.transformAsPoint(e),this.halfAxes=new mo([...r,...i,...n]),this}getTransform(){throw new Error("not implemented")}};var UG=new ot,zG=new ot,$a=class{constructor(e=[0,0,1],r=0){this.normal=new ot,this.distance=-0,this.fromNormalDistance(e,r)}fromNormalDistance(e,r){return Ja(Number.isFinite(r)),this.normal.from(e).normalize(),this.distance=r,this}fromPointNormal(e,r){e=UG.from(e),this.normal.from(r).normalize();let i=-this.normal.dot(e);return this.distance=i,this}fromCoefficients(e,r,i,n){return this.normal.set(e,r,i),Ja(Cs(this.normal.len(),1)),this.distance=n,this}clone(){return new $a(this.normal,this.distance)}equals(e){return Cs(this.distance,e.distance)&&Cs(this.normal,e.normal)}getPointDistance(e){return this.normal.dot(e)+this.distance}transform(e){let r=zG.copy(this.normal).transformAsVector(e).normalize(),i=this.normal.scale(-this.distance).transform(e);return this.fromPointNormal(i,r)}projectPointOntoPlane(e,r=[0,0,0]){let i=UG.from(e),n=this.getPointDistance(i),o=zG.copy(this.normal).scale(n);return i.subtract(o).to(r)}};var VG=[new ot([1,0,0]),new ot([0,1,0]),new ot([0,0,1])],jG=new ot,Uge=new ot,wa=class{constructor(e=[]){this.planes=e}fromBoundingSphere(e){this.planes.length=2*VG.length;let r=e.center,i=e.radius,n=0;for(let o of VG){let s=this.planes[n],l=this.planes[n+1];s||(s=this.planes[n]=new $a),l||(l=this.planes[n+1]=new $a);let u=jG.copy(o).scale(-i).add(r);s.fromPointNormal(u,o);let h=jG.copy(o).scale(i).add(r),v=Uge.copy(o).negate();l.fromPointNormal(h,v),n+=2}return this}computeVisibility(e){let r=sa.INSIDE;for(let i of this.planes)switch(e.intersectPlane(i)){case sa.OUTSIDE:return sa.OUTSIDE;case sa.INTERSECTING:r=sa.INTERSECTING;break;default:}return r}computeVisibilityWithPlaneMask(e,r){if(Ja(Number.isFinite(r),"parentPlaneMask is required."),r===wa.MASK_OUTSIDE||r===wa.MASK_INSIDE)return r;let i=wa.MASK_INSIDE,n=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&!(r&s))continue;let l=n[o],u=e.intersectPlane(l);if(u===sa.OUTSIDE)return wa.MASK_OUTSIDE;u===sa.INTERSECTING&&(i|=s)}return i}};wa.MASK_OUTSIDE=4294967295;wa.MASK_INSIDE=0;wa.MASK_INDETERMINATE=2147483647;var ptt=new ot,dtt=new ot,Att=new ot,mtt=new ot,gtt=new ot;var wtt=new ot,Ttt=new ot,Ett=new ot,Stt=new ot,Ctt=new ot,Mtt=new ot,Itt=new ot,Ptt=new ot,Rtt=new ot,Btt=new ot,Ott=new ot,Dtt=new ot;var Dh=new mo,Vge=new mo,jge=new mo,KS=new mo,HG=new mo;function CD(t,e={}){let r=Lu.EPSILON20,i=10,n=0,o=0,s=Vge,l=jge;s.identity(),l.copy(t);let u=r*Hge(l);for(;o<i&&Gge(l)>u;)Wge(l,KS),HG.copy(KS).transpose(),l.multiplyRight(KS),l.multiplyLeft(HG),s.multiplyRight(KS),++n>2&&(++o,n=0);return e.unitary=s.toTarget(e.unitary),e.diagonal=l.toTarget(e.diagonal),e}function Hge(t){let e=0;for(let r=0;r<9;++r){let i=t[r];e+=i*i}return Math.sqrt(e)}var ED=[1,0,0],SD=[2,2,1];function Gge(t){let e=0;for(let r=0;r<3;++r){let i=t[Dh.getElementIndex(SD[r],ED[r])];e+=2*i*i}return Math.sqrt(e)}function Wge(t,e){let r=Lu.EPSILON15,i=0,n=1;for(let h=0;h<3;++h){let v=Math.abs(t[Dh.getElementIndex(SD[h],ED[h])]);v>i&&(n=h,i=v)}let o=ED[n],s=SD[n],l=1,u=0;if(Math.abs(t[Dh.getElementIndex(s,o)])>r){let h=t[Dh.getElementIndex(s,s)],v=t[Dh.getElementIndex(o,o)],T=t[Dh.getElementIndex(s,o)],E=(h-v)/2/T,M;E<0?M=-1/(-E+Math.sqrt(1+E*E)):M=1/(E+Math.sqrt(1+E*E)),l=1/Math.sqrt(1+M*M),u=M*l}return mo.IDENTITY.to(e),e[Dh.getElementIndex(o,o)]=e[Dh.getElementIndex(s,s)]=l,e[Dh.getElementIndex(s,o)]=u,e[Dh.getElementIndex(o,s)]=-u,e}var tA=new ot,qge=new ot,Xge=new ot,Yge=new ot,Kge=new ot,Zge=new mo,Jge={diagonal:new mo,unitary:new mo};function xb(t,e=new Df){if(!t||t.length===0)return e.halfAxes=new mo([0,0,0,0,0,0,0,0,0]),e.center=new ot,e;let r=t.length,i=new ot(0,0,0);for(let $ of t)i.add($);let n=1/r;i.multiplyByScalar(n);let o=0,s=0,l=0,u=0,h=0,v=0;for(let $ of t){let Z=tA.copy($).subtract(i);o+=Z.x*Z.x,s+=Z.x*Z.y,l+=Z.x*Z.z,u+=Z.y*Z.y,h+=Z.y*Z.z,v+=Z.z*Z.z}o*=n,s*=n,l*=n,u*=n,h*=n,v*=n;let T=Zge;T[0]=o,T[1]=s,T[2]=l,T[3]=s,T[4]=u,T[5]=h,T[6]=l,T[7]=h,T[8]=v;let{unitary:E}=CD(T,Jge),M=e.halfAxes.copy(E),O=M.getColumn(0,Xge),F=M.getColumn(1,Yge),z=M.getColumn(2,Kge),W=-Number.MAX_VALUE,J=-Number.MAX_VALUE,K=-Number.MAX_VALUE,ne=Number.MAX_VALUE,ge=Number.MAX_VALUE,H=Number.MAX_VALUE;for(let $ of t)tA.copy($),W=Math.max(tA.dot(O),W),J=Math.max(tA.dot(F),J),K=Math.max(tA.dot(z),K),ne=Math.min(tA.dot(O),ne),ge=Math.min(tA.dot(F),ge),H=Math.min(tA.dot(z),H);O=O.multiplyByScalar(.5*(ne+W)),F=F.multiplyByScalar(.5*(ge+J)),z=z.multiplyByScalar(.5*(H+K)),e.center.copy(O).add(F).add(z);let me=qge.set(W-ne,J-ge,K-H).multiplyByScalar(.5),fe=new mo([me[0],0,0,0,me[1],0,0,0,me[2]]);return e.halfAxes.multiplyRight(fe),e}var V_=512,GG=3,WG=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],qG=WG.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Qge=qG.concat([[.25,.5],[.75,.5]]),rA=class{constructor(e,r,i){this.x=e,this.y=r,this.z=i}get children(){if(!this._children){let e=this.x*2,r=this.y*2,i=this.z+1;this._children=[new rA(e,r,i),new rA(e,r+1,i),new rA(e+1,r,i),new rA(e+1,r+1,i)]}return this._children}update(e){let{viewport:r,cullingVolume:i,elevationBounds:n,minZ:o,maxZ:s,bounds:l,offset:u,project:h}=e,v=this.getBoundingVolume(n,u,h);if(l&&!this.insideBounds(l)||i.computeVisibility(v)<0)return!1;if(!this.childVisible){let{z:E}=this;if(E<s&&E>=o){let M=v.distanceTo(r.cameraPosition)*r.scale/r.height;E+=Math.floor(Math.log2(M))}if(E>=s)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(let E of this.children)E.update(e);return!0}getSelected(e=[]){if(this.selected&&e.push(this),this._children)for(let r of this._children)r.getSelected(e);return e}insideBounds([e,r,i,n]){let o=Math.pow(2,this.z),s=V_/o;return this.x*s<i&&this.y*s<n&&(this.x+1)*s>e&&(this.y+1)*s>r}getBoundingVolume(e,r,i){if(i){let u=this.z<1?Qge:this.z<2?qG:WG,h=[];for(let v of u){let T=ZS(this.x+v[0],this.y+v[1],this.z);T[2]=e[0],h.push(i(T)),e[0]!==e[1]&&(T[2]=e[1],h.push(i(T)))}return xb(h)}let n=Math.pow(2,this.z),o=V_/n,s=this.x*o+r*V_,l=V_-(this.y+1)*o;return new eA([s,l,e[0]],[s+o,l+o,e[1]])}};function XG(t,e,r,i){let n=t instanceof Rp&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map(({normal:M,distance:O})=>new $a(M.clone().negate(),O)),s=new wa(o),l=t.distanceScales.unitsPerMeter[2],u=r&&r[0]*l||0,h=r&&r[1]*l||0,v=t instanceof Ec&&t.pitch<=60?e:0;if(i){let[M,O,F,z]=i,W=La([M,z]),J=La([F,O]);i=[W[0],V_-W[1],J[0],V_-J[1]]}let T=new rA(0,0,0),E={viewport:t,project:n,cullingVolume:s,elevationBounds:[u,h],minZ:v,maxZ:e,bounds:i,offset:0};if(T.update(E),t instanceof Ec&&t.subViewports&&t.subViewports.length>1){for(E.offset=-1;T.update(E)&&!(--E.offset<-GG););for(E.offset=1;T.update(E)&&!(++E.offset>GG););}return T.getSelected()}var Up=512,$ge=[-1/0,-1/0,1/0,1/0],iA={type:"object",value:null,validate:(t,e)=>e.optional&&t===null||typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string"),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;let r=t.length;if(r!==e.length)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}};function KG(t,e){let r=[e.transformAsPoint([t[0],t[1]]),e.transformAsPoint([t[2],t[1]]),e.transformAsPoint([t[0],t[3]]),e.transformAsPoint([t[2],t[3]])];return[Math.min(...r.map(n=>n[0])),Math.min(...r.map(n=>n[1])),Math.max(...r.map(n=>n[0])),Math.max(...r.map(n=>n[1]))]}function e0e(t){return Math.abs(t.split("").reduce((e,r)=>(e<<5)-e+r.charCodeAt(0)|0,0))}function Lh(t,e){if(!t||!t.length)return null;let{index:r,id:i}=e;if(Array.isArray(t)){let o=e0e(i)%t.length;t=t[o]}let n=t;for(let o of Object.keys(r)){let s=new RegExp(`{${o}}`,"g");n=n.replace(s,String(r[o]))}return Number.isInteger(r.y)&&Number.isInteger(r.z)&&(n=n.replace(/\{-y\}/g,String(Math.pow(2,r.z)-r.y-1))),n}function t0e(t,e,r){let i;if(e&&e.length===2){let[n,o]=e,s=t.getBounds({z:n}),l=t.getBounds({z:o});i=[Math.min(s[0],l[0]),Math.min(s[1],l[1]),Math.max(s[2],l[2]),Math.max(s[3],l[3])]}else i=t.getBounds();return t.isGeospatial?[Math.max(i[0],r[0]),Math.max(i[1],r[1]),Math.min(i[2],r[2]),Math.min(i[3],r[3])]:[Math.max(Math.min(i[0],r[2]),r[0]),Math.max(Math.min(i[1],r[3]),r[1]),Math.min(Math.max(i[2],r[0]),r[2]),Math.min(Math.max(i[3],r[1]),r[3])]}function ZG({viewport:t,z:e,cullRect:r}){return(t.subViewports||[t]).map(n=>MD(n,e||0,r))}function MD(t,e,r){if(!Array.isArray(e)){let o=r.x-t.x,s=r.y-t.y,{width:l,height:u}=r,h={targetZ:e},v=t.unproject([o,s],h),T=t.unproject([o+l,s],h),E=t.unproject([o,s+u],h),M=t.unproject([o+l,s+u],h);return[Math.min(v[0],T[0],E[0],M[0]),Math.min(v[1],T[1],E[1],M[1]),Math.max(v[0],T[0],E[0],M[0]),Math.max(v[1],T[1],E[1],M[1])]}let i=MD(t,e[0],r),n=MD(t,e[1],r);return[Math.min(i[0],n[0]),Math.min(i[1],n[1]),Math.max(i[2],n[2]),Math.max(i[3],n[3])]}function r0e(t,e,r){return r?KG(t,r).map(n=>n*e/Up):t.map(i=>i*e/Up)}function ID(t,e){return Math.pow(2,t)*Up/e}function ZS(t,e,r){let i=ID(r,Up),n=t/i*360-180,o=Math.PI-2*Math.PI*e/i,s=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[n,s]}function YG(t,e,r,i){let n=ID(r,i);return[t/n*Up,e/n*Up]}function PD(t,e,r,i,n=Up){if(t.isGeospatial){let[h,v]=ZS(e,r,i),[T,E]=ZS(e+1,r+1,i);return{west:h,north:v,east:T,south:E}}let[o,s]=YG(e,r,i,n),[l,u]=YG(e+1,r+1,i,n);return{left:o,top:s,right:l,bottom:u}}function i0e(t,e,r,i,n){let o=t0e(t,null,i),s=ID(e,r),[l,u,h,v]=r0e(o,s,n),T=[];for(let E=Math.floor(l);E<h;E++)for(let M=Math.floor(u);M<v;M++)T.push({x:E,y:M,z:e});return T}function RD({viewport:t,maxZoom:e,minZoom:r,zRange:i,extent:n,tileSize:o=Up,modelMatrix:s,modelMatrixInverse:l,zoomOffset:u=0}){let h=t.isGeospatial?Math.round(t.zoom+Math.log2(Up/o))+u:Math.ceil(t.zoom)+u;if(typeof r=="number"&&Number.isFinite(r)&&h<r){if(!n)return[];h=r}typeof e=="number"&&Number.isFinite(e)&&h>e&&(h=e);let v=n;return s&&l&&n&&!t.isGeospatial&&(v=KG(n,s)),t.isGeospatial?XG(t,h,i,n):i0e(t,h,o,v||$ge,l)}function BD(t){return/(?=.*{z})(?=.*{x})(?=.*({y}|{-y}))/.test(t)}function OD(t){return Number.isFinite(t.west)&&Number.isFinite(t.north)&&Number.isFinite(t.east)&&Number.isFinite(t.south)}function JG(t){let e={},r;return i=>{for(let n in i)if(!n0e(i[n],e[n])){r=t(i),e=i;break}return r}}function n0e(t,e){if(t===e)return!0;if(Array.isArray(t)){let r=t.length;if(!e||e.length!==r)return!1;for(let i=0;i<r;i++)if(t[i]!==e[i])return!1;return!0}return!1}var QG=1,JS=2,o0e="never",s0e="no-overlap",bb="best-available",a0e=5,l0e={[bb]:u0e,[s0e]:f0e,[o0e]:()=>{}},c0e={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}},rg=class{constructor(e){this._getCullBounds=JG(ZG),this.opts={...c0e,...e},this.setOptions(this.opts),this.onTileLoad=r=>{this.opts.onTileLoad?.(r),this.opts.maxCacheByteSize&&(this._cacheByteSize+=r.byteLength,this._resizeCache())},this._requestScheduler=new vd({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Kr,this._modelMatrixInverse=new Kr}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(e=>e.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(e=>e.needsReload)}setOptions(e){Object.assign(this.opts,e),Number.isFinite(e.maxZoom)&&(this._maxZoom=Math.floor(e.maxZoom)),Number.isFinite(e.minZoom)&&(this._minZoom=Math.ceil(e.minZoom))}finalize(){for(let e of this._cache.values())e.isLoading&&e.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(let e of this._cache.keys()){let r=this._cache.get(e);!this._selectedTiles||!this._selectedTiles.includes(r)?this._cache.delete(e):r.setNeedsReload()}}update(e,{zRange:r,modelMatrix:i}={zRange:null,modelMatrix:null}){let n=i?new Kr(i):new Kr,o=!n.equals(this._modelMatrix);if(!this._viewport||!e.equals(this._viewport)||!Cs(this._zRange,r)||o){o&&(this._modelMatrixInverse=n.clone().invert(),this._modelMatrix=n),this._viewport=e,this._zRange=r;let l=this.getTileIndices({viewport:e,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:r,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=l.map(u=>this._getTile(u,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(l=>this._getTile(l.index,!0)));let s=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),s&&this._frameNumber++,this._frameNumber}isTileVisible(e,r){if(!e.isVisible)return!1;if(r&&this._viewport){let i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:r}),{bbox:n}=e;for(let[o,s,l,u]of i){let h;if("west"in n)h=n.west<l&&n.east>o&&n.south<u&&n.north>s;else{let v=Math.min(n.top,n.bottom),T=Math.max(n.top,n.bottom);h=n.left<l&&n.right>o&&v<u&&T>s}if(h)return!0}return!1}return!0}getTileIndices({viewport:e,maxZoom:r,minZoom:i,zRange:n,modelMatrix:o,modelMatrixInverse:s}){let{tileSize:l,extent:u,zoomOffset:h}=this.opts;return RD({viewport:e,maxZoom:r,minZoom:i,zRange:n,tileSize:l,extent:u,modelMatrix:o,modelMatrixInverse:s,zoomOffset:h})}getTileId(e){return`${e.x}-${e.y}-${e.z}`}getTileZoom(e){return e.z}getTileMetadata(e){let{tileSize:r}=this.opts;return{bbox:PD(this._viewport,e.x,e.y,e.z,r)}}getParentIndex(e){let r=Math.floor(e.x/2),i=Math.floor(e.y/2),n=e.z-1;return{x:r,y:i,z:n}}updateTileStates(){let e=this.opts.refinementStrategy||bb,r=new Array(this._cache.size),i=0;for(let n of this._cache.values())r[i++]=n.isVisible,n.isSelected=!1,n.isVisible=!1;for(let n of this._selectedTiles)n.isSelected=!0,n.isVisible=!0;(typeof e=="function"?e:l0e[e])(Array.from(this._cache.values())),i=0;for(let n of this._cache.values())if(r[i++]!==n.isVisible)return!0;return!1}_pruneRequests(){let{maxRequests:e=0}=this.opts,r=[],i=0;for(let n of this._cache.values())n.isLoading&&(i++,!n.isSelected&&!n.isVisible&&r.push(n));for(;e>0&&i>e&&r.length>0;)r.shift().abort(),i--}_rebuildTree(){let{_cache:e}=this;for(let r of e.values())r.parent=null,r.children&&(r.children.length=0);for(let r of e.values()){let i=this._getNearestAncestor(r);r.parent=i,i?.children&&i.children.push(r)}}_resizeCache(){let{_cache:e,opts:r}=this,i=r.maxCacheSize||(r.maxCacheByteSize?1/0:a0e*this.selectedTiles.length),n=r.maxCacheByteSize||1/0;if(e.size>i||this._cacheByteSize>n){for(let[s,l]of e)if(!l.isVisible&&!l.isSelected&&(this._cacheByteSize-=r.maxCacheByteSize?l.byteLength:0,e.delete(s),this.opts.onTileUnload?.(l)),e.size<=i&&this._cacheByteSize<=n)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((s,l)=>s.zoom-l.zoom),this._dirty=!1)}_getTile(e,r){let i=this.getTileId(e),n=this._cache.get(i),o=!1;return!n&&r?(n=new tg(e),Object.assign(n,this.getTileMetadata(n.index)),Object.assign(n,{id:i,zoom:this.getTileZoom(n.index)}),o=!0,this._cache.set(i,n),this._dirty=!0):n&&n.needsReload&&(o=!0),n&&o&&n.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),n}_getNearestAncestor(e){let{_minZoom:r=0}=this,i=e.index;for(;this.getTileZoom(i)>r;){i=this.getParentIndex(i);let n=this._getTile(i);if(n)return n}return null}};function u0e(t){for(let e of t)e.state=0;for(let e of t)e.isSelected&&!$G(e)&&DD(e);for(let e of t)e.isVisible=Boolean(e.state&JS)}function f0e(t){for(let r of t)r.state=0;for(let r of t)r.isSelected&&$G(r);let e=Array.from(t).sort((r,i)=>r.zoom-i.zoom);for(let r of e)if(r.isVisible=Boolean(r.state&JS),r.children&&(r.isVisible||r.state&QG))for(let i of r.children)i.state=QG;else r.isSelected&&DD(r)}function $G(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=JS,!0;e=e.parent}return!1}function DD(t){for(let e of t.children)e.isLoaded||e.content?e.state|=JS:DD(e)}var h0e={TilesetClass:rg,data:{type:"data",value:[]},dataComparator:iA.equal,renderSubLayers:{type:"function",value:t=>new Oh(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:bb,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0},QS=class extends es{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return Boolean(this.state?.tileset?.selectedTiles?.every(e=>e.isLoaded&&e.layers&&e.layers.every(r=>r.isLoaded)))}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState({changeFlags:e}){let{tileset:r}=this.state,i=e.propsOrDataChanged||e.updateTriggersChanged,n=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);r?i&&(r.setOptions(this._getTilesetOptions()),n?r.reloadAll():r.tiles.forEach(o=>{o.layers=null})):(r=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:r})),this._updateTileset()}_getTilesetOptions(){let{tileSize:e,maxCacheSize:r,maxCacheByteSize:i,refinementStrategy:n,extent:o,maxZoom:s,minZoom:l,maxRequests:u,debounceTime:h,zoomOffset:v}=this.props;return{maxCacheSize:r,maxCacheByteSize:i,maxZoom:s,minZoom:l,tileSize:e,refinementStrategy:n,extent:o,maxRequests:u,debounceTime:h,zoomOffset:v,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){let e=this.state.tileset,{zRange:r,modelMatrix:i}=this.props,n=e.update(this.context.viewport,{zRange:r,modelMatrix:i}),{isLoaded:o}=e,s=this.state.isLoaded!==o,l=this.state.frameNumber!==n;o&&(s||l)&&this._onViewportLoad(),l&&this.setState({frameNumber:n}),this.state.isLoaded=o}_onViewportLoad(){let{tileset:e}=this.state,{onViewportLoad:r}=this.props;r&&r(e.selectedTiles)}_onTileLoad(e){this.props.onTileLoad(e),e.layers=null,this.setNeedsUpdate()}_onTileError(e,r){this.props.onTileError(e),r.layers=null,this.setNeedsUpdate()}_onTileUnload(e){this.props.onTileUnload(e)}getTileData(e){let{data:r,getTileData:i,fetch:n}=this.props,{signal:o}=e;return e.url=typeof r=="string"||Array.isArray(r)?Lh(r,e):null,i?i(e):n&&e.url?n(e.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(e){return this.props.renderSubLayers(e)}getSubLayerPropsByTile(e){return null}getPickingInfo(e){let r=e.sourceLayer,i=r.props.tile,n=e.info;return n.picked&&(n.tile=i),n.sourceTile=i,n.sourceTileSubLayer=r,n}_updateAutoHighlight(e){e.sourceTileSubLayer.updateAutoHighlight(e)}renderLayers(){return this.state.tileset.tiles.map(e=>{let r=this.getSubLayerPropsByTile(e);if(!(!e.isLoaded&&!e.content))if(e.layers)r&&e.layers[0]&&Object.keys(r).some(i=>e.layers[0].props[i]!==r[i])&&(e.layers=e.layers.map(i=>i.clone(r)));else{let i=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:e.id,updateTriggers:this.props.updateTriggers}),data:e.content,_offset:0,tile:e});e.layers=Rh(i,Boolean).map(n=>n.clone({tile:e,...r}))}return e.layers})}filterSubLayer({layer:e,cullRect:r}){let{tile:i}=e.props;return this.state.tileset.isTileVisible(i,r)}},Fh=QS;(()=>{QS.defaultProps=h0e})(),(()=>{QS.layerName="TileLayer"})();var p0e={fadeTrail:!0,trailLength:{type:"number",value:120,min:0},currentTime:{type:"number",value:0,min:0},getTimestamps:{type:"accessor",value:t=>t.timestamps}},$S=class extends Pf{getShaders(){let e=super.getShaders();return e.inject={"vs:#decl":`uniform float trailLength;
3316
3316
  in float instanceTimestamps;
3317
3317
  in float instanceNextTimestamps;
3318
3318
  out float vTime;