PageSourceSearch

https://www.arcnet.com/assets/deck-gl-Ce2nZgZd.js

js arcnet.com collected 2026-10-02 19:10:08 UTC 427,079 bytes, 1,145 lines download raw bytes

1import{g as Gl,r as Z}from"./vendor-BS2D_vZZ.js";function Hl(n,t){for(var e=0;e<t.length;e++){const i=t[e];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in n)){const s=Object.getOwnPropertyDescriptor(i,r);s&&Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}function Qn(n,t){if(!n)throw new Error(t||"loader assertion failed.")}const Or=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),Ls=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);Ls&&parseFloat(Ls[1]);const Wl="3.4.15";function Vt(n,t){if(!n)throw new Error(t||"loaders.gl assertion failed.")}const Wn=typeof process!="object"||String(process)!=="[object process]"||process.browser,Xl=typeof window<"u"&&typeof window.orientation<"u",Rs=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);Rs&&parseFloat(Rs[1]);function on(n){"@babel/helpers - typeof";return on=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},on(n)}function Yl(n,t){if(on(n)!="object"||!n)return n;var e=n[Symbol.toPrimitive];if(e!==void 0){var i=e.call(n,t);if(on(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(n)}function ql(n){var t=Yl(n,"string");return on(t)=="symbol"?t:t+""}function f(n,t,e){return(t=ql(t))in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}class Zl{constructor(t,e){f(this,"name",void 0),f(this,"workerThread",void 0),f(this,"isRunning",!0),f(this,"result",void 0),f(this,"_resolve",()=>{}),f(this,"_reject",()=>{}),this.name=t,this.workerThread=e,this.result=new Promise((i,r)=>{this._resolve=i,this._reject=r})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){Vt(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Vt(this.isRunning),this.isRunning=!1,this._reject(t)}}let Mi=class{terminate(){}};const Ci=new Map;function Kl(n){Vt(n.source&&!n.url||!n.source&&n.url);let t=Ci.get(n.source||n.url);return t||(n.url&&(t=$l(n.url),Ci.set(n.url,t)),n.source&&(t=Ea(n.source),Ci.set(n.source,t))),Vt(t),t}function $l(n){if(!n.startsWith("http"))return n;const t=Ql(n);return Ea(t)}function Ea(n){const t=new Blob([n],{type:"application/javascript"});return URL.createObjectURL(t)}function Ql(n){return`try {
2  importScripts('`.concat(n,`');
3} catch (error) {
4  console.error(error);
5  throw error;
6}`)}function Ta(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,e=arguments.length>2?arguments[2]:void 0;const i=e||new Set;if(n){if(Is(n))i.add(n);else if(Is(n.buffer))i.add(n.buffer);else if(!ArrayBuffer.isView(n)){if(t&&typeof n=="object")for(const r in n)Ta(n[r],t,i)}}return e===void 0?Array.from(i):[]}function Is(n){return n?n instanceof ArrayBuffer||typeof MessagePort<"u"&&n instanceof MessagePort||typeof ImageBitmap<"u"&&n instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas:!1}const Oi=()=>{};class sr{static isSupported(){return typeof Worker<"u"&&Wn||typeof Mi<"u"&&!Wn}constructor(t){f(this,"name",void 0),f(this,"source",void 0),f(this,"url",void 0),f(this,"terminated",!1),f(this,"worker",void 0),f(this,"onMessage",void 0),f(this,"onError",void 0),f(this,"_loadableURL","");const{name:e,source:i,url:r}=t;Vt(i||r),this.name=e,this.source=i,this.url=r,this.onMessage=Oi,this.onError=s=>console.log(s),this.worker=Wn?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Oi,this.onError=Oi,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(t,e){e=e||Ta(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+="worker ".concat(this.name," from ").concat(this.url,". "),t.message&&(e+="".concat(t.message," in ")),t.lineno&&(e+=":".concat(t.lineno,":").concat(t.colno)),new Error(e)}_createBrowserWorker(){this._loadableURL=Kl({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},t.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},t.onmessageerror=e=>console.error(e),t}_createNodeWorker(){let t;if(this.url){const i=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);t=new Mi(i,{eval:!1})}else if(this.source)t=new Mi(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}}class Jl{static isSupported(){return sr.isSupported()}constructor(t){f(this,"name","unnamed"),f(this,"source",void 0),f(this,"url",void 0),f(this,"maxConcurrency",1),f(this,"maxMobileConcurrency",1),f(this,"onDebug",()=>{}),f(this,"reuseWorkers",!0),f(this,"props",{}),f(this,"jobQueue",[]),f(this,"idleQueue",[]),f(this,"count",0),f(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,o,a)=>s.done(a),i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,o)=>s.error(o);const r=new Promise(s=>(this.jobQueue.push({name:t,onMessage:e,onError:i,onStart:s}),this));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const i=new Zl(e.name,t);t.onMessage=r=>e.onMessage(i,r.type,r.payload),t.onError=r=>e.onError(i,r),e.onStart(i);try{await i.result}
6finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const t="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new sr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Xl?this.maxMobileConcurrency:this.maxConcurrency}}const tu={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class Bt{static isSupported(){return sr.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Bt._workerFarm=Bt._workerFarm||new Bt({}),Bt._workerFarm.setProps(t),Bt._workerFarm}constructor(t){f(this,"props",void 0),f(this,"workerPools",new Map),this.props={...tu},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:i,url:r}=t;let s=this.workerPools.get(e);return s||(s=new Jl({name:e,source:i,url:r}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}f(Bt,"_workerFarm",void 0);const eu="latest";function nu(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const e=t[n.id]||{},i="".concat(n.id,"-worker.js");let r=e.workerUrl;if(!r&&n.id==="compression"&&(r=t.workerUrl),t._workerType==="test"&&(r="modules/".concat(n.module,"/dist/").concat(i)),!r){let s=n.version;s==="latest"&&(s=eu);const o=s?"@".concat(s):"";r="https://unpkg.com/@loaders.gl/".concat(n.module).concat(o,"/dist/").concat(i)}return Vt(r),r}function iu(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wl;Vt(n,"no worker provided");const e=n.version;return!(!t||!e)}function ru(n,t){return!Bt.isSupported()||!Wn&&!(t!=null&&t._nodeWorkers)?!1:n.worker&&t?.worker}async function su(n,t,e,i,r){const s=n.id,o=nu(n,e),c=Bt.getWorkerFarm(e).getWorkerPool({name:s,url:o});e=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(i||{}));const l=await c.startJob("process-on-worker",ou.bind(null,r));return l.postMessage("process",{input:t,options:e,context:i}),await(await l.result).result}async function ou(n,t,e,i){switch(e){case"done":t.done(i);break;case"error":t.error(new Error(i.error));break;case"process":const{id:r,input:s,options:o}=i;try{const a=await n(s,o);t.postMessage("done",{id:r,result:a})}catch(a){const c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:r,error:c})}break;default:console.warn("parse-with-worker unknown message ".concat(e))}}function au(n,t,e){if(e=e||n.byteLength,n.byteLength<e||t.byteLength<e)return!1;const i=new Uint8Array(n),r=new Uint8Array(t);for(let s=0;s<i.length;++s)if(i[s]!==r[s])return!1;return!0}function cu(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];const i=t.map(a=>a instanceof ArrayBuffer?new Uint8Array(a):a),r=i.reduce((a,c)=>a+c.byteLength,0),s=new Uint8Array(r);let o=0;for(const a of i)s.set(a,o),o+=a.byteLength;return s.buffer}async function lu(n){const t=[];for await(const e of n)t.push(e);return cu(...t)}function Ms(){let n;if(typeof window<"u"&&window.performance)n=window.performance.now();else if(typeof process<"u"&&process.hrtime){const t=process.hrtime();n=t[0]*1e3+t[1]/1e6}else n=Date.now();return n}class Cs{constructor(t,e){f(this,"name",void 0),f(this,"type",void 0),f(this,"sampleSize",1),f(this,"time",void 0),f(this,"count",void 0),f(this,"samples",void 0),f(this,"lastTiming",void 0),f(this,"lastSampleTime",void 0),f(this,"lastSampleCount",void 0),f(this,"_count",0),f(this,"_time",0),f(this,"_samples",0),f(this,"_startTime",0),f(this,"_timerPending",!1),this.name=t,this.type=e,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Ms(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Ms()-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}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}_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)}}class Nr{constructor(t){f(this,"id",void 0),f(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[e])}getTable(){const t={};
6return this.forEach(e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}}),t}_initializeStats(){(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).forEach(e=>this._getOrCreate(e))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:i}=t;return this.stats[e]||(t instanceof Cs?this.stats[e]=t:this.stats[e]=new Cs(e,i)),this.stats[e]}}let uu="";const Os={};function hu(n){for(const t in Os)if(n.startsWith(t)){const e=Os[t];n=n.replace(t,e)}return!n.startsWith("http://")&&!n.startsWith("https://")&&(n="".concat(uu).concat(n)),n}function fu(n){return n&&typeof n=="object"&&n.isBuffer}function wa(n){if(fu(n))return n;if(n instanceof ArrayBuffer)return n;if(ArrayBuffer.isView(n))return n.byteOffset===0&&n.byteLength===n.buffer.byteLength?n.buffer:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength);if(typeof n=="string"){const t=n;return new TextEncoder().encode(t).buffer}if(n&&typeof n=="object"&&n._toArrayBuffer)return n._toArrayBuffer();throw new Error("toArrayBuffer")}function Aa(n){const t=n?n.lastIndexOf("/"):-1;return t>=0?n.substr(t+1):""}function du(n){const t=n?n.lastIndexOf("/"):-1;return t>=0?n.substr(0,t):""}const gu=n=>typeof n=="boolean",nn=n=>typeof n=="function",dn=n=>n!==null&&typeof n=="object",Ns=n=>dn(n)&&n.constructor==={}.constructor,pu=n=>n&&typeof n[Symbol.iterator]=="function",mu=n=>n&&typeof n[Symbol.asyncIterator]=="function",ge=n=>typeof Response<"u"&&n instanceof Response||n&&n.arrayBuffer&&n.text&&n.json,pe=n=>typeof Blob<"u"&&n instanceof Blob,_u=n=>n&&typeof n=="object"&&n.isBuffer,bu=n=>typeof ReadableStream<"u"&&n instanceof ReadableStream||dn(n)&&nn(n.tee)&&nn(n.cancel)&&nn(n.getReader),yu=n=>dn(n)&&nn(n.read)&&nn(n.pipe)&&gu(n.readable),Sa=n=>bu(n)||yu(n),vu=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,Eu=/^([-\w.]+\/[-\w.+]+)/;function Tu(n){const t=Eu.exec(n);return t?t[1]:n}function ks(n){const t=vu.exec(n);return t?t[1]:""}const xa=/\?.*/;function wu(n){const t=n.match(xa);return t&&t[0]}function kr(n){return n.replace(xa,"")}function di(n){return ge(n)?n.url:pe(n)?n.name||"":typeof n=="string"?n:""}function Dr(n){if(ge(n)){const t=n,e=t.headers.get("content-type")||"",i=kr(t.url);return Tu(e)||ks(i)}return pe(n)?n.type||"":typeof n=="string"?ks(n):""}function Au(n){return ge(n)?n.headers["content-length"]||-1:pe(n)?n.size:typeof n=="string"?n.length:n instanceof ArrayBuffer||ArrayBuffer.isView(n)?n.byteLength:-1}async function Pa(n){if(ge(n))return n;const t={},e=Au(n);e>=0&&(t["content-length"]=String(e));const i=di(n),r=Dr(n);r&&(t["content-type"]=r);const s=await Pu(n);s&&(t["x-first-bytes"]=s),typeof n=="string"&&(n=new TextEncoder().encode(n));const o=new Response(n,{headers:t});return Object.defineProperty(o,"url",{value:i}),o}async function Su(n){if(!n.ok){const t=await xu(n);throw new Error(t)}}async function xu(n){let t="Failed to fetch resource ".concat(n.url," (").concat(n.status,"): ");try{const e=n.headers.get("Content-Type");let i=n.statusText;e.includes("application/json")&&(i+=" ".concat(await n.text())),t+=i,t=t.length>60?"".concat(t.slice(0,60),"..."):t}catch{}return t}async function Pu(n){if(typeof n=="string")return"data:,".concat(n.slice(0,5));if(n instanceof Blob){const e=n.slice(0,5);return await new Promise(i=>{const r=new FileReader;r.onload=s=>{var o;return i(s==null||(o=s.target)===null||o===void 0?void 0:o.result)},r.readAsDataURL(e)})}if(n instanceof ArrayBuffer){const e=n.slice(0,5),i=Lu(e);return"data:base64,".concat(i)}return null}function Lu(n){let t="";const e=new Uint8Array(n);for(let i=0;i<e.byteLength;i++)t+=String.fromCharCode(e[i]);return btoa(t)}async function Ds(n,t){if(typeof n=="string"){n=hu(n);let e=t;return t!=null&&t.fetch&&typeof t?.fetch!="function"&&(e=t.fetch),await fetch(n,e)}return await Pa(n)}
6function La(n){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&process.versions.electron)return!0;const e=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent;return!!(e&&e.indexOf("Electron")>=0)}function Gt(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||La()}const Xn={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,process:typeof process=="object"&&process},Nn=Xn.window||Xn.self||Xn.global,qe=Xn.process||{},Ra=typeof __VERSION__<"u"?__VERSION__:"untranspiled source";Gt();const Ni=globalThis;function Ia(n){if(!Gt())return"Node";if(La())return"Electron";const e=(typeof navigator<"u"?navigator:{}).userAgent||"";if(e.indexOf("Edge")>-1)return"Edge";const i=e.indexOf("MSIE ")!==-1,r=e.indexOf("Trident/")!==-1;return i||r?"IE":Ni.chrome?"Chrome":Ni.safari?"Safari":Ni.mozInnerScreenX?"Firefox":"Unknown"}function Ru(n){try{const t=window[n],e="__storage_test__";return t.setItem(e,e),t.removeItem(e),t}catch{return null}}class Iu{constructor(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"sessionStorage";f(this,"storage",void 0),f(this,"id",void 0),f(this,"config",void 0),this.storage=Ru(i),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function Mu(n){let t;return n<10?t="".concat(n.toFixed(2),"ms"):n<100?t="".concat(n.toFixed(1),"ms"):n<1e3?t="".concat(n.toFixed(0),"ms"):t="".concat((n/1e3).toFixed(2),"s"),t}function Cu(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;const e=Math.max(t-n.length,0);return"".concat(" ".repeat(e)).concat(n)}function ki(n,t,e){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:600;const r=n.src.replace(/\(/g,"%28").replace(/\)/g,"%29");n.width>i&&(e=Math.min(e,i/n.width));const s=n.width*e,o=n.height*e,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(s/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(r,");"),"background-size:".concat(s,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),a]}let Jn;(function(n){n[n.BLACK=30]="BLACK",n[n.RED=31]="RED",n[n.GREEN=32]="GREEN",n[n.YELLOW=33]="YELLOW",n[n.BLUE=34]="BLUE",n[n.MAGENTA=35]="MAGENTA",n[n.CYAN=36]="CYAN",n[n.WHITE=37]="WHITE",n[n.BRIGHT_BLACK=90]="BRIGHT_BLACK",n[n.BRIGHT_RED=91]="BRIGHT_RED",n[n.BRIGHT_GREEN=92]="BRIGHT_GREEN",n[n.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",n[n.BRIGHT_BLUE=94]="BRIGHT_BLUE",n[n.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",n[n.BRIGHT_CYAN=96]="BRIGHT_CYAN",n[n.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Jn||(Jn={}));function Fs(n){return typeof n=="string"?Jn[n.toUpperCase()]||Jn.WHITE:n}function Ou(n,t,e){return!Gt&&typeof n=="string"&&(t&&(t=Fs(t),n="\x1B[".concat(t,"m").concat(n,"\x1B[39m")),e&&(t=Fs(e),n="\x1B[".concat(e+10,"m").concat(n,"\x1B[49m"))),n}function Nu(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:["constructor"];const e=Object.getPrototypeOf(n),i=Object.getOwnPropertyNames(e);for(const r of i)typeof n[r]=="function"&&(t.find(s=>r===s)||(n[r]=n[r].bind(n)))}function ti(n,t){if(!n)throw new Error(t||"Assertion failed")}function be(){let n;if(Gt&&"performance"in Nn){var t,e;n=Nn==null||(t=Nn.performance)===null||t===void 0||(e=t.now)===null||e===void 0?void 0:e.call(t)}else if("hrtime"in qe){var i;const r=qe==null||(i=qe.hrtime)===null||i===void 0?void 0:i.call(qe);n=r[0]*1e3+r[1]/1e6}else n=Date.now();return n}const ye={debug:Gt&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},ku={enabled:!0,level:0};function bt(){}const Us={},Bs={once:!0};class gn{constructor(){let{id:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{id:""};f(this,"id",void 0),f(this,"VERSION",Ra),f(this,"_startTs",be()),f(this,"_deltaTs",be()),f(this,"_storage",void 0),f(this,"userData",{}),f(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new Iu("__probe-".concat(this.id,"__"),ku),this.timeStamp("".concat(this.id," started")),Nu(this),Ob
6ject.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((be()-this._startTs).toPrecision(10))}getDelta(){return Number((be()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){ti(t,e)}warn(t){return this._getLogFunction(0,t,ye.warn,arguments,Bs)}error(t){return this._getLogFunction(0,t,ye.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,ye.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,ye.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){for(var i=arguments.length,r=new Array(i>2?i-2:0),s=2;s<i;s++)r[s-2]=arguments[s];return this._getLogFunction(t,e,ye.debug||ye.info,arguments,Bs)}table(t,e,i){return e?this._getLogFunction(t,e,console.table||bt,i&&[i],{tag:Bu(e)}):bt}image(t){let{logLevel:e,priority:i,image:r,message:s="",scale:o=1}=t;return this._shouldLog(e||i)?Gt?Uu({image:r,message:s,scale:o}):Fu():bt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||bt)}group(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{collapsed:!1};const r=Vs({logLevel:t,message:e,opts:i}),{collapsed:s}=i;return r.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.group(t,e,Object.assign({},i,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||bt)}withGroup(t,e,i){this.group(t,e)();try{i()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Ma(t)}_getLogFunction(t,e,i,r,s){if(this._shouldLog(t)){s=Vs({logLevel:t,message:e,args:r,opts:s}),i=i||s.method,ti(i),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=be();const o=s.tag||s.message;if(s.once)if(!Us[o])Us[o]=be();else return bt;return e=Du(this.id,s.message,s),i.bind(console,e,...s.args)}return bt}}f(gn,"VERSION",Ra);function Ma(n){if(!n)return 0;let t;switch(typeof n){case"number":t=n;break;case"object":t=n.logLevel||n.priority||0;break;default:return 0}return ti(Number.isFinite(t)&&t>=0),t}function Vs(n){const{logLevel:t,message:e}=n;n.logLevel=Ma(t);const i=n.args?Array.from(n.args):[];for(;i.length&&i.shift()!==e;);switch(typeof t){case"string":case"function":e!==void 0&&i.unshift(e),n.message=t;break;case"object":Object.assign(n,t);break}typeof n.message=="function"&&(n.message=n.message());const r=typeof n.message;return ti(r==="string"||r==="object"),Object.assign(n,{args:i},n.opts)}function Du(n,t,e){if(typeof t=="string"){const i=e.time?Cu(Mu(e.total)):"";t=e.time?"".concat(n,": ").concat(i,"  ").concat(t):"".concat(n,": ").concat(t),t=Ou(t,e.color,e.background)}return t}function Fu(n){return console.warn("removed"),bt}function Uu(n){let{image:t,message:e="",scale:i=1}=n;if(typeof t=="string"){const s=new Image;return s.onload=()=>{const o=ki(s,e,i);console.log(...o)},s.src=t,bt}const r=t.nodeName||"";if(r.toLowerCase()==="img")return console.log(...ki(t,e,i)),bt;if(r.toLowerCase()==="canvas"){const s=new Image;return s.onload=()=>console.log(...ki(s,e,i)),s.src=t.toDataURL(),bt}return bt}function Bu(n){for(const t in n)for(const e in n[t])return e||"untitled";return"empty"}const js=new gn({id:"loaders.gl"});class Vu{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class ju{constructor(){f(this,"console",void 0),this.console=console}log(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.console.log.bind(this.console,...e)}info(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.console.info.bind(this.console,...e)}warn(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.console.warn.bind(this.console,...e)}error(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return this.console.error.bind(this.console,...e)}}const Ca={fetch:null,mimeType:void 0,nothrow:!1,log:new ju,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:Or,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},zu={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 Oa(){globalThis.loaders=globalThis.loaders||{};const{loaders:n}=globalThis;return n._state=n._state||{},n._state}const Na=()=>{const n=Oa();return n.globalOptions=n.globalOptions||{...Ca},n.globalOptions};function Gu(n,t,e,i){return e=e||[],e=Array.isArray(e)?e:[e],Hu(n,e),Xu(t,n,i)}function Hu(n,t){zs(n,null,Ca,zu,t);for(const e of t){const i=n&&n[e.id]||{},r=e.options&&e.options[e.id]||{},s=e.deprecatedOptions&&e.deprecatedOptions[e.id]||{};zs(i,e.id,r,s,t)}}function zs(n,t,e,i,r){const s=t||"Top level",o=t?"".concat(t,"."):"";for(const a in n){const c=!t&&dn(n[a]),l=a==="baseUri"&&!t,u=a==="workerUrl"&&t;if(!(a in e)&&!l&&!u){if(a in i)js.warn("".concat(s," loader option '").concat(o).concat(a,"' no longer supported, use '").concat(i[a],"'"))();else if(!c){const d=Wu(a,r);js.warn("".concat(s," loader option '").concat(o).concat(a,"' not recognized. ").concat(d))()}}}}function Wu(n,t){const e=n.toLowerCase();let i="";for(const r of t)for(const s in r.options){if(n===s)return"Did you mean '".concat(r.id,".").concat(s,"'?");const o=s.toLowerCase();(e.startsWith(o)||o.startsWith(e))&&(i=i||"Did you mean '".concat(r.id,".").concat(s,"'?"))}return i}function Xu(n,t,e){const r={...n.options||{}};return Yu(r,e),r.log===null&&(r.log=new Vu),Gs(r,Na()),Gs(r,t),r}function Gs(n,t){for(const e in t)if(e in t){const i=t[e];Ns(i)&&Ns(n[e])?n[e]={...n[e],...t[e]}:n[e]=t[e]}}function Yu(n,t){t&&!("baseUri"in n)&&(n.baseUri=t)}function Fr(n){var t;return n?(Array.isArray(n)&&(n=n[0]),Array.isArray((t=n)===null||t===void 0?void 0:t.extensions)):!1}function Ur(n){var t,e;Qn(n,"null loader"),Qn(Fr(n),"invalid loader");let i;return Array.isArray(n)&&(i=n[1],n=n[0],n={...n,options:{...n.options,...i}}),((t=n)!==null&&t!==void 0&&t.parseTextSync||(e=n)!==null&&e!==void 0&&e.parseText)&&(n.text=!0),n.text||(n.binary=!0),n}const ka=()=>{const n=Oa();return n.loaderRegistry=n.loaderRegistry||[],n.loaderRegistry};function qu(n){const t=ka();n=Array.isArray(n)?n:[n];for(const e of n){const i=Ur(e);
6t.find(r=>i===r)||t.unshift(i)}}function Zu(){return ka()}const Ku=new gn({id:"loaders.gl"}),$u=/\.([^.]+)$/;async function Qu(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],e=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!Da(n))return null;let r=Hs(n,t,{...e,nothrow:!0},i);if(r)return r;if(pe(n)&&(n=await n.slice(0,10).arrayBuffer(),r=Hs(n,t,e,i)),!r&&!(e!=null&&e.nothrow))throw new Error(Fa(n));return r}function Hs(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],e=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(!Da(n))return null;if(t&&!Array.isArray(t))return Ur(t);let r=[];t&&(r=r.concat(t)),e!=null&&e.ignoreRegisteredLoaders||r.push(...Zu()),th(r);const s=Ju(n,r,e,i);if(!s&&!(e!=null&&e.nothrow))throw new Error(Fa(n));return s}function Ju(n,t,e,i){const r=di(n),s=Dr(n),o=kr(r)||i?.url;let a=null,c="";if(e!=null&&e.mimeType&&(a=Di(t,e?.mimeType),c="match forced by supplied MIME type ".concat(e?.mimeType)),a=a||eh(t,o),c=c||(a?"matched url ".concat(o):""),a=a||Di(t,s),c=c||(a?"matched MIME type ".concat(s):""),a=a||ih(t,n),c=c||(a?"matched initial data ".concat(Ua(n)):""),a=a||Di(t,e?.fallbackMimeType),c=c||(a?"matched fallback MIME type ".concat(s):""),c){var l;Ku.log(1,"selectLoader selected ".concat((l=a)===null||l===void 0?void 0:l.name,": ").concat(c,"."))}return a}function Da(n){return!(n instanceof Response&&n.status===204)}function Fa(n){const t=di(n),e=Dr(n);let i="No valid loader found (";i+=t?"".concat(Aa(t),", "):"no url provided, ",i+="MIME type: ".concat(e?'"'.concat(e,'"'):"not provided",", ");const r=n?Ua(n):"";return i+=r?' first bytes: "'.concat(r,'"'):"first bytes: not available",i+=")",i}function th(n){for(const t of n)Ur(t)}function eh(n,t){const e=t&&$u.exec(t),i=e&&e[1];return i?nh(n,i):null}function nh(n,t){t=t.toLowerCase();for(const e of n)for(const i of e.extensions)if(i.toLowerCase()===t)return e;return null}function Di(n,t){for(const e of n)if(e.mimeTypes&&e.mimeTypes.includes(t)||t==="application/x.".concat(e.id))return e;return null}function ih(n,t){if(!t)return null;for(const e of n)if(typeof t=="string"){if(rh(t,e))return e}else if(ArrayBuffer.isView(t)){if(Ws(t.buffer,t.byteOffset,e))return e}else if(t instanceof ArrayBuffer&&Ws(t,0,e))return e;return null}function rh(n,t){return t.testText?t.testText(n):(Array.isArray(t.tests)?t.tests:[t.tests]).some(i=>n.startsWith(i))}function Ws(n,t,e){return(Array.isArray(e.tests)?e.tests:[e.tests]).some(r=>sh(n,t,e,r))}function sh(n,t,e,i){if(i instanceof ArrayBuffer)return au(i,n,i.byteLength);switch(typeof i){case"function":return i(n,e);case"string":const r=or(n,t,i.length);return i===r;default:return!1}}function Ua(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:5;return typeof n=="string"?n.slice(0,t):ArrayBuffer.isView(n)?or(n.buffer,n.byteOffset,t):n instanceof ArrayBuffer?or(n,0,t):""}function or(n,t,e){if(n.byteLength<t+e)return"";const i=new DataView(n);let r="";for(let s=0;s<e;s++)r+=String.fromCharCode(i.getUint8(t+s));return r}const oh=256*1024;function*ah(n,t){const e=t?.chunkSize||oh;let i=0;const r=new TextEncoder;for(;i<n.length;){const s=Math.min(n.length-i,e),o=n.slice(i,i+s);i+=s,yield r.encode(o)}}const ch=256*1024;function lh(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const{chunkSize:e=ch}=t;let i=0;for(;i<n.byteLength;){const r=Math.min(n.byteLength-i,e),s=new ArrayBuffer(r),o=new Uint8Array(n,i,r);new Uint8Array(s).set(o),i+=r,yield s}}()}const uh=1024*1024;async function*hh(n,t){const e=t?.chunkSize||uh;let i=0;for(;i<n.size;){const r=i+e,s=await n.slice(i,r).arrayBuffer();i=r,yield s}}function Xs(n,t){return Or?fh(n,t):dh(n)}async function*fh(n,t){const e=n.getReader();let i;try{for(;;){const r=i||e.read();t!=null&&t._streamReadAhead&&(i=e.read());const{done:s,value:o}=await r;if(s)return;yield wa(o)}}catch{e.releaseLock()}}async function*dh(n,t){for await(const e of n)yield wa(e)}function gh(n,t){if(typeof n=="string")return ah(n,t);if(n instanceof ArrayBuffer)return lh(n,t);if(pe(n))return hh(n,t);if(Sa(n))return Xs(n,t);if(ge(n))return Xs(n.body,t);throw new Error("makeIterator")}const Ba="Cannot convert supplied data type";function ph(n,t,e){if(t.text&&typeof n=="string")return n;if(_u(n)&&(n=n.buffer),n instanceof ArrayBuffer){const i=n;return t.text&&!t.binary?new TextDecoder("utf8").decode(i):i}if(ArrayBuffer.isView(n)){if(t.text&&!t.binary)return new TextDecoder("utf8").decode(n);let i=n.buffer;const r=n.byteLength||n.length;return(n.byteOffset!==0||r!==i.byteLength)&&(i=i.slice(n.byteOffset,n.byteOffset+r)),i}throw new Error(Ba)}async function mh(n,t,e){const i=n instanceof ArrayBuffer||ArrayBuffer.isView(n);if(typeof n=="string"||i)return ph(n,t);if(pe(n)&&(n=await Pa(n)),ge(n)){const r=n;return await Su(r),t.binary?await r.arrayBuffer():await r.text()}if(Sa(n)&&(n=gh(n,e)),pu(n)||mu(n))return lu(n);throw new Error(Ba)}function Va(n,t){const e=Na(),i=n||e;return typeof i.fetch=="function"?i.fetch:dn(i.fetch)?r=>Ds(r,i):t!=null&&t.fetch?t?.fetch:Ds}function _h(n,t,e){if(e)return e;const i={fetch:Va(t,n),...n};if(i.url){const r=kr(i.url);i.baseUrl=r,i.queryString=wu(i.url),i.filename=Aa(r),i.baseUrl=du(r)}return Array.isArray(i.loaders)||(i.loaders=null),i}function bh(n,t){if(!t&&n&&!Array.isArray(n))return n;let e;if(n&&(e=Array.isArray(n)?n:[n]),t&&t.loaders){const i=Array.isArray(t.loaders)?t.loaders:[t.loaders];e=e?[...e,...i]:i}return e&&e.length?e:null}async function Br(n,t,e,i){Vt(!i||typeof i=="object"),t&&!Array.isArray(t)&&!Fr(t)&&(i=void 0,e=t,t=void 0),n=await n,e=e||{};const r=di(n),o=bh(t,i),a=await Qu(n,o,e);return a?(e=Gu(e,a,o,r),i=_h({url:r,parse:Br,loaders:o},e,i||null),await yh(a,n,e,i)):null}async function yh(n,t,e,i){if(iu(n),ge(t)){const r=t,{ok:s,redirected:o,status:a,statusText:c,type:l,url:u}=r,d=Object.fromEntries(r.headers.entries());i.response={headers:d,ok:s,redirected:o,status:a,statusText:c,type:l,url:u}}if(t=await mh(t,n,e),n.parseTextSync&&typeof t=="string")return e.dataType="text",n.parseTextSync(t,e,i,n);if(ru(n,e))return await su(n,t,e,i,Br);if(n.parseText&&typeof t=="string")return await n.parseText(t,e,i,n);if(n.parse)return await n.parse(t,e,i,n);throw Vt(!n.parseSync),new Error("".concat(n.id," loader - no parser found and worker is disabled"))}async function ar(n,t,e,i){!Array.isArray(t)&&!Fr(t)&&(e=t,t=void 0);const r=Va(e);let s=n;return typeof n=="string"&&(s=await r(n)),pe(n)&&(s=await r(n)),await Br(s,t,e)}const vh="3.4.15",{_parseImageNode:Eh}=globalThis,cr=typeof Image<"u",lr=typeof ImageBitmap<"u",Th=!!Eh,ur=Or?!0:Th;function wh(n){switch(n){case"auto":return lr||cr||ur;case"imagebitmap":return lr;case"image":return cr;case"data":return ur;default:throw new Error("@loaders.gl/images: image ".concat(n," not supported in this environment"))}}function Ah(){if(lr)return"imagebitmap";if(cr)return"image";if(ur)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Sh(n){const t=Ph(n);if(!t)throw new Error("Not an image");return t}function xh(n){switch(Sh(n)){case"data":return n;case"image":case"imagebitmap":const t=document.createElement("canvas"),e=t.getContext("2d");if(!e)throw new Error("getImageData");
6return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height);default:throw new Error("getImageData")}}function Ph(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&n instanceof Image?"image":n&&typeof n=="object"&&n.data&&n.width&&n.height?"data":null}const Lh=/^data:image\/svg\+xml/,Rh=/\.svg((\?|#).*)?$/;function Vr(n){return n&&(Lh.test(n)||Rh.test(n))}function Ih(n,t){if(Vr(t)){let i=new TextDecoder().decode(n);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(i=unescape(encodeURIComponent(i)))}catch(s){throw new Error(s.message)}return"data:image/svg+xml;base64,".concat(btoa(i))}return ja(n,t)}function ja(n,t){if(Vr(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(n)])}async function za(n,t,e){const i=Ih(n,e),r=self.URL||self.webkitURL,s=typeof i!="string"&&r.createObjectURL(i);try{return await Mh(s||i,t)}finally{s&&r.revokeObjectURL(s)}}async function Mh(n,t){const e=new Image;return e.src=n,t.image&&t.image.decode&&e.decode?(await e.decode(),e):await new Promise((i,r)=>{try{e.onload=()=>i(e),e.onerror=s=>r(new Error("Could not load image ".concat(n,": ").concat(s)))}catch(s){r(s)}})}const Ch={};let Ys=!0;async function Oh(n,t,e){let i;Vr(e)?i=await za(n,t,e):i=ja(n,e);const r=t&&t.imagebitmap;return await Nh(i,r)}async function Nh(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if((kh(t)||!Ys)&&(t=null),t)try{return await createImageBitmap(n,t)}catch(e){console.warn(e),Ys=!1}return await createImageBitmap(n)}function kh(n){for(const t in n||Ch)return!1;return!0}function Dh(n){return!Vh(n,"ftyp",4)||!(n[8]&96)?null:Fh(n)}function Fh(n){switch(Uh(n,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Uh(n,t,e){return String.fromCharCode(...n.slice(t,e))}function Bh(n){return[...n].map(t=>t.charCodeAt(0))}function Vh(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;const i=Bh(t);for(let r=0;r<i.length;++r)if(i[r]!==n[r+e])return!1;return!0}const Mt=!1,rn=!0;function Ga(n){const t=pn(n);return zh(t)||Wh(t)||Gh(t)||Hh(t)||jh(t)}function jh(n){const t=new Uint8Array(n instanceof DataView?n.buffer:n),e=Dh(t);return e?{mimeType:e.mimeType,width:0,height:0}:null}function zh(n){const t=pn(n);return t.byteLength>=24&&t.getUint32(0,Mt)===2303741511?{mimeType:"image/png",width:t.getUint32(16,Mt),height:t.getUint32(20,Mt)}:null}function Gh(n){const t=pn(n);return t.byteLength>=10&&t.getUint32(0,Mt)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,rn),height:t.getUint16(8,rn)}:null}function Hh(n){const t=pn(n);return t.byteLength>=14&&t.getUint16(0,Mt)===16973&&t.getUint32(2,rn)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,rn),height:t.getUint32(22,rn)}:null}function Wh(n){const t=pn(n);if(!(t.byteLength>=3&&t.getUint16(0,Mt)===65496&&t.getUint8(2)===255))return null;const{tableMarkers:i,sofMarkers:r}=Xh();let s=2;for(;s+9<t.byteLength;){const o=t.getUint16(s,Mt);if(r.has(o))return{mimeType:"image/jpeg",height:t.getUint16(s+5,Mt),width:t.getUint16(s+7,Mt)};if(!i.has(o))return null;s+=2,s+=t.getUint16(s,Mt)}return null}function Xh(){const n=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)n.add(e);return{tableMarkers:n,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function pn(n){if(n instanceof DataView)return n;if(ArrayBuffer.isView(n))return new DataView(n.buffer);if(n instanceof ArrayBuffer)return new DataView(n);throw new Error("toDataView")}async function Yh(n,t){const{mimeType:e}=Ga(n)||{},i=globalThis._parseImageNode;return Qn(i),await i(n,e)}async function qh(n,t,e){t=t||{};const r=(t.image||{}).type||"auto",{url:s}=e||{},o=Zh(r);let a;switch(o){case"imagebitmap":a=await Oh(n,t,s);break;case"image":a=await za(n,t,s);break;case"data":a=await Yh(n);break;default:Qn(!1)}return r==="data"&&(a=xh(a)),a}function Zh(n){switch(n){case"auto":case"data":return Ah();default:return wh(n),n}}const Kh=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],$h=["image/png","image/jpeg","image/gif","
6image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Qh={image:{type:"auto",decode:!0}},Jh={id:"image",module:"images",name:"Images",version:vh,mimeTypes:$h,extensions:Kh,parse:qh,tests:[n=>!!Ga(new DataView(n))],options:Qh},z=new gn({id:"deck"});let hr={};function tf(n){hr=n}function ot(n,t,e,i){z.level>0&&hr[n]&&hr[n].call(null,t,e,i)}function ef(n){const t=n[0],e=n[n.length-1];return t==="{"&&e==="}"||t==="["&&e==="]"}const nf={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:ef,parseTextSync:JSON.parse};function rf(){const n="8.9.36",t=globalThis.deck&&globalThis.deck.VERSION;if(t&&t!==n)throw new Error("deck.gl - multiple versions detected: ".concat(t," vs ").concat(n));return t||(z.log(1,"deck.gl ".concat(n))(),globalThis.deck={...globalThis.deck,VERSION:n,version:n,log:z,_registerLoggers:tf},qu([nf,[Jh,{imagebitmap:{premultiplyAlpha:"none"}}]])),n}const sf=rf(),V={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(V,"IDENTITY",{get:()=>(z.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const Ct={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},an={common:0,meters:1,pixels:2},qs={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},M=new gn({id:"luma.gl"});function at(n,t){if(!n)throw new Error(t||"luma.gl: assertion failed.")}const of="Invalid WebGLRenderingContext",af="Requires WebGL2";function gi(n){return typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext?!0:!!(n&&Number.isFinite(n._version))}function F(n){return typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext?!0:!!(n&&n._version===2)}function cf(n){return F(n)?n:null}function pi(n){return at(gi(n),of),n}function ct(n){return at(F(n),af),n}const tn={};function lf(n){globalThis.console&&globalThis.console.error&&globalThis.console.error(n)}function uf(n){globalThis.console&&globalThis.console.log&&globalThis.console.log(n)}function hf(n,t){tn[n]=!0,lf(t)}function ff(n){const t=n.getError;n.getError=function(){let i;do i=t.apply(n),i!==0&&(tn[i]=!0);while(i!==0);for(i in tn)if(tn[i])return delete tn[i],parseInt(i,10);return 0}}const mn=function n(t){const e=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let i=0;i<this.attribs.length;i++){const r=new n.VertexAttrib(e);this.attribs[i]=r}this.maxAttrib=0};mn.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};mn.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};const me=function(t){const e=this;this.gl=t,ff(t);const i=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(s){return s===e.VERTEX_ARRAY_BINDING_OES?e.currentVertexArrayObject===e.defaultVertexArrayObject?null:e.currentVertexArrayObject:i.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(s){const o=e.currentVertexArrayObject;o.maxAttrib=Math.max(o.maxAttrib,s);const a=o.attribs[s];return a.enabled=!0,i.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(s){const o=e.currentVertexArrayObject;o.maxAttrib=Math.max(o.maxAttrib,s);const a=o.attribs[s];return a.enabled=!1,i.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(s,o){switch(s){case 34962:e.currentArrayBuffer=o;break;case 34963:e.currentVertexArrayObject.elementArrayBuffer=o;break}return i.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(s,o){const c=e.currentVertexArrayObject.attribs[s];switch(o){case 34975:return c.buffer;case 34338:return c.enabled;case 34339:return c.size;case 34340:return c.stride;case 34341:return c.type;case 34922:return c.normalized;default:return i.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(s,o,a,c,l,u){const d=e.currentVertexArrayObject;d.maxAttrib=Math.max(d.maxAttrib,s);const p=d.attribs[s];return p.buffer=e.currentArrayBuffer,p.size=o,p.type=a,p.normalized=c,p.stride=l,p.offset=u,p.recache(),i.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{uf("OESVertexArrayObject emulation library context restored"),e.reset_()},!0),this.reset_()};me.prototype.VERTEX_ARRAY_BINDING_OES=34229;me.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let i=0;i<this.vertexArrayObjects.length;++i)this.vertexArrayObjects.isAlive=!1;const e=this.gl;this.maxVertexAttribs=e.getParameter(34921),this.defaultVertexArrayObject=ne
6w mn(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};me.prototype.createVertexArrayOES=function(){const t=new mn(this);return this.vertexArrayObjects.push(t),t};me.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};me.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof mn&&t.hasBeenBound&&t.ext===this)};me.prototype.bindVertexArrayOES=function(t){const e=this.gl;if(t&&!t.isAlive){hf(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}const i=this.original,r=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;const s=this.currentVertexArrayObject;if(r===s)return;(!r||s.elementArrayBuffer!==r.elementArrayBuffer)&&i.bindBuffer.call(e,34963,s.elementArrayBuffer);let o=this.currentArrayBuffer;const a=Math.max(r?r.maxAttrib:0,s.maxAttrib);for(let c=0;c<=a;c++){const l=s.attribs[c],u=r?r.attribs[c]:null;if((!r||l.enabled!==u.enabled)&&(l.enabled?i.enableVertexAttribArray.call(e,c):i.disableVertexAttribArray.call(e,c)),l.enabled){let d=!1;(!r||l.buffer!==u.buffer)&&(o!==l.buffer&&(i.bindBuffer.call(e,34962,l.buffer),o=l.buffer),d=!0),(d||l.cached!==u.cached)&&i.vertexAttribPointer.call(e,c,l.size,l.type,l.normalized,l.stride,l.offset)}}this.currentArrayBuffer!==o&&i.bindBuffer.call(e,34962,this.currentArrayBuffer)};function df(n){if(typeof n.createVertexArray=="function")return;const t=n.getSupportedExtensions;n.getSupportedExtensions=function(){const r=t.call(this)||[];return r.indexOf("OES_vertex_array_object")<0&&r.push("OES_vertex_array_object"),r};const e=n.getExtension;n.getExtension=function(r){const s=e.call(this,r);return s||(r!=="OES_vertex_array_object"?null:(n.__OESVertexArrayObject||(this.__OESVertexArrayObject=new me(this)),this.__OESVertexArrayObject))}}const Zs="OES_element_index",Ks="WEBGL_draw_buffers",gf="EXT_disjoint_timer_query",pf="EXT_disjoint_timer_query_webgl2",mf="EXT_texture_filter_anisotropic",$s="WEBGL_debug_renderer_info",_f=35723,bf=4352,yf=36795,vf=34047,Ef=37445,Tf=37446,G=n=>F(n)?void 0:0,wf={3074:n=>F(n)?void 0:36064,[_f]:n=>F(n)?void 0:bf,35977:G,32937:G,[yf]:(n,t)=>{const e=F(n)?n.getExtension(pf):n.getExtension(gf);return e&&e.GPU_DISJOINT_EXT?t(e.GPU_DISJOINT_EXT):0},[Ef]:(n,t)=>{const e=n.getExtension($s);return t(e&&e.UNMASKED_VENDOR_WEBGL||7936)},[Tf]:(n,t)=>{const e=n.getExtension($s);return t(e&&e.UNMASKED_RENDERER_WEBGL||7937)},[vf]:(n,t)=>{const e=n.luma.extensions[mf];return e?t(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:G,35071:G,37447:G,36063:(n,t)=>{if(!F(n)){const e=n.getExtension(Ks);return e?t(e.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:G,35374:G,35377:G,34852:n=>{if(!F(n)){const t=n.getExtension(Ks);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},36203:n=>n.getExtension(Zs)?2147483647:65535,33001:n=>n.getExtension(Zs)?16777216:65535,33e3:n=>16777216,37157:G,35373:G,35657:G,36183:G,37137:G,34045:G,35978:G,35979:G,35968:G,35376:G,35375:G,35659:G,37154:G,35371:G,35658:G,35076:G,35077:G,35380:G};function Af(n,t,e){const i=wf[e],r=typeof i=="function"?i(n,t,e):i;return r!==void 0?r:t(e)}const Sf="OES_vertex_array_object",Ha="ANGLE_instanced_arrays",xf="WEBGL_draw_buffers",Pf="EXT_disjoint_timer_query",Lf="EXT_texture_filter_anisotropic",Rf="VertexArray requires WebGL2 or OES_vertex_array_object extension";function If(n,t){return{webgl2:F(n),ext:n.getExtension(t)}}const Wa={[Sf]:{meta:{suffix:"OES"},createVertexArray:()=>{at(!1,Rf)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[Ha]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(n,t){at(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[xf]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{at(!1)}},[Pf]:{meta:{suffix:"EXT"},createQuery:()=>{at(!1)},deleteQuery:()=>{at(!1)},beginQuery:()=>{at(!1)},endQuery:()=>{},getQuery(n,t){return this.getQueryObject(n,t)},getQueryParameter(n,t){return this.getQueryObject(n,t)},getQueryObject:()=>{}}},Fi={readBuffer:(n,t,e)=>{F(n)&&t(e)},getVertexAttrib:(n,t,e,i)=>{const{webgl2:r,ext:s}=If(n,Ha);let o;switch(i){case 35069:o=r?void 0:!1;break;case 35070:o=!r&&!s?0:void 0;break}return o!==void 0?o:t(e,i)},getProgramParameter:(n,t,e,i)=>{if(!F(n))switch(i){case 35967:return 35981;case 35971:return 0;case 35382:return 0}return t(e,i)},getInternalformatParameter:(n,t,e,i,r)=>{if(!F(n))switch(r){case 32937:return new Int32Array([0])}return n.getInternalformatParameter(e,i,r)},getTexParameter(n,t,e,i){switch(i){case 34046:const{extensions:r}=n.luma,s=r[Lf];i=s&&s.TEXTURE_MAX_ANISOTROPY_EXT||34046;break}return t(e,i)},getParameter:Af,hint(n,t,e,i){return t(e,i)}};function Mf(n){n.luma=n.luma||{};const{luma:t}=n;return t.polyfilled||(df(n),Cf(n),Nf(n,Wa),Of(n,{target:t,target2:n}),t.polyfilled=!0),n}globalThis.polyfillContext=Mf;function Cf(n){n.luma.extensions={};const t=n.getSupportedExtensions()||[];for(const e of t)n.luma[e]=n.getExtension(e)}function Of(n,t){let{target:e,target2:i}=t;
6Object.keys(Fi).forEach(r=>{if(typeof Fi[r]=="function"){const s=n[r]?n[r].bind(n):()=>{},o=Fi[r].bind(null,n,s);e[r]=o,i[r]=o}})}function Nf(n,t){for(const e of Object.getOwnPropertyNames(t))e!=="overrides"&&kf(n,{extension:e,target:n.luma,target2:n})}function kf(n,t){let{extension:e,target:i,target2:r}=t;const s=Wa[e];at(s);const{meta:o={}}=s,{suffix:a=""}=o,c=n.getExtension(e);for(const l of Object.keys(s)){const u="".concat(l).concat(a);let d=null;l==="meta"||typeof n[l]=="function"||(c&&typeof c[u]=="function"?d=function(){return c[u](...arguments)}:typeof s[l]=="function"&&(d=s[l].bind(i))),d&&(i[l]=d,r[l]=d)}}const jr={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,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,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],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},Yt=(n,t,e)=>t?n.enable(e):n.disable(e),Qs=(n,t,e)=>n.hint(e,t),ut=(n,t,e)=>n.pixelStorei(e,t),Df=(n,t)=>{const e=F(n)?36009:36160;return n.bindFramebuffer(e,t)},Ff=(n,t)=>n.bindFramebuffer(36008,t);function Ze(n){return Array.isArray(n)||ArrayBuffer.isView(n)}const Uf={3042:Yt,32773:(n,t)=>n.blendColor(...t),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(n,t)=>n.clearColor(...t),3107:(n,t)=>n.colorMask(...t),2884:Yt,2885:(n,t)=>n.cullFace(t),2929:Yt,2931:(n,t)=>n.clearDepth(t),2932:(n,t)=>n.depthFunc(t),2928:(n,t)=>n.depthRange(...t),2930:(n,t)=>
vendor: 4,130 bytes, line 6
6n.depthMask(t),3024:Yt,35723:Qs,36006:Df,2886:(n,t)=>n.frontFace(t),33170:Qs,2849:(n,t)=>n.lineWidth(t),32823:Yt,32824:"polygonOffset",10752:"polygonOffset",35977:Yt,32938:"sampleCoverage",32939:"sampleCoverage",3089:Yt,3088:(n,t)=>n.scissor(...t),2960:Yt,2961:(n,t)=>n.clearStencil(t),2968:(n,t)=>n.stencilMaskSeparate(1028,t),36005:(n,t)=>n.stencilMaskSeparate(1029,t),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(n,t)=>n.viewport(...t),3333:ut,3317:ut,37440:ut,37441:ut,37443:ut,3330:ut,3332:ut,3331:ut,36010:Ff,3314:ut,32878:ut,3316:ut,3315:ut,32877:ut,framebuffer:(n,t)=>{const e=t&&"handle"in t?t.handle:t;return n.bindFramebuffer(36160,e)},blend:(n,t)=>t?n.enable(3042):n.disable(3042),blendColor:(n,t)=>n.blendColor(...t),blendEquation:(n,t)=>{t=Ze(t)?t:[t,t],n.blendEquationSeparate(...t)},blendFunc:(n,t)=>{t=Ze(t)&&t.length===2?[...t,...t]:t,n.blendFuncSeparate(...t)},clearColor:(n,t)=>n.clearColor(...t),clearDepth:(n,t)=>n.clearDepth(t),clearStencil:(n,t)=>n.clearStencil(t),colorMask:(n,t)=>n.colorMask(...t),cull:(n,t)=>t?n.enable(2884):n.disable(2884),cullFace:(n,t)=>n.cullFace(t),depthTest:(n,t)=>t?n.enable(2929):n.disable(2929),depthFunc:(n,t)=>n.depthFunc(t),depthMask:(n,t)=>n.depthMask(t),depthRange:(n,t)=>n.depthRange(...t),dither:(n,t)=>t?n.enable(3024):n.disable(3024),derivativeHint:(n,t)=>{n.hint(35723,t)},frontFace:(n,t)=>n.frontFace(t),mipmapHint:(n,t)=>n.hint(33170,t),lineWidth:(n,t)=>n.lineWidth(t),polygonOffsetFill:(n,t)=>t?n.enable(32823):n.disable(32823),polygonOffset:(n,t)=>n.polygonOffset(...t),sampleCoverage:(n,t)=>n.sampleCoverage(...t),scissorTest:(n,t)=>t?n.enable(3089):n.disable(3089),scissor:(n,t)=>n.scissor(...t),stencilTest:(n,t)=>t?n.enable(2960):n.disable(2960),stencilMask:(n,t)=>{t=Ze(t)?t:[t,t];const[e,i]=t;n.stencilMaskSeparate(1028,e),n.stencilMaskSeparate(1029,i)},stencilFunc:(n,t)=>{t=Ze(t)&&t.length===3?[...t,...t]:t;const[e,i,r,s,o,a]=t;n.stencilFuncSeparate(1028,e,i,r),n.stencilFuncSeparate(1029,s,o,a)},stencilOp:(n,t)=>{t=Ze(t)&&t.length===3?[...t,...t]:t;const[e,i,r,s,o,a]=t;n.stencilOpSeparate(1028,e,i,r),n.stencilOpSeparate(1029,s,o,a)},viewport:(n,t)=>n.viewport(...t)};function Y(n,t,e){return t[n]!==void 0?t[n]:e[n]}const Bf={blendEquation:(n,t,e)=>n.blendEquationSeparate(Y(32777,t,e),Y(34877,t,e)),blendFunc:(n,t,e)=>n.blendFuncSeparate(Y(32969,t,e),Y(32968,t,e),Y(32971,t,e),Y(32970,t,e)),polygonOffset:(n,t,e)=>n.polygonOffset(Y(32824,t,e),Y(10752,t,e)),sampleCoverage:(n,t,e)=>n.sampleCoverage(Y(32938,t,e),Y(32939,t,e)),stencilFuncFront:(n,t,e)=>n.stencilFuncSeparate(1028,Y(2962,t,e),Y(2967,t,e),Y(2963,t,e)),stencilFuncBack:(n,t,e)=>n.stencilFuncSeparate(1029,Y(34816,t,e),Y(36003,t,e),Y(36004,t,e)),stencilOpFront:(n,t,e)=>n.stencilOpSeparate(1028,Y(2964,t,e),Y(2965,t,e),Y(2966,t,e)),stencilOpBack:(n,t,e)=>n.stencilOpSeparate(1029,Y(34817,t,e),Y(34818,t,e),Y(34819,t,e))},Js={enable:(n,t)=>n({[t]:!0}),disable:(n,t)=>n({[t]:!1}),pixelStorei:(n,t,e)=>n({[t]:e}),hint:(n,t,e)=>n({[t]:e}),bindFramebuffer:(n,t,e)=>{switch(t){case 36160:return n({36006:e,36010:e});case 36009:return n({36006:e});case 36008:return n({36010:e});default:return null}},blendColor:(n,t,e,i,r)=>n({32773:new Float32Array([t,e,i,r])}),blendEquation:(n,t)=>n({32777:t,34877:t}),blendEquationSeparate:(n,t,e)=>n({32777:t,34877:e}),blendFunc:(n,t,e)=>n({32969:t,32968:e,32971:t,32970:e}),blendFuncSeparate:(n,t,e,i,r)=>n({32969:t,32968:e,32971:i,32970:r}),clearColor:(n,t,e,i,r)=>n({3106:new Float32Array([t,e,i,r])}),clearDepth:(n,t)=>n({2931:t}),clearStencil:(n,t)=>n({2961:t}),colorMask:(n,t,e,i,r)=>n({3107:[t,e,i,r]}),cullFace:(n,t)=>n({2885:t}),depthFunc:(n,t)=>n({2932:t}),depthRange:(n,t,e)=>n({2928:new Float32Array([t,e])}),depthMask:(n,t)=>n({2930:t}),frontFace:(n,t)=>n({2886:t}),lineWidth:(n,t)=>n({2849:t}),polygonOffset:(n,t,e)=>n({32824:t,10752:e}),sampleCoverage:(n,t,e)=>n({32938:t,32939:e}),scissor:(n,t,e,i,r)=>
6n({3088:new Int32Array([t,e,i,r])}),stencilMask:(n,t)=>n({2968:t,36005:t}),stencilMaskSeparate:(n,t,e)=>n({[t===1028?2968:36005]:e}),stencilFunc:(n,t,e,i)=>n({2962:t,2967:e,2963:i,34816:t,36003:e,36004:i}),stencilFuncSeparate:(n,t,e,i,r)=>n({[t===1028?2962:34816]:e,[t===1028?2967:36003]:i,[t===1028?2963:36004]:r}),stencilOp:(n,t,e,i)=>n({2964:t,2965:e,2966:i,34817:t,34818:e,34819:i}),stencilOpSeparate:(n,t,e,i,r)=>n({[t===1028?2964:34817]:e,[t===1028?2965:34818]:i,[t===1028?2966:34819]:r}),viewport:(n,t,e,i,r)=>n({2978:[t,e,i,r]})},Lt=(n,t)=>n.isEnabled(t),to={3042:Lt,2884:Lt,2929:Lt,3024:Lt,32823:Lt,32926:Lt,32928:Lt,3089:Lt,2960:Lt,35977:Lt};function Xa(n){for(const t in n)return!1;return!0}function Vf(n,t){if(n===t)return!0;const e=Array.isArray(n)||ArrayBuffer.isView(n),i=Array.isArray(t)||ArrayBuffer.isView(t);if(e&&i&&n.length===t.length){for(let r=0;r<n.length;++r)if(n[r]!==t[r])return!1;return!0}return!1}function eo(n,t){const e=n[t].bind(n);n[t]=function(){const r=arguments.length<=0?void 0:arguments[0];return r in n.state.cache?n.state.enable?n.state.cache[r]:e(...arguments):e(...arguments)},Object.defineProperty(n[t],"name",{value:"".concat(t,"-from-cache"),configurable:!1})}function jf(n,t,e){const i=n[t].bind(n);n[t]=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const{valueChanged:c,oldValue:l}=e(n.state._updateCache,...o);return c&&i(...o),l},Object.defineProperty(n[t],"name",{value:"".concat(t,"-to-cache"),configurable:!1})}function zf(n){const t=n.useProgram.bind(n);n.useProgram=function(i){n.state.program!==i&&(t(i),n.state.program=i)}}class Gf{constructor(t){let{copyState:e=!1,log:i=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=e?Wf(t):Object.assign({},jr),this.log=i,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){this.stateStack.push({})}pop(){at(this.stateStack.length>0);const t=this.stateStack[this.stateStack.length-1];jt(this.gl,t),this.stateStack.pop()}_updateCache(t){let e=!1,i;const r=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(const s in t){at(s!==void 0);const o=t[s],a=this.cache[s];Vf(o,a)||(e=!0,i=a,r&&!(s in r)&&(r[s]=a),this.cache[s]=o)}return{valueChanged:e,oldValue:i}}}function Ya(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{enable:e=!0,copyState:i}=t;if(at(i!==void 0),!n.state){const{polyfillContext:r}=globalThis;r&&r(n),n.state=new Gf(n,{copyState:i}),zf(n);for(const s in Js){const o=Js[s];jf(n,s,o)}eo(n,"getParameter"),eo(n,"isEnabled")}return n.state.enable=e,n}function Hf(n){n.state||Ya(n,{copyState:!1}),n.state.push()}function no(n){at(n.state),n.state.pop()}function jt(n,t){if(at(gi(n),"setParameters requires a WebGL context"),Xa(t))return;const e={};for(const r in t){const s=Number(r),o=Uf[r];o&&(typeof o=="string"?e[o]=!0:o(n,t[r],s))}const i=n.state&&n.state.cache;if(i)for(const r in e){const s=Bf[r];s(n,t,i)}}function Wf(n,t){if(t=t||jr,typeof t=="number"){const r=t,s=to[r];return s?s(n,r):n.getParameter(r)}const e=Array.isArray(t)?t:Object.keys(t),i={};for(const r of e){const s=to[r];i[r]=s?s(n,Number(r)):n.getParameter(Number(r))}return i}function Xf(n){jt(n,jr)}function wt(n,t,e){if(Xa(t))return e(n);const{nocatch:i=!0}=t;Hf(n),jt(n,t);let r;if(i)r=e(n),no(n);else try{r=e(n)}finally{no(n)}return r}function Re(n){const{luma:t}=n;if(n.canvas&&t){const e=t.canvasSizeInfo,i="clientWidth"in e?e.clientWidth:n.canvas.clientWidth;return i?n.drawingBufferWidth/i:1}return 1}function Ui(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;const i=Re(n),r=n.drawingBufferWidth,s=n.drawingBufferHeight;return qf(t,i,r,s,e)}function Yf(n){const t=typeof window>"u"?1:window.devicePixelRatio||1;return Number.isFinite(n)?n<=0?1:n:n?t:1}function qf(n,t,e,i,r){const s=io(n[0],t,e);let o=ro(n[1],t,i,r),a=io(n[0]+1,t,e);const c=a===e-1?a:a-1;a=ro(n[1]+1,t,i,r);let l;return r?(a=a===0?a:a+1,l=o,o=a):l=a===i-1?a:a-1,{x:s,y:o,width:Math.max(c-s+1,1),height:Math.max(l-o+1,1)}}function io(n,t,e){return Math.min(Math.round(n*t),e-1)}function ro(n,t,e,i){return i?Math.max(0,e-1-Math.round(n*t)):Math.min(Math.round(n*t),e-1)}const zr=Gt(),Zf=zr&&typeof document<"u",qa={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function Za(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};at(zr,`createGLContext only available in the browser.
7Create your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils`),n=Object.assign({},qa,n);const{width:t,height:e}=n;function i(a){if(n.throwOnError)throw new Error(a);return console.error(a),null}n.onError=i;let r;const{canvas:s}=n,o=Jf({canvas:s,width:t,height:e,onError:i});return r=Qf(o,n),r?(r=Gr(r,n),td(r),r):null}function Gr(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!n||n._instrumented)return n;n._version=n._version||ed(n),n.luma=n.luma||{},n.luma.canvasSizeInfo=n.luma.canvasSizeInfo||{},t=Object.assign({},qa,t);const{manageState:e,debug:i}=t;return e&&Ya(n,{copyState:!1,log:function(){for(var r=arguments.length,s=new Array(r),o=0;o<r;o++)s[o]=arguments[o];return M.log(1,...s)()}}),zr&&i&&(globalThis.makeDebugContext?(n=globalThis.makeDebugContext(n,t),M.level=Math.max(M.level,1)):M.warn('WebGL debug mode not activated. import "@luma.gl/debug" to enable.')()),n._instrumented=!0,n}function Kf(n){const t=n.getParameter(7936),e=n.getParameter(7937),i=n.getExtension("WEBGL_debug_renderer_info"),r=i&&n.getParameter(i.UNMASKED_VENDOR_WEBGL||7936),s=i&&n.getParameter(i.UNMASKED_RENDERER_WEBGL||7937);return{vendor:r||t,renderer:s||e,vendorMasked:t,rendererMasked:e,version:n.getParameter(7938),shadingLanguageVersion:n.getParameter(35724)}}function $f(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n.canvas){const i=Yf(t.useDevicePixels);nd(n,i,t);return}const e=n.getExtension("STACKGL_resize_drawingbuffer");e&&"width"in t&&"height"in t&&e.resize(t.width,t.height)}function Qf(n,t){const{onError:e}=t;let i=null;const r=c=>i=c.statusMessage||i;n.addEventListener("webglcontextcreationerror",r,!1);
7const{webgl1:s=!0,webgl2:o=!0}=t;let a=null;return o&&(a=a||n.getContext("webgl2",t),a=a||n.getContext("experimental-webgl2",t)),s&&(a=a||n.getContext("webgl",t),a=a||n.getContext("experimental-webgl",t)),n.removeEventListener("webglcontextcreationerror",r,!1),a?(t.onContextLost&&n.addEventListener("webglcontextlost",t.onContextLost,!1),t.onContextRestored&&n.addEventListener("webglcontextrestored",t.onContextRestored,!1),a):e("Failed to create ".concat(o&&!s?"WebGL2":"WebGL"," context: ").concat(i||"Unknown error"))}function Jf(n){let{canvas:t,width:e=800,height:i=600,onError:r}=n,s;return typeof t=="string"?(Zf&&document.readyState==="complete"||r("createGLContext called on canvas '".concat(t,"' before page was loaded")),s=document.getElementById(t)):t?s=t:(s=document.createElement("canvas"),s.id="lumagl-canvas",s.style.width=Number.isFinite(e)?"".concat(e,"px"):"100%",s.style.height=Number.isFinite(i)?"".concat(i,"px"):"100%",document.body.insertBefore(s,document.body.firstChild)),s}function td(n){const t=F(n)?"WebGL2":"WebGL1",e=Kf(n),i=e?"(".concat(e.vendor,",").concat(e.renderer,")"):"",r=n.debug?" debug":"";M.info(1,"".concat(t).concat(r," context ").concat(i))()}function ed(n){return typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext?2:1}function nd(n,t,e){let i="width"in e?e.width:n.canvas.clientWidth,r="height"in e?e.height:n.canvas.clientHeight;(!i||!r)&&(M.log(1,"Canvas clientWidth/clientHeight is 0")(),t=1,i=n.canvas.width||1,r=n.canvas.height||1),n.luma=n.luma||{},n.luma.canvasSizeInfo=n.luma.canvasSizeInfo||{};const s=n.luma.canvasSizeInfo;if(s.clientWidth!==i||s.clientHeight!==r||s.devicePixelRatio!==t){let o=t;const a=Math.floor(i*o),c=Math.floor(r*o);n.canvas.width=a,n.canvas.height=c,(n.drawingBufferWidth!==a||n.drawingBufferHeight!==c)&&(M.warn("Device pixel ratio clamped")(),o=Math.min(n.drawingBufferWidth/i,n.drawingBufferHeight/r),n.canvas.width=Math.floor(i*o),n.canvas.height=Math.floor(r*o)),Object.assign(n.luma.canvasSizeInfo,{clientWidth:i,clientHeight:r,devicePixelRatio:t})}}const sn="8.5.21",id="set luma.log.level=1 (or higher) to trace rendering";class rd{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new Nr({id:t})),this.stats.get(t)}}const ue=new rd;if(globalThis.luma&&globalThis.luma.VERSION!==sn)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(sn));globalThis.luma||(Gt()&&M.log(1,"luma.gl ".concat(sn," - ").concat(id))(),globalThis.luma=globalThis.luma||{VERSION:sn,version:sn,log:M,stats:ue,globals:{modules:{},nodeIO:{}}});function sd(n){return typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame(n):setTimeout(n,1e3/60)}function od(n){return typeof window<"u"&&window.cancelAnimationFrame?window.cancelAnimationFrame(n):clearTimeout(n)}function R(n,t){if(!n)throw new Error(t||"luma.gl: assertion failed.")}function Bi(n,t){if(typeof t!="string")return t;const e=Number(t);if(!isNaN(e))return e;t=t.replace(/^.*\./,"");const i=n[t];return R(i!==void 0,"Accessing undefined constant GL.".concat(t)),i}function te(n,t){t=Number(t);for(const e in n)if(n[e]===t)return"GL.".concat(e);return String(t)}const Vi={};function ee(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"id";Vi[n]=Vi[n]||1;const t=Vi[n]++;return"".concat(n,"-").concat(t)}function so(n){return R(typeof n=="number","Input must be a number"),n&&(n&n-1)===0}function Ie(n){let t=!0;for(const e in n){t=!1;break}return t}function Ka(n,t,e,i){const r="See luma.gl ".concat(e," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),s=Object.getPrototypeOf(n);i.forEach(o=>{s.methodName||(s[o]=()=>{throw M.removed("Calling removed method ".concat(t,".").concat(o,": "),r)(),new Error(o)})})}const ve="Resource subclass must define virtual methods";let Ht=class{get[Symbol.toStringTag](){return"Resource"}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pi(t);const{id:i,userData:r={}}=e;this.gl=t,this.gl2=t,this.id=i||ee(this[Symbol.toStringTag]),this.userData=r,this._bound=!1,this._handle=e.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,e&&t&&e.filter(Boolean).forEac
7h(i=>i.delete()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let e;return this._bound?e=t():(this._bindHandle(this.handle),this._bound=!0,e=t(),this._bound=!1,this._bindHandle(null)),e}unbind(){this.bind(null)}getParameter(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Bi(this.gl,t),R(t);const r=(this.constructor.PARAMETERS||{})[t];if(r){const s=F(this.gl);if(!((!("webgl2"in r)||s)&&(!("extension"in r)||this.gl.getExtension(r.extension)))){const a=r.webgl1,c="webgl2"in r?r.webgl2:r.webgl1;return s?c:a}}return this._getParameter(t,e)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{parameters:e,keys:i}=t,r=this.constructor.PARAMETERS||{},s=F(this.gl),o={},a=e||Object.keys(r);for(const c of a){const l=r[c];if(l&&(!("webgl2"in l)||s)&&(!("extension"in l)||this.gl.getExtension(l.extension))){const d=i?te(this.gl,c):c;o[d]=this.getParameter(c,t),i&&l.type==="GLenum"&&(o[d]=te(this.gl,o[d]))}}return o}setParameter(t,e){t=Bi(this.gl,t),R(t);const r=(this.constructor.PARAMETERS||{})[t];if(r){const s=F(this.gl);if(!((!("webgl2"in r)||s)&&(!("extension"in r)||this.gl.getExtension(r.extension))))throw new Error("Parameter not available on this platform");r.type==="GLenum"&&(e=Bi(e))}return this._setParameter(t,e),this}setParameters(t){for(const e in t)this.setParameter(e,t[e]);return this}stubRemovedMethods(t,e,i){return Ka(this,t,e,i)}initialize(t){}_createHandle(){throw new Error(ve)}_deleteHandle(){throw new Error(ve)}_bindHandle(t){throw new Error(ve)}_getOptsFromHandle(){throw new Error(ve)}_getParameter(t,e){throw new Error(ve)}_setParameter(t,e){throw new Error(ve)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){const t=this[Symbol.toStringTag],e=ue.get("Resource Counts");e.get("Resources Created").incrementCount(),e.get("".concat(t,"s Created")).incrementCount(),e.get("".concat(t,"s Active")).incrementCount()}_removeStats(){const t=this[Symbol.toStringTag];ue.get("Resource Counts").get("".concat(t,"s Active")).decrementCount()}_trackAllocatedMemory(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(t,e),this._trackAllocatedMemoryForContext(t,e,this.gl.canvas&&this.gl.canvas.id),this.byteLength=t}_trackAllocatedMemoryForContext(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this[Symbol.toStringTag],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";const r=ue.get("Memory Usage".concat(i));r.get("GPU Memory").addCount(t),r.get("".concat(e," Memory")).addCount(t)}_trackDeallocatedMemory(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(t),this._trackDeallocatedMemoryForContext(t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this[Symbol.toStringTag],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const i=ue.get("Memory Usage".concat(e));i.get("GPU Memory").subtractCount(this.byteLength),i.get("".concat(t," Memory")).subtractCount(this.byteLength)}};const ad="Failed to deduce GL constant from typed array";function fr(n){switch(ArrayBuffer.isView(n)?n.constructor:n){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(ad)}}function cn(n){let{clamped:t=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};switch(n){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return t?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function cd(n){let{data:t,width:e,height:i,bytesPerPixel:r=4,temp:s}=n;const o=e*r;s=s||new Uint8Array(o);for(let a=0;a<i/2;++a){const c=a*o,l=(i-a-1)*o;s.set(t.subarray(c,c+o)),t.copyWithin(c,l,l+o),t.set(s,l)}}function ld(n){let{data:t,width:e,height:i}=n;const r=Math.round(e/2),s=Math.round(i/2),o=new Uint8Array(r*s*4);for(let a=0;a<s;a++)for(let c=0;c<r;c++)for(let l=0;l<4;l++)o[(a*r+c)*4+l]=t[(a*2*e+c*2)*4+l];return{data:o,width:r,height:s}}function dr(n,t,e){const{removedProps:i={},deprecatedProps:r={},replacedProps:s={}}=e;for(const a in i)if(a in t){const l=i[a]?"".concat(n,".").concat(i[a]):"N/A";M.removed("".concat(n,".").concat(a),l)()}for(const a in r)if(a in t){const c=r[a];M.deprecated("".concat(n,".").concat(a),"".concat(n,".").concat(c))()}let o=null;for(const a in s)if(a in t){const c=s[a];M.deprecated("".concat(n,".").concat(a),"".concat(n,".").concat(c))(),o=o||Object.assign({},t),o[c]=t[a],delete o[a]}return o||t}const ud={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},hd={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}};class gt{static getBytesPerElement(t){return cn(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return R(t.size),cn(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return new gt(ud,...e)}constructor(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach(r=>this._assign(r)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return gt.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return gt.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};
7return t=dr("Accessor",t,hd),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this}}const oo=10,$a={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},fd={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:$a},dd={removedProps:$a};class j extends Ht{get[Symbol.toStringTag](){return"Buffer"}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,e),this.stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),this.target=e.target||(this.gl.webgl2?36662:34962),this.initialize(e),Object.seal(this)}getElementCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/gt.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/gt.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=dr("Buffer",t,fd),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return t=dr("Buffer",t,dd),"accessor"in t&&this.setAccessor(t.accessor),this}setAccessor(t){return t=Object.assign({},t),delete t.buffer,this.accessor=new gt(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});const{data:e,offset:i=0,srcOffset:r=0}=t,s=t.byteLength||t.length;R(e);const o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),r!==0||s!==void 0?(ct(this.gl),this.gl.bufferSubData(this.target,i,e,r,s)):this.gl.bufferSubData(o,i,e),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(e),this}copyData(t){let{sourceBuffer:e,readOffset:i=0,writeOffset:r=0,size:s}=t;const{gl:o}=this;return ct(o),o.bindBuffer(36662,e.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,i,r,s),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:t=null,srcByteOffset:e=0,dstOffset:i=0,length:r=0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(this.gl);const s=cn(this.accessor.type||5126,{clamped:!1}),o=this._getAvailableElementCount(e),a=i;let c,l;t?(l=t.length,c=l-a):(c=Math.min(o,r||o),l=a+c);const u=Math.min(o,c);return r=r||u,R(r<=u),t=t||new s(l),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,t,i,r),this.gl.bindBuffer(36662,null),t}bind(){let{target:t=this.target,index:e=this.accessor&&this.accessor.index,offset:i=0,size:r}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?r!==void 0?this.gl.bindBufferRange(t,e,this.handle,i,r):(R(i===0),this.gl.bindBufferBase(t,e,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind(){let{target:t=this.target,index:e=this.accessor&&this.accessor.index}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t===35345||t===35982?this.gl.bindBufferBase(t,e,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(oo,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+e;R(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();const r=this._getTarget();this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,i,this.usage),this.gl.bufferSubData(r,e,t),this.gl.bindBuffer(r,null),this.debugData=t.slice(0,oo),this.bytesUsed=i,this._trackAllocatedMemory(i);const s=fr(t);return R(s),this.setAccessor(new gt(this.accessor,{type:s})),this}_setByteLength(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.usage;R(t>=0),this._trackDeallocatedMemory();let i=t;t===0&&(i=new Float32Array(0));const r=this._getTarget();return this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,i,e),this.gl.bindBuffer(r,null),this.usage=e,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){const e=cn(this.accessor.type||5126,{clamped:!1}),i=t/e.BYTES_PER_ELEMENT;return this.getElementCount()-i}_inferType(t){this.accessor.type||this.setAccessor(new gt(this.accessor,{type:fr(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);const e=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),e}get type(){return M.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}get bytes(){return M.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}setByteLength(t){return M.deprecated("setByteLength","reallocate")(),this.reallocate(t)}updateAccessor(t){return M.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new gt(this.accessor,t),this}}const Hr={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},Qa={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},Ja={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};function gd(n,t){const e=Hr[t];if(!e)return!1;if(e.gl1===void 0&&e.gl2===void 0)return!0;const i=F(n)&&e.gl2||e.gl1;return typeof i=="string"?n.getExtension(i):i}function pd(n,t){const e=Hr[t];switch(e&&e.types[0]){case 5126:return n.getExtension("OES_texture_float_linear");case 5131:return n.getExtension("OES_texture_half_float_linear");default:return!0}}const md=[9729,9728],ao=globalThis.WebGLBuffer||function(){};class Me extends Ht{get[Symbol.toStringTag](){return"Texture"}static isSupported(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{format:i,linearFiltering:r}=e;let s=!0;return i&&(s=s&&gd(t,i),s=s&&(!r||pd(t,i))),s}constructor(t,e){const{id:i=ee("texture"),handle:r,target:s}=e;super(t,{id:i,handle:r}),this.target=s,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=t.data;if(e instanceof Promise)return e.then(w=>this.initialize(Object.assign({},t,{pixels:w,data:w}))),this;const i=typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement;if(i&&e.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,e.addEventListener("loadeddata",()=>this.initialize(t)),this;const{pixels:r=null,format:s=6408,border:o=0,recreate:a=!1,parameters:c={},pixelStore:l={},textureUnit:u=void 0}=t;e||(e=r);let{width:d,height:p,dataFormat:_,type:b,compressed:y=!1,mipmaps:E=!0}=t;const{depth:T=0}=t;return{width:d,height:p,compressed:y,dataFormat:_,type:b}=this._deduceParameters({format:s,type:b,dataFormat:_,compressed:y,data:e,width:d,height:p}),this.width=d,this.height=p,this.depth=T,this.format=s,this.type=b,this.dataFormat=_,this.border=o,this.textureUnit=u,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),E&&this._isNPOT()&&(M.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),E=!1,this._updateForNPOT(c)),this.mipmaps=E,this.setImageData({data:e,width:d,height:p,depth:T,format:s,type:b,dataFormat:_,border:o,mipmaps:E,parameters:l,compressed:y}),E&&this.generateMipmap(),this.setParameters(c),a&&(this.data=e),i&&(this._video={video:e,parameters:c,lastTime:e.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?e.currentTime:-1}),this}update(){if(this._video){const{video:t,parameters:e,lastTime:i}=this._video;
7if(i===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:e}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}resize(t){let{height:e,width:i,mipmaps:r=!1}=t;return i!==this.width||e!==this.height?this.initialize({width:i,height:e,format:this.format,type:this.type,dataFormat:this.dataFormat,border:this.border,mipmaps:r}):this}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._isNPOT()?(M.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),wt(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory("Texture");const{target:e=this.target,pixels:i=null,level:r=0,format:s=this.format,border:o=this.border,offset:a=0,parameters:c={}}=t;let{data:l=null,type:u=this.type,width:d=this.width,height:p=this.height,dataFormat:_=this.dataFormat,compressed:b=!1}=t;l||(l=i),{type:u,dataFormat:_,compressed:b,width:d,height:p}=this._deduceParameters({format:s,type:u,dataFormat:_,compressed:b,data:l,width:d,height:p});const{gl:y}=this;y.bindTexture(this.target,this.handle);let E=null;({data:l,dataType:E}=this._getDataType({data:l,compressed:b}));let T,w=0;if(wt(this.gl,c,()=>{switch(E){case"null":y.texImage2D(e,r,s,d,p,o,_,u,l);break;case"typed-array":y.texImage2D(e,r,s,d,p,o,_,u,l,a);break;case"buffer":T=ct(y),T.bindBuffer(35052,l.handle||l),T.texImage2D(e,r,s,d,p,o,_,u,a),T.bindBuffer(35052,null);break;case"browser-object":F(y)?y.texImage2D(e,r,s,d,p,o,_,u,l):y.texImage2D(e,r,s,_,u,l);break;case"compressed":for(const[A,x]of l.entries())y.compressedTexImage2D(e,A,x.format,x.width,x.height,o,x.data),w+=x.levelSize;break;default:R(!1,"Unknown image data type")}}),E==="compressed")this._trackAllocatedMemory(w,"Texture");else if(l&&l.byteLength)this._trackAllocatedMemory(l.byteLength,"Texture");else{const A=Qa[this.dataFormat]||4,x=Ja[this.type]||1;this._trackAllocatedMemory(this.width*this.height*A*x,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:e=this.target,pixels:i=null,data:r=null,x:s=0,y:o=0,width:a=this.width,height:c=this.height,level:l=0,format:u=this.format,type:d=this.type,dataFormat:p=this.dataFormat,compressed:_=!1,offset:b=0,border:y=this.border,parameters:E={}}=t;if({type:d,dataFormat:p,compressed:_,width:a,height:c}=this._deduceParameters({format:u,type:d,dataFormat:p,compressed:_,data:r,width:a,height:c}),R(this.depth===0,"texSubImage not supported for 3D textures"),r||(r=i),r&&r.data){const T=r;r=T.data,a=T.shape[0],c=T.shape[1]}r instanceof j&&(r=r.handle),this.gl.bindTexture(this.target,this.handle),wt(this.gl,E,()=>{if(_)this.gl.compressedTexSubImage2D(e,l,s,o,a,c,u,r);else if(r===null)this.gl.texSubImage2D(e,l,s,o,a,c,p,d,null);else if(ArrayBuffer.isView(r))this.gl.texSubImage2D(e,l,s,o,a,c,p,d,r,b);else if(r instanceof ao){const T=ct(this.gl);T.bindBuffer(35052,r),T.texSubImage2D(e,l,s,o,a,c,p,d,b),T.bindBuffer(35052,null)}else F(this.gl)?ct(this.gl).texSubImage2D(e,l,s,o,a,c,p,d,r):this.gl.texSubImage2D(e,l,s,o,p,d,r)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){return M.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit;const{gl:e}=this;return t!==void 0&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit;const{gl:e}=this;return t!==void 0&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,null),t}_getDataType(t){let{data:e,compressed:i=!1}=t;return i?{data:e,dataType:"compressed"}:e===null?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof j?{data:e.handle,dataType:"buffer"}:e instanceof ao?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(t){const{format:e,data:i}=t;let{width:r,height:s,dataFormat:o,type:a,compressed:c}=t;const l=Hr[e];return o=o||l&&l.dataFormat,a=a||l&&l.types[0],c=c||l&&l.compressed,{width:r,height:s}=this._deduceImageSize(i,r,s),{dataFormat:o,type:a,compressed:c,width:r,height:s,format:e,data:i}}_deduceImageSize(t,e,i){let r;return typeof ImageData<"u"&&t instanceof ImageData?r={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?r={width:t.naturalWi
7dth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?r={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?r={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?r={width:t.videoWidth,height:t.videoHeight}:t?r={width:e,height:i}:r={width:e>=0?e:1,height:i>=0?i:1},R(r,"Could not deduced texture size"),R(e===void 0||r.width===e,"Deduced texture width does not match supplied width"),R(i===void 0||r.height===i,"Deduced texture height does not match supplied height"),r}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);const e=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),e}}_setParameter(t,e){switch(this.gl.bindTexture(this.target,this.handle),e=this._getNPOTParam(t,e),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,e);break;case 4096:case 4097:R(!1);break;default:this.gl.texParameteri(this.target,t,e);break}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return F(this.gl)||!this.width||!this.height?!1:!so(this.width)||!so(this.height)}_updateForNPOT(t){t[this.gl.TEXTURE_MIN_FILTER]===void 0&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),t[this.gl.TEXTURE_WRAP_S]===void 0&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),t[this.gl.TEXTURE_WRAP_T]===void 0&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,e){if(this._isNPOT())switch(t){case 10241:md.indexOf(e)===-1&&(e=9729);break;case 10242:case 10243:e!==33071&&(e=33071);break}return e}}let _d="";function bd(n,t){return R(typeof n=="string"),n=_d+n,new Promise((e,i)=>{try{const r=new Image;r.onload=()=>e(r),r.onerror=()=>i(new Error("Could not load image ".concat(n,"."))),r.crossOrigin=t&&t.crossOrigin||"anonymous",r.src=n}catch(r){i(r)}})}class At extends Me{get[Symbol.toStringTag](){return"Texture2D"}static isSupported(t,e){return Me.isSupported(t,e)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pi(t),(e instanceof Promise||typeof e=="string")&&(e={data:e}),typeof e.data=="string"&&(e=Object.assign({},e,{data:bd(e.data)})),super(t,Object.assign({},e,{target:3553})),this.initialize(e),Object.seal(this)}}const gr=[34069,34070,34071,34072,34073,34074];class tc extends Me{get[Symbol.toStringTag](){return"TextureCube"}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};pi(t),super(t,Object.assign({},e,{target:34067})),this.initialize(e),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{mipmaps:e=!0,parameters:i={}}=t;return this.opts=t,this.setCubeMapImageData(t).then(()=>{this.loaded=!0,e&&this.generateMipmap(t),this.setParameters(i)}),this}subImage(t){let{face:e,data:i,x:r=0,y:s=0,mipmapLevel:o=0}=t;return this._subImage({target:e,data:i,x:r,y:s,mipmapLevel:o})}async setCubeMapImageData(t){let{width:e,height:i,pixels:r,data:s,border:o=0,format:a=6408,type:c=5121}=t;const{gl:l}=this,u=r||s,d=await Promise.all(gr.map(p=>{const _=u[p];return Promise.all(Array.isArray(_)?_:[_])}));this.bind(),gr.forEach((p,_)=>{d[_].length>1&&this.opts.mipmaps!==!1&&M.warn("".concat(this.id," has mipmap and multiple LODs."))(),d[_].forEach((b,y)=>{e&&i?l.texImage2D(p,y,a,e,i,o,a,c,b):l.texImage2D(p,y,a,a,c,b)})}),this.unbind()}setImageDataForFace(t){const{face:e,width:i,height:r,pixels:s,data:o,border:a=0,format:c=6408,type:l=5121}=t,{gl:u}=this,d=s||o;return this.bind(),d instanceof Promise?d.then(p=>this.setImageDataForFace(Object.assign({},t,{face:e,data:p,pixels:p}))):this.width||this.height?u.texImage2D(e,0,c,i,r,a,c,l,d):u.texImage2D(e,0,c,c,l,d),this}}tc.FACES=gr;class yd extends Me{get[Symbol.toStringTag](){return"Texture3D"}static isSupported(t){return F(t)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ct(t),e=Object.assign({depth:1},e,{target:32879,unpackFlipY:!1}),super(t,e),this.initialize(e),Object.seal(this)}setImageData(t){let{level:e=0,dataFormat:i=6408,width:r,height:s,depth:o=1,border:a=0,format:c,type:l=5121,offset:u=0,data:d,parameters:p={}}=t;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),wt(this.gl,p,()=>{ArrayBuffer.isView(d)&&this.gl.texImage3D(this.target,e,i,r,s,o,a,c,l,d),d instanceof j&&(this.gl.bindBuffer(35052,d.handle),this.gl.texImage3D(this.target,e,i,r,s,o,a,c,l,u))}),d&&d.byteLength)this._trackAllocatedMemory(d.byteLength,"Texture");
7else{const _=Qa[this.dataFormat]||4,b=Ja[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*_*b,"Texture")}return this.loaded=!0,this}}const oe="EXT_color_buffer_float",co={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:oe,bpp:2},33327:{gl2:oe,bpp:4},34842:{gl2:oe,bpp:8},33326:{gl2:oe,bpp:4},33328:{gl2:oe,bpp:8},34836:{gl2:oe,bpp:16},35898:{gl2:oe,bpp:4}};function vd(n,t,e){const i=e[t];if(!i)return!1;const r=F(n)&&i.gl2||i.gl1;return typeof r=="string"?n.getExtension(r):r}class Se extends Ht{get[Symbol.toStringTag](){return"Renderbuffer"}static isSupported(t){let{format:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{format:null};return!e||vd(t,e,co)}static getSamplesForFormat(t,e){let{format:i}=e;return t.getInternalformatParameter(36161,i,32937)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,e),this.initialize(e),Object.seal(this)}initialize(t){let{format:e,width:i=1,height:r=1,samples:s=0}=t;return R(e,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),s!==0&&F(this.gl)?this.gl.renderbufferStorageMultisample(36161,s,e,i,r):this.gl.renderbufferStorage(36161,e,i,r),this.format=e,this.width=i,this.height=r,this.samples=s,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*co[this.format].bpp),this}resize(t){let{width:e,height:i}=t;return e!==this.width||i!==this.height?this.initialize({width:e,height:i,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){return this.gl.bindRenderbuffer(36161,this.handle),this.gl.getRenderbufferParameter(36161,t)}}const Ed=256,Td=1024,wd=16384,lo=6144,uo=6145,ho=6146,fo=34041,ec="clear: bad arguments";function Wr(n){let{framebuffer:t=null,color:e=null,depth:i=null,stencil:r=null}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s={};t&&(s.framebuffer=t);let o=0;e&&(o|=wd,e!==!0&&(s.clearColor=e)),i&&(o|=Ed,i!==!0&&(s.clearDepth=i)),r&&(o|=Td,i!==!0&&(s.clearStencil=i)),R(o!==0,ec),wt(n,s,()=>{n.clear(o)})}function Ad(n){let{framebuffer:t=null,buffer:e=lo,drawBuffer:i=0,value:r=[0,0,0,0]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ct(n),wt(n,{framebuffer:t},()=>{switch(e){case lo:switch(r.constructor){case Int32Array:n.clearBufferiv(e,i,r);break;case Uint32Array:n.clearBufferuiv(e,i,r);break;case Float32Array:default:n.clearBufferfv(e,i,r)}break;case uo:n.clearBufferfv(uo,0,[r]);break;case ho:n.clearBufferiv(ho,0,[r]);break;case fo:const[s,o]=r;n.clearBufferfi(fo,0,s,o);break;default:R(!1,ec)}})}function Sd(n){switch(n){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 R(!1),0}}function mi(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{sourceX:e=0,sourceY:i=0,sourceFormat:r=6408}=t;let{sourceAttachment:s=36064,target:o=null,sourceWidth:a,sourceHeight:c,sourceType:l}=t;const{framebuffer:u,deleteFramebuffer:d}=xd(n);R(u);const{gl:p,handle:_,attachments:b}=u;a=a||u.width,c=c||u.height,s===36064&&_===null&&(s=1028),R(b[s]),l=l||b[s].type,o=Pd(o,l,r,a,c),l=l||fr(o);const y=p.bindFramebuffer(36160,_);return p.readPixels(e,i,a,c,r,l,o),p.bindFramebuffer(36160,y||null),d&&u.delete(),o}function go(n){let{sourceAttachment:t=36064,targetMaxHeight:e=Number.MAX_SAFE_INTEGER}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=mi(n,{sourceAttachment:t}),{width:r,height:s}=n;for(;s>e;)({data:i,width:r,height:s}=ld({data:i,width:r,height:s}));cd({data:i,width:r,height:s});const o=document.createElement("canvas");o.width=r,o.height=s;const a=o.getContext("2d"),c=a.createImageData(r,s);return c.data.set(i),a.putImageData(c,0,0),o.toDataURL()}function xd(n){return n instanceof Q?{framebuffer:n,deleteFramebuffer:!1}:{framebuffer:Fd(n),deleteFramebuffer:!0}}function Pd(n,t,e,i,r){if(n)return n;t=t||5121;const s=cn(t,{clamped:!1}),o=Sd(e);return new s(i*r*o)}const X={WEBGL2:"WEBGL2",VERTEX_ARRAY_OBJECT:"VERTEX_ARRAY_OBJECT",TIMER_QUERY:"TIMER_QUERY",INSTANCED_RENDERING:"INSTANCED_RENDERING",MULTIPLE_RENDER_TARGETS:"MULTIPLE_RENDER_TARGETS",ELEMENT_INDEX_UINT32:"ELEMENT_INDEX_UINT32",BLEND_EQUATION_MINMAX:"BLEND_EQUATION_MINMAX",FLOAT_BLEND:"FLOAT_BLEND",COLOR_ENCODING_SRGB:"COLOR_ENCODING_SRGB",TEXTURE_DEPTH:"TEXTURE_DEPTH",TEXTURE_FLOAT:"TEXTURE_FLOAT",TEXTURE_HALF_FLOAT:"TEXTURE_HALF_FLOAT",TEXTURE_FILTER_LINEAR_FLOAT:"TEXTURE_FILTER_LINEAR_FLOAT",TEXTURE_FILTER_LINEAR_HALF_FLOAT:"TEXTURE_FILTER_LINEAR_HALF_FLOAT",TEXTURE_FILTER_ANISOTROPIC:"TEXTURE_FILTER_ANISOTROPIC",COLOR_ATTACHMENT_RGBA32F:"COLOR_ATTACHMENT_RGBA32F",COLOR_ATTACHMENT_FLOAT:"COLOR_ATTACHMENT_FLOAT",COLOR_ATTACHMENT_HALF_FLOAT:"COLOR_ATTACHMENT_HALF_FLOAT",GLSL_FRAG_DATA:"GLSL_FRAG_DATA",GLSL_FRAG_DEPTH:"GLSL_FRAG_DEPTH",GLSL_DERIVATIVES:"GLSL_DERIVATIVES",GLSL_TEXTURE_LOD:"GLSL_TEXTURE_LOD"};function Ld(n){const t=new At(n,{format:6408,type:5126,dataFormat:6408}),e=new Q(n,{id:"test-framebuffer",check:!1,attachments:{36064:t}}),i=e.getStatus();return t.delete(),e.delete(),i===36053}const nc={[X.WEBGL2]:[!1,!0],[X.VERTEX_ARRAY_OBJECT]:["OES_vertex_array_object",!0],[X.TIMER_QUERY]:["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],[X.INSTANCED_RENDERING]:["ANGLE_instanced_arrays",!0],[X.MULTIPLE_RENDER_TARGETS]:["WEBGL_draw_buffers",!0],[X.ELEMENT_INDEX_UINT32]:["OES_element_index_uint",!0],[X.BLEND_EQUATION_MINMAX]:["EXT_blend_minmax",!0],[X.FLOAT_BLEND]:["EXT_float_blend"],[X.COLOR_ENCODING_SRGB]:["EXT_sRGB",!0],[X.TEXTURE_DEPTH]:["WEBGL_depth_texture",!0],[X.TEXTURE_FLOAT]:["OES_texture_float",!0],[X.TEXTURE_HALF_FLOAT]:["OES_texture_half_float",!0],[X.TEXTURE_FILTER_LINEAR_FLOAT]:["OES_texture_float_linear"],[X.TEXTURE_FILTER_LINEAR_HALF_FLOAT]:["OES_texture_half_float_linear"],[X.TEXTURE_FILTER_ANISOTROPIC]:["EXT_texture_filter_anisotropic"],[X.COLOR_ATTACHMENT_RGBA32F]:[Ld,"EXT_color_buffer_float"],[X.COLOR_ATTACHMENT_FLOAT]:[!1,"EXT_color_buffer_float"],[X.COLOR_ATTACHMENT_HALF_FLOAT]:["EXT_color_buffer_half_float"],[X.GLSL_FRAG_DATA]:["WEBGL_draw_buffers",!0],[X.GLSL_FRAG_DEPTH]:["EXT_frag_depth",!0],[X.GLSL_DERIVATIVES]:["OES_standard_derivatives",!0],[X.GLSL_TEXTURE_LOD]:["EXT_shader_texture_lod",!0]},Rd=2;function Id(n,t){return ic(n,t)}function ic(n,t){return t=Array.isArray(t)?t:[t],t.every(e=>rc(n,e))}function Md(n){n.luma=n.luma||{},n.luma.caps=n.luma.caps||{};for(const t in nc)n.luma.caps[t]===void 0&&(n.luma.caps[t]=rc(n,t));return n.luma.caps}function rc(n,t){return n.luma=n.luma||{},n.luma.caps=n.luma.caps||{},n.luma.caps[t]===void 0&&(n.luma.caps[t]=Cd(n,t)),n.luma.caps[t]||M.log(Rd,"Feature: ".concat(t," not supported"))(),n.luma.caps[t]}function Cd(n,t){const e=nc[t];R(e,t);let i;const r=F(n)&&e[1]||e[0];if(typeof r=="function")i=r(n);else if(Array.isArray(r)){i=!0;for(const s of r)i=i&&!!n.getExtension(s)}else typeof r=="string"?i=!!n.getExtension(r):typeof r=="boolean"?i=r:R(!1);return i}const po="Multiple render targets not supported";class Q extends Ht{get[Symbol.toStringTag](){return"Framebuffer"}static isSupported(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{colorBufferFloat:i,colorBufferHalfFloat:r}=e;let s=!0;return i&&(s=!!(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")||t.getExtension("OES_texture_float"))),r&&(s=s&&!!(t.getExtension("EXT_color_buffer_float")||t.getExtension("EXT_color_buffer_half_float"))),s}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new Q(t,{id:"default-framebuffer",handle:null,attachments:{}}
7),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){const t=ct(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){const t=ct(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,e),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(e),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(t){let{width:e=1,height:i=1,attachments:r=null,color:s=!0,depth:o=!0,stencil:a=!1,check:c=!0,readBuffer:l=void 0,drawBuffers:u=void 0}=t;if(R(e>=0&&i>=0,"Width and height need to be integers"),this.width=e,this.height=i,r)for(const d in r){const p=r[d];(Array.isArray(p)?p[0]:p).resize({width:e,height:i})}else r=this._createDefaultAttachments(s,o,a,e,i);this.update({clearAttachments:!0,attachments:r,readBuffer:l,drawBuffers:u}),r&&c&&this.checkStatus()}delete(){for(const t of this.ownResources)t.delete();return super.delete(),this}update(t){let{attachments:e={},readBuffer:i,drawBuffers:r,clearAttachments:s=!1,resizeAttachments:o=!0}=t;this.attach(e,{clearAttachments:s,resizeAttachments:o});const{gl:a}=this,c=a.bindFramebuffer(36160,this.handle);return i&&this._setReadBuffer(i),r&&this._setDrawBuffers(r),a.bindFramebuffer(36160,c||null),this}resize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{width:e,height:i}=t;if(this.handle===null)return R(e===void 0&&i===void 0),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;e===void 0&&(e=this.gl.drawingBufferWidth),i===void 0&&(i=this.gl.drawingBufferHeight),e!==this.width&&i!==this.height&&M.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(e,"x").concat(i))();for(const r in this.attachments)this.attachments[r].resize({width:e,height:i});return this.width=e,this.height=i,this}attach(t){let{clearAttachments:e=!1,resizeAttachments:i=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r={};e&&Object.keys(this.attachments).forEach(o=>{r[o]=null}),Object.assign(r,t);const s=this.gl.bindFramebuffer(36160,this.handle);for(const o in r){R(o!==void 0,"Misspelled framebuffer binding point?");const a=Number(o),c=r[a];let l=c;if(!l)this._unattach(a);else if(l instanceof Se)this._attachRenderbuffer({attachment:a,renderbuffer:l});else if(Array.isArray(c)){const[u,d=0,p=0]=c;l=u,this._attachTexture({attachment:a,texture:u,layer:d,level:p})}else this._attachTexture({attachment:a,texture:l,layer:0,level:0});i&&l&&l.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,s||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter(o=>!this.attachments[o]).forEach(o=>{delete this.attachments[o]})}checkStatus(){const{gl:t}=this,e=this.getStatus();if(e!==36053)throw new Error(Nd(e));return this}getStatus(){const{gl:t}=this,e=t.bindFramebuffer(36160,this.handle),i=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,e||null),i}clear(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{color:e,depth:i,stencil:r,drawBuffers:s=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(e||i||r)&&Wr(this.gl,{color:e,depth:i,stencil:r}
7),s.forEach((a,c)=>{Ad(this.gl,{drawBuffer:c,value:a})}),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){return M.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}readPixelsToBuffer(){return M.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}copyToDataUrl(){return M.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}copyToImage(){return M.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}copyToTexture(){return M.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}blit(){return M.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}invalidate(t){let{attachments:e=[],x:i=0,y:r=0,width:s,height:o}=t;const a=ct(this.gl),c=a.bindFramebuffer(36008,this.handle);return i===0&&r===0&&s===void 0&&o===void 0?a.invalidateFramebuffer(36008,e):a.invalidateFramebuffer(36008,e,i,r,s,o),a.bindFramebuffer(36008,c),this}getAttachmentParameter(t,e,i){let r=this._getAttachmentParameterFallback(e);return r===null&&(this.gl.bindFramebuffer(36160,this.handle),r=this.gl.getFramebufferAttachmentParameter(36160,t,e),this.gl.bindFramebuffer(36160,null)),i&&r>1e3&&(r=te(this.gl,r)),r}getAttachmentParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:36064,e=arguments.length>1?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[];const r={};for(const s of i){const o=e?te(this.gl,s):s;r[o]=this.getAttachmentParameter(t,s,e)}return r}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;const e=Object.keys(this.attachments),i={};for(const r of e){const s=Number(r),o=t?te(this.gl,s):s;i[o]=this.getAttachmentParameters(s,t)}return i}show(){return typeof window<"u"&&window.open(go(this),"luma-debug-texture"),this}log(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t>M.level||typeof window>"u")return this;e=e||"Framebuffer ".concat(this.id);const i=go(this,{targetMaxHeight:100});return M.image({logLevel:t,message:e,image:i},e)(),this}bind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,this.handle),this}unbind(){let{target:t=36160}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,e,i,r,s){let o=null;return t&&(o=o||{},o[36064]=new At(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:r,height:s,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(o[36064])),e&&i?(o=o||{},o[33306]=new Se(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:r,height:111}),this.ownResources.push(o[33306])):e?(o=o||{},o[36096]=new Se(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:r,height:s}),this.ownResources.push(o[36096])):i&&R(!1),o}_unattach(t){const e=this.attachments[t];e&&(e instanceof Se?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer(t){let{attachment:e=36064,renderbuffer:i}=t;const{gl:r}=this;r.framebufferRenderbuffer(36160,e,36161,i.handle),this.attachments[e]=i}_attachTexture(t){let{attachment:e=36064,texture:i,layer:r,level:s}=t;const{gl:o}=this;switch(o.bindTexture(i.target,i.handle),i.target){case 35866:case 32879:ct(o).framebufferTextureLayer(36160,e,i.target,s,r);break;case 34067:const c=Od(r);o.framebufferTexture2D(36160,e,c,i.handle,s);break;case 3553:o.framebufferTexture2D(36160,e,3553,i.handle,s);break;default:R(!1,"Illegal texture type")}o.bindTexture(i.target,null),this.attachments[e]=i}_setReadBuffer(t){const e=cf(this.gl);e?e.readBuffer(t):R(t===36064||t===1029,po),this.readBuffer=t}_setDrawBuffers(t){const{gl:e}=this,i=ct(e);if(i)i.drawBuffers(t);else{const r=e.getExtension("WEBGL_draw_buffers");r?r.drawBuffersWEBGL(t):R(t.length===1&&(t[0]===36064||t[0]===1029),po)}this.drawBuffers=t}_getAttachmentParameterFallback(t){const e=Md(this.gl);switch(t){case 36052:return e.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return e.WEBGL2?null:8;case 33297:return e.WEBGL2?null:5125;case 33296:return!e.WEBGL2&&!e.EXT_sRGB?9729:null;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}}function Od(n){return n<34069?n+34069:n}function Nd(n){return(Q.STATUS||{})[n]||"Framebuffer error ".concat(n)}
7const kd=[36049,36048,33296,33298,33299,33300,33301,33302,33303];Q.ATTACHMENT_PARAMETERS=kd;function Dd(n,t){R(n instanceof At||n instanceof tc||n instanceof yd);const e=n.constructor,{gl:i,width:r,height:s,format:o,type:a,dataFormat:c,border:l,mipmaps:u}=n,d=Object.assign({width:r,height:s,format:o,type:a,dataFormat:c,border:l,mipmaps:u},t);return new e(i,d)}function Fd(n,t){const{gl:e,width:i,height:r,id:s}=n;return new Q(e,Object.assign({},t,{id:"framebuffer-for-".concat(s),width:i,height:r,attachments:{36064:n}}))}function Yn(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed";const e=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/,i=n.match(e);return i?i[1]:t}const Ud=35632,Bd=35633;function Vd(n){switch(n){case Ud:return"fragment";case Bd:return"vertex";default:return"unknown type"}}function jd(n,t,e,i){const r=n.split(/\r?\n/),s={},o={},a=i||Yn(t)||"(unnamed)",c="".concat(Vd(e)," shader ").concat(a);for(let u=0;u<r.length;u++){const d=r[u];if(d.length<=1)continue;const p=d.split(":"),_=p[0],b=parseInt(p[2],10);if(isNaN(b))throw new Error("GLSL compilation error in ".concat(c,": ").concat(n));_!=="WARNING"?s[b]=d:o[b]=d}const l=zd(t);return{shaderName:c,errors:mo(s,l),warnings:mo(o,l)}}function mo(n,t){let e="";for(let i=0;i<t.length;i++){const r=t[i];if(!(!n[i+3]&&!n[i+2]&&!n[i+1])&&(e+="".concat(r,`
8`),n[i+1])){const s=n[i+1],o=s.split(":",3),a=o[0],c=parseInt(o[1],10)||0,l=s.substring(o.join(":").length+1).trim();e+=sc("^^^ ".concat(a,": ").concat(l,`
9
10`),c)}}return e}function zd(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:": ";const i=n.split(/\r?\n/),r=String(i.length+t-1).length;return i.map((s,o)=>{const a=String(o+t),c=a.length;return sc(a,r-c)+e+s})}function sc(n,t){let e="";for(let i=0;i<t;++i)e+=" ";return"".concat(e).concat(n)}function oc(n){let t=100;const e=n.match(/[^\s]+/g);if(e.length>=2&&e[0]==="#version"){const i=parseInt(e[1],10);Number.isFinite(i)&&(t=i)}return t}const Gd="Shader: GLSL source code must be a JavaScript string";class ln extends Ht{get[Symbol.toStringTag](){return"Shader"}static getTypeName(t){switch(t){case 35633:return"vertex-shader";case 35632:return"fragment-shader";default:return R(!1),"unknown"}}constructor(t,e){pi(t),R(typeof e.source=="string",Gd);const i=Yn(e.source,null)||e.id||ee("unnamed ".concat(ln.getTypeName(e.shaderType)));super(t,{id:i}),this.shaderType=e.shaderType,this.source=e.source,this.initialize(e)}initialize(t){let{source:e}=t;const i=Yn(e,null);i&&(this.id=ee(i)),this._compile(e)}getParameter(t){return this.gl.getShaderParameter(this.handle,t)}toString(){return"".concat(ln.getTypeName(this.shaderType),":").concat(this.id)}getName(){return Yn(this.source)||"unnamed-shader"}getSource(){return this.gl.getShaderSource(this.handle)}getTranslatedSource(){const t=this.gl.getExtension("WEBGL_debug_shaders");return t?t.getTranslatedShaderSource(this.handle):"No translated source available. WEBGL_debug_shaders not implemented"}_compile(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.source;if(t.startsWith("#version ")||(t=`#version 100
11`.concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle),!this.getParameter(35713)){const i=this.gl.getShaderInfoLog(this.handle),{shaderName:r,errors:s,warnings:o}=jd(i,this.source,this.shaderType,this.id);throw M.error("GLSL compilation errors in ".concat(r,`
12`).concat(s))(),M.warn("GLSL compilation warnings in ".concat(r,`
13`).concat(o))(),new Error("GLSL compilation errors in ".concat(r))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}}class ji extends ln{get[Symbol.toStringTag](){return"VertexShader"}constructor(t,e){typeof e=="string"&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}}class zi extends ln{get[Symbol.toStringTag](){return"FragmentShader"}constructor(t,e){typeof e=="string"&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}}const Hd={5126:H.bind(null,"uniform1fv",ht,1,it),35664:H.bind(null,"uniform2fv",ht,2,it),35665:H.bind(null,"uniform3fv",ht,3,it),35666:H.bind(null,"uniform4fv",ht,4,it),5124:H.bind(null,"uniform1iv",qt,1,it),35667:H.bind(null,"uniform2iv",qt,2,it),35668:H.bind(null,"uniform3iv",qt,3,it),35669:H.bind(null,"uniform4iv",qt,4,it),35670:H.bind(null,"uniform1iv",qt,1,it),35671:H.bind(null,"uniform2iv",qt,2,it),35672:H.bind(null,"uniform3iv",qt,3,it),35673:H.bind(null,"uniform4iv",qt,4,it),35674:H.bind(null,"uniformMatrix2fv",ht,4,Ut),35675:H.bind(null,"uniformMatrix3fv",ht,9,Ut),35676:H.bind(null,"uniformMatrix4fv",ht,16,Ut),35678:et,35680:et,5125:H.bind(null,"uniform1uiv",kn,1,it),36294:H.bind(null,"uniform2uiv",kn,2,it),36295:H.bind(null,"uniform3uiv",kn,3,it),36296:H.bind(null,"uniform4uiv",kn,4,it),35685:H.bind(null,"uniformMatrix2x3fv",ht,6,Ut),35686:H.bind(null,"uniformMatrix2x4fv",ht,8,Ut),35687:H.bind(null,"uniformMatrix3x2fv",ht,6,Ut),35688:H.bind(null,"uniformMatrix3x4fv",ht,12,Ut),35689:H.bind(null,"uniformMatrix4x2fv",ht,8,Ut),35690:H.bind(null,"uniformMatrix4x3fv",ht,12,Ut),35678:et,35680:et,35679:et,35682:et,36289:et,36292:et,36293:et,36298:et,36299:et,36300:et,36303:et,36306:et,36307:et,36308:et,36311:et},Wd={},Xd={},Yd={},_o=[0];function Xr(n,t,e,i){t===1&&typeof n=="boolean"&&(n=n?1:0),Number.isFinite(n)&&(_o[0]=n,n=_o);const r=n.length;if(r%t&&M.warn("Uniform size should be multiples of ".concat(t),n)(),n instanceof e)return n;let s=i[r];s||(s=new e(r),i[r]=s);for(let o=0;o<r;o++)s[o]=n[o];return s}function ht(n,t){return Xr(n,t,Float32Array,Wd)}function qt(n,t){return Xr(n,t,Int32Array,Xd)}function kn(n,t){return Xr(n,t,Uint32Array,Yd)}function bo(n,t,e){const i=Hd[e.type];if(!i)throw new Error("Unknown GLSL uniform type ".concat(e.type));return i().bind(null,n,t)}function qd(n){if(n[n.length-1]!=="]")return{name:n,length:1,isArray:!1};const t=/([^[]*)(\[[0-9]+\])?/,e=n.match(t);if(!e||e.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(n));return{name:e[1],length:e[2]||1,isArray:!!e[2]}}function Zd(n,t,e){for(const i in n){const r=n[i];if((!e||!!e[i])&&!Kd(r))throw t=t?"".concat(t," "):"",console.error("".concat(t," Bad uniform ").concat(i),r),new Error("".concat(t," Bad uniform ").concat(i))}return!0}function Kd(n){return Array.isArray(n)||ArrayBuffer.isView(n)?Qd(n):isFinite(n)||n===!0||n===!1||n instanceof Me||n instanceof Se?!0:n instanceof Q?!!n.texture:!1}function $d(n,t,e){if(Array.isArray(e)||ArrayBuffer.isView(e))if(n[t]){const i=n[t];for(let r=0,s=e.length;r<s;++r)i[r]=e[r]}else n[t]=e.slice();else n[t]=e}function Qd(n){if(n.length===0)return!1;const t=Math.min(n.length,16);for(let e=0;e<t;++e)if(!Number.isFinite(n[e]))return!1;return!0}function et(){let n=null;return(t,e,i)=>{const r=n!==i;return r&&(t.uniform1i(e,i),n=i),r}}function H(n,t,e,i){let r=null,s=null;return(o,a,c)=>{const l=t(c,e),u=l.length;let d=!1;if(r===null)r=new Float32Array(u),s=u,d=!0;else{R(s===u,"Uniform length cannot change.");for(let p=0;p<u;++p)if(l[p]!==r[p]){d=!0;break}}return d&&(i(o,n,a,l),r.set(l)),d}}function it(n,t,e,i){n[t](e,i)}function Ut(n,t,e,i){n[t](e,!1,i)}const Jd=5120,tg=5121,eg=5122,ng=5123,yo=0,Dn=1,ig=2,rg=3,Fn=4,sg=5,og=6,$=5126,ag=35664,cg=35665,lg=35666,Ke=5124,ug=35667,hg=35668,fg=35669,$e=5125,dg=36294,gg=36295,pg=36296,mg=35670,_g=35671,bg=35672,yg=35673,vg=35674,Eg=35675,Tg=35676,wg=35685,Ag=35686,Sg=35687,xg=35688,Pg=35689,Lg=35690,pr={[$]:[$,1,"float"],[ag]:[$,2,"vec2"],[cg]:[$,3,"vec3"],[lg]:[$,4,"vec4"],[Ke]:[Ke,1,"int"],[ug]:[Ke,2,"ivec2"],[hg]:[Ke,3,"ivec3"],[fg]:[Ke,4,"ivec4"],[$e]:[$e,1,"uint"],[dg]:[$e,2,"uvec2"],[gg]:[$e,3,"uvec3"],[pg]:[$e,4,"uvec4"],[mg]:[$,1,"bool"],[_g]:[$,2,"bvec2"],[bg]:[$,3,"bvec3"],[yg]:[$,4,"bvec4"],[vg]:[$,8,"mat2"],[wg]:[$,8,"mat2x3"],[Ag]:[$,8,"mat2x4"],[Eg]:[$,12,"mat3"],[Sg]:[$,12,"mat3x2"],[xg]:[$,12,"mat3x4"],[Tg]:[$,16,"mat4"],[Pg]:[$,16,"mat4x2"],[Lg]:[$,16,"mat4x3"]};function Rg(n){switch(n){case yo:return yo;case Dn:return Dn;case rg:return Dn;case ig:return Dn;case Fn:return Fn;case sg:return Fn;case og:return Fn;default:return R(!1),0}}function vo(n){const t=pr[n];if(!t)return null;const[e,i]=t;return{type:e,components:i}}function ac(n,t){switch(n){case Jd:case tg:case eg:case ng:n=$;break}for(const e in pr){const[i,r,s]=pr[e];if(i===n&&r===t)return{glType:e,name:s}}return null}class Ig{constructor(t){this.id=t.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(t),this._readVaryingsFromProgram(t)}getAttributeInfo(t){const e=Number(t);return Number.isFinite(e)?this.attributeInfosByLocation[e]:this.attributeInfosByName[t]||null}getAttributeLocation(t){const e=this.getAttributeInfo(t);return e?e.location:-1}
13getAttributeAccessor(t){const e=this.getAttributeInfo(t);return e?e.accessor:null}getVaryingInfo(t){const e=Number(t);return Number.isFinite(e)?this.varyingInfos[e]:this.varyingInfosByName[t]||null}getVaryingIndex(t){const e=this.getVaryingInfo();return e?e.location:-1}getVaryingAccessor(t){const e=this.getVaryingInfo();return e?e.accessor:null}_readAttributesFromProgram(t){const{gl:e}=t,i=e.getProgramParameter(t.handle,35721);for(let r=0;r<i;r++){const{name:s,type:o,size:a}=e.getActiveAttrib(t.handle,r),c=e.getAttribLocation(t.handle,s);c>=0&&this._addAttribute(c,s,o,a)}this.attributeInfos.sort((r,s)=>r.location-s.location)}_readVaryingsFromProgram(t){const{gl:e}=t;if(!F(e))return;const i=e.getProgramParameter(t.handle,35971);for(let r=0;r<i;r++){const{name:s,type:o,size:a}=e.getTransformFeedbackVarying(t.handle,r);this._addVarying(r,s,o,a)}this.varyingInfos.sort((r,s)=>r.location-s.location)}_addAttribute(t,e,i,r){const{type:s,components:o}=vo(i),a={type:s,size:r*o};this._inferProperties(t,e,a);const c={location:t,name:e,accessor:new gt(a)};this.attributeInfos.push(c),this.attributeInfosByLocation[t]=c,this.attributeInfosByName[c.name]=c}_inferProperties(t,e,i){/instance/i.test(e)&&(i.divisor=1)}_addVarying(t,e,i,r){const{type:s,components:o}=vo(i),a=new gt({type:s,size:r*o}),c={location:t,name:e,accessor:a};this.varyingInfos.push(c),this.varyingInfosByName[c.name]=c}}const Eo=4,Mg=35981,Cg=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"];class cc extends Ht{get[Symbol.toStringTag](){return"Program"}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,e),this.stubRemovedMethods("Program","v6.0",Cg),this._isCached=!1,this.initialize(e),Object.seal(this),this._setId(e.id)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{hash:e,vs:i,fs:r,varyings:s,bufferMode:o=Mg}=t;return this.hash=e||"",this.vs=typeof i=="string"?new ji(this.gl,{id:"".concat(t.id,"-vs"),source:i}):i,this.fs=typeof r=="string"?new zi(this.gl,{id:"".concat(t.id,"-fs"),source:r}):r,R(this.vs instanceof ji),R(this.fs instanceof zi),this.uniforms={},this._textureUniforms={},s&&s.length>0&&(ct(this.gl),this.varyings=s,this.gl2.transformFeedbackVaryings(this.handle,s,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new Ig(this),this.setProps(t)}delete(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this._isCached?this:super.delete(t)}setProps(t){return"uniforms"in t&&this.setUniforms(t.uniforms),this}draw(t){let{logPriority:e,drawMode:i=4,vertexCount:r,offset:s=0,start:o,end:a,isIndexed:c=!1,indexType:l=5123,instanceCount:u=0,isInstanced:d=u>0,vertexArray:p=null,transformFeedback:_,framebuffer:b,parameters:y={},uniforms:E,samplers:T}=t;if((E||T)&&(M.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(E||{})),M.priority>=e){const w=b?b.id:"default",A="mode=".concat(te(this.gl,i)," verts=").concat(r," ")+"instances=".concat(u," indexType=").concat(te(this.gl,l)," ")+"isInstanced=".concat(d," isIndexed=").concat(c," ")+"Framebuffer=".concat(w);M.log(e,A)()}return R(p),this.gl.useProgram(this.handle),!this._areTexturesRenderable()||r===0||d&&u===0?!1:(p.bindForDraw(r,u,()=>{if(b!==void 0&&(y=Object.assign({},y,{framebuffer:b})),_){const w=Rg(i);_.begin(w)}this._bindTextures(),wt(this.gl,y,()=>{c&&d?this.gl2.drawElementsInstanced(i,r,l,s,u):c&&F(this.gl)&&!isNaN(o)&&!isNaN(a)?this.gl2.drawRangeElements(i,o,a,r,l,s):c?this.gl.drawElements(i,r,l,s):d?this.gl2.drawArraysInstanced(i,s,r,u):this.gl.drawArrays(i,s,r)}),_&&_.end()}),!0)}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};M.priority>=2&&Zd(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(const e in t){const i=t[e],r=this._uniformSetters[e];if(r){let s=i,o=!1;if(s instanceof Q&&(s=s.texture),s instanceof Me)if(o=this.uniforms[e]!==i,o){r.textureIndex===void 0&&(r.textureIndex=this._textureIndexCounter++);const a=s,{textureIndex:c}=r;a.bind(c),s=c,this._textureUniforms[e]=a}else s=r.textureIndex;else this._textureUniforms[e]&&delete this._textureUniforms[e];(r(s)||o)&&$d(this.uniforms,e,i)}}return this}_areTexturesRenderable(){let t=!0;for(const e in this._textureUniforms){const i=this._textureUniforms[e];i.update(),t=t&&i.loaded}return t}_bindTextures(){for(const t in this._textureUniforms){const e=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(e)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){const e=this.gl.getAttachedShaders(t),i={};for(const r of e)switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:i.vs=new ji({handle:r});break;case 35632:i.fs=new zi({handle:r});break}return i}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){const e=this._getName();this.id=ee(e)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,""),t=t?"".concat(t,"-program"):"program",t}_compileAndLink(){const{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),M.time(Eo,"linkProgram for ".concat(this._getName()))(),t.linkProgram(this.handle),M.timeEnd(Eo,"linkProgram for ".concat(this._getName()))(),t.debug||M.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(t.getProgramInfoLog(this.handle)));if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(t.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){const{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let e=0;e<this._uniformCount;e++){const i=this.gl.getActiveUniform(this.handle,e),{name:r}=qd(i.name);let s=t.getUniformLocation(this.handle,r);
13if(this._uniformSetters[r]=bo(t,s,i),i.size>1)for(let o=0;o<i.size;o++)s=t.getUniformLocation(this.handle,"".concat(r,"[").concat(o,"]")),this._uniformSetters["".concat(r,"[").concat(o,"]")]=bo(t,s,i)}this._textureIndexCounter=0}getActiveUniforms(t,e){return this.gl2.getActiveUniforms(this.handle,t,e)}getUniformBlockIndex(t){return this.gl2.getUniformBlockIndex(this.handle,t)}getActiveUniformBlockParameter(t,e){return this.gl2.getActiveUniformBlockParameter(this.handle,t,e)}uniformBlockBinding(t,e){this.gl2.uniformBlockBinding(this.handle,t,e)}}const Og=34918,Ng=34919,kg=35007,Dg=36795,Fg=35976,Ug=35887,Bg=36202;class ei extends Ht{get[Symbol.toStringTag](){return"Query"}static isSupported(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const i=F(t),r=ic(t,X.TIMER_QUERY);let s=i||r;for(const o of e)switch(o){case"queries":s=s&&i;break;case"timers":s=s&&r;break;default:R(!1)}return s}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,e),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(kg)}beginOcclusionQuery(){let{conservative:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.begin(t?Bg:Ug)}beginTransformFeedbackQuery(){return this.begin(Fg)}begin(t){return this._queryPending?this:(this.target=t,this.gl2.beginQuery(this.target,this.handle),this)}end(){return this._queryPending?this:(this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this)}isResultAvailable(){if(!this._queryPending)return!1;const t=this.gl2.getQueryParameter(this.handle,Ng);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(Dg)}getResult(){return this.gl2.getQueryParameter(this.handle,Og)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let e=0;return this._pollingPromise=new Promise((i,r)=>{const s=()=>{this.isResultAvailable()?(i(this.getResult()),this._pollingPromise=null):e++>t?(r("Timed out"),this._pollingPromise=null):requestAnimationFrame(s)};requestAnimationFrame(s)}),this._pollingPromise}_createHandle(){return ei.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}}class lc extends Ht{get[Symbol.toStringTag](){return"TransformFeedback"}static isSupported(t){return F(t)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ct(t),super(t,e),this.initialize(e),this.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(this)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,Ie(this.buffers)||this.bind(()=>this._unbindBuffers()),this.setProps(t),this}setProps(t){"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"bindOnUse"in t&&(t=t.bindOnUse),"buffers"in t&&this.setBuffers(t.buffers)}setBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.bind(()=>{for(const e in t)this.setBuffer(e,t[e])}),this}setBuffer(t,e){const i=this._getVaryingIndex(t),{buffer:r,byteSize:s,byteOffset:o}=this._getBufferParams(e);return i<0?(this.unused[t]=r,M.warn("".concat(this.id," unused varying buffer ").concat(t))(),this):(this.buffers[i]=e,this.bindOnUse||this._bindBuffer(i,r,o,s),this)}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let e,i,r;return t instanceof j?r=t:(r=t.buffer,i=t.byteSize,e=t.byteOffset),(e!==void 0||i!==void 0)&&(e=e||0,i=i||r.byteLength-e),{buffer:r,byteOffset:e,byteSize:i}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;const e=Number(t);return Number.isFinite(e)?e:-1}_bindBuffers(){if(this.bindOnUse)for(const t in this.buffers){const{buffer:e,byteSize:i,byteOffset:r}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,e,r,i)}}_unbindBuffers(){if(this.bindOnUse)for(const t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;const s=e&&e.handle;return!s||r===void 0?this.gl.bindBufferBase(35982,t,s):this.gl.bindBufferRange(35982,t,s,i,r),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}}let Un=null;function Vg(n){return(!Un||Un.byteLength<n)&&(Un=new ArrayBuffer(n)),Un}function jg(n,t){const e=Vg(n.BYTES_PER_ELEMENT*t);return new n(e,0,t)}function zg(n){let{target:t,source:e,start:i=0,count:r=1}=n;const s=e.length,o=r*s;let a=0;for(let c=i;a<s;a++)t[c++]=e[a];for(;a<o;)a<o-a?(t.copyWithin(i+a,i,i+a),a*=2):(t.copyWithin(i+a,i,i+o-a),a=o);return t}const Gg="elements must be GL.ELEMENT_ARRAY_BUFFER";class ft extends Ht{get[Symbol.toStringTag](){return"VertexArrayObject"}static isSupported(t){return(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).constantAttributeZero?F(t)||Ia()==="Chrome":!0}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new ft(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return ft.MAX_ATTRIBUTES=ft.MAX_ATTRIBUTES||t.getParameter(34921),ft.MAX_ATTRIBUTES}static setConstant(t,e,i){switch(i.constructor){case Float32Array:ft._setConstantFloatArray(t,e,i);break;case Int32Array:ft._setConstantIntArray(t,e,i);break;case Uint32Array:ft._setConstantUintArray(t,e,i);break;default:R(!1)}}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=e.id||e.program&&e.program.id;super(t,Object.assign({},e,{id:i})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=e.isDefaultArray||!1,this.gl2=t,this.initialize(e),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return ft.getMaxAttributes(this.gl)}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.setProps(t)}setProps(t){return this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return R(!t||t.target===34963,Gg),this.bind(()=>{this.gl.bindBuffer(34963,t?t.handle:null)}),this}setBuffer(t,e,i){if(e.target===34963)return this.setElementBuffer(e,i);const{size:r,type:s,stride:o,offset:a,normalized:c,integer:l,divisor:u}=i,{gl:d,gl2:p}=this;return t=Number(t),this.bind(()=>{d.bindBuffer(34962,e.handle),l?(R(F(d)),p.vertexAttribIPointer(t,r,s,o,a)):d.vertexAttribPointer(t,r,s,c,o,a),d.enableVertexAttribArray(t),p.vertexAttribDivisor(t,u||0)}),this}enable(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return!e&&t===0&&!ft.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind(()=>e?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t))),this}getConstantBuffer(t,e){const i=this._normalizeConstantArrayValue(e),r=i.byteLength*t,s=i.length*t;let o=!this.buffer;if(this.buffer=this.buffer||new j(this.gl,r),o=o||this.buffer.reallocate(r),o=o||!this._compareConstantArrayValues(i,this.bufferValue),o){const a=jg(e.constructor,s);zg({target:a,source:i,start:0,count:s}),this.buffer.subData(a),this.bufferValue=e}return this.buffer}_normalizeConstantArrayValue(t){return Array.isArray(t)?new Float32Array(t):t}_compareConstantArrayValues(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}static _setConstantFloatArray(t,e,i){switch(i.length){case 1:t.vertexAttrib1fv(e,i);break;case 2:t.vertexAttrib2fv(e,i);break;case 3:t.vertexAttrib3fv(e,i);break;case 4:t.vertexAttrib4fv(e,i);break;default:R(!1)}}static _setConstantIntArray(t,e,i){switch(R(F(t)),i.length){case 1:t.vertexAttribI1iv(e,i);break;case 2:t.vertexAttribI2iv(e,i);break;case 3:t.vertexAttribI3iv(e,i);break;case 4:t.vertexAttribI4iv(e,i);break;default:R(!1)}}static _setConstantUintArray(t,e,i){switch(R(F(t)),i.length){case 1:t.vertexAttribI1uiv(e,i);break;case 2:t.vertexAttribI2uiv(e,i);break;case 3:t.vertexAttribI3uiv(e,i);break;case 4:t.vertexAttribI4uiv(e,i);break;default:R(!1)}}_createHandle(){return this.gl.createVertexArray()}_deleteHandle(t){return this.gl2.deleteVertexArray(t),[this.elements]}_bindHandle(t){this.gl2.bindVertexArray(t)}_getParameter(t,e){let{location:i}=e;return R(Number.isFinite(i)),this.bind(()=>{switch(t){case 34373:return this.gl.getVertexAttribOffset(i,t);default:return this.gl.getVertexAttrib(i,t)}})}}const Hg="VertexArray: attributes must be Buffers or constants (i.e. typed array)",Wg=/^(.+)__LOCATION_([0-9]+)$/,Xg=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"];class Yg{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=e.id||e.program&&e.program.id;this.id=i,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={}
13,this.vertexArrayObject=new ft(t),Ka(this,"VertexArray","v6.0",Xg),this.initialize(e),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;const{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"attributes"in t&&this.setAttributes(t.attributes),"elements"in t&&this.setElementBuffer(t.elements),"bindOnUse"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind(()=>{for(const e in t){const i=t[e];this._setAttribute(e,i)}this.gl.bindBuffer(34962,null)}),this}setElementBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.elements=t,this.elementsAccessor=e,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,e),this}setBuffer(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(e.target===34963)return this.setElementBuffer(e,i);const{location:r,accessor:s}=this._resolveLocationAndAccessor(t,e,e.accessor,i);return r>=0&&(this.values[r]=e,this.accessors[r]=s,this.clearDrawParams(),this.vertexArrayObject.setBuffer(r,e,s)),this}setConstant(t,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{location:r,accessor:s}=this._resolveLocationAndAccessor(t,e,Object.assign({size:e.length},i));return r>=0&&(e=this.vertexArrayObject._normalizeConstantArrayValue(e),this.values[r]=e,this.accessors[r]=s,this.clearDrawParams(),this.vertexArrayObject.enable(r,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new j(this.gl,{accessor:{size:4}});for(let t=0;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++)this.values[t]instanceof j&&(this.gl.disableVertexAttribArray(t),this.gl.bindBuffer(34962,this.buffer.handle),this.gl.vertexAttribPointer(t,1,5126,!1,0,0))}),this}bindBuffers(){return this.vertexArrayObject.bind(()=>{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t<this.vertexArrayObject.MAX_ATTRIBUTES;t++){const e=this.values[t];e instanceof j&&this.setBuffer(t,e)}}),this}bindForDraw(t,e,i){let r;return this.vertexArrayObject.bind(()=>{this._setConstantAttributes(t,e),r=i()}),r}_resolveLocationAndAccessor(t,e,i,r){const s={location:-1,accessor:null},{location:o,name:a}=this._getAttributeIndex(t);if(!Number.isFinite(o)||o<0)return this.unused[t]=e,M.once(3,()=>"unused value ".concat(t," in ").concat(this.id))(),s;const c=this._getAttributeInfo(a||o);if(!c)return s;const l=this.accessors[o]||{},u=gt.resolve(c.accessor,l,i,r),{size:d,type:p}=u;return R(Number.isFinite(d)&&Number.isFinite(p)),{location:o,accessor:u}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){const e=Number(t);if(Number.isFinite(e))return{location:e};const i=Wg.exec(t),r=i?i[1]:t,s=i?Number(i[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(r)+s,name:r}:{location:-1}}_setAttribute(t,e){if(e instanceof j)this.setBuffer(t,e);else if(Array.isArray(e)&&e.length&&e[0]instanceof j){const i=e[0],r=e[1];this.setBuffer(t,i,r)}else if(ArrayBuffer.isView(e)||Array.isArray(e)){const i=e;this.setConstant(t,i)}else if(e.buffer instanceof j){const i=e;this.setBuffer(t,i.buffer,i)}else throw new Error(Hg)}_setConstantAttributes(t,e){const i=Math.max(t|0,e|0);let r=this.values[0];ArrayBuffer.isView(r)&&this._setConstantAttributeZero(r,i);for(let s=1;s<this.vertexArrayObject.MAX_ATTRIBUTES;s++)r=this.values[s],ArrayBuffer.isView(r)&&this._setConstantAttribute(s,r)}_setConstantAttributeZero(t,e){if(ft.isSupported(this.gl,{constantAttributeZero:!0})){this._setConstantAttribute(0,t);return}const i=this.vertexArrayObject.getConstantBuffer(e,t);
13this.vertexArrayObject.setBuffer(0,i,this.accessors[0])}_setConstantAttribute(t,e){ft.setConstant(this.gl,t,e)}_updateDrawParams(){const t={isIndexed:!1,isInstanced:!1,indexCount:1/0,vertexCount:1/0,instanceCount:1/0};for(let e=0;e<this.vertexArrayObject.MAX_ATTRIBUTES;e++)this._updateDrawParamsForLocation(t,e);return this.elements&&(t.elementCount=this.elements.getElementCount(this.elements.accessor),t.isIndexed=!0,t.indexType=this.elementsAccessor.type||this.elements.accessor.type,t.indexOffset=this.elementsAccessor.offset||0),t.indexCount===1/0&&(t.indexCount=0),t.vertexCount===1/0&&(t.vertexCount=0),t.instanceCount===1/0&&(t.instanceCount=0),t}_updateDrawParamsForLocation(t,e){const i=this.values[e],r=this.accessors[e];if(!i)return;const{divisor:s}=r,o=s>0;if(t.isInstanced=t.isInstanced||o,i instanceof j){const a=i;if(o){const c=a.getVertexCount(r);t.instanceCount=Math.min(t.instanceCount,c)}else{const c=a.getVertexCount(r);t.vertexCount=Math.min(t.vertexCount,c)}}}setElements(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return M.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(t,e)}}function qg(n,t){const{maxElts:e=16,size:i=1}=t;let r="[";for(let o=0;o<n.length&&o<e;++o)o>0&&(r+=",".concat(o%i===0?" ":"")),r+=un(n[o],t);const s=n.length>e?"...":"]";return"".concat(r).concat(s)}function un(n){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const e=1e-16,{isInteger:i=!1}=t;if(Array.isArray(n)||ArrayBuffer.isView(n))return qg(n,t);if(!Number.isFinite(n))return String(n);if(Math.abs(n)<e)return i?"0":"0.";if(i||Math.abs(n)>100&&Math.abs(n)<1e4)return n.toFixed(0);const r=n.toPrecision(2);return r.indexOf(".0")===r.length-2?r.slice(0,-1):r}function To(n){let{header:t="Uniforms",program:e,uniforms:i,undefinedOnly:r=!1}=n;R(e);const s=".*_.*",o=".*Matrix",a=e._uniformSetters,c={},l=Object.keys(a).sort();let u=0;for(const _ of l)!_.match(s)&&!_.match(o)&&Gi({table:c,header:t,uniforms:i,uniformName:_,undefinedOnly:r})&&u++;for(const _ of l)_.match(o)&&Gi({table:c,header:t,uniforms:i,uniformName:_,undefinedOnly:r})&&u++;for(const _ of l)c[_]||Gi({table:c,header:t,uniforms:i,uniformName:_,undefinedOnly:r})&&u++;let d=0;const p={};if(!r)for(const _ in i){const b=i[_];c[_]||(d++,p[_]={Type:"NOT USED: ".concat(b),[t]:un(b)})}return{table:c,count:u,unusedTable:p,unusedCount:d}}function Gi(n){let{table:t,header:e,uniforms:i,uniformName:r,undefinedOnly:s}=n;const o=i[r],a=Zg(o);return!s||!a?(t[r]={[e]:a?un(o):"N/A","Uniform Type":a?o:"NOT PROVIDED"},!0):!1}function Zg(n){return n!=null}function Kg(n){let{vertexArray:t,header:e="Attributes"}=n;if(!t.configuration)return{};const i={};t.elements&&(i.ELEMENT_ARRAY_BUFFER=wo(t,t.elements,null,e));const r=t.values;for(const s in r){const o=t._getAttributeInfo(s);if(o){let a="".concat(s,": ").concat(o.name);const c=t.accessors[o.location];c&&(a="".concat(s,": ").concat($g(o.name,c))),i[a]=wo(t,r[s],c,e)}}return i}function wo(n,t,e,i){const{gl:r}=n;if(!t)return{[i]:"null","Format ":"N/A"};let s="NOT PROVIDED",o=1,a=0,c=0,l,u,d;if(e&&(s=e.type,o=e.size,s=String(s).replace("Array",""),l=s.indexOf("nt")!==-1),t instanceof j){const p=t,{data:_,changed:b}=p.getDebugData();u=b?"*":"",d=_,c=p.byteLength,a=c/_.BYTES_PER_ELEMENT/o;let y;if(e){const E=e.divisor>0;y="".concat(E?"I ":"P "," ").concat(a," (x").concat(o,"=").concat(c," bytes ").concat(te(r,s),")")}else l=!0,y="".concat(c," bytes");return{[i]:"".concat(u).concat(un(d,{size:o,isInteger:l})),"Format ":y}}return d=t,o=t.length,s=String(t.constructor.name).replace("Array",""),l=s.indexOf("nt")!==-1,{[i]:"".concat(un(d,{size:o,isInteger:l})," (constant)"),"Format ":"".concat(o,"x").concat(s," (constant)")}}function $g(n,t){const{type:e,size:i}=t,r=ac(e,i);return r?"".concat(n," (").concat(r.name,")"):n}function Qg(n){const t={},e="Accessors for ".concat(n.id);for(const i of n.attributeInfos)if(i){const r=Ao(i);t["in ".concat(r)]={[e]:JSON.stringify(i.accessor)}}for(const i of n.varyingInfos)if(i){const r=Ao(i);t["out ".concat(r)]={[e]:JSON.stringify(i.accessor)}}return t}function Ao(n){const{type:t,size:e}=n.accessor,i=ac(t,e);return i?"".concat(i.name," ").concat(n.name):n.name}const So=Gt()&&typeof document<"u";let Jg=0;class tp{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{onCreateContext:e=E=>Za(E),onAddHTML:i=null,onInitialize:r=()=>{},onRender:s=()=>{},onFinalize:o=()=>{},onError:a,gl:c=null,glOptions:l={},debug:u=!1,createFramebuffer:d=!1,autoResizeViewport:p=!0,autoResizeDrawingBuffer:_=!0,stats:b=ue.get("animation-loop-".concat(Jg++))}=t;let{useDevicePixels:y=!0}=t;"useDevicePixelRatio"in t&&(M.deprecated("useDevicePixelRatio","useDevicePixels")(),y=t.useDevicePixelRatio),this.props={onCreateContext:e,onAddHTML:i,onInitialize:r,onRender:s,onFinalize:o,onError:a,gl:c,glOptions:l,debug:u,createFramebuffer:d},this.gl=c,this.needsRedraw=null,this.timeline=null,this.stats=b,this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:p,autoResizeDrawingBuffer:_,useDevicePixels:y}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return R(typeof t=="string"),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.autoResizeViewport=t.autoResizeViewport),"autoResizeDrawingBuffer"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),"useDevicePixels"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this._running)return this;this._running=!0;const e=this._getPageLoadPromise().then(()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=ei.isSupported(this.gl,["timers"])?new ei(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps))).then(i=>{this._running&&(this._addCallbackData(i||{}),i!==!1&&this._startLoop())});return this.props.onError&&e.catch(this.props.onError),this}redraw(){return this.isContextLost()?this:(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers(),this)}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(t=>{this._resolveNextFrame=t})),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const i=document.getElementById(t);return i?Number(i.value):e}
13setViewParameters(){return M.removed("AnimationLoop.setViewParameters","AnimationLoop.setProps")(),this}_startLoop(){const t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=So?new Promise((t,e)=>{if(So&&document.readyState==="complete"){t(document);return}window.addEventListener("load",()=>{t(document)})}):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):od(t)}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):sd(t)}_renderFrame(){if(this.display){this.display._renderFrame(...arguments);return}this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){const{width:t,height:e,aspect:i}=this._getSizeAndAspect();(t!==this.animationProps.width||e!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),i!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,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,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){typeof t=="object"&&t!==null&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&typeof OffscreenCanvas<"u"&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?Gr(this.props.gl,t):this.onCreateContext(t),!gi(this.gl))throw new Error("AnimationLoop.onCreateContext - illegal context returned");Xf(this.gl),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){const t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";const e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",t.appendChild(this.gl.canvas),t.appendChild(e);const i=this.props.onAddHTML(e);i&&(e.innerHTML=i)}}_getSizeAndAspect(){const t=this.gl.drawingBufferWidth,e=this.gl.drawingBufferHeight;let i=1;const{canvas:r}=this.gl;return r&&r.clientHeight?i=r.clientWidth/r.clientHeight:t>0&&e>0&&(i=t/e),{width:t,height:e,aspect:i}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&$f(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new Q(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get("GPU Time").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){const{canvas:t}=this.gl;t&&(t.addEventListener("mousemove",this._onMousemove),t.addEventListener("mouseleave",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}}const _n="vs",Yr="fs";function pt(n,t){if(!n)throw new Error(t||"shadertools: assertion failed.")}const Hi={number:{validate(n,t){return Number.isFinite(n)&&(!("max"in t)||n<=t.max)&&(!("min"in t)||n>=t.min)}},array:{validate(n,t){return Array.isArray(n)||ArrayBuffer.isView(n)}}};function ep(n){const t={};for(const e in n){const i=n[e],r=np(i);t[e]=r}return t}function np(n){let t=xo(n);return t==="object"?n?"type"in n?Object.assign({},n,Hi[n.type]):"value"in n?(t=xo(n.value),Object.assign({type:t},n,Hi[t])):{type:"object",value:n}:{type:"object",value:null}:Object.assign({type:t,value:n},Hi[t])}function xo(n){return Array.isArray(n)||ArrayBuffer.isView(n)?"array":typeof n}const ip="vs",rp="fs";class Po{constructor(t){let{name:e,vs:i,fs:r,dependencies:s=[],uniforms:o,getUniforms:a,deprecations:c=[],defines:l={},inject:u={},vertexShader:d,fragmentShader:p}=t;pt(typeof e=="string"),this.name=e,this.vs=i||d,this.fs=r||p,this.getModuleUniforms=a,this.dependencies=s,this.deprecations=this._parseDeprecationDefinitions(c),this.defines=l,this.injections=sp(u),o&&(this.uniforms=ep(o))}getModuleSource(t){let e;switch(t){case ip:e=this.vs||"";break;case rp:e=this.fs||"";break;default:pt(!1)}return"#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),`
14`).concat(e,"// END MODULE_").concat(this.name,`
15
16`)}getUniforms(t,e){return this.getModuleUniforms?this.getModuleUniforms(t,e):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,e){this.deprecations.forEach(i=>
16{i.regex.test(t)&&(i.deprecated?e.deprecated(i.old,i.new)():e.removed(i.old,i.new)())})}_parseDeprecationDefinitions(t){return t.forEach(e=>{switch(e.type){case"function":e.regex=new RegExp("\\b".concat(e.old,"\\("));break;default:e.regex=new RegExp("".concat(e.type," ").concat(e.old,";"))}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e={},i=this.uniforms;for(const r in i){const s=i[r];r in t&&!s.private?(s.validate&&pt(s.validate(t[r],s),"".concat(this.name,": invalid ").concat(r)),e[r]=t[r]):e[r]=s.value}return e}}function sp(n){const t={vs:{},fs:{}};for(const e in n){let i=n[e];const r=e.slice(0,2);typeof i=="string"&&(i={order:0,injection:i}),t[r][e]=i}return t}function op(n){return ap(hc(n))}function ap(n){const t={},e={};return uc({modules:n,level:0,moduleMap:t,moduleDepth:e}),Object.keys(e).sort((i,r)=>e[r]-e[i]).map(i=>t[i])}function uc(n){let{modules:t,level:e,moduleMap:i,moduleDepth:r}=n;if(e>=5)throw new Error("Possible loop in shader dependency graph");for(const s of t)i[s.name]=s,(r[s.name]===void 0||r[s.name]<e)&&(r[s.name]=e);for(const s of t)s.dependencies&&uc({modules:s.dependencies,level:e+1,moduleMap:i,moduleDepth:r})}function hc(n,t){return n.map(e=>(e instanceof Po||(pt(typeof e!="string","Shader module use by name is deprecated. Import shader module '".concat(e,"' and use it directly.")),pt(e.name,"shader module has no name"),e=new Po(e),e.dependencies=hc(e.dependencies)),e))}function cp(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const t=typeof window<"u"?window.navigator||{}:{},e=n.userAgent||t.userAgent||"",i=e.indexOf("MSIE ")!==-1,r=e.indexOf("Trident/")!==-1;return i||r}const lp=7936,up=7937,hp=7938,fp=35724,qr={GLSL_FRAG_DATA:["WEBGL_draw_buffers",!0],GLSL_FRAG_DEPTH:["EXT_frag_depth",!0],GLSL_DERIVATIVES:["OES_standard_derivatives",!0],GLSL_TEXTURE_LOD:["EXT_shader_texture_lod",!0]},le={};Object.keys(qr).forEach(n=>{le[n]=n});function dp(n){return typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext?!0:!!(n&&n._version===2)}function gp(n){const t=n.getExtension("WEBGL_debug_renderer_info"),e=n.getParameter(t&&t.UNMASKED_VENDOR_WEBGL||lp),i=n.getParameter(t&&t.UNMASKED_RENDERER_WEBGL||up);return{gpuVendor:pp(e,i),vendor:e,renderer:i,version:n.getParameter(hp),shadingLanguageVersion:n.getParameter(fp)}}function pp(n,t){return n.match(/NVIDIA/i)||t.match(/NVIDIA/i)?"NVIDIA":n.match(/INTEL/i)||t.match(/INTEL/i)?"INTEL":n.match(/AMD/i)||t.match(/AMD/i)||n.match(/ATI/i)||t.match(/ATI/i)?"AMD":"UNKNOWN GPU"}const Wi={};function Lo(n,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=qr[t];if(pt(i,t),!cp(e))return!0;if(t in Wi)return Wi[t];const r=i[0],s=e.behavior||"enable",o="#extension GL_".concat(r," : ").concat(s,`
17void main(void) {}`),a=n.createShader(35633);n.shaderSource(a,o),n.compileShader(a);const c=n.getShaderParameter(a,35713);return n.deleteShader(a),Wi[t]=c,c}function mp(n,t){const e=qr[t];pt(e,t);const i=dp(n)&&e[1]||e[0],r=typeof i=="string"?!!n.getExtension(i):i;return pt(r===!1||r===!0),r}function Bn(n,t){return t=Array.isArray(t)?t:[t],t.every(e=>mp(n,e))}function _p(n){switch(gp(n).gpuVendor.toLowerCase()){case"nvidia":return`#define NVIDIA_GPU
18// Nvidia optimizes away the calculation necessary for emulated fp64
19#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
20`;case"intel":return`#define INTEL_GPU
21// Intel optimizes away the calculation necessary for emulated fp64
22#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
23// Intel's built-in 'tan' function doesn't have acceptable precision
24#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
25// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
26#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
27`;case"amd":return`#define AMD_GPU
28`;default:return`#define DEFAULT_GPU
29// Prevent driver from optimizing away the calculation necessary for emulated fp64
30#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
31// Intel's built-in 'tan' function doesn't have acceptable precision
32#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
33// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
34#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
35`}}function bp(n,t,e){let i=`#if (__VERSION__ > 120)
36
37# define FEATURE_GLSL_DERIVATIVES
38# define FEATURE_GLSL_DRAW_BUFFERS
39# define FEATURE_GLSL_FRAG_DEPTH
40# define FEATURE_GLSL_TEXTURE_LOD
41
42// DEPRECATED FLAGS, remove in v9
43# define FRAG_DEPTH
44# define DERIVATIVES
45# define DRAW_BUFFERS
46# define TEXTURE_LOD
47
48#endif // __VERSION
49`;return Bn(n,le.GLSL_FRAG_DEPTH)&&(i+=`
50// FRAG_DEPTH => gl_FragDepth is available
51#ifdef GL_EXT_frag_depth
52#extension GL_EXT_frag_depth : enable
53# define FEATURE_GLSL_FRAG_DEPTH
54# define FRAG_DEPTH
55# define gl_FragDepth gl_FragDepthEXT
56#endif
57`),Bn(n,le.GLSL_DERIVATIVES)&&Lo(n,le.GLSL_DERIVATIVES)&&(i+=`
58// DERIVATIVES => dxdF, dxdY and fwidth are available
59#ifdef GL_OES_standard_derivatives
60#extension GL_OES_standard_derivatives : enable
61# define FEATURE_GLSL_DERIVATIVES
62# define DERIVATIVES
63#endif
64`),Bn(n,le.GLSL_FRAG_DATA)&&Lo(n,le.GLSL_FRAG_DATA,{behavior:"require"})&&(i+=`
65// DRAW_BUFFERS => gl_FragData[] is available
66#ifdef GL_EXT_draw_buffers
67#extension GL_EXT_draw_buffers : require
68#define FEATURE_GLSL_DRAW_BUFFERS
69#define DRAW_BUFFERS
70#endif
71`),Bn(n,le.GLSL_TEXTURE_LOD)&&(i+=`// TEXTURE_LOD => texture2DLod etc are available
72#ifdef GL_EXT_shader_texture_lod
73#extension GL_EXT_shader_texture_lod : enable
74
75# define FEATURE_GLSL_TEXTURE_LOD
76# define TEXTURE_LOD
77
78#endif
79`),i}const yp=`#ifdef MODULE_LOGDEPTH
80  logdepth_adjustPosition(gl_Position);
81#endif
82`,vp=`#ifdef MODULE_MATERIAL
83  gl_FragColor = material_filterColor(gl_FragColor);
84#endif
85
86#ifdef MODULE_LIGHTING
87  gl_FragColor = lighting_filterColor(gl_FragColor);
88#endif
89
90#ifdef MODULE_FOG
91  gl_FragColor = fog_filterColor(gl_FragColor);
92#endif
93
94#ifdef MODULE_PICKING
95  gl_FragColor = picking_filterHighlightColor(gl_FragColor);
96  gl_FragColor = picking_filterPickingColor(gl_FragColor);
97#endif
98
99#ifdef MODULE_LOGDEPTH
100  logdepth_setFragDepth();
101#endif
102`,Ep={[_n]:yp,[Yr]:vp},qn="__LUMA_INJECT_DECLARATIONS__",Ro=/void\s+main\s*\([^)]*\)\s*\{\n?/,Io=/}\n?[^{}]*$/,Xi=[];function Mo(n,t,e){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const r=t===_n;for(const s in e){const o=e[s];o.sort((c,l)=>c.order-l.order),Xi.length=o.length;for(let c=0,l=o.length;c<l;++c)Xi[c]=o[c].injection;const a="".concat(Xi.join(`
103`),`
104`);switch(s){case"vs:#decl":r&&(n=n.replace(qn,a));break;
104case"vs:#main-start":r&&(n=n.replace(Ro,c=>c+a));break;case"vs:#main-end":r&&(n=n.replace(Io,c=>a+c));break;case"fs:#decl":r||(n=n.replace(qn,a));break;case"fs:#main-start":r||(n=n.replace(Ro,c=>c+a));break;case"fs:#main-end":r||(n=n.replace(Io,c=>a+c));break;default:n=n.replace(s,c=>c+a)}}return n=n.replace(qn,""),i&&(n=n.replace(/\}\s*$/,s=>s+Ep[t])),n}function mr(n){const t={};return pt(Array.isArray(n)&&n.length>1),n.forEach(e=>{for(const i in e)t[i]=t[i]?"".concat(t[i],`
105`).concat(e[i]):e[i]}),t}function Ce(n){return new RegExp("\\b".concat(n,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}const fc=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
106`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Tp=[...fc,[Ce("attribute"),"in $1"],[Ce("varying"),"out $1"]],wp=[...fc,[Ce("varying"),"in $1"]],dc=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Ap=[...dc,[Ce("in"),"attribute $1"],[Ce("out"),"varying $1"]],Sp=[...dc,[Ce("in"),"varying $1"]],_r="gl_FragColor",br=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,xp=/void\s+main\s*\([^)]*\)\s*\{\n?/;function Pp(n,t,e){switch(t){case 300:return e?ni(n,Tp):Lp(n);case 100:return e?ni(n,Ap):Rp(n);default:throw new Error("unknown GLSL version ".concat(t))}}function ni(n,t){for(const[e,i]of t)n=n.replace(e,i);return n}function Lp(n){n=ni(n,wp);const t=n.match(br);if(t){const e=t[1];n=n.replace(new RegExp("\\b".concat(_r,"\\b"),"g"),e)}else{const e="fragmentColor";n=n.replace(xp,i=>"out vec4 ".concat(e,`;
107`).concat(i)).replace(new RegExp("\\b".concat(_r,"\\b"),"g"),e)}return n}function Rp(n){n=ni(n,Sp);const t=n.match(br);if(t){const e=t[1];n=n.replace(br,"").replace(new RegExp("\\b".concat(e,"\\b"),"g"),_r)}return n}const Ip=`
108
109`.concat(qn,`
110
111`),gc={[_n]:"vertex",[Yr]:"fragment"},Mp=`precision highp float;
112
113`;function Cp(n,t){const{vs:e,fs:i}=t,r=op(t.modules||[]);return{gl:n,vs:Co(n,Object.assign({},t,{source:e,type:_n,modules:r})),fs:Co(n,Object.assign({},t,{source:i,type:Yr,modules:r})),getUniforms:Op(r)}}function Co(n,t){let{id:e,source:i,type:r,modules:s,defines:o={},hookFunctions:a=[],inject:c={},transpileToGLSL100:l=!1,prologue:u=!0,log:d}=t;pt(typeof i=="string","shader source must be a string");const p=r===_n,_=i.split(`
114`);let b=100,y="",E=i;_[0].indexOf("#version ")===0?(b=300,y=_[0],E=_.slice(1).join(`
115`)):y="#version ".concat(b);const T={};s.forEach(O=>{Object.assign(T,O.getDefines())}),Object.assign(T,o);let w=u?"".concat(y,`
116`).concat(kp({id:e,source:i,type:r}),`
117`).concat(Np({type:r}),`
118`).concat(_p(n),`
119`).concat(bp(n),`
120`).concat(Dp(T),`
121`).concat(p?"":Mp,`
122`):"".concat(y,`
123`);const A=Up(a),x={},L={},P={};for(const O in c){const U=typeof c[O]=="string"?{injection:c[O],order:0}:c[O],C=O.match(/^(v|f)s:(#)?([\w-]+)$/);if(C){const N=C[2],k=C[3];N?k==="decl"?L[O]=[U]:P[O]=[U]:x[O]=[U]}else P[O]=[U]}for(const O of s){d&&O.checkDeprecations(E,d);const U=O.getModuleSource(r,b);w+=U;const C=O.injections[r];for(const N in C){const k=N.match(/^(v|f)s:#([\w-]+)$/);if(k){const q=k[2]==="decl"?L:P;q[N]=q[N]||[],q[N].push(C[N])}else x[N]=x[N]||[],x[N].push(C[N])}}return w+=Ip,w=Mo(w,r,L),w+=Fp(A[r],x),w+=E,w=Mo(w,r,P),w=Pp(w,l?100:b,p),w}function Op(n){return function(e){const i={};for(const r of n){const s=r.getUniforms(e,i);Object.assign(i,s)}return i}}function Np(n){let{type:t}=n;return`
124#define SHADER_TYPE_`.concat(gc[t].toUpperCase(),`
125`)}function kp(n){let{id:t,source:e,type:i}=n;return t&&typeof t=="string"&&e.indexOf("SHADER_NAME")===-1?`
126#define SHADER_NAME `.concat(t,"_").concat(gc[i],`
127
128`):""}function Dp(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=0,e="";for(const i in n){t===0&&(e+=`
129// APPLICATION DEFINES
130`),t++;const r=n[i];(r||Number.isFinite(r))&&(e+="#define ".concat(i.toUpperCase()," ").concat(n[i],`
131`))}return t===0&&(e+=`
132`),e}function Fp(n,t){let e="";for(const i in n){const r=n[i];if(e+="void ".concat(r.signature,` {
133`),r.header&&(e+="  ".concat(r.header)),t[i]){const s=t[i];s.sort((o,a)=>o.order-a.order);for(const o of s)e+="  ".concat(o.injection,`
134`)}r.footer&&(e+="  ".concat(r.footer)),e+=`}
135`}return e}function Up(n){const t={vs:{},fs:{}};
135return n.forEach(e=>{let i;typeof e!="string"?(i=e,e=i.hook):i={},e=e.trim();const[r,s]=e.split(":"),o=e.replace(/\(.+/,"");t[r][o]=Object.assign(i,{signature:s})}),t}const Bp="void main() {gl_FragColor = vec4(0);}",pc=`out vec4 transform_output;
136void main() {
137  transform_output = vec4(0);
138}`,Vp=`#version 300 es
139`.concat(pc);function mc(n,t){t=Array.isArray(t)?t:[t];const e=n.replace(/^\s+/,"").split(/\s+/),[i,r,s]=e;if(!t.includes(i)||!r||!s)return null;const o=s.split(";")[0];return{qualifier:i,type:r,name:o}}function _c(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{version:t=100,input:e,inputType:i,output:r}=n;if(!e)return t===300?Vp:t>300?"#version ".concat(t,`
140`).concat(pc):Bp;const s=Gp(e,i);return t>=300?"#version ".concat(t," ").concat(t===300?"es":"",`
141in `).concat(i," ").concat(e,`;
142out vec4 `).concat(r,`;
143void main() {
144  `).concat(r," = ").concat(s,`;
145}`):"varying ".concat(i," ").concat(e,`;
146void main() {
147  gl_FragColor = `).concat(s,`;
148}`)}function jp(n){switch(n){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:return pt(!1),null}}function zp(n){switch(n){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:return pt(!1),null}}function Gp(n,t){switch(t){case"float":return"vec4(".concat(n,", 0.0, 0.0, 1.0)");case"vec2":return"vec4(".concat(n,", 0.0, 1.0)");case"vec3":return"vec4(".concat(n,", 1.0)");case"vec4":return n;default:return pt(!1),null}}const Hp=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
149const float TWO_PI = 6.2831854820251465;
150const float PI_2 = 1.5707963705062866;
151const float PI_16 = 0.1963495463132858;
152
153const float SIN_TABLE_0 = 0.19509032368659973;
154const float SIN_TABLE_1 = 0.3826834261417389;
155const float SIN_TABLE_2 = 0.5555702447891235;
156const float SIN_TABLE_3 = 0.7071067690849304;
157
158const float COS_TABLE_0 = 0.9807852506637573;
159const float COS_TABLE_1 = 0.9238795042037964;
160const float COS_TABLE_2 = 0.8314695954322815;
161const float COS_TABLE_3 = 0.7071067690849304;
162
163const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;
164const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;
165const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;
166const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;
167
168float sin_taylor_fp32(float a) {
169  float r, s, t, x;
170
171  if (a == 0.0) {
172    return 0.0;
173  }
174
175  x = -a * a;
176  s = a;
177  r = a;
178
179  r = r * x;
180  t = r * INVERSE_FACTORIAL_3;
181  s = s + t;
182
183  r = r * x;
184  t = r * INVERSE_FACTORIAL_5;
185  s = s + t;
186
187  r = r * x;
188  t = r * INVERSE_FACTORIAL_7;
189  s = s + t;
190
191  r = r * x;
192  t = r * INVERSE_FACTORIAL_9;
193  s = s + t;
194
195  return s;
196}
197
198void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
199  if (a == 0.0) {
200    sin_t = 0.0;
201    cos_t = 1.0;
202  }
203  sin_t = sin_taylor_fp32(a);
204  cos_t = sqrt(1.0 - sin_t * sin_t);
205}
206
207float tan_taylor_fp32(float a) {
208    float sin_a;
209    float cos_a;
210
211    if (a == 0.0) {
212        return 0.0;
213    }
214    float z = floor(a / TWO_PI);
215    float r = a - TWO_PI * z;
216
217    float t;
218    float q = floor(r / PI_2 + 0.5);
219    int j = int(q);
220
221    if (j < -2 || j > 2) {
222        return 1.0 / 0.0;
223    }
224
225    t = r - PI_2 * q;
226
227    q = floor(t / PI_16 + 0.5);
228    int k = int(q);
229    int abs_k = int(abs(float(k)));
230
231    if (abs_k > 4) {
232        return 1.0 / 0.0;
233    } else {
234        t = t - PI_16 * q;
235    }
236
237    float u = 0.0;
238    float v = 0.0;
239
240    float sin_t, cos_t;
241    float s, c;
242    sincos_taylor_fp32(t, sin_t, cos_t);
243
244    if (k == 0) {
245        s = sin_t;
246        c = cos_t;
247    } else {
248        if (abs(float(abs_k) - 1.0) < 0.5) {
249            u = COS_TABLE_0;
250            v = SIN_TABLE_0;
251        } else if (abs(float(abs_k) - 2.0) < 0.5) {
252            u = COS_TABLE_1;
253            v = SIN_TABLE_1;
254        } else if (abs(float(abs_k) - 3.0) < 0.5) {
255            u = COS_TABLE_2;
256            v = SIN_TABLE_2;
257        } else if (abs(float(abs_k) - 4.0) < 0.5) {
258            u = COS_TABLE_3;
259            v = SIN_TABLE_3;
260        }
261        if (k > 0) {
262            s = u * sin_t + v * cos_t;
263            c = u * cos_t - v * sin_t;
264        } else {
265            s = u * sin_t - v * cos_t;
266            c = u * cos_t + v * sin_t;
267        }
268    }
269
270    if (j == 0) {
271        sin_a = s;
272        cos_a = c;
273    } else if (j == 1) {
274        sin_a = c;
275        cos_a = -s;
276    } else if (j == -1) {
277        sin_a = -c;
278        cos_a = s;
279    } else {
280        sin_a = -s;
281        cos_a = -c;
282    }
283    return sin_a / cos_a;
284}
285#endif
286
287float tan_fp32(float a) {
288#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
289  return tan_taylor_fp32(a);
290#else
291  return tan(a);
292#endif
293}
294`,Wp={name:"fp32",vs:Hp,fs:null};function Oo(n,t){if(!n)throw new Error("math.gl assertion ".concat(t))}const yt={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function Xp(n,{precision:t=yt.precision}={}){return n=Yp(n),"".concat(parseFloat(n.toPrecision(t)))}function Oe(n){return Array.isArray(n)||ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Qt(n,t,e){return Zp(n,i=>Math.max(t,Math.min(e,i)))}function ii(n,t,e){return Oe(n)?n.map((i,r)=>ii(i,t[r],e)):e*t+(1-e)*n}function hn(n,t,e){const i=yt.EPSILON;try{if(n===t)return!0;
294if(Oe(n)&&Oe(t)){if(n.length!==t.length)return!1;for(let r=0;r<n.length;++r)if(!hn(n[r],t[r]))return!1;return!0}return n&&n.equals?n.equals(t):t&&t.equals?t.equals(n):typeof n=="number"&&typeof t=="number"?Math.abs(n-t)<=yt.EPSILON*Math.max(1,Math.abs(n),Math.abs(t)):!1}finally{yt.EPSILON=i}}function Yp(n){return Math.round(n/yt.EPSILON)*yt.EPSILON}function qp(n){return n.clone?n.clone():new Array(n.length)}function Zp(n,t,e){if(Oe(n)){const i=n;e=e||qp(i);for(let r=0;r<e.length&&r<i.length;++r)e[r]=t(n[r],r,e);return e}return t(n)}function Kp(n){function t(){var e=Reflect.construct(n,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return t.prototype=Object.create(n.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n,t}class bc extends Kp(Array){clone(){return new this.constructor().copy(this)}fromArray(t,e=0){for(let i=0;i<this.ELEMENTS;++i)this[i]=t[i+e];return this.check()}toArray(t=[],e=0){for(let i=0;i<this.ELEMENTS;++i)t[e+i]=this[i];return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:Oe(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(yt)}formatString(t){let e="";for(let i=0;i<this.ELEMENTS;++i)e+=(i>0?", ":"")+Xp(this[i],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!hn(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,i){if(i===void 0)return this.lerp(this,t,e);for(let r=0;r<this.ELEMENTS;++r){const s=t[r];this[r]=s+i*(e[r]-s)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],t[i]),e[i]);return this.check()}add(...t){for(const e of t)for(let i=0;i<this.ELEMENTS;++i)this[i]+=e[i];return this.check()}subtract(...t){for(const e of t)for(let i=0;i<this.ELEMENTS;++i)this[i]-=e[i];return this.check()}scale(t){if(typeof t=="number")for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;else for(let e=0;e<this.ELEMENTS&&e<t.length;++e)this[e]*=t[e];return this.check()}multiplyByScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}check(){if(yt.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.multiplyByScalar(1/t)}clampScalar(t,e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(Math.max(this[i],t),e);return this.check()}get elements(){return this}}function $p(n,t){if(n.length!==t)return!1;for(let e=0;e<n.length;++e)if(!Number.isFinite(n[e]))return!1;return!0}function dt(n){if(!Number.isFinite(n))throw new Error("Invalid number ".concat(n));return n}function Yi(n,t,e=""){if(yt.debug&&!$p(n,t))throw new Error("math.gl: ".concat(e," some fields set to invalid numbers'"));return n}class Qp extends bc{get x(){return this[0]}set x(t){this[0]=dt(t)}get y(){return this[1]}set y(t){this[1]=dt(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let i=0;i<this.ELEMENTS;++i){const r=this[i]-t[i];e+=r*r}return dt(e)}dot(t){let e=0;for(let i=0;i<this.ELEMENTS;++i)e+=this[i]*t[i];return dt(e)}normalize(){const t=this.magnitude();if(t!==0)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let i=0;i<this.ELEMENTS;++i)this[i]*=e[i];return this.check()}divide(...t){for(const e of t)for(let i=0;i<this.ELEMENTS;++i)this[i]/=e[i];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Oo(t>=0&&t<this.ELEMENTS,"index is out of range"),dt(this[t])}setComponent(t,e){return Oo(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Zn=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array;function Jp(){var n=new Ne(2);return Ne!=Float32Array&&(n[0]=0,n[1]=0),n}function No(n,t,e){return n[0]=t[0]+e[0],n[1]=t[1]+e[1],n}function tm(n,t){return n[0]=-t[0],n[1]=-t[1],n}function yc(n,t,e,i){var r=t[0],s=t[1];return n[0]=r+i*(e[0]-r),n[1]=s+i*(e[1]-s),n}function em(n,t,e){var i=t[0],r=t[1];return n[0]=e[0]*i+e[4]*r+e[12],n[1]=e[1]*i+e[5]*r+e[13],n}(function(){var n=Jp();
vendor: 17,087 bytes, lines 294-298
294return function(t,e,i,r,s,o){var a,c;for(e||(e=2),i||(i=0),r?c=Math.min(r*e+i,t.length):c=t.length,a=i;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],s(n,n,o),t[a]=n[0],t[a+1]=n[1];return t}})();function nm(n,t,e){const i=t[0],r=t[1],s=e[3]*i+e[7]*r||1;return n[0]=(e[0]*i+e[4]*r)/s,n[1]=(e[1]*i+e[5]*r)/s,n}function vc(n,t,e){const i=t[0],r=t[1],s=t[2],o=e[3]*i+e[7]*r+e[11]*s||1;return n[0]=(e[0]*i+e[4]*r+e[8]*s)/o,n[1]=(e[1]*i+e[5]*r+e[9]*s)/o,n[2]=(e[2]*i+e[6]*r+e[10]*s)/o,n}function im(n,t,e){const i=t[0],r=t[1];return n[0]=e[0]*i+e[2]*r,n[1]=e[1]*i+e[3]*r,n[2]=t[2],n}function rm(){var n=new Ne(3);return Ne!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function sm(n,t,e){return n[0]=t[0]-e[0],n[1]=t[1]-e[1],n[2]=t[2]-e[2],n}function om(n,t){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n}function am(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function cm(n,t,e){var i=t[0],r=t[1],s=t[2],o=e[0],a=e[1],c=e[2];return n[0]=r*c-s*a,n[1]=s*o-i*c,n[2]=i*a-r*o,n}function Ec(n,t,e){var i=t[0],r=t[1],s=t[2],o=e[3]*i+e[7]*r+e[11]*s+e[15];return o=o||1,n[0]=(e[0]*i+e[4]*r+e[8]*s+e[12])/o,n[1]=(e[1]*i+e[5]*r+e[9]*s+e[13])/o,n[2]=(e[2]*i+e[6]*r+e[10]*s+e[14])/o,n}function lm(n,t,e){var i=t[0],r=t[1],s=t[2];return n[0]=i*e[0]+r*e[3]+s*e[6],n[1]=i*e[1]+r*e[4]+s*e[7],n[2]=i*e[2]+r*e[5]+s*e[8],n}function um(n,t,e){var i=e[0],r=e[1],s=e[2],o=e[3],a=t[0],c=t[1],l=t[2],u=r*l-s*c,d=s*a-i*l,p=i*c-r*a;return u=u+u,d=d+d,p=p+p,n[0]=a+o*u+r*p-s*d,n[1]=c+o*d+s*u-i*p,n[2]=l+o*p+i*d-r*u,n}function hm(n,t,e,i){var r=[],s=[];return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],s[0]=r[0],s[1]=r[1]*Math.cos(i)-r[2]*Math.sin(i),s[2]=r[1]*Math.sin(i)+r[2]*Math.cos(i),n[0]=s[0]+e[0],n[1]=s[1]+e[1],n[2]=s[2]+e[2],n}function fm(n,t,e,i){var r=[],s=[];return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],s[0]=r[2]*Math.sin(i)+r[0]*Math.cos(i),s[1]=r[1],s[2]=r[2]*Math.cos(i)-r[0]*Math.sin(i),n[0]=s[0]+e[0],n[1]=s[1]+e[1],n[2]=s[2]+e[2],n}function dm(n,t,e,i){var r=[],s=[];return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],s[0]=r[0]*Math.cos(i)-r[1]*Math.sin(i),s[1]=r[0]*Math.sin(i)+r[1]*Math.cos(i),s[2]=r[2],n[0]=s[0]+e[0],n[1]=s[1]+e[1],n[2]=s[2]+e[2],n}function gm(n,t){var e=n[0],i=n[1],r=n[2],s=t[0],o=t[1],a=t[2],c=Math.sqrt((e*e+i*i+r*r)*(s*s+o*o+a*a)),l=c&&am(n,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var pm=sm;(function(){var n=rm();return function(t,e,i,r,s,o){var a,c;for(e||(e=3),i||(i=0),r?c=Math.min(r*e+i,t.length):c=t.length,a=i;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],s(n,n,o),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2];return t}})();const qi=[0,0,0];let Vn;class Nt extends Qp{static get ZERO(){return Vn||(Vn=new Nt(0,0,0),Object.freeze(Vn)),Vn}constructor(t=0,e=0,i=0){super(-0,-0,-0),arguments.length===1&&Oe(t)?this.copy(t):(yt.debug&&(dt(t),dt(e),dt(i)),this[0]=t,this[1]=e,this[2]=i)}set(t,e,i){return this[0]=t,this[1]=e,this[2]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return yt.debug&&(dt(t.x),dt(t.y),dt(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=dt(t)}angle(t){return gm(this,t)}cross(t){return cm(this,this,t),this.check()}rotateX({radians:t,origin:e=qi}){return hm(this,this,e,t),this.check()}rotateY({radians:t,origin:e=qi}){return fm(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=qi}){return dm(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Ec(this,this,t),this.check()}transformAsVector(t){return vc(this,this,t),this.check()}transformByMatrix3(t){return lm(this,this,t),this.check()}transformByMatrix2(t){return im(this,this,t),this.check()}transformByQuaternion(t){return um(this,this,t),this.check()}}class mm extends bc{toString(){let t="[";if(yt.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let i=0;i<this.RANK;++i)t+=" ".concat(this[i*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,i){return this[e*this.RANK+t]=dt(i),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const i=t*this.RANK;for(let r=0;r<this.RANK;++r)e[r]=this[i+r];return e}setColumn(t,e){const i=t*this.RANK;for(let r=0;r<this.RANK;++r)this[i+r]=e[r];return this}}function _m(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function bm(n,t){if(n===t){var e=t[1],i=t[2],r=t[3],s=t[6],o=t[7],a=t[11];n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=e,n[6]=t[9],n[7]=t[13],n[8]=i,n[9]=s,n[11]=t[14],n[12]=r,n[13]=o,n[14]=a}else n[0]=t[0],n[1]=t[4],n[2]=t[8],n[3]=t[12],n[4]=t[1],n[5]=t[5],n[6]=t[9],n[7]=t[13],n[8]=t[2],n[9]=t[6],n[10]=t[10],n[11]=t[14],n[12]=t[3],n[13]=t[7],n[14]=t[11],n[15]=t[15];return n}function yr(n,t){var e=t[0],i=t[1],r=t[2],s=t[3],o=t[4],a=t[5],c=t[6],l=t[7],u=t[8],d=t[9],p=t[10],_=t[11],b=t[12],y=t[13],E=t[14],T=t[15],w=e*a-i*o,A=e*c-r*o,x=e*l-s*o,L=i*c-r*a,P=i*l-s*a,O=r*l-s*c,U=u*y-d*b,C=u*E-p*b,N=u*T-_*b,k=d*E-p*y,W=d*T-_*y,q=p*T-_*E,B=w*q-A*W+x*k+L*N-P*C+O*U;return B?(B=1/B,n[0]=(a*q-c*W+l*k)*B,n[1]=(r*W-i*q-s*k)*B,n[2]=(y*O-E*P+T*L)*B,n[3]=(p*P-d*O-_*L)*B,n[4]=(c*N-o*q-l*C)*B,n[5]=(e*q-r*N+s*C)*B,n[6]=(E*x-b*O-T*A)*B,n[7]=(u*O-p*x+_*A)*B,n[8]=(o*W-a*N+l*U)*B,n[9]=(i*N-e*W-s*U)*B,n[10]=(b*P-y*x+T*w)*B,n[11]=(d*x-u*P-_*w)*B,n[12]=(a*C-o*k-c*U)*B,n[13]=(e*k-i*C+r*U)*B,n[14]=(y*A-b*L-E*w)*B,n[15]=(u*L-d*A+p*w)*B,n):null}function ym(n){var t=n[0],e=n[1],i=n[2],r=n[3],s=n[4],o=n[5],a=n[6],c=n[7],l=n[8],u=n[9],d=n[10],p=n[11],_=n[12],b=n[13],y=n[14],E=n[15],T=t*o-e*s,w=t*a-i*s,A=e*a-i*o,x=l*b-u*_,L=l*y-d*_,P=u*y-d*b,O=t*P-e*L+i*x,U=s*P-o*L+a*x,C=l*A-u*w+d*T,N=_*A-b*w+y*T;return c*O-r*U+E*C-p*N}function he(n,t,e){var i=t[0],r=t[1],s=t[2],o=t[3],a=t[4],c=t[5],l=t[6],u=t[7],d=t[8],p=t[9],_=t[10],b=t[11],y=t[12],E=t[13],T=t[14],w=t[15],A=e[0],x=e[1],L=e[2],P=e[3];return n[0]=A*i+x*a+L*d+P*y,n[1]=A*r+x*c+L*p+P*E,n[2]=A*s+x*l+L*_+P*T,n[3]=A*o+x*u+L*b+P*w,A=e[4],x=e[5],L=e[6],P=e[7],n[4]=A*i+x*a+L*d+P*y,n[5]=A*r+x*c+L*p+P*E,n[6]=A*s+x*l+L*_+P*T,n[7]=A*o+x*u+L*b+P*w,A=e[8],x=e[9],L=e[10],P=e[11],n[8]=A*i+x*a+L*d+P*y,n[9]=A*r+x*c+L*p+P*E,n[10]=A*s+x*l+L*_+P*T,n[11]=A*o+x*u+L*b+P*w,A=e[12],x=e[13],L=e[14],P=e[15],n[12]=A*i+x*a+L*d+P*y,n[13]=A*r+x*c+L*p+P*E,n[14]=A*s+x*l+L*_+P*T,n[15]=A*o+x*u+L*b+P*w,n}function ri(n,t,e){var i=e[0],r=e[1],s=e[2],o,a,c,l,u,d,p,_,b,y,E,T;return t===n?(n[12]=t[0]*i+t[4]*r+t[8]*s+t[12],n[13]=t[1]*i+t[5]*r+t[9]*s+t[13],n[14]=t[2]*i+t[6]*r+t[10]*s+t[14],n[15]=t[3]*i+t[7]*r+t[11]*s+t[15]):(o=t[0],a=t[1],c=t[2],l=t[3],u=t[4],d=t[5],p=t[6],_=t[7],b=t[8],y=t[9],E=t[10],T=t[11],n[0]=o,n[1]=a,n[2]=c,n[3]=l,n[4]=u,n[5]=d,n[6]=p,n[7]=_,n[8]=b,n[9]=y,n[10]=E,n[11]=T,n[12]=o*i+u*r+b*s+t[12],n[13]=a*i+d*r+y*s+t[13],n[14]=c*i+p*r+E*s+t[14],n[15]=l*i+_*r+T*s+t[15]),n}function Zr(n,t,e){var i=e[0],r=e[1],s=e[2];return n[0]=t[0]*i,n[1]=t[1]*i,n[2]=t[2]*i,n[3]=t[3]*i,n[4]=t[4]*r,n[5]=t[5]*r,n[6]=t[6]*r,n[7]=t[7]*r,n[8]=t[8]*s,n[9]=t[9]*s,n[10]=t[10]*s,n[11]=t[11]*s,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n}function vm(n,t,e,i){var r=i[0],s=i[1],o=i[2],a=Math.sqrt(r*r+s*s+o*o),c,l,u,d,p,_,b,y,E,T,w,A,x,L,P,O,U,C,N,k,W,q,B,ne;return a<Zn?null:(a=1/a,r*=a,s*=a,o*=a,c=Math.sin(e),l=Math.cos(e),u=1-l,d=t[0],p=t[1],_=t[2],b=t[3],y=t[4],E=t[5],T=t[6],w=t[7],A=t[8],x=t[9],L=t[10],P=t[11],O=r*r*u+l,U=s*r*u+o*c,C=o*r*u-s*c,N=r*s*u-o*c,k=s*s*u+l,W=o*s*u+r*c,q=r*o*u+s*c,B=s*o*u-r*c,ne=o*o*u+l,n[0]=d*O+y*U+A*C,n[1]=p*O+E*U+x*C,n[2]=_*O+T*U+L*C,n[3]=b*O+w*U+P*C,n[4]=d*N+y*k+A*W,n[5]=p*N+E*k+x*W,n[6]=_*N+T*k+L*W,n[7]=b*N+w*k+P*W,n[8]=d*q+y*B+A*ne,n[9]=p*q+E*B+x*ne,n[10]=_*q+T*B+L*ne,n[11]=b*q+w*B+P*ne,t!==n&&(n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n)}function Tc(n,t,e){var i=Math.sin(e),r=Math.cos(e),s=t[4],o=t[5],a=t[6],c=t[7],l=t[8],u=t[9],d=t[10],p=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=s*r+l*i,n[5]=o*r+u*i,n[6]=a*r+d*i,n[7]=c*r+p*i,n[8]=l*r-s*i,n[9]=u*r-o*i,n[10]=d*r-a*i,n[11]=p*r-c*i,n}function Em(n,t,e){var i=Math.sin(e),r=Math.cos(e),s=t[0],o=t[1],a=t[2],c=t[3],l=t[8],u=t[9],d=t[10],p=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=s*r-l*i,n[1]=o*r-u*i,n[2]=a*r-d*i,n[3]=c*r-p*i,n[8]=s*i+l*r,n[9]=o*i+u*r,n[10]=a*i+d*r,n[11]=c*i+p*r,n}function wc(n,t,e){var i=Math.sin(e),r=Math.cos(e),s=t[0],o=t[1],a=t[2],c=t[3],l=t[4],u=t[5],d=t[6],p=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=s*r+l*i,n[1]=o*r+u*i,n[2]=a*r+d*i,n[3]=c*r+p*i,n[4]=l*r-s*i,n[5]=u*r-o*i,n[6]=d*r-a*i,n[7]=p*r-c*i,n}function Tm(n,t){var e=t[0],i=t[1],r=t[2],s=t[3],o=e+e,a=i+i,c=r+r,l=e*o,u=i*o,d=i*a,p=r*o,_=r*a,b=r*c,y=s*o,E=s*a,T=s*c;return n[0]=1-d-b,n[1]=u+T,n[2]=p-E,n[3]=0,n[4]=u-T,n[5]=1-l-b,n[6]=_+y,n[7]=0,n[8]=p+E,n[9]=_-y,n[10]=1-l-d,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function wm(n,t,e,i,r,s,o){var a=1/(e-t),c=1/(r-i),l=1/(s-o);return n[0]=s*2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s*2*c,n[6]=0,n[7]=0,n[8]=(e+t)*a,n[9]=(r+i)*c,n[10]=(o+s)*l,n[11]=-1,n[12]=0,n[13]=0,n[14]=o*s*2*l,n[15]=0,n}function Am(n,t,e,i,r){var s=1/Math.tan(t/2);if(n[0]=s/e,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,r!=null&&r!==1/0){var o=1/(i-r);n[10]=(r+i)*o,n[14]=2*r*i*o}else n[10]=-1,n[14]=-2*i;return n}var Sm=Am;function xm(n,t,e,i,r,s,o){var a=1/(t-e),c=1/(i-r),l=1/(s-o);return n[0]=-2*a,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*c,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*l,n[11]=0,n[12]=(t+e)*a,n[13]=(r+i)*c,n[14]=(o+s)*l,n[15]=1,n}var Pm=xm;function Lm(n,t,e,i){var r,s,o,a,c,l,u,d,p,_,b=t[0],y=t[1],E=t[2],T=i[0],w=i[1],A=i[2],x=e[0],L=e[1],P=e[2];return Math.abs(b-x)<Zn&&Math.abs(y-L)<Zn&&Math.abs(E-P)<Zn?_m(n):(u=b-x,d=y-L,p=E-P,_=1/Math.sqrt(u*u+d*d+p*p),u*=_,d*=_,p*=_,r=w*p-A*d,s=A*u-T*p,o=T*d-w*u,_=Math.sqrt(r*r+s*s+o*o),_?(_=1/_,r*=_,s*=_,o*=_):(r=0,s=0,o=0),a=d*o-p*s,c=p*r-u*o,l=u*s-d*r,_=Math.sqrt(a*a+c*c+l*l),_?(_=1/_,a*=_,c*=_,l*=_):(a=0,c=0,l=0),n[0]=r,n[1]=a,n[2]=u,n[3]=0,n[4]=s,n[5]=c,n[6]=d,n[7]=0,n[8]=o,n[9]=l,n[10]=p,n[11]=0,n[12]=-(r*b+s*y+o*E),n[13]=-(a*b+c*y+l*E),n[14]=-(u*b+d*y+p*E),n[15]=1,n)}function Rm(){var n=new Ne(4);return Ne!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function Im(n,t,e){return n[0]=t[0]*e,n[1]=t[1]*e,n[2]=t[2]*e,n[3]=t[3]*e,n}function bn(n,t,e){var i=t[0],r=t[1],s=t[2],o=t[3];return n[0]=e[0]*i+e[4]*r+e[8]*s+e[12]*o,n[1]=e[1]*i+e[5]*r+e[9]*s+e[13]*o,n[2]=e[2]*i+e[6]*r+e[10]*s+e[14]*o,n[3]=e[3]*i+e[7]*r+e[11]*s+e[15]*o,n}(function(){var n=Rm();return function(t,e,i,r,s,o){var a,c;for(e||(e=4),i||(i=0),r?c=Math.min(r*e+i,t.length):c=t.length,a=i;a<c;a+=e)n[0]=t[a],n[1]=t[a+1],n[2]=t[a+2],n[3]=t[a+3],s(n,n,o),t[a]=n[0],t[a+1]=n[1],t[a+2]=n[2],t[a+3]=n[3];return t}})();var vr;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL0ROW3=3]="COL0ROW3",n[n.COL1ROW0=4]="COL1ROW0",n[n.COL1ROW1=5]="COL1ROW1",n[n.COL1ROW2=6]="COL1ROW2",n[n.COL1ROW3=7]="COL1ROW3",n[n.COL2ROW0=8]="COL2ROW0",n[n.COL2ROW1=9]="COL2ROW1",n[n.COL2ROW2=10]="COL2ROW2",n[n.COL2ROW3=11]="COL2ROW3",n[n.COL3ROW0=12]="COL3ROW0",n[n.COL3ROW1=13]="COL3ROW1",n[n.COL3ROW2=14]="COL3ROW2",n[n.COL3ROW3=15]="COL3ROW3"})(vr||(vr={}));const Mm=45*Math.PI/180,Cm=1,Zi=.1,Ki=500,Om=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class kt extends mm{static get IDENTITY(){return km()}static get ZERO(){return Nm()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return vr}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,i,r,s,o,a,c,l,u,d,p,_,b,y,E){return this[0]=t,this[1]=e,this[2]=i,this[3]=r,this[4]=s,this[5]=o,this[6]=a,this[7]=c,this[8]=l,this[9]=u,this[10]=d,this[11]=p,this[12]=_,this[13]=b,this[14]=y,this[15]=E,this.check()}setRowMajor(t,e,i,r,s,o,a,c,l,u,d,p,_,b,y,E){return this[0]=t,this[1]=s,this[2]=l,this[3]=_,this[4]=e,this[5]=o,this[6]=u,this[7]=b,this[8]=i,this[9]=a,this[10]=d,this[11]=y,this[12]=r,this[13]=c,this[14]=p,this[15]=E,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(Om)}fromObject(t){return this.check()}fromQuaternion(t){return Tm(this,t),this.check()}frustum(t){const{left:e,right:i,bottom:r,top:s,near:o=Zi,far:a=Ki}=t;return a===1/0?Dm(this,e,i,r,s,o):wm(this,e,i,r,s,o,a),this.check()}lookAt(t){const{eye:e,center:i=[0,0,0],up:r=[0,1,0]}=t;return Lm(this,e,i,r),this.check()}ortho(t){const{left:e,right:i,bottom:r,top:s,near:o=Zi,far:a=Ki}=t;return Pm(this,e,i,r,s,o,a),this.check()}orthographic(t){const{fovy:e=Mm,aspect:i=Cm,focalDistance:r=1,near:s=Zi,far:o=Ki}=t;ko(e);const a=e/2,c=r*Math.tan(a),l=c*i;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:s,far:o})}perspective(t){const{fovy:e=45*Math.PI/180,aspect:i=1,near:r=.1,far:s=500}=t;return ko(e),Sm(this,e,i,r,s),this.check()}determinant(){return ym(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const i=this.getScale(e),r=1/i[0],s=1/i[1],o=1/i[2];return t[0]=this[0]*r,t[1]=this[1]*s,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*s,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*s,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const i=this.getScale(e),r=1/i[0],s=1/i[1],o=1/i[2];return t[0]=this[0]*r,t[1]=this[1]*s,t[2]=this[2]*o,t[3]=this[4]*r,t[4]=this[5]*s,t[5]=this[6]*o,t[6]=this[8]*r,t[7]=this[9]*s,t[8]=this[10]*o,t}transpose(){return bm(this,this),this.check()}invert(){return yr(this,this),this.check()}multiplyLeft(t){return he(this,t,this),this.check()}multiplyRight(t){return he(this,this,t),this.check()}rotateX(t){return Tc(this,this,t),this.check()}rotateY(t){return Em(this,this,t),this.check()}rotateZ(t){return wc(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return vm(this,this,t,e),this.check()}scale(t){return Zr(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return ri(this,this,t),this.check()}transform(t,e){return t.length===4?(e=bn(e||[-0,-0,-0,-0],t,this),Yi(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:i}=t;let r;switch(i){case 2:r=em(e||[-0,-0],t,this);break;case 3:r=Ec(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Yi(r,t.length),r}transformAsVector(t,e){let i;switch(t.length){case 2:i=nm(e||[-0,-0],t,this);break;case 3:i=vc(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Yi(i,t.length),i}transformPoint(t,e){return this.transformAsPoint(t,e)}transformVector(t,e){return this.transformAsPoint(t,e)}transformDirection(t,e){return this.transformAsVector(t,e)}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,i){return this.identity().translate([t,e,i])}}let jn,zn;function Nm(){return jn||(jn=new kt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(jn)),jn}function km(){return zn||(zn=new kt,Object.freeze(zn)),zn}function ko(n){if(n>Math.PI*2)throw Error("expected radians")}function Dm(n,t,e,i,r,s){const o=2*s/(e-t),a=2*s/(r-i),c=(e+t)/(e-t),l=(r+i)/(r-i),u=-1,d=-1,p=-2*s;return n[0]=o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=a,n[6]=0,n[7]=0,n[8]=c,n[9]=l,n[10]=u,n[11]=d,n[12]=0,n[13]=0,n[14]=p,n[15]=0,n}const Fm=new Uint8Array([0,255,255,255]),Um={pickingSelectedColor:null,pickingHighlightColor:Fm,pickingActive:!1,pickingAttribute:!1};function Bm(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Um;const t={};if(n.pickingSelectedColor!==void 0)if(!n.pickingSelectedColor)t.picking_uSelectedColorValid=0;else{const e=n.pickingSelectedColor.slice(0,3);t.picking_uSelectedColorValid=1,t.picking_uSelectedColor=e}if(n.pickingHighlightColor){const e=Array.from(n.pickingHighlightColor,i=>i/255);Number.isFinite(e[3])||(e[3]=1),t.picking_uHighlightColor=e}return n.pickingActive!==void 0&&(t.picking_uActive=!!n.pickingActive,t.picking_uAttribute=!!n.pickingAttribute),t}const Vm=`uniform bool picking_uActive;
295uniform bool picking_uAttribute;
296uniform vec3 picking_uSelectedColor;
297uniform bool picking_uSelectedColorValid;
298
299out vec4 picking_vRGBcolor_Avalid;
300
301const float COLOR_SCALE = 1. / 255.;
302
303bool picking_isColorValid(vec3 color) {
304  return dot(color, vec3(1.0)) > 0.001;
305}
306
307bool isVertexPicked(vec3 vertexColor) {
308  return
309    picking_uSelectedColorValid &&
310    !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));
311}
312
313void picking_setPickingColor(vec3 pickingColor) {
314  if (picking_uActive) {
315    picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));
316
317    if (!picking_uAttribute) {
318      picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;
319    }
320  } else {
321    picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));
322  }
323}
324
325void picking_setPickingAttribute(float value) {
326  if (picking_uAttribute) {
327    picking_vRGBcolor_Avalid.r = value;
328  }
329}
330void picking_setPickingAttribute(vec2 value) {
331  if (picking_uAttribute) {
332    picking_vRGBcolor_Avalid.rg = value;
333  }
334}
335void picking_setPickingAttribute(vec3 value) {
336  if (picking_uAttribute) {
337    picking_vRGBcolor_Avalid.rgb = value;
338  }
339}
340`,jm=`uniform bool picking_uActive;
341uniform vec3 picking_uSelectedColor;
342uniform vec4 picking_uHighlightColor;
343
344in vec4 picking_vRGBcolor_Avalid;
345vec4 picking_filterHighlightColor(vec4 color) {
346  if (picking_uActive) {
347    return color;
348  }
349  bool selected = bool(picking_vRGBcolor_Avalid.a);
350
351  if (selected) {
352    float highLightAlpha = picking_uHighlightColor.a;
353    float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
354    float highLightRatio = highLightAlpha / blendedAlpha;
355
356    vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);
357    return vec4(blendedRGB, blendedAlpha);
358  } else {
359    return color;
360  }
361}
362vec4 picking_filterPickingColor(vec4 color) {
363  if (picking_uActive) {
364    if (picking_vRGBcolor_Avalid.a == 0.0) {
365      discard;
366    }
367    return picking_vRGBcolor_Avalid;
368  }
369  return color;
370}
371vec4 picking_filterColor(vec4 color) {
372  vec4 highightColor = picking_filterHighlightColor(color);
373  return picking_filterPickingColor(highightColor);
374}
375
376`,zm={name:"picking",vs:Vm,fs:jm,getUniforms:Bm},Gm=`attribute float transform_elementID;
377vec2 transform_getPixelSizeHalf(vec2 size) {
378  return vec2(1.) / (2. * size);
379}
380
381vec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {
382  float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);
383  float xIndex = transform_elementID - (yIndex * texSize[0]);
384  return vec2(xIndex, yIndex);
385}
386vec2 transform_getTexCoord(vec2 size) {
387  vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);
388  vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);
389  vec2 coord = indices / size + pixelSizeHalf;
390  return coord;
391}
392vec2 transform_getPos(vec2 size) {
393  vec2 texCoord = transform_getTexCoord(size);
394  vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);
395  return pos;
396}
397vec4 transform_getInput(sampler2D texSampler, vec2 size) {
398  vec2 texCoord = transform_getTexCoord(size);
399  vec4 textureColor = texture2D(texSampler, texCoord);
400  return textureColor;
401}
402`,Hm={name:"transform",vs:Gm,fs:null};class yn{static getDefaultProgramManager(t){return t.luma=t.luma||{},t.luma.defaultProgramManager=t.luma.defaultProgramManager||new yn(t),t.luma.defaultProgramManager}constructor(t){this.gl=t,this._programCache={},this._getUniforms={},this._registeredModules={},this._hookFunctions=[],this._defaultModules=[],this._hashes={},this._hashCounter=0,this.stateHash=0,this._useCounts={}}addDefaultModule(t){this._defaultModules.find(e=>e.name===t.name)||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){const e=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(i=>i.name!==e),this.stateHash++}addShaderHook(t,e){e&&(t=Object.assign(e,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{vs:e="",fs:i="",defines:r={},inject:s={},varyings:o=[],bufferMode:a=35981,transpileToGLSL100:c=!1}=t,l=this._getModuleList(t.modules),u=this._getHash(e),d=this._getHash(i),p=l.map(A=>this._getHash(A.name)).sort(),_=o.map(A=>this._getHash(A)),b=Object.keys(r).sort(),y=Object.keys(s).sort(),E=[],T=[];for(const A of b)E.push(this._getHash(A)),E.push(this._getHash(r[A]));for(const A of y)T.push(this._getHash(A)),T.push(this._getHash(s[A]));const w="".concat(u,"/").concat(d,"D").concat(E.join("/"),"M").concat(p.join("/"),"I").concat(T.join("/"),"V").concat(_.join("/"),"H").concat(this.stateHash,"B").concat(a).concat(c?"T":"");
402if(!this._programCache[w]){const A=Cp(this.gl,{vs:e,fs:i,modules:l,inject:s,defines:r,hookFunctions:this._hookFunctions,transpileToGLSL100:c});this._programCache[w]=new cc(this.gl,{hash:w,vs:A.vs,fs:A.fs,varyings:o,bufferMode:a}),this._getUniforms[w]=A.getUniforms||(x=>{}),this._useCounts[w]=0}return this._useCounts[w]++,this._programCache[w]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){const e=t.hash;this._useCounts[e]--,this._useCounts[e]===0&&(this._programCache[e].delete(),delete this._programCache[e],delete this._getUniforms[e],delete this._useCounts[e])}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];const e=new Array(this._defaultModules.length+t.length),i={};let r=0;for(let s=0,o=this._defaultModules.length;s<o;++s){const a=this._defaultModules[s],c=a.name;e[r++]=a,i[c]=!0}for(let s=0,o=t.length;s<o;++s){const a=t[s],c=a.name;i[c]||(e[r++]=a,i[c]=!0)}return e.length=r,e}}const Wm={POSITION:"positions",NORMAL:"normals",COLOR_0:"colors",TEXCOORD_0:"texCoords",TEXCOORD_1:"texCoords1",TEXCOORD_2:"texCoords2"};function Xm(n,t,e){const i={};let r=t.indices;for(const s in t.attributes){const o=t.attributes[s],a=Ym(s);if(s==="indices")r=o;else if(o.constant)i[a]=o.value;else{const c=o.value,l={...o};delete l.value,i[a]=[new j(n,c),l],qm(s,l)}}if(r){const s=r.value||r;R(s instanceof Uint16Array||s instanceof Uint32Array,'attribute array for "indices" must be of integer type');const o={size:1,isIndexed:r.isIndexed===void 0?!0:r.isIndexed};i.indices=[new j(n,{data:s,target:34963}),o]}return i}function Ym(n,t){const{attributeMap:e=Wm}={};return e&&e[n]||n}function qm(n,t){let e;switch(n){case"texCoords":case"texCoord1":case"texCoord2":case"texCoord3":e="uvs";break;case"vertices":case"positions":case"normals":case"pickingColors":e="vectors";break}switch(e){case"vectors":t.size=t.size||3;break;case"uvs":t.size=t.size||2;break}R(Number.isFinite(t.size),"attribute ".concat(n," needs size"))}const Ee=2,Zm=1e4,Km="Model needs drawMode and vertexCount",Do=()=>{},$m={};class Kr{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{id:i=ee("model")}=e;R(gi(t)),this.id=i,this.gl=t,this.id=e.id||ee("Model"),this.lastLogTime=0,this.animated=!1,this.initialize(e)}initialize(t){this.props={},this.programManager=t.programManager||yn.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;const{program:e=null,vs:i,fs:r,modules:s,defines:o,inject:a,varyings:c,bufferMode:l,transpileToGLSL100:u}=t;this.programProps={program:e,vs:i,fs:r,modules:s,defines:o,inject:a,varyings:c,bufferMode:l,transpileToGLSL100:u},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=t.drawMode!==void 0?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},R(this.drawMode!==void 0&&Number.isFinite(this.vertexCount),Km)}setProps(t){this._setModelProps(t)}delete(){for(const t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){const{program:e,vs:i,fs:r,modules:s,defines:o,inject:a,varyings:c,bufferMode:l,transpileToGLSL100:u}=t;this.programProps={program:e,vs:i,fs:r,modules:s,defines:o,inject:a,varyings:c,bufferMode:l,transpileToGLSL100:u},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return R(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return R(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=Xm(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ie(t))return this;const e={};for(const i in t){const r=t[i];e[i]=r.getValue?r.getValue():r}return this.vertexArray.setAttributes(e),this}setUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();const e=this.programManager.getUniforms(this.program);return e?e(t):{}}updateModuleSettings(t){const e=this.getModuleUniforms(t||{});return this.setUniforms(e)}clear(t){return Wr(this.program.gl,t),this}draw(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._checkProgram();const{moduleSettings:e=null,framebuffer:i,uniforms:r={},attributes:s={},transformFeedback:o=this.transformFeedback,parameters:a={},vertexArray:c=this.vertexArray}=t;this.setAttributes(s),this.updateModuleSettings(e),this.setUniforms(r);let l;M.priority>=Ee&&(l=this._logDrawCallStart(Ee));const u=this.vertexArray.getDrawParams(),{isIndexed:d=u.isIndexed,indexType:p=u.indexType,indexOffset:_=u.indexOffset,vertexArrayInstanced:b=u.isInstanced}=this.props;b&&!this.isInstanced&&M.warn("Found instanced attributes on non-instanced model",this.id)();const{isInstanced:y,instanceCount:E}=this,{onBeforeRender:T=Do,onAfterRender:w=Do}=this.props;T(),this.program.setUniforms(this.uniforms);const A=this.program.draw(Object.assign($m,t,{logPriority:l,uniforms:null,framebuffer:i,parameters:a,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:c,transformFeedback:o,isIndexed:d,indexType:p,isInstanced:y,instanceCount:E,offset:d?_:0}));return w(),M.priority>=Ee&&this._logDrawCallEnd(l,c,i),A}transform(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{discard:e=!0,feedbackBuffers:i,unbindModels:r=[]}=t;let{parameters:s}=t;i&&this._setFeedbackBuffers(i),e&&(s=Object.assign({},s,{35977:e})),r.forEach(o=>o.vertexArray.unbindBuffers());try{this.draw(Object.assign({},t,{parameters:s}))}finally{r.forEach(o=>o.vertexArray.bindBuffers())}return this}render(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return M.warn("Model.render() is deprecated. Use Model.setUniforms() and Model.draw()")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),"uniforms"in t&&this.setUniforms(t.uniforms),"pickable"in t&&(this.pickable=t.pickable),"instanceCount"in t&&(this.instanceCount=t.instanceCount),"geometry"in t&&this.setGeometry(t.geometry),"attributes"in t&&this.setAttributes(t.attributes),"_feedbackBuffers"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:e}=this.programProps;if(e)this._managedProgram=!1;else{const{vs:i,fs:r,modules:s,inject:o,defines:a,varyings:c,bufferMode:l,transpileToGLSL100:u}=this.programProps;e=this.programManager.get({vs:i,fs:r,modules:s,inject:o,defines:a,varyings:c,bufferMode:l,transpileToGLSL100:u}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}R(e instanceof cc,"Model needs a program"),this._programDirty=!1,e!==this.program&&(this.program=e,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new Yg(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(const t in this.geometryBuffers){const e=this.geometryBuffers[t][0]||this.geometryBuffers[t];e instanceof j&&e.delete()}}_setAnimationProps(t){this.animated&&R(t,"Model.draw(): animated uniforms but no animationProps")}_setFeedbackBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ie(t))return this;const{gl:e}=this.program;return this.transformFeedback=this.transformFeedback||new lc(e,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){const e=t>3?0:Zm;
402if(!(Date.now()-this.lastLogTime<e))return this.lastLogTime=Date.now(),M.group(Ee,">>> DRAWING MODEL ".concat(this.id),{collapsed:M.level<=2})(),t}_logDrawCallEnd(t,e,i,r){if(t===void 0)return;const s=Kg({vertexArray:e,header:"".concat(this.id," attributes"),attributes:this._attributes}),{table:o,unusedTable:a,unusedCount:c}=To({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i)}),{table:l,count:u}=To({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,i),undefinedOnly:!0});u>0&&M.log("MISSING UNIFORMS",Object.keys(l))(),c>0&&M.log("UNUSED UNIFORMS",Object.keys(a))();const d=Qg(this.vertexArray.configuration);M.table(t,s)(),M.table(t,o)(),M.table(t+1,d)(),r&&r.log({logLevel:Ee,message:"Rendered to ".concat(r.id)}),M.groupEnd(Ee)()}}class Qm{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}setupResources(t){for(const e of this.bindings)this._setupTransformFeedback(e,t)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{varyings:e}=this;return e.length>0&&(t=Object.assign({},t,{varyings:e})),t}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e=this.bindings[this.currentIndex],{sourceBuffers:i,transformFeedback:r}=e;return{attributes:Object.assign({},i,t.attributes),transformFeedback:r}}swap(){return this.feedbackMap?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t)}getBuffer(t){const{feedbackBuffers:e}=this.bindings[this.currentIndex],i=t?e[t]:null;return i?i instanceof j?i:i.buffer:null}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{varyingName:e}=t,i=this.getBuffer(e);return i?i.getData():null}delete(){for(const t in this.resources)this.resources[t].delete()}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&R(F(this.gl))}_getFeedbackBuffers(t){const{sourceBuffers:e={}}=t,i={};if(this.bindings[this.currentIndex]&&Object.assign(i,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(const r in this.feedbackMap){const s=this.feedbackMap[r];r in e&&(i[s]=r)}Object.assign(i,t.feedbackBuffers);for(const r in i){const s=i[r];if(typeof s=="string"){const o=e[s],{byteLength:a,usage:c,accessor:l}=o;i[r]=this._createNewBuffer(r,{byteLength:a,usage:c,accessor:l})}}return i}_setupBuffers(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{sourceBuffers:e=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);const i=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:e,feedbackBuffers:i})}_setupTransformFeedback(t,e){let{model:i}=e;const{program:r}=i;t.transformFeedback=new lc(this.gl,{program:r,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){const{sourceBuffers:e,feedbackBuffers:i}=this._swapBuffers(this.bindings[this.currentIndex]),r=this._getNextIndex();this.bindings[r]=this._updateBinding(this.bindings[r],{sourceBuffers:e,feedbackBuffers:i})}}_updateBinding(t,e){return t?(Object.assign(t.sourceBuffers,e.sourceBuffers),Object.assign(t.feedbackBuffers,e.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},e.sourceBuffers),feedbackBuffers:Object.assign({},e.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;const e=Object.assign({},t.sourceBuffers),i=Object.assign({},t.feedbackBuffers);for(const r in this.feedbackMap){const s=this.feedbackMap[r];e[r]=t.feedbackBuffers[s],i[s]=t.sourceBuffers[r],R(i[s]instanceof j)}return{sourceBuffers:e,feedbackBuffers:i}}_createNewBuffer(t,e){const i=new j(this.gl,e);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=i,i}_getNextIndex(){return(this.currentIndex+1)%2}}const Jm="transform_uSampler_",si="transform_uSize_",Fo="transform_position";function t_(n){let{vs:t,sourceTextureMap:e,targetTextureVarying:i,targetTexture:r}=n,o=Object.keys(e).length,a=null;const c={};let l=t,u={};if(o>0||i){const d=l.split(`
403`),p=d.slice();
403if(d.forEach((_,b,y)=>{if(o>0){const E=s_(_,e);if(E){const{updatedLine:T,inject:w}=E;p[b]=T,u=mr([u,w]),Object.assign(c,E.samplerTextureMap),o--}}i&&!a&&(a=r_(_,i))}),i){R(r);const _="".concat(si).concat(i),b="uniform vec2 ".concat(_,`;
404`),y="     vec2 ".concat(Fo," = transform_getPos(").concat(_,`);
405     gl_Position = vec4(`).concat(Fo,`, 0, 1.);
406`);u=mr([u,{"vs:#decl":b,"vs:#main-start":y}])}l=p.join(`
407`)}return{vs:l,targetTextureType:a,inject:u,samplerTextureMap:c}}function e_(n){let{sourceTextureMap:t,targetTextureVarying:e,targetTexture:i}=n;const r={};let s,o;e&&({width:s,height:o}=i,r["".concat(si).concat(e)]=[s,o]);for(const a in t)({width:s,height:o}=t[a]),r["".concat(si).concat(a)]=[s,o];return r}function n_(n){return mc(n,["attribute","in"])}function i_(n){const t="".concat(Jm).concat(n),e="".concat(si).concat(n),i="  uniform sampler2D ".concat(t,`;
408  uniform vec2 `).concat(e,";");return{samplerName:t,sizeName:e,uniformDeclerations:i}}function r_(n,t){const e=mc(n,["varying","out"]);return e&&e.name===t?e.type:null}function s_(n,t){const e={},i=n_(n);if(!i)return null;const{type:r,name:s}=i;if(s&&t[s]){const o="// ".concat(n," => Replaced by Transform with a sampler"),{samplerName:a,sizeName:c,uniformDeclerations:l}=i_(s),u=jp(r),d="  ".concat(r," ").concat(s," = transform_getInput(").concat(a,", ").concat(c,").").concat(u,`;
409`);return e[a]=s,{updatedLine:o,inject:{"vs:#decl":l,"vs:#main-start":d},samplerTextureMap:e}}return null}const o_={10241:9728,10240:9728,10242:33071,10243:33071},a_="transform_output";class c_{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}updateModelProps(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e=this._processVertexShader(t);return Object.assign({},t,e)}getDrawOptions(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{sourceBuffers:e,sourceTextures:i,framebuffer:r,targetTexture:s}=this.bindings[this.currentIndex],o=Object.assign({},e,t.attributes),a=Object.assign({},t.uniforms),c=Object.assign({},t.parameters);let l=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(const d in this.samplerTextureMap){const p=this.samplerTextureMap[d];a[d]=i[p]}this._setSourceTextureParameters();const u=e_({sourceTextureMap:i,targetTextureVarying:this.targetTextureVarying,targetTexture:s});Object.assign(a,u)}return this.hasTargetTexture&&(l=!1,c.viewport=[0,0,r.width,r.height]),{attributes:o,framebuffer:r,uniforms:a,discard:l,parameters:c}}swap(){return this._swapTexture?(this.currentIndex=this._getNextIndex(),!0):!1}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this._setupTextures(t)}getTargetTexture(){const{targetTexture:t}=this.bindings[this.currentIndex];return t}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{framebuffer:e}=this.bindings[this.currentIndex],i=mi(e);if(!t)return i;const r=i.constructor,s=zp(this.targetTextureType),o=new r(i.length*s/4);let a=0;for(let c=0;c<i.length;c+=4)for(let l=0;l<s;l++)o[a++]=i[c+l];return o}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}delete(){this.ownTexture&&this.ownTexture.delete(),this.elementIDBuffer&&this.elementIDBuffer.delete()}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{_targetTextureVarying:e,_swapTexture:i}=t;this._swapTexture=i,this.targetTextureVarying=e,this.hasTargetTexture=e,this._setupTextures(t)}_createTargetTexture(t){const{sourceTextures:e,textureOrReference:i}=t;if(i instanceof At)return i;const r=e[i];return r?(this._targetRefTexName=i,this._createNewTexture(r)):null}_setupTextures(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{sourceBuffers:e,_sourceTextures:i={},_targetTexture:r}=t,s=this._createTargetTexture({sourceTextures:i,textureOrReference:r});this.hasSourceTextures=this.hasSourceTextures||i&&Object.keys(i).length>0,this._updateBindings({sourceBuffers:e,sourceTextures:i,targetTexture:s}),"elementCount"in t&&this._updateElementIDBuffer(t.elementCount)}
409_updateElementIDBuffer(t){if(typeof t!="number"||this.elementCount>=t)return;const e=new Float32Array(t);e.forEach((i,r,s)=>{s[r]=r}),this.elementIDBuffer?this.elementIDBuffer.setData({data:e}):this.elementIDBuffer=new j(this.gl,{data:e,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){const{sourceTextures:e,targetTexture:i}=this._swapTextures(this.bindings[this.currentIndex]),r=this._getNextIndex();this.bindings[r]=this._updateBinding(this.bindings[r],{sourceTextures:e,targetTexture:i})}}_updateBinding(t,e){const{sourceBuffers:i,sourceTextures:r,targetTexture:s}=e;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,r),Object.assign(t.sourceBuffers,i),s){t.targetTexture=s;const{width:o,height:a}=s,{framebuffer:c}=t;c?(c.update({attachments:{36064:s},resizeAttachments:!1}),c.resize({width:o,height:a})):t.framebuffer=new Q(this.gl,{id:"transform-framebuffer",width:o,height:a,attachments:{36064:s}})}return t}_setSourceTextureParameters(){const t=this.currentIndex,{sourceTextures:e}=this.bindings[t];for(const i in e)e[i].setParameters(o_)}_swapTextures(t){if(!this._swapTexture)return null;const e=Object.assign({},t.sourceTextures);e[this._swapTexture]=t.targetTexture;const i=t.sourceTextures[this._swapTexture];return{sourceTextures:e,targetTexture:i}}_createNewTexture(t){const e=Dd(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=e,e}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{sourceTextures:e,targetTexture:i}=this.bindings[this.currentIndex],{vs:r,uniforms:s,targetTextureType:o,inject:a,samplerTextureMap:c}=t_({vs:t.vs,sourceTextureMap:e,targetTextureVarying:this.targetTextureVarying,targetTexture:i}),l=mr([t.inject||{},a]);this.targetTextureType=o,this.samplerTextureMap=c;const u=t._fs||_c({version:oc(r),input:this.targetTextureVarying,inputType:o,output:a_}),d=this.hasSourceTextures||this.targetTextureVarying?[Hm].concat(t.modules||[]):t.modules;return{vs:r,fs:u,modules:d,uniforms:s,inject:l}}}class $r{static isSupported(t){return F(t)}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(e),Object.seal(this)}delete(){const{model:t,bufferTransform:e,textureTransform:i}=this;t&&t.delete(),e&&e.delete(),i&&i.delete()}run(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{clearRenderTarget:e=!0}=t,i=this._updateDrawOptions(t);e&&i.framebuffer&&i.framebuffer.clear({color:!0}),this.model.transform(i)}swap(){let t=!1;const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const i of e)t=t||i.swap();R(t,"Nothing to swap")}getBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const i of e){const r=i.getData(t);if(r)return r}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};"elementCount"in t&&this.model.setVertexCount(t.elementCount);const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const i of e)i.update(t)}_initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{gl:e}=this;this._buildResourceTransforms(e,t),t=this._updateModelProps(t),this.model=new Kr(e,Object.assign({},t,{fs:t.fs||_c({version:oc(t.vs)}),id:t.id||"transform-model",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let e=Object.assign({},t);
409const i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of i)e=r.updateModelProps(e);return e}_buildResourceTransforms(t,e){l_(e)&&(this.bufferTransform=new Qm(t,e)),u_(e)&&(this.textureTransform=new c_(t,e)),R(this.bufferTransform||this.textureTransform,"must provide source/feedback buffers or source/target textures")}_updateDrawOptions(t){let e=Object.assign({},t);const i=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of i)e=Object.assign(e,r.getDrawOptions(e));return e}}function l_(n){return!!(!Ie(n.feedbackBuffers)||!Ie(n.feedbackMap)||n.varyings&&n.varyings.length>0)}function u_(n){return!!(!Ie(n._sourceTextures)||n._targetTexture||n._targetTextureVarying)}const Uo={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Ac{static get DRAW_MODE(){return Uo}constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:e=ee("geometry"),drawMode:i=Uo.TRIANGLES,attributes:r={},indices:s=null,vertexCount:o=null}=t;this.id=e,this.drawMode=i|0,this.attributes={},this.userData={},this._setAttributes(r,s),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}
409_print(t){return"Geometry ".concat(this.id," attribute ").concat(t)}_setAttributes(t,e){e&&(this.indices=ArrayBuffer.isView(e)?{value:e,size:1}:e);for(const i in t){let r=t[i];r=ArrayBuffer.isView(r)?{value:r}:r,R(ArrayBuffer.isView(r.value),"".concat(this._print(i),": must be typed array or object with value as typed array")),(i==="POSITION"||i==="positions")&&!r.size&&(r.size=3),i==="indices"?(R(!this.indices),this.indices=r):this.attributes[i]=r}return this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,e){if(e)return e.value.length;let i=1/0;for(const r in t){const s=t[r],{value:o,size:a,constant:c}=s;!c&&o&&a>=1&&(i=Math.min(i,o.length/a))}return R(Number.isFinite(i)),i}}let h_=1,f_=1;class Sc{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){const{delay:e=0,duration:i=Number.POSITIVE_INFINITY,rate:r=1,repeat:s=1}=t,o=h_++,a={time:0,delay:e,duration:i,rate:r,repeat:s};return this._setChannelTime(a,this.time),this.channels.set(o,a),o}removeChannel(t){this.channels.delete(t);for(const[e,i]of this.animations)i.channel===t&&this.detachAnimation(e)}isFinished(t){const e=this.channels.get(t);return e===void 0?!1:this.time>=e.delay+e.duration*e.repeat}getTime(t){if(t===void 0)return this.time;const e=this.channels.get(t);return e===void 0?-1:e.time}setTime(t){this.time=Math.max(0,t);const e=this.channels.values();for(const r of e)this._setChannelTime(r,this.time);const i=this.animations.values();for(const r of i){const{animation:s,channel:o}=r;s.setTime(this.getTime(o))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){const i=f_++;return this.animations.set(i,{animation:t,channel:e}),t.setTime(this.getTime(e)),i}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){const i=e-t.delay,r=t.duration*t.repeat;i>=r?t.time=t.duration*t.rate:(t.time=Math.max(0,i)%t.duration,t.time*=t.rate)}}const d_=[255,255,255],g_=1;let p_=0;class m_{constructor(t={}){f(this,"id",void 0),f(this,"color",void 0),f(this,"intensity",void 0),f(this,"type","ambient");const{color:e=d_}=t,{intensity:i=g_}=t;this.id=t.id||"ambient-".concat(p_++),this.color=e,this.intensity=i}}const __=[255,255,255],b_=1,y_=[0,0,-1];let v_=0;class Bo{constructor(t={}){f(this,"id",void 0),f(this,"color",void 0),f(this,"intensity",void 0),f(this,"type","directional"),f(this,"direction",void 0),f(this,"shadow",void 0);const{color:e=__}=t,{intensity:i=b_}=t,{direction:r=y_}=t,{_shadow:s=!1}=t;this.id=t.id||"directional-".concat(v_++),this.color=e,this.intensity=i,this.type="directional",this.direction=new Nt(r).normalize().toArray(),this.shadow=s}getProjectedLight(t){return this}}class E_{constructor(t,e={id:"pass"}){f(this,"id",void 0),f(this,"gl",void 0),f(this,"props",void 0);const{id:i}=e;this.id=i,this.gl=t,this.props={...e}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}}class Qr extends E_{constructor(...t){super(...t),f(this,"_lastRenderIndex",-1)}render(t){const e=this.gl;return jt(e,{framebuffer:t.target}),this._drawLayers(t)}_drawLayers(t){const{target:e,moduleParameters:i,viewports:r,views:s,onViewportActive:o,clearStack:a=!0,clearCanvas:c=!0}=t;t.pass=t.pass||"unknown";const l=this.gl;c&&w_(l,e),a&&(this._lastRenderIndex=-1);const u=[];for(const d of r){const p=s&&s[d.id];o?.(d);const _=this._getDrawLayerParams(d,t),b=d.subViewports||[d];for(const y of b){const E=this._drawLayersInViewport(l,{target:e,moduleParameters:i,viewport:y,view:p,pass:t.pass,layers:t.layers},_);u.push(E)}}return u}_getDrawLayerParams(t,{layers:e,pass:i,isPicking:r=!1,layerFilter:s,cullRect:o,effects:a,moduleParameters:c},l=!1){const u=[],d=xc(this._lastRenderIndex+1),p={layer:e[0],viewport:t,isPicking:r,renderPass:i,cullRect:o},_={};for(let b=0;b<e.length;b++){const y=e[b],E=this._shouldDrawLayer(y,p,s,_),T={shouldDrawLayer:E};E&&!l&&(T.layerRenderIndex=d(y,E),T.moduleParameters=this._getModuleParameters(y,a,i,c),T.layerParameters=this.getLayerParameters(y,b,t)),u[b]=T}return u}_drawLayersInViewport(t,{layers:e,moduleParameters:i,pass:r,target:s,viewport:o,view:a},c){const l=T_(t,{moduleParameters:i,target:s,viewport:o});if(a&&a.props.clear){const d=a.props.clear===!0?{color:!0,depth:!0}:a.props.clear;wt(t,{scissorTest:!0,scissor:l},()=>Wr(t,d))}const u={totalCount:e.length,visibleCount:0,compositeCount:0,pickableCount:0};jt(t,{viewport:l});for(let d=0;d<e.length;d++){const p=e[d],{shouldDrawLayer:_,layerRenderIndex:b,moduleParameters:y,layerParameters:E}=c[d];if(_&&p.props.pickable&&u.pickableCount++,p.isComposite)u.compositeCount++;else if(_){u.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,b),y.viewport=o;try{p._drawLayer({moduleParameters:y,uniforms:{layerIndex:b},parameters:E})}catch(T){p.raiseError(T,"drawing ".concat(p," to ").concat(r))}}}return u}shouldDrawLayer(t){return!0}getModuleParameters(t,e){return null}getLayerParameters(t,e,i){return t.props.parameters}_shouldDrawLayer(t,e,i,r){if(!(t.props.visible&&this.shouldDrawLayer(t)))return!1;e.layer=t;let o=t.parent;for(;o;){if(!o.props.visible||!o.filterSubLayer(e))return!1;e.layer=o,o=o.parent}if(i){const a=e.layer.id;
409if(a in r||(r[a]=i(e)),!r[a])return!1}return t.activateViewport(e.viewport),!0}_getModuleParameters(t,e,i,r){var s;const o=Object.assign(Object.create(((s=t.internalState)===null||s===void 0?void 0:s.propsInTransition)||t.props),{autoWrapLongitude:t.wrapLongitude,viewport:t.context.viewport,mousePosition:t.context.mousePosition,pickingActive:0,devicePixelRatio:Re(this.gl)});if(e)for(const c of e){var a;Object.assign(o,(a=c.getModuleParameters)===null||a===void 0?void 0:a.call(c,t))}return Object.assign(o,this.getModuleParameters(t,e),r)}}function xc(n=0,t={}){const e={},i=(r,s)=>{const o=r.props._offset,a=r.id,c=r.parent&&r.parent.id;let l;if(c&&!(c in t)&&i(r.parent,!1),c in e){const u=e[c]=e[c]||xc(t[c],t);l=u(r,s),e[a]=u}else Number.isFinite(o)?(l=o+(t[c]||0),e[a]=null):l=n;return s&&l>=n&&(n=l+1),t[a]=l,l};return i}function T_(n,{moduleParameters:t,target:e,viewport:i}){const r=e&&e.id!=="default-framebuffer",s=t&&t.devicePixelRatio||Re(n),o=r?e.height:n.drawingBufferHeight,a=i;return[a.x*s,o-(a.y+a.height)*s,a.width*s,a.height*s]}function w_(n,t){const e=t?t.width:n.drawingBufferWidth,i=t?t.height:n.drawingBufferHeight;jt(n,{viewport:[0,0,e,i]}),n.clear(16640)}class A_ extends Qr{constructor(t,e){super(t,e),f(this,"shadowMap",void 0),f(this,"depthBuffer",void 0),f(this,"fbo",void 0),this.shadowMap=new At(t,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new Se(t,{format:33189,width:1,height:1}),this.fbo=new Q(t,{id:"shadowmap",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(t){const e=this.fbo;wt(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},()=>{const i=t.viewports[0],r=Re(this.gl),s=i.width*r,o=i.height*r;(s!==e.width||o!==e.height)&&e.resize({width:s,height:o}),super.render({...t,target:e,pass:"shadow"})})}shouldDrawLayer(t){return t.props.shadowEnabled!==!1}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}}const Pc="#define SMOOTH_EDGE_RADIUS 0.5",S_=`
410`.concat(Pc,`
411
412struct VertexGeometry {
413  vec4 position;
414  vec3 worldPosition;
415  vec3 worldPositionAlt;
416  vec3 normal;
417  vec2 uv;
418  vec3 pickingColor;
419} geometry = VertexGeometry(
420  vec4(0.0, 0.0, 1.0, 0.0),
421  vec3(0.0),
422  vec3(0.0),
423  vec3(0.0),
424  vec2(0.0),
425  vec3(0.0)
426);
427`),x_=`
428`.concat(Pc,`
429
430struct FragmentGeometry {
431  vec2 uv;
432} geometry;
433
434float smoothedge(float edge, float x) {
435  return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);
436}
437`),P_={name:"geometry",vs:S_,fs:x_},L_=Object.keys(V).map(n=>"const int COORDINATE_SYSTEM_".concat(n," = ").concat(V[n],";")).join(""),R_=Object.keys(Ct).map(n=>"const int PROJECTION_MODE_".concat(n," = ").concat(Ct[n],";")).join(""),I_=Object.keys(an).map(n=>"const int UNIT_".concat(n.toUpperCase()," = ").concat(an[n],";")).join(""),M_="".concat(L_,`
438`).concat(R_,`
439`).concat(I_,`
440
441uniform int project_uCoordinateSystem;
442uniform int project_uProjectionMode;
443uniform float project_uScale;
444uniform bool project_uWrapLongitude;
445uniform vec3 project_uCommonUnitsPerMeter;
446uniform vec3 project_uCommonUnitsPerWorldUnit;
447uniform vec3 project_uCommonUnitsPerWorldUnit2;
448uniform vec4 project_uCenter;
449uniform mat4 project_uModelMatrix;
450uniform mat4 project_uViewProjectionMatrix;
451uniform vec2 project_uViewportSize;
452uniform float project_uDevicePixelRatio;
453uniform float project_uFocalDistance;
454uniform vec3 project_uCameraPosition;
455uniform vec3 project_uCoordinateOrigin;
456uniform vec3 project_uCommonOrigin;
457uniform bool project_uPseudoMeters;
458
459const float TILE_SIZE = 512.0;
460const float PI = 3.1415926536;
461const float WORLD_SCALE = TILE_SIZE / (PI * 2.0);
462const vec3 ZERO_64_LOW = vec3(0.0);
463const float EARTH_RADIUS = 6370972.0;
464const float GLOBE_RADIUS = 256.0;
465float project_size_at_latitude(float lat) {
466  float y = clamp(lat, -89.9, 89.9);
467  return 1.0 / cos(radians(y));
468}
469
470float project_size() {
471  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&
472    project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&
473    project_uPseudoMeters == false) {
474    
475    if (geometry.position.w == 0.0) {
476      return project_size_at_latitude(geometry.worldPosition.y);
477    }
478  
479    float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
480    float y2 = y * y;
481    float y4 = y2 * y2;
482    float y6 = y4 * y2;
483    return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;
484  }
485  return 1.0;
486}
487
488float project_size_at_latitude(float meters, float lat) {
489  return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);
490}
491float project_size(float meters) {
492  return meters * project_uCommonUnitsPerMeter.z * project_size();
493}
494
495vec2 project_size(vec2 meters) {
496  return meters * project_uCommonUnitsPerMeter.xy * project_size();
497}
498
499vec3 project_size(vec3 meters) {
500  return meters * project_uCommonUnitsPerMeter * project_size();
501}
502
503vec4 project_size(vec4 meters) {
504  return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);
505}
506mat3 project_get_orientation_matrix(vec3 up) {
507  vec3 uz = normalize(up);
508  vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));
509  vec3 uy = cross(uz, ux);
510  return mat3(ux, uy, uz);
511}
512
513bool project_needs_rotation(vec3 commonPosition, out mat3 transform) {
514  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {
515    transform = project_get_orientation_matrix(commonPosition);
516    return true;
517  }
518  return false;
519}
520vec3 project_normal(vec3 vector) {
521  vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);
522  vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);
523  mat3 rotation;
524  if (project_needs_rotation(geometry.position.xyz, rotation)) {
525    n = rotation * n;
526  }
527  return n;
528}
529
530vec4 project_offset_(vec4 offset) {
531  float dy = offset.y;
532  vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;
533  return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);
534}
535vec2 project_mercator_(vec2 lnglat) {
536  float x = lnglat.x;
537  if (project_uWrapLongitude) {
538    x = mod(x + 180., 360.0) - 180.;
539  }
540  float y = clamp(lnglat.y, -89.9, 89.9);
541  return vec2(
542    radians(x) + PI,
543    PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))
544  ) * WORLD_SCALE;
545}
546
547vec3 project_globe_(vec3 lnglatz) {
548  float lambda = radians(lnglatz.x);
549  float phi = radians(lnglatz.y);
550  float cosPhi = cos(phi);
551  float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;
552
553  return vec3(
554    sin(lambda) * cosPhi,
555    -cos(lambda) * cosPhi,
556    sin(phi)
557  ) * D;
558}
559vec4 project_position(vec4 position, vec3 position64Low) {
560  vec4 position_world = project_uModelMatrix * position;
561  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {
562    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
563      return vec4(
564        project_mercator_(position_world.xy),
565        project_size_at_latitude(position_world.z, position_world.y),
566        position_world.w
567      );
568    }
569    if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
570      position_world.xyz += project_uCoordinateOrigin;
571    }
572  }
573  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {
574    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
575      return vec4(
576        project_globe_(position_world.xyz),
577        position_world.w
578      );
579    }
580  }
581  if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
582    if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
583      if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {
584        return vec4(
585          project_mercator_(position_world.xy) - project_uCommonOrigin.xy,
586          project_size(position_world.z),
587          position_world.w
588        );
589      }
590    }
591  }
592  if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||
593    (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&
594    (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
595     project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {
596    position_world.xyz -= project_uCoordinateOrigin;
597  }
598  return project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));
599}
600
601vec4 project_position(vec4 position) {
602  return project_position(position, ZERO_64_LOW);
603}
604
605vec3 project_position(vec3 position, vec3 position64Low) {
606  vec4 projected_position = project_position(vec4(position, 1.0), position64Low);
607  return projected_position.xyz;
608}
609
610vec3 project_position(vec3 position) {
611  vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);
612  return projected_position.xyz;
613}
614
615vec2 project_position(vec2 position) {
616  vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);
617  return projected_position.xy;
618}
619
620vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
621  return viewProjectionMatrix * position + center;
622}
623vec4 project_common_position_to_clipspace(vec4 position) {
624  return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);
625}
626vec2 project_pixel_size_to_clipspace(vec2 pixels) {
627  vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;
628  return offset * project_uFocalDistance;
629}
630
631float project_size_to_pixel(float meters) {
632  return project_size(meters) * project_uScale;
633}
634float project_size_to_pixel(float size, int unit) {
635  if (unit == UNIT_METERS) return project_size_to_pixel(size);
636  if (unit == UNIT_COMMON) return size * project_uScale;
637  return size;
638}
639float project_pixel_size(float pixels) {
640  return pixels / project_uScale;
641}
642vec2 project_pixel_size(vec2 pixels) {
643  return pixels / project_uScale;
644}
645`);function C_(n,t){if(n===t)return!0;if(Array.isArray(n)){const e=n.length;if(!t||t.length!==e)return!1;for(let i=0;i<e;i++)if(n[i]!==t[i])return!1;return!0}return!1}function vn(n){let t={},e;return i=>{for(const r in i)if(!C_(i[r],t[r])){e=n(i),t=i;break}return e}}const Vo=[0,0,0,0],O_=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],Lc=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],N_=[0,0,0],Rc=[0,0,0],k_=vn(U_);function Ic(n,t,e=Rc){e.length<3&&(e=[e[0],e[1],0]);let i=e,r,s=!0;switch(t===V.LNGLAT_OFFSETS||t===V.METER_OFFSETS?r=e:r=n.isGeospatial?[Math.fround(n.longitude),Math.fround(n.latitude),0]:null,n.projectionMode){case Ct.WEB_MERCATOR:(t===V.LNGLAT||t===V.CARTESIAN)&&(r=[0,0,0],s=!1);break;case Ct.WEB_MERCATOR_AUTO_OFFSET:t===V.LNGLAT?i=r:t===V.CARTESIAN&&(i=[Math.fround(n.center[0]),Math.fround(n.center[1]),0],r=n.unprojectPosition(i),i[0]-=e[0],i[1]-=e[1],i[2]-=e[2]);break;case Ct.IDENTITY:i=n.position.map(Math.fround),i[2]=i[2]||0;break;case Ct.GLOBE:s=!1,r=null;break;default:s=!1}return{geospatialOrigin:r,shaderCoordinateOrigin:i,offsetMode:s}}function D_(n,t,e){const{viewMatrixUncentered:i,projectionMatrix:r}=n;let{viewMatrix:s,viewProjectionMatrix:o}=n,a=Vo,c=Vo,l=n.cameraPosition;const{geospatialOrigin:u,shaderCoordinateOrigin:d,offsetMode:p}=Ic(n,t,e);return p&&(c=n.projectPosition(u||d),l=[l[0]-c[0],l[1]-c[1],l[2]-c[2]],c[3]=1,a=bn([],c,o),s=i||s,o=he([],r,s),o=he([],o,O_)),{viewMatrix:s,viewProjectionMatrix:o,projectionCenter:a,originCommon:c,cameraPosCommon:l,shaderCoordinateOrigin:d,geospatialOrigin:u}}function F_({viewport:n,devicePixelRatio:t=1,modelMatrix:e=null,coordinateSystem:i=V.DEFAULT,coordinateOrigin:r=Rc,autoWrapLongitude:s=!1}){i===V.DEFAULT&&(i=n.isGeospatial?V.LNGLAT:V.CARTESIAN);const o=k_({viewport:n,devicePixelRatio:t,coordinateSystem:i,coordinateOrigin:r});return o.project_uWrapLongitude=s,o.project_uModelMatrix=e||Lc,o}function U_({viewport:n,devicePixelRatio:t,coordinateSystem:e,coordinateOrigin:i}){const{projectionCenter:r,viewProjectionMatrix:s,originCommon:o,cameraPosCommon:a,shaderCoordinateOrigin:c,geospatialOrigin:l}=D_(n,e,i),u=n.getDistanceScales(),d=[n.width*t,n.height*t],p=bn([],[0,0,-n.focalDistance,1],n.projectionMatrix)[3]||1,_={project_uCoordinateSystem:e,project_uProjectionMode:n.projectionMode,project_uCoordinateOrigin:c,project_uCommonOrigin:o.slice(0,3),project_uCenter:r,project_uPseudoMeters:!!n._pseudoMeters,project_uViewportSize:d,project_uDevicePixelRatio:t,project_uFocalDistance:p,project_uCommonUnitsPerMeter:u.unitsPerMeter,project_uCommonUnitsPerWorldUnit:u.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:N_,project_uScale:n.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:s,project_uModelMatrix:Lc,project_uCameraPosition:a};if(l){const b=n.getDistanceScales(l);switch(e){case V.METER_OFFSETS:_.project_uCommonUnitsPerWorldUnit=b.unitsPerMeter,_.project_uCommonUnitsPerWorldUnit2=b.unitsPerMeter2;break;case V.LNGLAT:case V.LNGLAT_OFFSETS:n._pseudoMeters||(_.project_uCommonUnitsPerMeter=b.unitsPerMeter),_.project_uCommonUnitsPerWorldUnit=b.unitsPerDegree,_.project_uCommonUnitsPerWorldUnit2=b.unitsPerDegree2;break;case V.CARTESIAN:_.project_uCommonUnitsPerWorldUnit=[1,1,b.unitsPerMeter[2]],_.project_uCommonUnitsPerWorldUnit2=[0,0,b.unitsPerMeter2[2]];break}}return _}const B_={};function V_(n=B_){return"viewport"in n?F_(n):{}}
vendor: 21,541 bytes, lines 645-718
645const Jr={name:"project",dependencies:[Wp,P_],vs:M_,getUniforms:V_};function j_(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Pe(n,t){const e=bn([],t,n);return Im(e,e,1/e[3]),e}function jo(n,t){const e=n%t;return e<0?t+e:e}function Er(n,t,e){return n<t?t:n>e?e:n}function z_(n){return Math.log(n)*Math.LOG2E}const ts=Math.log2||z_;function zt(n,t){if(!n)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}const Tt=Math.PI,Mc=Tt/4,vt=Tt/180,Tr=180/Tt,ke=512,oi=4003e4,Gn=85.051129,G_=1.5;function H_(n){return ts(n)}function ai(n){const[t,e]=n;zt(Number.isFinite(t)),zt(Number.isFinite(e)&&e>=-90&&e<=90,"invalid latitude");const i=t*vt,r=e*vt,s=ke*(i+Tt)/(2*Tt),o=ke*(Tt+Math.log(Math.tan(Mc+r*.5)))/(2*Tt);return[s,o]}function De(n){const[t,e]=n,i=t/ke*(2*Tt)-Tt,r=2*(Math.atan(Math.exp(e/ke*(2*Tt)-Tt))-Mc);return[i*Tr,r*Tr]}function W_(n){const{latitude:t}=n;zt(Number.isFinite(t));const e=Math.cos(t*vt);return H_(oi*e)-9}function $i(n){const t=Math.cos(n*vt);return ke/oi/t}function wr(n){const{latitude:t,longitude:e,highPrecision:i=!1}=n;zt(Number.isFinite(t)&&Number.isFinite(e));const r=ke,s=Math.cos(t*vt),o=r/360,a=o/s,c=r/oi/s,l={unitsPerMeter:[c,c,c],metersPerUnit:[1/c,1/c,1/c],unitsPerDegree:[o,a,c],degreesPerUnit:[1/o,1/a,1/c]};if(i){const u=vt*Math.tan(t*vt)/s,d=o*u/2,p=r/oi*u,_=p/a*c;l.unitsPerDegree2=[0,d,p],l.unitsPerMeter2=[_,0,_]}return l}function Cc(n,t){const[e,i,r]=n,[s,o,a]=t,{unitsPerMeter:c,unitsPerMeter2:l}=wr({longitude:e,latitude:i,highPrecision:!0}),u=ai(n);u[0]+=s*(c[0]+l[0]*o),u[1]+=o*(c[1]+l[1]*o);const d=De(u),p=(r||0)+(a||0);return Number.isFinite(r)||Number.isFinite(a)?[d[0],d[1],p]:d}function X_(n){const{height:t,pitch:e,bearing:i,altitude:r,scale:s,center:o}=n,a=j_();ri(a,a,[0,0,-r]),Tc(a,a,-e*vt),wc(a,a,i*vt);const c=s/t;return Zr(a,a,[c,c,c]),o&&ri(a,a,om([],o)),a}function Y_(n){const{width:t,height:e,altitude:i,pitch:r=0,offset:s,center:o,scale:a,nearZMultiplier:c=1,farZMultiplier:l=1}=n;let{fovy:u=ci(G_)}=n;i!==void 0&&(u=ci(i));const d=u*vt,p=r*vt,_=Oc(u);let b=_;o&&(b+=o[2]*a/Math.cos(p)/e);const y=d*(.5+(s?s[1]:0)/e),E=Math.sin(y)*b/Math.sin(Er(Math.PI/2-p-y,.01,Math.PI-.01)),T=Math.sin(p)*E+b,w=b*10,A=Math.min(T*l,w);return{fov:d,aspect:t/e,focalDistance:_,near:c,far:A}}function ci(n){return 2*Math.atan(.5/n)*Tr}function Oc(n){return .5/Math.tan(.5*n*vt)}function Nc(n,t){const[e,i,r=0]=n;return zt(Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(r)),Pe(t,[e,i,r,1])}function es(n,t,e=0){const[i,r,s]=n;if(zt(Number.isFinite(i)&&Number.isFinite(r),"invalid pixel coordinate"),Number.isFinite(s))return Pe(t,[i,r,s,1]);const o=Pe(t,[i,r,0,1]),a=Pe(t,[i,r,1,1]),c=o[2],l=a[2],u=c===l?0:((e||0)-c)/(l-c);return yc([],o,a,u)}function q_(n){const{width:t,height:e,bounds:i,minExtent:r=0,maxZoom:s=24,offset:o=[0,0]}=n,[[a,c],[l,u]]=i,d=Z_(n.padding),p=ai([a,Er(u,-Gn,Gn)]),_=ai([l,Er(c,-Gn,Gn)]),b=[Math.max(Math.abs(_[0]-p[0]),r),Math.max(Math.abs(_[1]-p[1]),r)],y=[t-d.left-d.right-Math.abs(o[0])*2,e-d.top-d.bottom-Math.abs(o[1])*2];zt(y[0]>0&&y[1]>0);const E=y[0]/b[0],T=y[1]/b[1],w=(d.right-d.left)/2/E,A=(d.top-d.bottom)/2/T,x=[(_[0]+p[0])/2+w,(_[1]+p[1])/2+A],L=De(x),P=Math.min(s,ts(Math.abs(Math.min(E,T))));return zt(Number.isFinite(P)),{longitude:L[0],latitude:L[1],zoom:P}}function Z_(n=0){return typeof n=="number"?{top:n,bottom:n,left:n,right:n}:(zt(Number.isFinite(n.top)&&Number.isFinite(n.bottom)&&Number.isFinite(n.left)&&Number.isFinite(n.right)),n)}const zo=Math.PI/180;function K_(n,t=0){const{width:e,height:i,unproject:r}=n,s={targetZ:t},o=r([0,i],s),a=r([e,i],s);let c,l;const u=n.fovy?.5*n.fovy*zo:Math.atan(.5/n.altitude),d=(90-n.pitch)*zo;return u>d-.01?(c=Go(n,0,t),l=Go(n,e,t)):(c=r([0,0],s),l=r([e,0],s)),[o,a,l,c]}function Go(n,t,e){const{pixelUnprojectionMatrix:i}=n,r=Pe(i,[t,0,1,1]),s=Pe(i,[t,n.height,1,1]),a=(e*n.distanceScales.unitsPerMeter[2]-r[2])/(s[2]-r[2]),c=yc([],r,s,a),l=De(c);return l.push(e),l}const Ho=512;function $_(n){const{width:t,height:e,pitch:i=0}=n;let{longitude:r,latitude:s,zoom:o,bearing:a=0}=n;(r<-180||r>180)&&(r=jo(r+180,360)-180),(a<-180||a>180)&&(a=jo(a+180,360)-180);const c=ts(e/Ho);if(o<=c)o=c,s=0;else{const l=e/2/Math.pow(2,o),u=De([0,l])[1];if(s<u)s=u;else{const d=De([0,Ho-l])[1];s>d&&(s=d)}}return{width:t,height:e,longitude:r,latitude:s,zoom:o,pitch:i,bearing:a}}const Q_=`
646const int max_lights = 2;
647uniform mat4 shadow_uViewProjectionMatrices[max_lights];
648uniform vec4 shadow_uProjectCenters[max_lights];
649uniform bool shadow_uDrawShadowMap;
650uniform bool shadow_uUseShadowMap;
651uniform int shadow_uLightId;
652uniform float shadow_uLightCount;
653
654varying vec3 shadow_vPosition[max_lights];
655
656vec4 shadow_setVertexPosition(vec4 position_commonspace) {
657  if (shadow_uDrawShadowMap) {
658    return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);
659  }
660  if (shadow_uUseShadowMap) {
661    for (int i = 0; i < max_lights; i++) {
662      if(i < int(shadow_uLightCount)) {
663        vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);
664        shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;
665      }
666    }
667  }
668  return gl_Position;
669}
670`,J_=`
671const int max_lights = 2;
672uniform bool shadow_uDrawShadowMap;
673uniform bool shadow_uUseShadowMap;
674uniform sampler2D shadow_uShadowMap0;
675uniform sampler2D shadow_uShadowMap1;
676uniform vec4 shadow_uColor;
677uniform float shadow_uLightCount;
678
679varying vec3 shadow_vPosition[max_lights];
680
681const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);
682const vec4 bitUnpackShift = 1.0 / bitPackShift;
683const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0,  0.0);
684
685float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {
686  vec4 rgbaDepth = texture2D(shadowMap, position.xy);
687
688  float z = dot(rgbaDepth, bitUnpackShift);
689  return smoothstep(0.001, 0.01, position.z - z);
690}
691
692vec4 shadow_filterShadowColor(vec4 color) {
693  if (shadow_uDrawShadowMap) {
694    vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);
695    rgbaDepth -= rgbaDepth.gbaa * bitMask;
696    return rgbaDepth;
697  }
698  if (shadow_uUseShadowMap) {
699    float shadowAlpha = 0.0;
700    shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);
701    if(shadow_uLightCount > 1.0) {
702      shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);
703    }
704    shadowAlpha *= shadow_uColor.a / shadow_uLightCount;
705    float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);
706
707    return vec4(
708      mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),
709      blendedAlpha
710    );
711  }
712  return color;
713}
714`,t0=vn(s0),e0=vn(o0),n0=[0,0,0,1],i0=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function r0(n,t){const[e,i,r]=n,s=es([e,i,r],t);return Number.isFinite(r)?s:[s[0],s[1],0]}function s0({viewport:n,center:t}){return new kt(n.viewProjectionMatrix).invert().transform(t)}function o0({viewport:n,shadowMatrices:t}){const e=[],i=n.pixelUnprojectionMatrix,r=n.isGeospatial?void 0:1,s=[[0,0,r],[n.width,0,r],[0,n.height,r],[n.width,n.height,r],[0,0,-1],[n.width,0,-1],[0,n.height,-1],[n.width,n.height,-1]].map(o=>r0(o,i));for(const o of t){const a=o.clone().translate(new Nt(n.center).negate()),c=s.map(u=>a.transform(u)),l=new kt().ortho({left:Math.min(...c.map(u=>u[0])),right:Math.max(...c.map(u=>u[0])),bottom:Math.min(...c.map(u=>u[1])),top:Math.max(...c.map(u=>u[1])),near:Math.min(...c.map(u=>-u[2])),far:Math.max(...c.map(u=>-u[2]))});e.push(l.multiplyRight(o))}return e}function a0(n,t){const{shadowEnabled:e=!0}=n;if(!e||!n.shadowMatrices||!n.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};const i={shadow_uDrawShadowMap:!!n.drawToShadowMap,shadow_uUseShadowMap:n.shadowMaps?n.shadowMaps.length>0:!1,shadow_uColor:n.shadowColor||n0,shadow_uLightId:n.shadowLightId||0,shadow_uLightCount:n.shadowMatrices.length},r=t0({viewport:n.viewport,center:t.project_uCenter}),s=[],o=e0({shadowMatrices:n.shadowMatrices,viewport:n.viewport}).slice();for(let a=0;a<n.shadowMatrices.length;a++){const c=o[a],l=c.clone().translate(new Nt(n.viewport.center).negate());t.project_uCoordinateSystem===V.LNGLAT&&t.project_uProjectionMode===Ct.WEB_MERCATOR?(o[a]=l,s[a]=r):(o[a]=c.clone().multiplyRight(i0),s[a]=l.transform(r))}for(let a=0;a<o.length;a++)i["shadow_uViewProjectionMatrices[".concat(a,"]")]=o[a],i["shadow_uProjectCenters[".concat(a,"]")]=s[a],n.shadowMaps&&n.shadowMaps.length>0?i["shadow_uShadowMap".concat(a)]=n.shadowMaps[a]:i["shadow_uShadowMap".concat(a)]=n.dummyShadowMap;return i}const Qi={name:"shadow",dependencies:[Jr],vs:Q_,fs:J_,inject:{"vs:DECKGL_FILTER_GL_POSITION":`
715    position = shadow_setVertexPosition(geometry.position);
716    `,"fs:DECKGL_FILTER_COLOR":`
717    color = shadow_filterShadowColor(color);
718    `},getUniforms:(n={},t={})=>"viewport"in n&&(n.drawToShadowMap||n.shadowMaps&&n.shadowMaps.length>0)?a0(n,t):{}},c0={color:[255,255,255],intensity:1},Wo=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],l0=[0,0,0,200/255];class kc{constructor(t={}){f(this,"id","lighting-effect"),f(this,"props",void 0),f(this,"shadowColor",l0),f(this,"shadow",void 0),f(this,"ambientLight",void 0),f(this,"directionalLights",void 0),f(this,"pointLights",void 0),f(this,"shadowPasses",[]),f(this,"shadowMaps",[]),f(this,"dummyShadowMap",null),f(this,"programManager",void 0),f(this,"shadowMatrices",void 0),this.setProps(t)}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(const e in t){const i=t[e];switch(i.type){case"ambient":this.ambientLight=i;break;case"directional":this.directionalLights.push(i);break;case"point":this.pointLights.push(i);break}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(e=>e.shadow),this.props=t}preRender(t,{layers:e,layerFilter:i,viewports:r,onViewportActive:s,views:o}){if(this.shadow){this.shadowMatrices=this._calculateMatrices(),this.shadowPasses.length===0&&this._createShadowPasses(t),this.programManager||(this.programManager=yn.getDefaultProgramManager(t),Qi&&this.programManager.addDefaultModule(Qi)),this.dummyShadowMap||(this.dummyShadowMap=new At(t,{width:1,height:1}));for(let a=0;a<this.shadowPasses.length;a++)this.shadowPasses[a].render({layers:e,layerFilter:i,viewports:r,onViewportActive:s,views:o,moduleParameters:{shadowLightId:a,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}})}}getModuleParameters(t){const e=this.shadow?{shadowMaps:this.shadowMaps,dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{};return e.lightSources={ambientLight:this.ambientLight,directionalLights:this.directionalLights.map(i=>i.getProjectedLight({layer:t})),pointLights:this.pointLights.map(i=>i.getProjectedLight({layer:t}))},e}cleanup(){for(const t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(Qi),this.programManager=null)}_calculateMatrices(){const t=[];for(const e of this.directionalLights){const i=new kt().lookAt({eye:new Nt(e.direction).negate()});t.push(i)}return t}_createShadowPasses(t){for(let e=0;e<this.directionalLights.length;e++){const i=new A_(t);this.shadowPasses[e]=i,this.shadowMaps[e]=i.shadowMap}}_applyDefaultLights(){const{ambientLight:t,pointLights:e,directionalLights:i}=this;!t&&e.length===0&&i.length===0&&(this.ambientLight=new m_(c0),this.directionalLights.push(new Bo(Wo[0]),new Bo(Wo[1])))}}class u0{constructor(t={}){f(this,"_pool",[]),f(this,"opts",{overAlloc:2,poolSize:100}),this.setOptions(t)}setOptions(t){Object.assign(this.opts,t)}allocate(t,e,{size:i=1,type:r,padding:s=0,copy:o=!1,initialize:a=!1,maxCount:c}){const l=r||t&&t.constructor||Float32Array,u=e*i+s;if(ArrayBuffer.isView(t)){if(u<=t.length)return t;if(u*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new l(t.buffer,0,u)}let d=1/0;c&&(d=c*i+s);const p=this._allocate(l,u,a,d);return t&&o?p.set(t):a||p.fill(0,0,4),this._release(t),p}release(t){this._release(t)}_allocate(t,e,i,r){let s=Math.max(Math.ceil(e*this.opts.overAlloc),1);s>r&&(s=r);const o=this._pool,a=t.BYTES_PER_ELEMENT*s,c=o.findIndex(l=>l.byteLength>=a);if(c>=0){const l=new t(o.splice(c,1)[0],0,s);return i&&l.fill(0),l}return new t(s)}_release(t){if(!ArrayBuffer.isView(t))return;const e=this._pool,{buffer:i}=t,{byteLength:r}=i,s=e.findIndex(o=>o.byteLength>=r);s<0?e.push(i):(s>0||e.length<this.opts.poolSize)&&e.splice(s,0,i),e.length>this.opts.poolSize&&e.shift()}}const fn=new u0;function en(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function h0(n){return[n[12],n[13],n[14]]}function f0(n){return{left:Te(n[3]+n[0],n[7]+n[4],n[11]+n[8],n[15]+n[12]),right:Te(n[3]-n[0],n[7]-n[4],n[11]-n[8],n[15]-n[12]),bottom:Te(n[3]+n[1],n[7]+n[5],n[11]+n[9],n[15]+n[13]),top:Te(n[3]-n[1],n[7]-n[5],n[11]-n[9],n[15]-n[13]),near:Te(n[3]+n[2],n[7]+n[6],n[11]+n[10],n[15]+n[14]),far:Te(n[3]-n[2],n[7]-n[6],n[11]-n[10],n[15]-n[14])}}const Xo=new Nt;function Te(n,t,e,i){Xo.set(n,t,e);const r=Xo.len();return{distance:i/r,normal:new Nt(-n/r,-t/r,-e/r)}}function d0(n){return n-Math.fround(n)}let Qe;function Ji(n,t){const{size:e=1,startIndex:i=0}=t,r=t.endIndex!==void 0?t.endIndex:n.length,s=(r-i)/e;Qe=fn.allocate(Qe,s,{type:Float32Array,size:e*2});let o=i,a=0;for(;o<r;){for(let c=0;c<e;c++){const l=n[o++];Qe[a+c]=l,Qe[a+c+e]=d0(l)}a+=e*2}return Qe.subarray(0,s*e*2)}function g0(n){let t=null,e=!1;for(const i of n)i&&(t?(e||(t=[[t[0][0],t[0][1]],[t[1][0],t[1][1]]],e=!0),t[0][0]=Math.min(t[0][0],i[0][0]),t[0][1]=Math.min(t[0][1],i[0][1]),t[1][0]=Math.max(t[1][0],i[1][0]),t[1][1]=Math.max(t[1][1],i[1][1])):t=i);return t}const p0=Math.PI/180,m0=en(),Yo=[0,0,0],_0={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function b0({width:n,height:t,orthographic:e,fovyRadians:i,focalDistance:r,padding:s,near:o,far:a}){const c=n/t,l=e?new kt().orthographic({fovy:i,aspect:c,focalDistance:r,near:o,far:a}):new kt().perspective({fovy:i,aspect:c,near:o,far:a});if(s){const{left:u=0,right:d=0,top:p=0,bottom:_=0}=s,b=Qt((u+n-d)/2,0,n)-n/2,y=Qt((p+t-_)/2,0,t)-t/2;l[8]-=b*2/n,l[9]+=y*2/t}return l}class Be{constructor(t={}){f(this,"id",void 0),f(this,"x",void 0),f(this,"y",void 0),f(this,"width",void 0),f(this,"height",void 0),f(this,"padding",void 0),f(this,"isGeospatial",void 0),f(this,"zoom",void 0),f(this,"focalDistance",void 0),f(this,"position",void 0),f(this,"modelMatrix",void 0),f(this,"distanceScales",void 0),f(this,"scale",void 0),f(this,"center",void 0),f(this,"cameraPosition",void 0),f(this,"projectionMatrix",void 0),f(this,"viewMatrix",void 0),f(this,"viewMatrixUncentered",void 0),f(this,"viewMatrixInverse",void 0),f(this,"viewProjectionMatrix",void 0),f(this,"pixelProjectionMatrix",void 0),f(this,"pixelUnprojectionMatrix",void 0),f(this,"resolution",void 0),f(this,"_frustumPlanes",{}),this.id=t.id||this.constructor.displayName||"viewport",this.x=t.x||0,this.y=t.y||0,this.width=t.width||1,this.height=t.height||1,this.zoom=t.zoom||0,this.padding=t.padding,this.distanceScales=t.distanceScales||_0,this.focalDistance=t.focalDistance||1,this.position=t.position||Yo,this.modelMatrix=t.modelMatrix||null;const{longitude:e,latitude:i}=t;this.isGeospatial=Number.isFinite(i)&&Number.isFinite(e),this._initProps(t),this._initMatrices(t),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?Ct.WEB_MERCATOR:Ct.WEB_MERCATOR_AUTO_OFFSET:Ct.IDENTITY}equals(t){return t instanceof Be?this===t?!0:t.width===this.width&&t.height===this.height&&t.scale===this.scale&&hn(t.projectionMatrix,this.projectionMatrix)&&hn(t.viewMatrix,this.viewMatrix):!1}project(t,{topLeft:e=!0}={}){const i=this.projectPosition(t),r=Nc(i,this.pixelProjectionMatrix),[s,o]=r,a=e?o:this.height-o;return t.length===2?[s,a]:[s,a,r[2]]}unproject(t,{topLeft:e=!0,targetZ:i}={}){const[r,s,o]=t,a=e?s:this.height-s,c=i&&i*this.distanceScales.unitsPerMeter[2],l=es([r,a,o],this.pixelUnprojectionMatrix,c),[u,d,p]=this.unprojectPosition(l);return Number.isFinite(o)?[u,d,p]:Number.isFinite(i)?[u,d,i]:[u,d]}projectPosition(t){const[e,i]=this.projectFlat(t),r=(t[2]||0)*this.distanceScales.unitsPerMeter[2];return[e,i,r]}unprojectPosition(t){const[e,i]=this.unprojectFlat(t),r=(t[2]||0)*this.distanceScales.metersPerUnit[2];return[e,i,r]}projectFlat(t){if(this.isGeospatial){const e=ai(t);return e[1]=Qt(e[1],-318,830),e}return t}unprojectFlat(t){return this.isGeospatial?De(t):t}getBounds(t={}){const e={targetZ:t.z||0},i=this.unproject([0,0],e),r=this.unproject([this.width,0],e),s=this.unproject([0,this.height],e),o=this.unproject([this.width,this.height],e);return[Math.min(i[0],r[0],s[0],o[0]),Math.min(i[1],r[1],s[1],o[1]),Math.max(i[0],r[0],s[0],o[0]),Math.max(i[1],r[1],s[1],o[1])]}getDistanceScales(t){return t?wr({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}containsPixel({x:t,y:e,width:i=1,height:r=1}){return t<this.x+this.width&&this.x<t+i&&e<this.y+this.height&&this.y<e+r}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,f0(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(t,e){return null}_initProps(t){const e=t.longitude,i=t.latitude;this.isGeospatial&&(Number.isFinite(t.zoom)||(this.zoom=W_({latitude:i})+Math.log2(this.focalDistance)),this.distanceScales=t.distanceScales||wr({latitude:i,longitude:e}));const r=Math.pow(2,this.zoom);this.scale=r;const{position:s,modelMatrix:o}=t;let a=Yo;if(s&&(a=o?new kt(o).transformAsVector(s,[]):s),this.isGeospatial){const c=this.projectPosition([e,i,0]);this.center=new Nt(a).scale(this.distanceScales.unitsPerMeter).add(c)}else this.center=this.projectPosition(a)}_initMatrices(t){const{viewMatrix:e=m0,projectionMatrix:i=null,orthographic:r=!1,fovyRadians:s,fovy:o=75,near:a=.1,far:c=1e3,padding:l=null,focalDistance:u=1}=t;this.viewMatrixUncentered=e,this.viewMatrix=new kt().multiplyRight(e).translate(new Nt(this.center).negate()),this.projectionMatrix=i||b0({width:this.width,height:this.height,orthographic:r,fovyRadians:s||o*p0,focalDistance:u,padding:l,near:a,far:c});const d=en();he(d,d,this.projectionMatrix),he(d,d,this.viewMatrix),this.viewProjectionMatrix=d,this.viewMatrixInverse=yr([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=h0(this.viewMatrixInverse);const p=en(),_=en();Zr(p,p,[this.width/2,-this.height/2,1]),ri(p,p,[1,-1,0]),he(_,p,this.viewProjectionMatrix),this.pixelProjectionMatrix=_,this.pixelUnprojectionMatrix=yr(en(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||z.warn("Pixel project matrix not invertible")()}}f(Be,"displayName","Viewport");class Fe extends Be{constructor(t={}){const{latitude:e=0,longitude:i=0,zoom:r=0,pitch:s=0,bearing:o=0,nearZMultiplier:a=.1,farZMultiplier:c=1.01,nearZ:l,farZ:u,orthographic:d=!1,projectionMatrix:p,repeat:_=!1,worldOffset:b=0,position:y,padding:E,legacyMeterSizes:T=!1}=t;let{width:w,height:A,altitude:x=1.5}=t;const L=Math.pow(2,r);w=w||1,A=A||1;let P,O=null;if(p)x=p[5]/2,P=ci(x);else{t.fovy?(P=t.fovy,x=Oc(P)):P=ci(x);let C;if(E){const{top:N=0,bottom:k=0}=E;C=[0,Qt((N+A-k)/2,0,A)-A/2]}O=Y_({width:w,height:A,scale:L,center:y&&[0,0,y[2]*$i(e)],offset:C,pitch:s,fovy:P,nearZMultiplier:a,farZMultiplier:c}),Number.isFinite(l)&&(O.near=l),Number.isFinite(u)&&(O.far=u)}let U=X_({height:A,pitch:s,bearing:o,scale:L,altitude:x});b&&(U=new kt().translate([512*b,0,0]).multiplyLeft(U)),super({...t,width:w,height:A,viewMatrix:U,longitude:i,latitude:e,zoom:r,...O,fovy:P,focalDistance:x}),f(this,"longitude",void 0),f(this,"latitude",void 0),f(this,"pitch",void 0),f(this,"bearing",void 0),f(this,"altitude",void 0),f(this,"fovy",void 0),f(this,"orthographic",void 0),f(this,"_subViewports",void 0),f(this,"_pseudoMeters",void 0),this.latitude=e,this.longitude=i,this.zoom=r,this.pitch=s,this.bearing=o,this.altitude=x,this.fovy=P,this.orthographic=d,this._subViewports=_?[]:null,this._pseudoMeters=T,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const t=this.getBounds(),e=Math.floor((t[0]+180)/360),i=Math.ceil((t[2]-180)/360);for(let r=e;r<=i;r++){const s=r?new Fe({...this,worldOffset:r}):this;this._subViewports.push(s)}}return this._subViewports}projectPosition(t){if(this._pseudoMeters)return super.projectPosition(t);const[e,i]=this.projectFlat(t),r=(t[2]||0)*$i(t[1]);return[e,i,r]}unprojectPosition(t){if(this._pseudoMeters)return super.unprojectPosition(t);const[e,i]=this.unprojectFlat(t),r=(t[2]||0)/$i(i);return[e,i,r]}addMetersToLngLat(t,e){return Cc(t,e)}panByPosition(t,e){const i=es(e,this.pixelUnprojectionMatrix),r=this.projectFlat(t),s=No([],r,tm([],i)),o=No([],this.center,s),[a,c]=this.unprojectFlat(o);return{longitude:a,latitude:c}}getBounds(t={}){const e=K_(this,t.z||0);return[Math.min(e[0][0],e[1][0],e[2][0],e[3][0]),Math.min(e[0][1],e[1][1],e[2][1],e[3][1]),Math.max(e[0][0],e[1][0],e[2][0],e[3][0]),Math.max(e[0][1],e[1][1],e[2][1],e[3][1])]}fitBounds(t,e={}){const{width:i,height:r}
718=this,{longitude:s,latitude:o,zoom:a}=q_({width:i,height:r,bounds:t,...e});return new Fe({width:i,height:r,longitude:s,latitude:o,zoom:a})}}f(Fe,"displayName","WebMercatorViewport");const qo=[0,0,0];function tr(n,t,e=!1){const i=t.projectPosition(n);if(e&&t instanceof Fe){const[r,s,o=0]=n,a=t.getDistanceScales([r,s]);i[2]=o*a.unitsPerMeter[2]}return i}function y0(n){const{viewport:t,modelMatrix:e,coordinateOrigin:i}=n;let{coordinateSystem:r,fromCoordinateSystem:s,fromCoordinateOrigin:o}=n;return r===V.DEFAULT&&(r=t.isGeospatial?V.LNGLAT:V.CARTESIAN),s===void 0&&(s=r),o===void 0&&(o=i),{viewport:t,coordinateSystem:r,coordinateOrigin:i,modelMatrix:e,fromCoordinateSystem:s,fromCoordinateOrigin:o}}function Dc(n,{viewport:t,modelMatrix:e,coordinateSystem:i,coordinateOrigin:r,offsetMode:s}){let[o,a,c=0]=n;switch(e&&([o,a,c]=bn([],[o,a,c,1],e)),i){case V.LNGLAT:return tr([o,a,c],t,s);case V.LNGLAT_OFFSETS:return tr([o+r[0],a+r[1],c+(r[2]||0)],t,s);case V.METER_OFFSETS:return tr(Cc(r,[o,a,c]),t,s);case V.CARTESIAN:default:return t.isGeospatial?[o+r[0],a+r[1],c+r[2]]:t.projectPosition([o,a,c])}}function v0(n,t){const{viewport:e,coordinateSystem:i,coordinateOrigin:r,modelMatrix:s,fromCoordinateSystem:o,fromCoordinateOrigin:a}=y0(t),{autoOffset:c=!0}=t,{geospatialOrigin:l=qo,shaderCoordinateOrigin:u=qo,offsetMode:d=!1}=c?Ic(e,i,r):{},p=Dc(n,{viewport:e,modelMatrix:s,coordinateSystem:o,coordinateOrigin:a,offsetMode:d});if(d){const _=e.projectPosition(l||u);pm(p,p,_)}return p}const Zo={blendFunc:[1,0,32771,0],blendEquation:32774};class Fc extends Qr{constructor(...t){super(...t),f(this,"pickZ",void 0),f(this,"_colorEncoderState",null)}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer({layers:t,layerFilter:e,views:i,viewports:r,onViewportActive:s,pickingFBO:o,deviceRect:{x:a,y:c,width:l,height:u},cullRect:d,effects:p,pass:_="picking",pickZ:b,moduleParameters:y}){const E=this.gl;this.pickZ=b;const T=this._resetColorEncoder(b),w=wt(E,{scissorTest:!0,scissor:[a,c,l,u],clearColor:[0,0,0,0],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0],...Zo,blend:!b},()=>super.render({target:o,layers:t,layerFilter:e,views:i,viewports:r,onViewportActive:s,cullRect:d,effects:p?.filter(x=>x.useInPicking),pass:_,isPicking:!0,moduleParameters:y}));return this._colorEncoderState=null,{decodePickingColor:T&&T0.bind(null,T),stats:w}}shouldDrawLayer(t){const{pickable:e,operation:i}=t.props;return e&&i.includes("draw")||i.includes("terrain")||i.includes("mask")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(t,e,i){const r={...t.props.parameters},{pickable:s,operation:o}=t.props;return this._colorEncoderState?s&&o.includes("draw")&&(Object.assign(r,Zo),r.blend=!0,r.blendColor=E0(this._colorEncoderState,t,i)):r.blend=!1,o.includes("terrain")&&(r.blend=!1),r}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function E0(n,t,e){const{byLayer:i,byAlpha:r}=n;let s,o=i.get(t);return o?(o.viewports.push(e),s=o.a):(s=i.size+1,s<=255?(o={a:s,layer:t,viewports:[e]},i.set(t,o),r[s]=o):(z.warn("Too many pickable layers, only picking the first 255")(),s=0)),[0,0,0,s/255]}function T0(n,t){const e=n.byAlpha[t[3]];return e&&{pickedLayer:e.layer,pickedViewports:e.viewports,pickedObjectIndex:e.layer.decodePickingColor(t)}}const Ae={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},li=Symbol.for("component"),fe=Symbol.for("propTypes"),er=Symbol.for("deprecatedProps"),Le=Symbol.for("asyncPropDefaults"),de=Symbol.for("asyncPropOriginal"),Jt=Symbol.for("asyncPropResolved");function Uc(n,t=()=>!0){return Array.isArray(n)?Bc(n,t,[]):t(n)?[n]:[]}function Bc(n,t,e){let i=-1;for(;++i<n.length;){const r=n[i];Array.isArray(r)?Bc(r,t,e):t(r)&&e.push(r)}return e}function w0({target:n,source:t,start:e=0,count:i=1}){const r=t.length,s=i*r;let o=0;for(let a=e;o<r;
718o++)n[a++]=t[o];for(;o<s;)o<s-o?(n.copyWithin(e+o,e,e+o),o*=2):(n.copyWithin(e+o,e,e+s-o),o=s);return n}class A0{constructor(t,e,i){f(this,"id",void 0),f(this,"context",void 0),f(this,"isLoaded",void 0),f(this,"persistent",void 0),f(this,"_loadCount",0),f(this,"_subscribers",new Set),f(this,"_data",void 0),f(this,"_loader",void 0),f(this,"_error",void 0),f(this,"_content",void 0),this.id=t,this.context=i,this.setData(e)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(t,e){if(t===this._data&&!e)return;this._data=t;const i=++this._loadCount;let r=t;typeof t=="string"&&(r=ar(t)),r instanceof Promise?(this.isLoaded=!1,this._loader=r.then(s=>{this._loadCount===i&&(this.isLoaded=!0,this._error=void 0,this._content=s)}).catch(s=>{this._loadCount===i&&(this.isLoaded=!0,this._error=s||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=t);for(const s of this._subscribers)s.onChange(this.getData())}}class S0{constructor({gl:t,protocol:e}){f(this,"protocol",void 0),f(this,"_context",void 0),f(this,"_resources",void 0),f(this,"_consumers",void 0),f(this,"_pruneRequest",void 0),this.protocol=e||"resource://",this._context={gl:t,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return t.startsWith(this.protocol)?!0:t in this._resources}add({resourceId:t,data:e,forceUpdate:i=!1,persistent:r=!0}){let s=this._resources[t];s?s.setData(e,i):(s=new A0(t,e,this._context),this._resources[t]=s),s.persistent=r}remove(t){const e=this._resources[t];e&&(e.delete(),delete this._resources[t])}unsubscribe({consumerId:t}){const e=this._consumers[t];if(e){for(const i in e){const r=e[i],s=this._resources[r.resourceId];s&&s.unsubscribe(r)}delete this._consumers[t],this.prune()}}subscribe({resourceId:t,onChange:e,consumerId:i,requestId:r="default"}){const{_resources:s,protocol:o}=this;t.startsWith(o)&&(t=t.replace(o,""),s[t]||this.add({resourceId:t,data:null,persistent:!1}));const a=s[t];if(this._track(i,r,a,e),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(const t in this._resources)this._resources[t].delete()}_track(t,e,i,r){const s=this._consumers,o=s[t]=s[t]||{},a=o[e]||{},c=a.resourceId&&this._resources[a.resourceId];c&&(c.unsubscribe(a),this.prune()),i&&(o[e]=a,a.onChange=r,a.resourceId=i.id,i.subscribe(a))}_prune(){this._pruneRequest=null;for(const t of Object.keys(this._resources)){const e=this._resources[t];!e.persistent&&!e.inUse()&&(e.delete(),delete this._resources[t])}}}const x0=`
719vec4 project_position_to_clipspace(
720  vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition
721) {
722  vec3 projectedPosition = project_position(position, position64Low);
723  mat3 rotation;
724  if (project_needs_rotation(projectedPosition, rotation)) {
725    // offset is specified as ENU
726    // when in globe projection, rotate offset so that the ground alighs with the surface of the globe
727    offset = rotation * offset;
728  }
729  commonPosition = vec4(projectedPosition + offset, 1.0);
730  return project_common_position_to_clipspace(commonPosition);
731}
732
733vec4 project_position_to_clipspace(
734  vec3 position, vec3 position64Low, vec3 offset
735) {
736  vec4 commonPosition;
737  return project_position_to_clipspace(position, position64Low, offset, commonPosition);
738}
739`,Vc={name:"project32",dependencies:[Jr],vs:x0},jc={inject:{"vs:DECKGL_FILTER_GL_POSITION":`
740    // for picking depth values
741    picking_setPickingAttribute(position.z / position.w);
742  `,"vs:DECKGL_FILTER_COLOR":`
743  picking_setPickingColor(geometry.pickingColor);
744  `,"fs:#decl":`
745uniform bool picking_uAttribute;
746  `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:`
747  // use highlight color if this fragment belongs to the selected object.
748  color = picking_filterHighlightColor(color);
749
750  // use picking color if rendering to picking FBO.
751  color = picking_filterPickingColor(color);
752    `}},...zm},P0=[Jr],L0=["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 R0(n){const t=yn.getDefaultProgramManager(n);for(const e of P0)t.addDefaultModule(e);for(const e of L0)t.addShaderHook(e);return t}const I0="layerManager.setLayers",M0="layerManager.activateViewport";class C0{constructor(t,{deck:e,stats:i,viewport:r,timeline:s}={}){f(this,"layers",void 0),f(this,"context",void 0),f(this,"resourceManager",void 0),f(this,"_lastRenderedLayers",[]),f(this,"_needsRedraw",!1),f(this,"_needsUpdate",!1),f(this,"_nextLayers",null),f(this,"_debug",!1),f(this,"activateViewport",o=>{ot(M0,this,o),o&&(this.context.viewport=o)}),this.layers=[],this.resourceManager=new S0({gl:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:t,deck:e,programManager:t&&R0(t),stats:i||new Nr({id:"deck.gl"}),viewport:r||new Be({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:s||new Sc,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const t of this.layers)this._finalizeLayer(t)}needsRedraw(t={clearRedrawFlags:!1}){let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(const i of this.layers){const r=i.getNeedsRedraw(t);e=e||r}return e}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers({layerIds:t}={}){return t?this.layers.filter(e=>t.find(i=>e.id.indexOf(i)===0)):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,e){ot(I0,this,e,t),this._lastRenderedLayers=t;const i=Uc(t,Boolean);for(const r of i)r.context=this.context;this._updateLayers(this.layers,i)}updateLayers(){const t=this.needsUpdate();t&&(this.setNeedsRedraw("updating layers: ".concat(t)),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}_handleError(t,e,i){i.raiseError(e,"".concat(t," of ").concat(i))}_updateLayers(t,e){const i={};for(const o of t)i[o.id]?z.warn("Multiple old layers with same id ".concat(o.id))():i[o.id]=o;const r=[];this._updateSublayersRecursively(e,i,r),this._finalizeOldLayers(i);let s=!1;for(const o of r)if(o.hasUniformTransition()){s="Uniform transition in ".concat(o);break}this._needsUpdate=s,this.layers=r}_updateSublayersRecursively(t,e,i){for(const r of t){r.context=this.context;const s=e[r.id];s===null&&z.warn("Multiple new layers with same id ".concat(r.id))(),e[r.id]=null;let o=null;try{this._debug&&s!==r&&r.validateProps(),s?(this._transferLayerState(s,r),this._updateLayer(r)):this._initializeLayer(r),i.push(r),o=r.isComposite?r.getSubLayers():null}catch(a){this._handleError("matching",a,r)}o&&this._updateSublayersRecursively(o,e,i)}}_finalizeOldLayers(t){for(const e in t){const i=t[e];i&&this._finalizeLayer(i)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=Ae.INITIALIZED}catch(e){this._handleError("initialization",e,t)}}_transferLayerState(t,e){e._transferState(t),e.lifecycle=Ae.MATCHED,e!==t&&(t.lifecycle=Ae.AWAITING_GC)}_updateLayer(t){try{t._update()}catch(e){this._handleError("update",e,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||"finalized ".concat(t),t.lifecycle=Ae.AWAITING_FINALIZATION;try{t._finalize(),t.lifecycle=Ae.FINALIZED}catch(e){this._handleError("finalization",e,t)}}}function Ot(n,t,e){if(n===t)return!0;
752if(!e||!n||!t)return!1;if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let i=0;i<n.length;i++)if(!Ot(n[i],t[i],e-1))return!1;return!0}if(Array.isArray(t))return!1;if(typeof n=="object"&&typeof t=="object"){const i=Object.keys(n),r=Object.keys(t);if(i.length!==r.length)return!1;for(const s of i)if(!t.hasOwnProperty(s)||!Ot(n[s],t[s],e-1))return!1;return!0}return!1}class O0{constructor(t){f(this,"width",void 0),f(this,"height",void 0),f(this,"views",void 0),f(this,"viewState",void 0),f(this,"controllers",void 0),f(this,"timeline",void 0),f(this,"_viewports",void 0),f(this,"_viewportMap",void 0),f(this,"_isUpdating",void 0),f(this,"_needsRedraw",void 0),f(this,"_needsUpdate",void 0),f(this,"_eventManager",void 0),f(this,"_eventCallbacks",void 0),this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=t.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=t.eventManager,this._eventCallbacks={onViewStateChange:t.onViewStateChange,onInteractionStateChange:t.onInteractionStateChange},Object.seal(this),this.setProps(t)}finalize(){for(const t in this.controllers){const e=this.controllers[t];e&&e.finalize()}this.controllers={}}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(const t in this.controllers){const e=this.controllers[t];e&&e.updateTransition()}}getViewports(t){return t?this._viewports.filter(e=>e.containsPixel(t)):this._viewports}getViews(){const t={};return this.views.forEach(e=>{t[e.id]=e}),t}getView(t){return this.views.find(e=>e.id===t)}getViewState(t){const e=typeof t=="string"?this.getView(t):t,i=e&&this.viewState[e.getViewStateId()]||this.viewState;return e?e.filterViewState(i):i}getViewport(t){return this._viewportMap[t]}unproject(t,e){const i=this.getViewports(),r={x:t[0],y:t[1]};for(let s=i.length-1;s>=0;--s){const o=i[s];if(o.containsPixel(r)){const a=t.slice();return a[0]-=o.x,a[1]-=o.y,o.unproject(a,e)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,e){(t!==this.width||e!==this.height)&&(this.width=t,this.height=e,this.setNeedsUpdate("Size changed"))}_setViews(t){t=Uc(t,Boolean),this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){t?(!Ot(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t):z.warn("missing `viewState` or `initialViewState`")()}_onViewStateChange(t,e){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...e,viewId:t})}_createController(t,e){const i=e.type;return new i({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,e.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:s=>{var o;return(o=this.getView(t.id))===null||o===void 0?void 0:o.makeViewport({viewState:s,width:this.width,height:this.height})}})}_updateController(t,e,i,r){const s=t.controller;if(s&&i){const o={...e,...s,id:t.id,x:i.x,y:i.y,width:i.width,height:i.height};return(!r||r.constructor!==s.type)&&(r=this._createController(t,o)),r&&r.setProps(o),r}return null}_rebuildViewports(){const{views:t}=this,e=this.controllers;this._viewports=[],this.controllers={};let i=!1;for(let r=t.length;r--;){const s=t[r],o=this.getViewState(s),a=s.makeViewport({viewState:o,width:this.width,height:this.height});let c=e[s.id];const l=!!s.controller;l&&!c&&(i=!0),(i||!l)&&c&&(c.finalize(),c=null),this.controllers[s.id]=this._updateController(s,o,a,c),a&&this._viewports.unshift(a)}for(const r in e){const s=e[r];s&&!this.controllers[r]&&s.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={}
752,this._viewports.forEach(t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)})}_diffViews(t,e){return t.length!==e.length?!0:t.some((i,r)=>!t[r].equals(e[r]))}}const N0=/([0-9]+\.?[0-9]*)(%|px)/;function Zt(n){switch(typeof n){case"number":return{position:n,relative:!1};case"string":const t=N0.exec(n);if(t&&t.length>=3){const e=t[2]==="%",i=parseFloat(t[1]);return{position:e?i/100:i,relative:e}}default:throw new Error("Could not parse position string ".concat(n))}}function Kt(n,t){return n.relative?Math.round(n.position*t):n.position}function nt(n,t){if(!n)throw new Error(t||"deck.gl: assertion failed.")}class Ue{constructor(t){f(this,"id",void 0),f(this,"viewportInstance",void 0),f(this,"_x",void 0),f(this,"_y",void 0),f(this,"_width",void 0),f(this,"_height",void 0),f(this,"_padding",void 0),f(this,"props",void 0);const{id:e,x:i=0,y:r=0,width:s="100%",height:o="100%",padding:a=null,viewportInstance:c}=t||{};nt(!c||c instanceof Be),this.viewportInstance=c,this.id=e||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=Zt(i),this._y=Zt(r),this._width=Zt(s),this._height=Zt(o),this._padding=a&&{left:Zt(a.left||0),right:Zt(a.right||0),top:Zt(a.top||0),bottom:Zt(a.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t?!0:this.viewportInstance?t.viewportInstance?this.viewportInstance.equals(t.viewportInstance):!1:this.ViewportType===t.ViewportType&&Ot(this.props,t.props,2)}makeViewport({width:t,height:e,viewState:i}){if(this.viewportInstance)return this.viewportInstance;i=this.filterViewState(i);const r=this.getDimensions({width:t,height:e});return!r.height||!r.width?null:new this.ViewportType({...i,...this.props,...r})}getViewStateId(){const{viewState:t}=this.props;return typeof t=="string"?t:t?.id||this.id}filterViewState(t){if(this.props.viewState&&typeof this.props.viewState=="object"){if(!this.props.viewState.id)return this.props.viewState;const e={...t};for(const i in this.props.viewState)i!=="id"&&(e[i]=this.props.viewState[i]);return e}return t}getDimensions({width:t,height:e}){const i={x:Kt(this._x,t),y:Kt(this._y,e),width:Kt(this._width,t),height:Kt(this._height,e)};return this._padding&&(i.padding={left:Kt(this._padding.left,t),top:Kt(this._padding.top,e),right:Kt(this._padding.right,t),bottom:Kt(this._padding.bottom,e)}),i}get controller(){const t=this.props.controller;return t?t===!0?{type:this.ControllerType}:typeof t=="function"?{type:t}:{type:this.ControllerType,...t}:null}}class En{constructor(t){f(this,"_inProgress",void 0),f(this,"_handle",void 0),f(this,"_timeline",void 0),f(this,"time",void 0),f(this,"settings",void 0),this._inProgress=!1,this._handle=null,this._timeline=t,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(t){var e,i;this.cancel(),this.settings=t,this._inProgress=!0,(e=(i=this.settings).onStart)===null||e===void 0||e.call(i,this)}end(){if(this._inProgress){var t,e;this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(t=(e=this.settings).onEnd)===null||t===void 0||t.call(e,this)}}cancel(){if(this._inProgress){var t,e;(t=(e=this.settings).onInterrupt)===null||t===void 0||t.call(e,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1}}update(){var t,e;if(!this._inProgress)return!1;if(this._handle===null){const{_timeline:i,settings:r}=this;this._handle=i.addChannel({delay:i.getTime(),duration:r.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(t=(e=this.settings).onUpdate)===null||t===void 0||t.call(e,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const Ko=()=>{},Ar={BREAK:1,SNAP_TO_END:2,IGNORE:3},k0=n=>n,D0=Ar.BREAK;class F0{constructor(t){f(this,"getControllerState",void 0),f(this,"props",void 0),f(this,"propsInTransition",void 0),f(this,"transition",void 0),f(this,"onViewStateChange",void 0),f(this,"onStateChange",void 0),f(this,"_onTransitionUpdate",e=>{const{time:i,settings:{interpolator:r,startProps:s,endProps:o,duration:a,easing:c}}=e,l=c(i/a),u=r.interpolateProps(s,o,l);this.propsInTransition=this.getControllerState({...this.props,...u}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})}),this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new En(t.timeline),this.onViewStateChange=t.onViewStateChange||Ko,this.onStateChange=t.onStateChange||Ko}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let e=!1;const i=this.props;if(this.props=t,!i||this._shouldIgnoreViewportChange(i,t))return!1;if(this._isTransitionEnabled(t)){let r=i;if(this.transition.inProgress){const{interruption:s,endProps:o}=this.transition.settings;r={...i,...s===Ar.SNAP_TO_END?o:this.propsInTransition||i}}this._triggerTransition(r,t),e=!0}else this.transition.cancel();return e}updateTransition(){this.transition.update()}_isTransitionEnabled(t){const{transitionDuration:e,transitionInterpolator:i}=t;return(e>0||e==="auto")&&!!i}_isUpdateDueToCurrentTransition(t){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition):!1}_shouldIgnoreViewportChange(t,e){return this.transition.inProgress?this.transition.settings.interruption===Ar.IGNORE||this._isUpdateDueToCurrentTransition(e):this._isTransitionEnabled(e)?e.transitionInterpolator.arePropsEqual(t,e):!0}_triggerTransition(t,e){const i=this.getControllerState(t),r=this.getControllerState(e).shortestPathFrom(i),s=e.transitionInterpolator,o=s.getDuration?s.getDuration(t,e):e.transitionDuration;if(o===0)return;const a=s.initializeProps(t,r);this.propsInTransition={};const c={duration:o,easing:e.transitionEasing||k0,interpolator:s,interruption:e.transitionInterruption||D0,startProps:a.start,endProps:a.end,onStart:e.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(e.onTransitionInterrupt),onEnd:this._onTransitionEnd(e.onTransitionEnd)};this.transition.start(c),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return e=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),t?.(e)}}}class U0{constructor(t){f(this,"_propsToCompare",void 0),f(this,"_propsToExtract",void 0),f(this,"_requiredProps",void 0);const{compare:e,extract:i,required:r}=t;this._propsToCompare=e,this._propsToExtract=i||e,this._requiredProps=r}arePropsEqual(t,e){for(const i of this._propsToCompare)if(!(i in t)||!(i in e)||!hn(t[i],e[i]))return!1;return!0}initializeProps(t,e){const i={},r={};for(const s of this._propsToExtract)(s in t||s in e)&&(i[s]=t[s],r[s]=e[s]);return this._checkRequiredProps(i),this._checkRequiredProps(r),{start:i,end:r}}getDuration(t,e){return e.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach(e
752=>{const i=t[e];nt(Number.isFinite(i)||Array.isArray(i),"".concat(e," is required for transition"))})}}const B0=["longitude","latitude","zoom","bearing","pitch"],V0=["longitude","latitude","zoom"];class zc extends U0{constructor(t={}){const e=Array.isArray(t)?t:t.transitionProps,i=Array.isArray(t)?{}:t;i.transitionProps=Array.isArray(e)?{compare:e,required:e}:e||{compare:B0,required:V0},super(i.transitionProps),f(this,"opts",void 0),this.opts=i}initializeProps(t,e){const i=super.initializeProps(t,e),{makeViewport:r,around:s}=this.opts;if(r&&s){const o=r(t),a=r(e),c=o.unproject(s);i.start.around=s,Object.assign(i.end,{around:a.project(c),aroundPosition:c,width:e.width,height:e.height})}return i}interpolateProps(t,e,i){const r={};for(const s of this._propsToExtract)r[s]=ii(t[s]||0,e[s]||0,i);if(e.aroundPosition&&this.opts.makeViewport){const s=this.opts.makeViewport({...e,...r});Object.assign(r,s.panByPosition(e.aroundPosition,ii(t.around,e.around,i)))}return r}}const $t={transitionDuration:0},j0=300,Hn=n=>1-(1-n)*(1-n),we={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],TRIPLE_PAN:["tripanstart","tripanmove","tripanend"],DOUBLE_TAP:["doubletap"],KEYBOARD:["keydown"]},ae={};class z0{constructor(t){f(this,"props",void 0),f(this,"state",{}),f(this,"transitionManager",void 0),f(this,"eventManager",void 0),f(this,"onViewStateChange",void 0),f(this,"onStateChange",void 0),f(this,"makeViewport",void 0),f(this,"_controllerState",void 0),f(this,"_events",{}),f(this,"_interactionState",{isDragging:!1}),f(this,"_customEvents",[]),f(this,"_eventStartBlocked",null),f(this,"_panMove",!1),f(this,"invertPan",!1),f(this,"dragMode","rotate"),f(this,"inertia",0),f(this,"scrollZoom",!0),f(this,"dragPan",!0),f(this,"dragRotate",!0),f(this,"doubleClickZoom",!0),f(this,"touchZoom",!0),f(this,"touchRotate",!1),f(this,"keyboard",!0),this.transitionManager=new F0({...t,getControllerState:e=>new this.ControllerState(e),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(const e in this._events)if(this._events[e]){var t;(t=this.eventManager)===null||t===void 0||t.off(e,this.handleEvent)}this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;const e=this._eventStartBlocked;switch(t.type){case"panstart":return e?!1:this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return e?!1:this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"tripanstart":return e?!1:this._onTriplePanStart(t);case"tripanmove":return this._onTriplePan(t);case"tripanend":return this._onTriplePanEnd(t);case"doubletap":return this._onDoubleTap(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){const{x:e,y:i}=this.props,{offsetCenter:r}=t;return[r.x-e,r.y-i]}isPointInBounds(t,e){const{width:i,height:r}=this.props;if(e&&e.handled)return!1;const s=t[0]>=0&&t[0]<=i&&t[1]>=0&&t[1]<=r;return s&&e&&e.stopPropagation(),s}isFunctionKeyPressed(t){const{srcEvent:e}=t;return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){const e=setTimeout(()=>{this._eventStartBlocked===e&&(this._eventStartBlocked=null)},t);this._eventStartBlocked=e}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);const{inertia:e}=t;this.inertia=Number.isFinite(e)?e:e===!0?j0:0;const{scrollZoom:i=!0,dragPan:r=!0,dragRotate:s=!0,doubleClickZoom:o=!0,touchZoom:a=!0,touchRotate:c=!1,keyboard:l=!0}=t,u=!!this.onViewStateChange;this.toggleEvents(we.WHEEL,u&&i),this.toggleEvents(we.PAN,u),this.toggleEvents(we.PINCH,u&&(
vendor: 9,131 bytes, line 752
752a||c)),this.toggleEvents(we.TRIPLE_PAN,u&&c),this.toggleEvents(we.DOUBLE_TAP,u&&o),this.toggleEvents(we.KEYBOARD,u&&l),this.scrollZoom=i,this.dragPan=r,this.dragRotate=s,this.doubleClickZoom=o,this.touchZoom=a,this.touchRotate=c,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,e){this.eventManager&&t.forEach(i=>{this._events[i]!==e&&(this._events[i]=e,e?this.eventManager.on(i,this.handleEvent):this.eventManager.off(i,this.handleEvent))})}updateViewport(t,e=null,i={}){const r={...t.getViewportProps(),...e},s=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(i),s){const o=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:r,interactionState:this._interactionState,oldViewState:o})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;let i=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(i=!i);const r=this.controllerState[i?"panStart":"rotateStart"]({pos:e});return this._panMove=i,this.updateViewport(r,$t,{isDragging:!0}),!0}_onPan(t){return this.isDragging()?this._panMove?this._onPanMove(t):this._onPanRotate(t):!1}_onPanEnd(t){return this.isDragging()?this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t):!1}_onPanMove(t){if(!this.dragPan)return!1;const e=this.getCenter(t),i=this.controllerState.pan({pos:e});return this.updateViewport(i,$t,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){const{inertia:e}=this;if(this.dragPan&&e&&t.velocity){const i=this.getCenter(t),r=[i[0]+t.velocityX*e/2,i[1]+t.velocityY*e/2],s=this.controllerState.pan({pos:r}).panEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:Hn},{isDragging:!1,isPanning:!0})}else{const i=this.controllerState.panEnd();this.updateViewport(i,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;const e=this.getCenter(t),i=this.controllerState.rotate({pos:e});return this.updateViewport(i,$t,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){const{inertia:e}=this;if(this.dragRotate&&e&&t.velocity){const i=this.getCenter(t),r=[i[0]+t.velocityX*e/2,i[1]+t.velocityY*e/2],s=this.controllerState.rotate({pos:r}).rotateEnd();this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:Hn},{isDragging:!1,isRotating:!0})}else{const i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;t.srcEvent.preventDefault();const{speed:i=.01,smooth:r=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:s}=t;let o=2/(1+Math.exp(-Math.abs(s*i)));s<0&&o!==0&&(o=1/o);const a=this.controllerState.zoom({pos:e,scale:o});return this.updateViewport(a,{...this._getTransitionProps({around:e}),transitionDuration:r?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const i=this.controllerState.rotateStart({pos:e});return this.updateViewport(i,$t,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate||!this.isDragging())return!1;const e=this.getCenter(t);e[0]-=t.deltaX;const i=this.controllerState.rotate({pos:e});return this.updateViewport(i,$t,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this;if(this.touchRotate&&e&&t.velocityY){const i=this.getCenter(t),r=[i[0],i[1]+=t.velocityY*e/2],s=this.controllerState.rotate({pos:r});this.updateViewport(s,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:Hn},{isDragging:!1,isRotating:!0}),this.blockEvents(e)}else{const i=this.controllerState.rotateEnd();this.updateViewport(i,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const i=this.controllerState.zoomStart({pos:e}).rotateStart({pos:e});return ae._startPinchRotation=t.rotation,ae._lastPinchEvent=t,this.updateViewport(i,$t,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let e=this.controllerState;if(this.touchZoom){const{scale:i}=t,r=this.getCenter(t);e=e.zoom({pos:r,scale:i})}if(this.touchRotate){const{rotation:i}=t;e=e.rotate({deltaAngleX:ae._startPinchRotation-i})}return this.updateViewport(e,$t,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),ae._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this,{_lastPinchEvent:i}=ae;if(this.touchZoom&&e&&i&&t.scale!==i.scale){const r=this.getCenter(t);let s=this.controllerState.rotateEnd();const o=Math.log2(t.scale),a=(o-Math.log2(i.scale))/(t.deltaTime-i.deltaTime),c=Math.pow(2,o+a*e/2);s=s.zoom({pos:r,scale:c}).zoomEnd(),this.updateViewport(s,{...this._getTransitionProps({around:r}),transitionDuration:e,transitionEasing:Hn},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(e)}else{const r=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(r,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return ae._startPinchRotation=null,ae._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const i=this.isFunctionKeyPressed(t),r=this.controllerState.zoom({pos:e,scale:i?.5:2});return this.updateViewport(r,this._getTransitionProps({around:e}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;const e=this.isFunctionKeyPressed(t),{zoomSpeed:i,moveSpeed:r,rotateSpeedX:s,rotateSpeedY:o}=this.keyboard===!0?{}:this.keyboard,{controllerState:a}=this;let c;const l={};switch(t.srcEvent.code){case"Minus":c=e?a.zoomOut(i).zoomOut(i):a.zoomOut(i),l.isZooming=!0;break;case"Equal":c=e?a.zoomIn(i).zoomIn(i):a.zoomIn(i),l.isZooming=!0;break;case"ArrowLeft":e?(c=a.rotateLeft(s),l.isRotating=!0):(c=a.moveLeft(r),l.isPanning=!0);break;case"ArrowRight":e?(c=a.rotateRight(s),l.isRotating=!0):(c=a.moveRight(r),l.isPanning=!0);break;case"ArrowUp":e?(c=a.rotateUp(o),l.isRotating=!0):(c=a.moveUp(r),l.isPanning=!0);break;case"ArrowDown":e?(c=a.rotateDown(o),l.isRotating=!0):(c=a.moveDown(r),l.isPanning=!0);break;default:return!1}return this.updateViewport(c,this._getTransitionProps(),l),!0}_getTransitionProps(t){const{transition:e}=this;return!e||!e.transitionInterpolator?$t:t?{...e,transitionInterpolator:new zc({...t,...e.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:e}}class G0{constructor(t,e){f(this,"_viewportProps",void 0),f(this,"_state",void 0),this._viewportProps=this.applyConstraints(t),this._state=e}getViewportProps(){return this._viewportProps}getState(){return this._state}}const $o=5,H0=1.2;class W0 extends G0{constructor(t){const{width:e,height:i,latitude:r,longitude:s,zoom:o,bearing:a=0,pitch:c=0,altitude:l=1.5,position:u=[0,0,0],maxZoom:d=20,minZoom:p=0,maxPitch:_=60,minPitch:b=0,startPanLngLat:y,startZoomLngLat:E,startRotatePos:T,startBearing:w,startPitch:A,startZoom:x,normalize:L=!0}=t;nt(Number.isFinite(s)),nt(Number.isFinite(r)),nt(Number.isFinite(o)),super({width:e,height:i,latitude:r,longitude:s,zoom:o,bearing:a,pitch:c,altitude:l,maxZoom:d,minZoom:p,maxPitch:_,minPitch:b,normalize:L,position:u},{startPanLngLat:y,startZoomLngLat:E,startRotatePos:T,startBearing:w,startPitch:A,startZoom:x}),f(this,"makeViewport",void 0),this.makeViewport=t.makeViewport}panStart({pos:t}){return this._getUpdatedState({startPanLngLat:this._unproject(t)})}pan({pos:t,startPos:e}){const i=this.getState().startPanLngLat||this._unproject(e);if(!i)return this;const s=this.makeViewport(this.getViewportProps()).panByPosition(i,t);return this._getUpdatedState(s)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:t}){return this._getUpdatedState({startRotatePos:t,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:t,deltaAngleX:e=0,deltaAngleY:i=0}){const{startRotatePos:r,startBearing:s,startPitch:o}=this.getState();if(!r||s===void 0||o===void 0)return this;let a;return t?a=this._getNewRotation(t,r,o,s):a={bearing:s+e,pitch:o+i},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart({pos:t}){return this._getUpdatedState({startZoomLngLat:this._unproject(t),startZoom:this.getViewportProps().zoom})}zoom({pos:t,startPos:e,scale:i}){let{startZoom:r,startZoomLngLat:s}=this.getState();if(s||(r=this.getViewportProps().zoom,s=this._unproject(e)||this._unproject(t)),!s)return this;const{maxZoom:o,minZoom:a}=this.getViewportProps();let c=r+Math.log2(i);c=Qt(c,a,o);const l=this.makeViewport({...this.getViewportProps(),zoom:c});return this._getUpdatedState({zoom:c,...l.panByPosition(s,t)})}
752zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(t=2){return this._zoomFromCenter(t)}zoomOut(t=2){return this._zoomFromCenter(1/t)}moveLeft(t=100){return this._panFromCenter([t,0])}moveRight(t=100){return this._panFromCenter([-t,0])}moveUp(t=100){return this._panFromCenter([0,t])}moveDown(t=100){return this._panFromCenter([0,-t])}rotateLeft(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(t=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(t=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){const e=t.getViewportProps(),i={...this.getViewportProps()},{bearing:r,longitude:s}=i;return Math.abs(r-e.bearing)>180&&(i.bearing=r<0?r+360:r-360),Math.abs(s-e.longitude)>180&&(i.longitude=s<0?s+360:s-360),i}applyConstraints(t){const{maxZoom:e,minZoom:i,zoom:r}=t;t.zoom=Qt(r,i,e);const{maxPitch:s,minPitch:o,pitch:a}=t;t.pitch=Qt(a,o,s);const{normalize:c=!0}=t;return c&&Object.assign(t,$_(t)),t}_zoomFromCenter(t){const{width:e,height:i}=this.getViewportProps();return this.zoom({pos:[e/2,i/2],scale:t})}_panFromCenter(t){const{width:e,height:i}=this.getViewportProps();return this.pan({startPos:[e/2,i/2],pos:[e/2+t[0],i/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){const e=this.makeViewport(this.getViewportProps());return t&&e.unproject(t)}_getNewRotation(t,e,i,r){const s=t[0]-e[0],o=t[1]-e[1],a=t[1],c=e[1],{width:l,height:u}=this.getViewportProps(),d=s/l;let p=0;o>0?Math.abs(u-c)>$o&&(p=o/(c-u)*H0):o<0&&c>$o&&(p=1-a/c),p=Qt(p,-1,1);const{minPitch:_,maxPitch:b}=this.getViewportProps(),y=r+180*d;let E=i;return p>0?E=i+p*(b-i):p<0&&(E=i-p*(_-i)),{pitch:E,bearing:y}}}class X0 extends z0{constructor(...t){super(...t),f(this,"ControllerState",W0),f(this,"transition",{transitionDuration:300,transitionInterpolator:new zc({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})}),f(this,"dragMode","pan")}setProps(t){t.position=t.position||[0,0,0];const e=this.props;super.setProps(t),(!e||e.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}}class Gc extends Ue{get ViewportType(){return Fe}get ControllerType(){return X0}}f(Gc,"displayName","MapView");const Y0=new kc;function q0(n,t){var e,i;const r=(e=n.order)!==null&&e!==void 0?e:1/0,s=(i=t.order)!==null&&i!==void 0?i:1/0;return r-s}class Z0{constructor(){f(this,"effects",void 0),f(this,"_resolvedEffects",[]),f(this,"_defaultEffects",[]),f(this,"_needsRedraw",void 0),this.effects=[],this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(t){const e=this._defaultEffects;if(!e.find(i=>i.id===t.id)){const i=e.findIndex(r=>q0(r,t)>0);i<0?e.push(t):e.splice(i,0,t),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(Ot(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}getEffects(){return this._resolvedEffects}_setEffects(t){const e={};for(const r of this.effects)e[r.id]=r;const i=[];for(const r of t){const s=e[r.id];s&&s!==r?s.setProps?(s.setProps(r.props),i.push(s)):(s.cleanup(),i.push(r)):i.push(r),delete e[r.id]}for(const r in e)e[r].cleanup();this.effects=i,this._resolvedEffects=i.concat(this._defaultEffects),t.some(r=>r instanceof kc)||this._resolvedEffects.push(Y0),this._needsRedraw="effects changed"}finalize(){for(const t of this._resolvedEffects)t.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class K0 extends Qr{shouldDrawLayer(t){const{operation:e}=t.props;return e.includes("draw")||e.includes("terrain")}}const $0="deckRenderer.renderLayers";class Q0{constructor(t){f(this,"gl",void 0),f(this,"layerFilter",void 0),f(this,"drawPickingColors",void 0),f(this,"drawLayersPass",void 0),f(this,"pickLayersPass",void 0),f(this,"renderCount",void 0),f(this,"_needsRedraw",void 0),f(this,"renderBuffers",void 0),f(this,"lastPostProcessEffect",void 0),this.gl=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new K0(t),this.pickLayersPass=new Fc(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){if(!t.viewports.length)return;const e=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,i={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t,target:t.target||Q.getDefaultFramebuffer(this.gl)};i.effects&&this._preRender(i.effects,i);const r=this.lastPostProcessEffect?this.renderBuffers[0]:i.target,s=e.render({...i,target:r});i.effects&&this._postRender(i.effects,i),this.renderCount++,ot($0,this,s,t)}needsRedraw(t={clearRedrawFlags:!1}){const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}finalize(){const{renderBuffers:t}=this;for(const e of t)e.delete();t.length=0}_preRender(t,e){this.lastPostProcessEffect=null,e.preRenderStats=e.preRenderStats||{};for(const i of t)e.preRenderStats[i.id]=i.preRender(this.gl,e),i.postRender&&(this.lastPostProcessEffect=i.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:t}=this;t.length===0&&t.push(new Q(this.gl),new Q(this.gl));for(const e of t)e.resize()}_postRender(t,e){const{renderBuffers:i}=this,r={...e,inputBuffer:i[0],swapBuffer:i[1],target:null};for(const s of t)if(s.postRender){if(s.id===this.lastPostProcessEffect){r.target=e.target,s.postRender(this.gl,r);break}const o=s.postRender(this.gl,r);r.inputBuffer=o,r.swapBuffer=o===i[0]?i[1]:i[0]}}}const J0={pickedColor:null,pickedObjectIndex:-1};function tb({pickedColors:n,decodePickingColor:t,deviceX:e,deviceY:i,deviceRadius:r,deviceRect:s}){const{x:o,y:a,width:c,height:l}=s;let u=r*r,d=-1,p=0;for(let _=0;_<l;_++){const b=_+a-i,y=b*b;if(y>u)p+=4*c;else for(let E=0;E<c;E++){if(n[p+3]-1>=0){const w=E+o-e,A=w*w+y;A<=u&&(u=A,d=p)}p+=4}}if(d>=0){const _=n.slice(d,d+4),b=t(_);
752if(b){const y=Math.floor(d/4/c),E=d/4-y*c;return{...b,pickedColor:_,pickedX:o+E,pickedY:a+y}}z.error("Picked non-existent layer. Is picking buffer corrupt?")()}return J0}function eb({pickedColors:n,decodePickingColor:t}){const e=new Map;if(n){for(let i=0;i<n.length;i+=4)if(n[i+3]-1>=0){const s=n.slice(i,i+4),o=s.join(",");if(!e.has(o)){const a=t(s);a?e.set(o,{...a,color:s}):z.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(e.values())}function Hc({pickInfo:n,viewports:t,pixelRatio:e,x:i,y:r,z:s}){let o=t[0];t.length>1&&(o=ib(n?.pickedViewports||t,{x:i,y:r}));let a;if(o){const c=[i-o.x,r-o.y];s!==void 0&&(c[2]=s),a=o.unproject(c)}return{color:null,layer:null,viewport:o,index:-1,picked:!1,x:i,y:r,pixel:[i,r],coordinate:a,devicePixel:n&&"pickedX"in n?[n.pickedX,n.pickedY]:void 0,pixelRatio:e}}function nb(n){const{pickInfo:t,lastPickedInfo:e,mode:i,layers:r}=n,{pickedColor:s,pickedLayer:o,pickedObjectIndex:a}=t,c=o?[o]:[];if(i==="hover"){const d=e.index,p=e.layerId,_=o?o.props.id:null;if(_!==p||a!==d){if(_!==p){const b=r.find(y=>y.props.id===p);b&&c.unshift(b)}e.layerId=_,e.index=a,e.info=null}}const l=Hc(n),u=new Map;return u.set(null,l),c.forEach(d=>{let p={...l};d===o&&(p.color=s,p.index=a,p.picked=!0),p=Wc({layer:d,info:p,mode:i});const _=p.layer;d===o&&i==="hover"&&(e.info=p),u.set(_.id,p),i==="hover"&&_.updateAutoHighlight(p)}),u}function Wc({layer:n,info:t,mode:e}){for(;n&&t;){const i=t.layer||null;t.sourceLayer=i,t.layer=n,t=n.getPickingInfo({info:t,mode:e,sourceLayer:i}),n=n.parent}return t}function ib(n,t){for(let e=n.length-1;e>=0;e--){const i=n[e];if(i.containsPixel(t))return i}return n[0]}class rb{constructor(t){f(this,"gl",void 0),f(this,"pickingFBO",void 0),f(this,"depthFBO",void 0),f(this,"pickLayersPass",void 0),f(this,"layerFilter",void 0),f(this,"lastPickedInfo",void 0),f(this,"_pickable",!0),this.gl=t,this.pickLayersPass=new Fc(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}
752pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject({x:t,y:e,layers:i,viewports:r},s=this.lastPickedInfo.info){const o=s&&s.layer&&s.layer.id,a=s&&s.viewport&&s.viewport.id,c=o?i.find(p=>p.id===o):null,l=a&&r.find(p=>p.id===a)||r[0],u=l&&l.unproject([t-l.x,e-l.y]);return{...s,...{x:t,y:e,viewport:l,coordinate:u,layer:c}}}_resizeBuffer(){var t,e;const{gl:i}=this;if(!this.pickingFBO&&(this.pickingFBO=new Q(i),Q.isSupported(i,{colorBufferFloat:!0}))){const r=new Q(i);r.attach({36064:new At(i,{format:F(i)?34836:6408,type:5126})}),this.depthFBO=r}(t=this.pickingFBO)===null||t===void 0||t.resize({width:i.canvas.width,height:i.canvas.height}),(e=this.depthFBO)===null||e===void 0||e.resize({width:i.canvas.width,height:i.canvas.height})}_getPickable(t){if(this._pickable===!1)return null;const e=t.filter(i=>this.pickLayersPass.shouldDrawLayer(i)&&!i.isComposite);return e.length?e:null}_pickClosestObject({layers:t,views:e,viewports:i,x:r,y:s,radius:o=0,depth:a=1,mode:c="query",unproject3D:l,onViewportActive:u,effects:d}){const p=this._getPickable(t),_=Re(this.gl);if(!p)return{result:[],emptyInfo:Hc({viewports:i,x:r,y:s,pixelRatio:_})};this._resizeBuffer();const b=Ui(this.gl,[r,s],!0),y=[b.x+Math.floor(b.width/2),b.y+Math.floor(b.height/2)],E=Math.round(o*_),{width:T,height:w}=this.pickingFBO,A=this._getPickingRect({deviceX:y[0],deviceY:y[1],deviceRadius:E,deviceWidth:T,deviceHeight:w}),x={x:r-o,y:s-o,width:o*2+1,height:o*2+1};let L;const P=[],O=new Set;for(let U=0;U<a;U++){let C;if(A){const k=this._drawAndSample({layers:p,views:e,viewports:i,onViewportActive:u,deviceRect:A,cullRect:x,effects:d,pass:"picking:".concat(c)});C=tb({...k,deviceX:y[0],deviceY:y[1],deviceRadius:E,deviceRect:A})}else C={pickedColor:null,pickedObjectIndex:-1};let N;if(C.pickedLayer&&l&&this.depthFBO){const{pickedColors:k}=this._drawAndSample({layers:[C.pickedLayer],views:e,viewports:i,onViewportActive:u,deviceRect:{x:C.pickedX,y:C.pickedY,width:1,height:1},cullRect:x,effects:d,pass:"picking:".concat(c,":z")},!0);k[3]&&(N=k[0])}C.pickedLayer&&U+1<a&&(O.add(C.pickedLayer),C.pickedLayer.disablePickingIndex(C.pickedObjectIndex)),L=nb({pickInfo:C,lastPickedInfo:this.lastPickedInfo,mode:c,layers:p,viewports:i,x:r,y:s,z:N,pixelRatio:_});for(const k of L.values())k.layer&&P.push(k);if(!C.pickedColor)break}for(const U of O)U.restorePickingColors();return{result:P,emptyInfo:L.get(null)}}_pickVisibleObjects({layers:t,views:e,viewports:i,x:r,y:s,width:o=1,height:a=1,mode:c="query",maxObjects:l=null,onViewportActive:u,effects:d}){const p=this._getPickable(t);if(!p)return[];this._resizeBuffer();const _=Re(this.gl),b=Ui(this.gl,[r,s],!0),y=b.x,E=b.y+b.height,T=Ui(this.gl,[r+o,s+a],!0),w=T.x+T.width,A=T.y,x={x:y,y:A,width:w-y,height:E-A},L=this._drawAndSample({layers:p,views:e,viewports:i,onViewportActive:u,deviceRect:x,cullRect:{x:r,y:s,width:o,height:a},effects:d,pass:"picking:".concat(c)}),P=eb(L),O=new Map,U=Number.isFinite(l);for(let N=0;N<P.length;N++){var C;if(U&&l&&O.size>=l)break;const k=P[N];let W={color:k.pickedColor,layer:null,index:k.pickedObjectIndex,picked:!0,x:r,y:s,pixelRatio:_};W=Wc({layer:k.pickedLayer,info:W,mode:c});const q=(C=W.object)!==null&&C!==void 0?C:"".concat(W.layer.id,"[").concat(W.index,"]");O.has(q)||O.set(q,W)}return Array.from(O.values())}_drawAndSample({layers:t,views:e,viewports:i,onViewportActive:r,deviceRect:s,cullRect:o,effects:a,pass:c},l=!1){const u=l?this.depthFBO:this.pickingFBO,d={layers:t,layerFilter:this.layerFilter,views:e,viewports:i,onViewportActive:r,pickingFBO:u,deviceRect:s,cullRect:o,effects:a,pass:c,pickZ:l,preRenderStats:{}};for(const w of a)w.useInPicking&&(d.preRenderStats[w.id]=w.preRender(this.gl,d));const{decodePickingColor:p}=this.pickLayersPass.render(d),{x:_,y:b,width:y,height:E}=s,T=new(l?Float32Array:Uint8Array)(y*E*4);return mi(u,{sourceX:_,sourceY:b,sourceWidth:y,sourceHeight:E,target:T}),{pickedColors:T,decodePickingColor:p}}_getPickingRect({deviceX:t,deviceY:e,deviceRadius:i,deviceWidth:r,deviceHeight:s}){const o=Math.max(0,t-i),a=Math.max(0,e-i),c=Math.min(r,t+i+1)-o,l=Math.min(s,e+i+1)-a;return c<=0||l<=0?null:{x:o,y:a,width:c,height:l}}}const sb={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class ob{constructor(t){f(this,"el",null),f(this,"isVisible",!1);const e=t.parentElement;e&&(this.el=document.createElement("div"),this.el.className="deck-tooltip",Object.assign(this.el.style,sb),e.appendChild(this.el))}setTooltip(t,e,i){const r=this.el;if(r){if(typeof t=="string")r.innerText=t;else if(t)t.text&&(r.innerText=t.text),t.html&&(r.innerHTML=t.html),t.className&&(r.className=t.className);else{this.isVisible=!1,r.style.display="none";return}this.isVisible=!0,r.style.display="block",r.style.transform="translate(".concat(e,"px, ").concat(i,"px)"),t&&typeof t=="object"&&"style"in t&&Object.assign(r.style,t.style)}
vendor: 30,933 bytes, lines 752-758
752}remove(){this.el&&(this.el.remove(),this.el=null)}}var Xc={exports:{}};/*! Hammer.JS - v2.0.7 - 2016-04-22
753 * http://hammerjs.github.io/
754 *
755 * Copyright (c) 2016 Jorik Tangelder;
756 * Licensed under the MIT license */(function(n){(function(t,e,i,r){var s=["","webkit","Moz","MS","ms","o"],o=e.createElement("div"),a="function",c=Math.round,l=Math.abs,u=Date.now;function d(h,g,m){return setTimeout(A(h,m),g)}function p(h,g,m){return Array.isArray(h)?(_(h,m[g],m),!0):!1}function _(h,g,m){var v;if(h)if(h.forEach)h.forEach(g,m);else if(h.length!==r)for(v=0;v<h.length;)g.call(m,h[v],v,h),v++;else for(v in h)h.hasOwnProperty(v)&&g.call(m,h[v],v,h)}function b(h,g,m){var v="DEPRECATED METHOD: "+g+`
757`+m+` AT 
758`;return function(){var S=new Error("get-stack-trace"),I=S&&S.stack?S.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",D=t.console&&(t.console.warn||t.console.log);return D&&D.call(t.console,v,I),h.apply(this,arguments)}}var y;typeof Object.assign!="function"?y=function(g){if(g===r||g===null)throw new TypeError("Cannot convert undefined or null to object");for(var m=Object(g),v=1;v<arguments.length;v++){var S=arguments[v];if(S!==r&&S!==null)for(var I in S)S.hasOwnProperty(I)&&(m[I]=S[I])}return m}:y=Object.assign;var E=b(function(g,m,v){for(var S=Object.keys(m),I=0;I<S.length;)(!v||v&&g[S[I]]===r)&&(g[S[I]]=m[S[I]]),I++;return g},"extend","Use `assign`."),T=b(function(g,m){return E(g,m,!0)},"merge","Use `assign`.");function w(h,g,m){var v=g.prototype,S;S=h.prototype=Object.create(v),S.constructor=h,S._super=v,m&&y(S,m)}function A(h,g){return function(){return h.apply(g,arguments)}}function x(h,g){return typeof h==a?h.apply(g&&g[0]||r,g):h}function L(h,g){return h===r?g:h}function P(h,g,m){_(N(g),function(v){h.addEventListener(v,m,!1)})}function O(h,g,m){_(N(g),function(v){h.removeEventListener(v,m,!1)})}function U(h,g){for(;h;){if(h==g)return!0;h=h.parentNode}return!1}function C(h,g){return h.indexOf(g)>-1}function N(h){return h.trim().split(/\s+/g)}function k(h,g,m){if(h.indexOf&&!m)return h.indexOf(g);for(var v=0;v<h.length;){if(m&&h[v][m]==g||!m&&h[v]===g)return v;v++}return-1}function W(h){return Array.prototype.slice.call(h,0)}function q(h,g,m){for(var v=[],S=[],I=0;I<h.length;){var D=h[I][g];k(S,D)<0&&v.push(h[I]),S[I]=D,I++}return v=v.sort(function(tt,st){return tt[g]>st[g]}),v}function B(h,g){for(var m,v,S=g[0].toUpperCase()+g.slice(1),I=0;I<s.length;){if(m=s[I],v=m?m+S:g,v in h)return v;I++}return r}var ne=1;function ll(){return ne++}function as(h){var g=h.ownerDocument||h;return g.defaultView||g.parentWindow||t}var ul=/mobile|tablet|ip(ad|hone|od)|android/i,cs="ontouchstart"in t,hl=B(t,"PointerEvent")!==r,fl=cs&&ul.test(navigator.userAgent),Ve="touch",dl="pen",vi="mouse",gl="kinect",pl=25,rt=1,ie=2,K=4,lt=8,An=1,je=2,ze=4,Ge=8,He=16,St=je|ze,re=Ge|He,ls=St|re,us=["x","y"],Sn=["clientX","clientY"];function mt(h,g){var m=this;this.manager=h,this.callback=g,this.element=h.element,this.target=h.options.inputTarget,this.domHandler=function(v){x(h.options.enable,[h])&&m.handler(v)},this.init()}mt.prototype={handler:function(){},init:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(as(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&O(this.element,this.evEl,this.domHandler),this.evTarget&&O(this.target,this.evTarget,this.domHandler),this.evWin&&O(as(this.element),this.evWin,this.domHandler)}};function ml(h){var g,m=h.options.inputClass;return m?g=m:hl?g=Ti:fl?g=Ln:cs?g=wi:g=Pn,new g(h,_l)}function _l(h,g,m){var v=m.pointers.length,S=m.changedPointers.length,I=g&rt&&v-S===0,D=g&(K|lt)&&v-S===0;m.isFirst=!!I,m.isFinal=!!D,I&&(h.session={}),m.eventType=g,bl(h,m),h.emit("hammer.input",m),h.recognize(m),h.session.prevInput=m}function bl(h,g){var m=h.session,v=g.pointers,S=v.length;m.firstInput||(m.firstInput=hs(g)),S>1&&!m.firstMultiple?m.firstMultiple=hs(g):S===1&&(m.firstMultiple=!1);var I=m.firstInput,D=m.firstMultiple,J=D?D.center:I.center,tt=g.center=fs(v);g.timeStamp=u(),g.deltaTime=g.timeStamp-I.timeStamp,g.angle=Ei(J,tt),g.distance=xn(J,tt),yl(m,g),g.offsetDirection=gs(g.deltaX,g.deltaY);var st=ds(g.deltaTime,g.deltaX,g.deltaY);g.overallVelocityX=st.x,g.overallVelocityY=st.y,g.overallVelocity=l(st.x)>l(st.y)?st.x:st.y,g.scale=D?Tl(D.pointers,v):1,g.rotation=D?El(D.pointers,v):0,g.maxPointers=m.prevInput?g.pointers.length>m.prevInput.maxPointers?g.pointers.length:m.prevInput.maxPointers:g.pointers.length,vl(m,g);var Pt=h.element;U(g.srcEvent.target,Pt)&&(Pt=g.srcEvent.target),g.target=Pt}function yl(h,g){var m=g.center,v=h.offsetDelta||{},S=h.prevDelta||{},I=h.prevInput||{};(g.eventType===rt||I.eventType===K)&&(S=h.prevDelta={x:I.deltaX||0,y:I.deltaY||0},v=h.offsetDelta={x:m.x,y:m.y}),g.deltaX=S.x+(m.x-v.x),g.deltaY=S.y+(m.y-v.y)}function vl(h,g){var m=h.lastInterval||g,v=g.timeStamp-m.timeStamp,S,I,D,J;if(g.eventType!=lt&&(v>pl||m.velocity===r)){var tt=g.deltaX-m.deltaX,st=g.deltaY-m.deltaY,Pt=ds(v,tt,st);I=Pt.x,D=Pt.y,S=l(Pt.x)>l(Pt.y)?Pt.x:Pt.y,J=gs(tt,st),h.lastInterval=g}else S=m.velocity,I=m.velocityX,D=m.velocityY,J=m.direction;g.velocity=S,g.velocityX=I,g.velocityY=D,g.direction=J}function hs(h){for(var g=[],m=0;m<h.pointers.length;)g[m]={clientX:c(h.pointers[m].clientX),clientY:c(h.pointers[m].clientY)},m++;return{timeStamp:u(),pointers:g,center:fs(g),deltaX:h.deltaX,deltaY:h.deltaY}}function fs(h){var g=h.length;if(g===1)return{x:c(h[0].clientX),y:c(h[0].clientY)};for(var m=0,v=0,S=0;S<g;)m+=h[S].clientX,v+=h[S].clientY,S++;return{x:c(m/g),y:c(v/g)}}function ds(h,g,m){return{x:g/h||0,y:m/h||0}}function gs(h,g){return h===g?An:l(h)>=l(g)?h<0?je:ze:g<0?Ge:He}function xn(h,g,m){m||(m=us);var v=g[m[0]]-h[m[0]],S=g[m[1]]-h[m[1]];return Math.sqrt(v*v+S*S)}function Ei(h,g,m){m||(m=us);var v=g[m[0]]-h[m[0]],S=g[m[1]]-h[m[1]];return Math.atan2(S,v)*180/Math.PI}function El(h,g){return Ei(g[1],g[0],Sn)+Ei(h[1],h[0],Sn)}function Tl(h,g){return xn(g[0],g[1],Sn)/xn(h[0],h[1],Sn)}var wl={mousedown:rt,mousemove:ie,mouseup:K},Al="mousedown",Sl="mousemove mouseup";function Pn(){this.evEl=Al,this.evWin=Sl,this.pressed=!1,mt.apply(this,arguments)}w(Pn,mt,{handler:function(g){var m=wl[g.type];m&rt&&g.button===0&&(this.pressed=!0),m&ie&&g.which!==1&&(m=K),this.pressed&&(m&K&&(this.pressed=!1),this.callback(this.manager,m,{pointers:[g],changedPointers:[g],pointerType:vi,srcEvent:g}))}});var xl={pointerdown:rt,pointermove:ie,pointerup:K,pointercancel:lt,pointerout:lt},Pl={2:Ve,3:dl,4:vi,5:gl},ps="pointerdown",ms="pointermove pointerup pointercancel";t.MSPointerEvent&&!t.PointerEvent&&(ps="MSPointerDown",ms="MSPointerMove MSPointerUp MSPointerCancel");function Ti(){this.evEl=ps,this.evWin=ms,mt.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}w(Ti,mt,{handler:function(g){var m=this.store,v=!1,S=g.type.toLowerCase().replace("ms",""),I=xl[S],D=Pl[g.pointerType]||g.pointerType,J=D==Ve,tt=k(m,g.pointerId,"pointerId");I&rt&&(g.button===0||J)?tt<0&&(m.push(g),tt=m.length-1):I&(K|lt)&&(v=!0),!(tt<0)&&(m[tt]=g,this.callback(this.manager,I,{pointers:m,changedPointers:[g],pointerType:D,srcEvent:g}),v&&m.splice(tt,1))}});var Ll={touchstart:rt,touchmove:ie,touchend:K,touchcancel:lt},Rl="touchstart",Il="touchstart touchmove touchend touchcancel";function _s(){this.evTarget=Rl,this.evWin=Il,this.started=!1,mt.apply(this,arguments)}w(_s,mt,{handler:function(g){var m=Ll[g.type];if(m===rt&&(this.started=!0),!!this.started){var v=Ml.call(this,g,m);m&(K|lt)&&v[0].length-v[1].length===0&&(this.started=!1),this.callback(this.manager,m,{pointers:v[0],changedPointers:v[1],pointerType:Ve,srcEvent:g})}}});function Ml(h,g){var m=W(h.touches),v=W(h.changedTouches);return g&(K|lt)&&(m=q(m.concat(v),"identifier")),[m,v]}var Cl={touchstart:rt,touchmove:ie,touchend:K,touchcancel:lt},Ol="touchstart touchmove touchend touchcancel";function Ln(){this.evTarget=Ol,this.targetIds={},mt.apply(this,arguments)}w(Ln,mt,{handler:function(g){var m=Cl[g.type],v=Nl.call(this,g,m);v&&this.callback(this.manager,m,{pointers:v[0],changedPointers:v[1],pointerType:Ve,srcEvent:g})}});function Nl(h,g){var m=W(h.touches),v=this.targetIds;if(g&(rt|ie)&&m.length===1)return v[m[0].identifier]=!0,[m,m];var S,I,D=W(h.changedTouches),J=[],tt=this.target;if(I=m.filter(function(st){return U(st.target,tt)}),g===rt)for(S=0;S<I.length;)v[I[S].identifier]=!0,S++;for(S=0;S<D.length;)v[D[S].identifier]&&J.push(D[S]),g&(K|lt)&&delete v[D[S].identifier],S++;if(J.length)return[q(I.concat(J),"identifier"),J]}var kl=2500,bs=25;function wi(){mt.apply(this,arguments);var h=A(this.handler,this);this.touch=new Ln(this.manager,h),this.mouse=new Pn(this.manager,h),this.primaryTouch=null,this.lastTouches=[]}w(wi,mt,{handler:function(g,m,v){var S=v.pointerType==Ve,I=v.pointerType==vi;if(!(I&&v.sourceCapabilities&&v.sourceCapabilities.firesTouchEvents)){if(S)Dl.call(this,m,v);else if(I&&Fl.call(this,v))return;this.callback(g,m,v)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Dl(h,g){h&rt?(this.primaryTouch=g.changedPointers[0].identifier,ys.call(this,g)):h&(K|lt)&&ys.call(this,g)}function ys(h){var g=h.changedPointers[0];if(g.identifier===this.primaryTouch){var m={x:g.clientX,y:g.clientY};this.lastTouches.push(m);var v=this.lastTouches,S=function(){var I=v.indexOf(m);I>-1&&v.splice(I,1)};setTimeout(S,kl)}}function Fl(h){for(var g=h.srcEvent.clientX,m=h.srcEvent.clientY,v=0;v<this.lastTouches.length;v++){var S=this.lastTouches[v],I=Math.abs(g-S.x),D=Math.abs(m-S.y);if(I<=bs&&D<=bs)return!0}return!1}var vs=B(o.style,"touchAction"),Es=vs!==r,Ts="compute",ws="auto",Ai="manipulation",se="none",We="pan-x",Xe="pan-y",Rn=Bl();function Si(h,g){this.manager=h,this.set(g)}Si.prototype={set:function(h){h==Ts&&(h=this.compute()),Es&&this.manager.element.style&&Rn[h]&&(this.manager.element.style[vs]=h),this.actions=h.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var h=[];return _(this.manager.recognizers,function(g){x(g.options.enable,[g])&&(h=h.concat(g.getTouchAction()))}),Ul(h.join(" "))},preventDefaults:function(h){var g=h.srcEvent,m=h.offsetDirection;if(this.manager.session.prevented){g.preventDefault();return}var v=this.actions,S=C(v,se)&&!Rn[se],I=C(v,Xe)&&!Rn[Xe],D=C(v,We)&&!Rn[We];if(S){var J=h.pointers.length===1,tt=h.distance<2,st=h.deltaTime<250;if(J&&tt&&st)return}if(!(D&&I)&&(S||I&&m&St||D&&m&re))return this.preventSrc(g)},preventSrc:function(h){this.manager.session.prevented=!0,h.preventDefault()}};function Ul(h){if(C(h,se))return se;var g=C(h,We),m=C(h,Xe);return g&&m?se:g||m?g?We:Xe:C(h,Ai)?Ai:ws}function Bl(){if(!Es)return!1;var h={},g=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(m){h[m]=g?t.CSS.supports("touch-action",m):!0}),h}var In=1,_t=2,_e=4,Wt=8,Dt=Wt,Ye=16,xt=32;function Ft(h){this.options=y({},this.defaults,h||{}),this.id=ll(),this.manager=null,this.options.enable=L(this.options.enable,!0),this.state=In,this.simultaneous={},this.requireFail=[]}Ft.prototype={defaults:{},set:function(h){return y(this.options,h),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(h){if(p(h,"recognizeWith",this))return this;var g=this.simultaneous;return h=Mn(h,this),g[h.id]||(g[h.id]=h,h.recognizeWith(this)),this},dropRecognizeWith:function(h){return p(h,"dropRecognizeWith",this)?this:(h=Mn(h,this),delete this.simultaneous[h.id],this)},requireFailure:function(h){if(p(h,"requireFailure",this))return this;var g=this.requireFail;return h=Mn(h,this),k(g,h)===-1&&(g.push(h),h.requireFailure(this)),this},dropRequireFailure:function(h){if(p(h,"dropRequireFailure",this))return this;h=Mn(h,this);var g=k(this.requireFail,h);return g>-1&&this.requireFail.splice(g,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(h){return!!this.simultaneous[h.id]},emit:function(h){var g=this,m=this.state;function v(S){g.manager.emit(S,h)}m<Wt&&v(g.options.event+As(m)),v(g.options.event),h.additionalEvent&&v(h.additionalEvent),m>=Wt&&v(g.options.event+As(m))},tryEmit:function(h){if(this.canEmit())return this.emit(h);this.state=xt},canEmit:function(){for(var h=0;h<this.requireFail.length;){if(!(this.requireFail[h].state&(xt|In)))return!1;h++}return!0},recognize:function(h){var g=y({},h);if(!x(this.options.enable,[this,g])){this.reset(),this.state=xt;return}this.state&(Dt|Ye|xt)&&(this.state=In),this.state=this.process(g),this.state&(_t|_e|Wt|Ye)&&this.tryEmit(g)},process:function(h){},getTouchAction:function(){},reset:function(){}};function As(h){return h&Ye?"cancel":h&Wt?"end":h&_e?"move":h&_t?"start":""}function Ss(h){return h==He?"down":h==Ge?"up":h==je?"left":h==ze?"right":""}function Mn(h,g){var m=g.manager;return m?m.get(h):h}function Et(){Ft.apply(this,arguments)}w(Et,Ft,{defaults:{pointers:1},attrTest:function(h){var g=this.options.pointers;return g===0||h.pointers.length===g},process:function(h){var g=this.state,m=h.eventType,v=g&(_t|_e),S=this.attrTest(h);return v&&(m&lt||!S)?g|Ye:v||S?m&K?g|Wt:g&_t?g|_e:_t:xt}});function Cn(){Et.apply(this,arguments),this.pX=null,this.pY=null}w(Cn,Et,{defaults:{event:"pan",threshold:10,pointers:1,direction:ls},getTouchAction:function(){var h=this.options.direction,g=[];return h&St&&g.push(Xe),h&re&&g.push(We),g},directionTest:function(h){var g=this.options,m=!0,v=h.distance,S=h.direction,I=h.deltaX,D=h.deltaY;return S&g.direction||(g.direction&St?(S=I===0?An:I<0?je:ze,m=I!=this.pX,v=Math.abs(h.deltaX)):(S=D===0?An:D<0?Ge:He,m=D!=this.pY,v=Math.abs(h.deltaY))),h.direction=S,m&&v>g.threshold&&S&g.direction},attrTest:function(h){return Et.prototype.attrTest.call(this,h)&&(this.state&_t||!(this.state&_t)&&this.directionTest(h))},emit:function(h){this.pX=h.deltaX,this.pY=h.deltaY;var g=Ss(h.direction);g&&(h.additionalEvent=this.options.event+g),this._super.emit.call(this,h)}});function xi(){Et.apply(this,arguments)}w(xi,Et,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[se]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.scale-1)>this.options.threshold||this.state&_t)},emit:function(h){if(h.scale!==1){var g=h.scale<1?"in":"out";h.additionalEvent=this.options.event+g}this._super.emit.call(this,h)}});function Pi(){Ft.apply(this,arguments),this._timer=null,this._input=null}w(Pi,Ft,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ws]},process:function(h){var g=this.options,m=h.pointers.length===g.pointers,v=h.distance<g.threshold,S=h.deltaTime>g.time;if(this._input=h,!v||!m||h.eventType&(K|lt)&&!S)this.reset();else if(h.eventType&rt)this.reset(),this._timer=d(function(){this.state=Dt,this.tryEmit()},g.time,this);else if(h.eventType&K)return Dt;return xt},reset:function(){clearTimeout(this._timer)},emit:function(h){this.state===Dt&&(h&&h.eventType&K?this.manager.emit(this.options.event+"up",h):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}});function Li(){Et.apply(this,arguments)}w(Li,Et,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[se]},attrTest:function(h){return this._super.attrTest.call(this,h)&&(Math.abs(h.rotation)>this.options.threshold||this.state&_t)}});function Ri(){Et.apply(this,arguments)}w(Ri,Et,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:St|re,pointers:1},getTouchAction:function(){return Cn.prototype.getTouchAction.call(this)},attrTest:function(h){var g=this.options.direction,m;return g&(St|re)?m=h.overallVelocity:g&St?m=h.overallVelocityX:g&re&&(m=h.overallVelocityY),this._super.attrTest.call(this,h)&&g&h.offsetDirection&&h.distance>this.options.threshold&&h.maxPointers==this.options.pointers&&l(m)>this.options.velocity&&h.eventType&K},emit:function(h){var g=Ss(h.offsetDirection);g&&this.manager.emit(this.options.event+g,h),this.manager.emit(this.options.event,h)}});function On(){Ft.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}w(On,Ft,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ai]},process:function(h){var g=this.options,m=h.pointers.length===g.pointers,v=h.distance<g.threshold,S=h.deltaTime<g.time;if(this.reset(),h.eventType&rt&&this.count===0)return this.failTimeout();if(v&&S&&m){if(h.eventType!=K)return this.failTimeout();var I=this.pTime?h.timeStamp-this.pTime<g.interval:!0,D=!this.pCenter||xn(this.pCenter,h.center)<g.posThreshold;this.pTime=h.timeStamp,this.pCenter=h.center,!D||!I?this.count=1:this.count+=1,this._input=h;var J=this.count%g.taps;if(J===0)return this.hasRequireFailures()?(this._timer=d(function(){this.state=Dt,this.tryEmit()},g.interval,this),_t):Dt}return xt},failTimeout:function(){return this._timer=d(function(){this.state=xt},this.options.interval,this),xt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Dt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Xt(h,g){return g=g||{},g.recognizers=L(g.recognizers,Xt.defaults.preset),new Ii(h,g)}Xt.VERSION="2.0.7",Xt.defaults={domEvents:!1,touchAction:Ts,enable:!0,inputTarget:null,inputClass:null,preset:[[Li,{enable:!1}],[xi,{enable:!1},["rotate"]],[Ri,{direction:St}],[Cn,{direction:St},["swipe"]],[On],[On,{event:"doubletap",taps:2},["tap"]],[Pi]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Vl=1,xs=2;function Ii(h,g){this.options=y({},Xt.defaults,g||{}),this.options.inputTarget=this.options.inputTarget||h,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=h,this.input=ml(this),this.touchAction=new Si(this,this.options.touchAction),Ps(this,!0),_(this.options.recognizers,function(m){var v=this.add(new m[0](m[1]));m[2]&&v.recognizeWith(m[2]),m[3]&&v.requireFailure(m[3])},this)}Ii.prototype={set:function(h){return y(this.options,h),h.touchAction&&this.touchAction.update(),h.inputTarget&&(this.input.destroy(),this.input.target=h.inputTarget,this.input.init()),this},stop:function(h){this.session.stopped=h?xs:Vl},recognize:function(h){var g=this.session;if(!g.stopped){this.touchAction.preventDefaults(h);var m,v=this.recognizers,S=g.curRecognizer;(!S||S&&S.state&Dt)&&(S=g.curRecognizer=null);for(var I=0;I<v.length;)m=v[I],g.stopped!==xs&&(!S||m==S||m.canRecognizeWith(S))?m.recognize(h):m.reset(),!S&&m.state&(_t|_e|Wt)&&(S=g.curRecognizer=m),I++}},get:function(h){if(h instanceof Ft)return h;for(var g=this.recognizers,m=0;m<g.length;m++)if(g[m].options.event==h)return g[m];return null},add:function(h){if(p(h,"add",this))return this;var g=this.get(h.options.event);return g&&this.remove(g),this.recognizers.push(h),h.manager=this,this.touchAction.update(),h},remove:function(h){if(p(h,"remove",this))return this;if(h=this.get(h),h){var g=this.recognizers,m=k(g,h);m!==-1&&(g.splice(m,1),this.touchAction.update())}return this},on:function(h,g){if(h!==r&&g!==r){var m=this.handlers;return _(N(h),function(v){m[v]=m[v]||[],m[v].push(g)}),this}},off:function(h,g){if(h!==r){var m=this.handlers;return _(N(h),function(v){g?m[v]&&m[v].splice(k(m[v],g),1):delete m[v]}),this}},emit:function(h,g){this.options.domEvents&&jl(h,g);var m=this.handlers[h]&&this.handlers[h].slice();if(!(!m||!m.length)){g.type=h,g.preventDefault=function(){g.srcEvent.preventDefault()};for(var v=0;v<m.length;)m[v](g),v++}},destroy:function(){this.element&&Ps(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Ps(h,g){var m=h.element;if(m.style){var v;_(h.options.cssProps,function(S,I){v=B(m.style,I),g?(h.oldCssProps[v]=m.style[v],m.style[v]=S):m.style[v]=h.oldCssProps[v]||""}),g||(h.oldCssProps={})}}function jl(h,g){var m=e.createEvent("Event");m.initEvent(h,!0,!0),m.gesture=g,g.target.dispatchEvent(m)}y(Xt,{INPUT_START:rt,INPUT_MOVE:ie,INPUT_END:K,INPUT_CANCEL:lt,STATE_POSSIBLE:In,STATE_BEGAN:_t,STATE_CHANGED:_e,STATE_ENDED:Wt,STATE_RECOGNIZED:Dt,STATE_CANCELLED:Ye,STATE_FAILED:xt,DIRECTION_NONE:An,DIRECTION_LEFT:je,DIRECTION_RIGHT:ze,DIRECTION_UP:Ge,DIRECTION_DOWN:He,DIRECTION_HORIZONTAL:St,DIRECTION_VERTICAL:re,DIRECTION_ALL:ls,Manager:Ii,Input:mt,TouchAction:Si,TouchInput:Ln,MouseInput:Pn,PointerEventInput:Ti,TouchMouseInput:wi,SingleTouchInput:_s,Recognizer:Ft,AttrRecognizer:Et,Tap:On,Pan:Cn,Swipe:Ri,Pinch:xi,Rotate:Li,Press:Pi,on:P,off:O,each:_,merge:T,extend:E,assign:y,inherit:w,bindFn:A,prefixed:B});var zl=typeof t<"u"?t:typeof self<"u"?self:{};zl.Hammer=Xt,n.exports?n.exports=Xt:t[i]=Xt})(window,document,"Hammer")})(Xc);var Tn=Xc.exports;const ab=Gl(Tn),Rt=Hl({__proto__:null,default:ab},[Tn]),Yc=1,qc=2,Sr=4,cb={mousedown:Yc,mousemove:qc,mouseup:Sr};function lb(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return!0;return!1}function ub(n){const t=n.prototype.handler;n.prototype.handler=function(i){const r=this.store;i.button>0&&i.type==="pointerdown"&&(lb(r,s=>s.pointerId===i.pointerId)||r.push(i)),t.call(this,i)}}function hb(n){n.prototype.handler=function(e){let i=cb[e.type];i&Yc&&e.button>=0&&(this.pressed=!0),i&qc&&e.buttons===0&&(i=Sr),this.pressed&&(i&Sr&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}}ub(Tn.PointerEventInput);hb(Tn.MouseInput);const fb=Tn.Manager;class _i{constructor(t,e,i){this.element=t,this.callback=e,this.options={enable:!0,...i}}}const db=Rt?[[Rt.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[Rt.Rotate,{enable:!1}],[Rt.Pinch,{enable:!1}],[Rt.Swipe,{enable:!1}],[Rt.Pan,{threshold:0,enable:!1}],[Rt.Press,{enable:!1}],[Rt.Tap,{event:"doubletap",taps:2,enable:!1}],[Rt.Tap,{event:"anytap",enable:!1}],[Rt.Tap,{enable:!1}]]:null,Qo={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},gb={doubletap:["tap"]},pb={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},ns={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},mb={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},Jo={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},_b=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",xe=typeof window<"u"?window:global;let xr=!1;try{const n={get passive(){return xr=!0,!0}};xe.addEventListener("test",null,n),xe.removeEventListener("test",null)}catch{xr=!1}const bb=_b.indexOf("firefox")!==-1,{WHEEL_EVENTS:yb}=ns,ta="wheel",ea=4.000244140625,vb=40,Eb=.25;class Tb extends _i{constructor(t,e,i){super(t,e,i),this.handleEvent=r=>{if(!this.options.enable)return;let s=r.deltaY;xe.WheelEvent&&(bb&&r.deltaMode===xe.WheelEvent.DOM_DELTA_PIXEL&&(s/=xe.devicePixelRatio),r.deltaMode===xe.WheelEvent.DOM_DELTA_LINE&&(s*=vb)),s!==0&&s%ea===0&&(s=Math.floor(s/ea)),r.shiftKey&&s&&(s=s*Eb),this.callback({type:ta,center:{x:r.clientX,y:r.clientY},delta:-s,srcEvent:r,pointerType:"mouse",target:r.target})},this.events=(this.options.events||[]).concat(yb),this.events.forEach(r=>t.addEventListener(r,this.handleEvent,xr?{passive:!1}:!1))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===ta&&(this.options.enable=e)}}const{MOUSE_EVENTS:wb}=ns,na="pointermove",ia="pointerover",ra="pointerout",sa="pointerenter",oa="pointerleave";class Ab extends _i{constructor(t,e,i){super(t,e,i),this.handleEvent=s=>{this.handleOverEvent(s),this.handleOutEvent(s),this.handleEnterEvent(s),this.handleLeaveEvent(s),this.handleMoveEvent(s)},this.pressed=!1;const{enable:r}=this.options;this.enableMoveEvent=r,this.enableLeaveEvent=r,this.enableEnterEvent=r,this.enableOutEvent=r,this.enableOverEvent=r,this.events=(this.options.events||[]).concat(wb),this.events.forEach(s=>t.addEventListener(s,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===na&&(this.enableMoveEvent=e),t===ia&&(this.enableOverEvent=e),t===ra&&(this.enableOutEvent=e),t===sa&&(this.enableEnterEvent=e),t===oa&&(this.enableLeaveEvent=e)}handleOverEvent(t){this.enableOverEvent&&t.type==="mouseover"&&this._emit(ia,t)}handleOutEvent(t){this.enableOutEvent&&t.type==="mouseout"&&this._emit(ra,t)}handleEnterEvent(t){this.enableEnterEvent&&t.type==="mouseenter"&&this._emit(sa,t)}handleLeaveEvent(t){this.enableLeaveEvent&&t.type==="mouseleave"&&this._emit(oa,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":t.buttons===0&&(this.pressed=!1),this.pressed||this._emit(na,t);break;case"mouseup":this.pressed=!1;break}}_emit(t,e){this.callback({type:t,center:{x:e.clientX,y:e.clientY},srcEvent:e,pointerType:"mouse",target:e.target})}}const{KEY_EVENTS:Sb}=ns,aa="keydown",ca="keyup";class xb extends _i{constructor(t,e,i){super(t,e,i),this.handleEvent=r=>{const s=r.target||r.srcElement;s.tagName==="INPUT"&&s.type==="text"||s.tagName==="TEXTAREA"||(this.enableDownEvent&&r.type==="keydown"&&this.callback({type:aa,srcEvent:r,key:r.key,target:r.target}),this.enableUpEvent&&r.type==="keyup"&&this.callback({type:ca,srcEvent:r,key:r.key,target:r.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(Sb),t.tabIndex=this.options.tabIndex||0,t.style.outline="none",this.events.forEach(r=>t.addEventListener(r,this.handleEvent))}destroy(){this.events.forEach(t=>this.element.removeEventListener(t,this.handleEvent))}enableEventType(t,e){t===aa&&(this.enableDownEvent=e),t===ca&&(this.enableUpEvent=e)}}const la="contextmenu";class Pb extends _i{constructor(t,e,i){super(t,e,i),this.handleEvent=r=>{this.options.enable&&this.callback({type:la,center:{x:r.clientX,y:r.clientY},srcEvent:r,pointerType:"mouse",target:r.target})},t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===la&&(this.options.enable=e)}}const ua=1,Pr=2,ha=4,Lb={pointerdown:ua,pointermove:Pr,pointerup:ha,mousedown:ua,mousemove:Pr,mouseup:ha},Rb=0,Ib=1,Mb=2,Cb=1,Ob=2,Nb=4;function kb(n){const t=Lb[n.srcEvent.type];if(!t)return null;const{buttons:e,button:i}=n.srcEvent;let r=!1,s=!1,o=!1;return t===Pr?(r=!!(e&Cb),s=!!(e&Nb),o=!!(e&Ob)):(r=i===Rb,s=i===Ib,o=i===Mb),{leftButton:r,middleButton:s,rightButton:o}}function Db(n,t){const e=n.center;if(!e)return null;const i=t.getBoundingClientRect(),r=i.width/t.offsetWidth||1,s=i.height/t.offsetHeight||1,o={x:(e.x-i.left-t.clientLeft)/r,y:(e.y-i.top-t.clientTop)/s};return{center:e,offsetCenter:o}}const nr={srcElement:"root",priority:0};class Fb{constructor(t){this.handleEvent=e=>{if(this.isEmpty())return;const i=this._normalizeEvent(e);let r=e.srcEvent.target;for(;r&&r!==i.rootElement;){if(this._emit(i,r),i.handled)return;r=r.parentNode}this._emit(i,"root")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,e,i,r=!1,s=!1){const{handlers:o,handlersByElement:a}=this;let c=nr;typeof i=="string"||i&&i.addEventListener?c={...nr,srcElement:i}:i&&(c={...nr,...i});let l=a.get(c.srcElement);l||(l=[],a.set(c.srcElement,l));const u={type:t,handler:e,srcElement:c.srcElement,priority:c.priority};r&&(u.once=!0),s&&(u.passive=!0),o.push(u),this._active=this._active||!u.passive;let d=l.length-1;for(;d>=0&&!(l[d].priority>=u.priority);)d--;l.splice(d+1,0,u)}remove(t,e){const{handlers:i,handlersByElement:r}=this;for(let s=i.length-1;s>=0;s--){const o=i[s];if(o.type===t&&o.handler===e){i.splice(s,1);const a=r.get(o.srcElement);a.splice(a.indexOf(o),1),a.length===0&&r.delete(o.srcElement)}}this._active=i.some(s=>!s.passive)}_emit(t,e){const i=this.handlersByElement.get(e);if(i){let r=!1;const s=()=>{t.handled=!0},o=()=>{t.handled=!0,r=!0},a=[];for(let c=0;c<i.length;c++){const{type:l,handler:u,once:d}=i[c];if(u({...t,type:l,stopPropagation:s,stopImmediatePropagation:o}),d&&a.push(i[c]),r)break}for(let c=0;c<a.length;c++){const{type:l,handler:u}=a[c];this.remove(l,u)}}}_normalizeEvent(t){const e=this.eventManager.getElement();return{...t,...kb(t),...Db(t,e),preventDefault:()=>{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:e}}}const Ub={events:null,recognizers:null,recognizerOptions:{},Manager:fb,touchAction:"none",tabIndex:0};class Bb{constructor(t=null,e){this._onBasicInput=r=>{const{srcEvent:s}=r,o=pb[s.type];o&&this.manager.emit(o,r)},this._onOtherEvent=r=>{this.manager.emit(r.type,r)},this.options={...Ub,...e},this.events=new Map,this.setElement(t);const{events:i}=this.options;i&&this.on(i)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;const{options:e}=this,i=e.Manager;this.manager=new i(t,{touchAction:e.touchAction,recognizers:e.recognizers||db}).on("hammer.input",this._onBasicInput),e.recognizers||Object.keys(Qo).forEach(r=>{const s=this.manager.get(r);s&&Qo[r].forEach(o=>{s.recognizeWith(o)})});for(const r in e.recognizerOptions){const s=this.manager.get(r);if(s){const o=e.recognizerOptions[r];delete o.enable,s.set(o)}}this.wheelInput=new Tb(t,this._onOtherEvent,{enable:!1}),this.moveInput=new Ab(t,this._onOtherEvent,{enable:!1}),this.keyInput=new xb(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new Pb(t,this._onOtherEvent,{enable:!1});for(const[r,s]of this.events)s.isEmpty()||(this._toggleRecognizer(s.recognizerName,!0),this.manager.on(r,s.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}
758on(t,e,i){this._addEventHandler(t,e,i,!1)}once(t,e,i){this._addEventHandler(t,e,i,!0)}watch(t,e,i){this._addEventHandler(t,e,i,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:i}=this;if(!i)return;const r=i.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const s=gb[t];s&&!this.options.recognizers&&s.forEach(o=>{const a=i.get(o);e?(a.requireFailure(t),r.dropRequireFailure(o)):a.dropRequireFailure(t)})}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,i,r,s){if(typeof t!="string"){i=e;for(const u in t)this._addEventHandler(u,t[u],i,r,s);return}const{manager:o,events:a}=this,c=Jo[t]||t;let l=a.get(c);l||(l=new Fb(this),a.set(c,l),l.recognizerName=mb[c]||c,o&&o.on(c,l.handleEvent)),l.add(t,e,i,r,s),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(t,e){if(typeof t!="string"){for(const o in t)this._removeEventHandler(o,t[o]);return}const{events:i}=this,r=Jo[t]||t,s=i.get(r);if(s&&(s.remove(t,e),s.isEmpty())){const{recognizerName:o}=s;let a=!1;for(const c of i.values())if(c.recognizerName===o&&!c.isEmpty()){a=!0;break}a||this._toggleRecognizer(o,!1)}}}function ce(){}const Vb=({isDragging:n})=>n?"grabbing":"grab",Zc={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:ce,onResize:ce,onViewStateChange:ce,onInteractionStateChange:ce,onBeforeRender:ce,onAfterRender:ce,onLoad:ce,onError:n=>z.error(n.message,n.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Vb,getTooltip:null,debug:!1,drawPickingColors:!1};class bi{constructor(t){f(this,"props",void 0),f(this,"width",0),f(this,"height",0),f(this,"userData",{}),f(this,"canvas",null),f(this,"viewManager",null),f(this,"layerManager",null),f(this,"effectManager",null),f(this,"deckRenderer",null),f(this,"deckPicker",null),f(this,"eventManager",null),f(this,"tooltip",null),f(this,"metrics",void 0),f(this,"animationLoop",void 0),f(this,"stats",void 0),f(this,"viewState",void 0),f(this,"cursorState",void 0),f(this,"_needsRedraw",void 0),f(this,"_pickRequest",void 0),f(this,"_lastPointerDownInfo",null),f(this,"_metricsCounter",void 0),f(this,"_onPointerMove",e=>{const{_pickRequest:i}=this;if(e.type==="pointerleave")i.x=-1,i.y=-1,i.radius=0;else{if(e.leftButton||e.rightButton)return;{const r=e.offsetCenter;if(!r)return;i.x=r.x,i.y=r.y,i.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:i.x,y:i.y}),i.event=e}),f(this,"_onEvent",e=>{const i=qs[e.type],r=e.offsetCenter;if(!i||!r||!this.layerManager)return;const s=this.layerManager.getLayers(),o=this.deckPicker.getLastPickedObject({x:r.x,y:r.y,layers:s,viewports:this.getViewports(r)},this._lastPointerDownInfo),{layer:a}=o,c=a&&(a[i.handler]||a.props[i.handler]),l=this.props[i.handler];let u=!1;c&&(u=c.call(a,o,e)),!u&&l&&l(o,e)}),f(this,"_onPointerDown",e=>{const i=e.offsetCenter,r=this._pick("pickObject","pickObject Time",{x:i.x,y:i.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=r.result[0]||r.emptyInfo}),this.props={...Zc,...t},t=this.props,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},t.viewState&&t.initialViewState&&z.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),Ia()==="IE"&&z.warn("IE 11 is not supported")(),this.viewState=t.initialViewState,t.gl||typeof document<"u"&&(this.canvas=this._createCanvas(t)),this.animationLoop=this._createAnimationLoop(t),this.stats=new Nr({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(t),t._typedArrayManagerProps&&fn.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){var t,e,i,r,s,o,a,c;if((t=this.animationLoop)===null||t===void 0||t.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,(e=this.layerManager)===null||e===void 0||e.finalize(),this.layerManager=null,(i=this.viewManager)===null||i===void 0||i.finalize(),this.viewManager=null,(r=this.effectManager)===null||r===void 0||r.finalize(),this.effectManager=null,(s=this.deckRenderer)===null||s===void 0||s.finalize(),this.deckRenderer=null,(o=this.deckPicker)===null||o===void 0||o.finalize(),this.deckPicker=null,(a=this.eventManager)===null||a===void 0||a.destroy(),this.eventManager=null,(c=this.tooltip)===null||c===void 0||c.remove(),this.tooltip=null,!this.props.canvas&&!this.props.gl&&this.canvas){var l;(l=this.canvas.parentElement)===null||l===void 0||l.removeChild(this.canvas),this.canvas=null}}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&z.removed("onLayerHover","onHover")(),"onLayerClick"in t&&z.removed("onLayerClick","onClick")(),t.initialViewState&&!Ot(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);const e=Object.create(this.props);Object.assign(e,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(e),this.layerManager&&(this.viewManager.setProps(e),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(e),this.effectManager.setProps(e),this.deckRenderer.setProps(e),this.deckPicker.setProps(e)),this.stats.get("setProps Time").timeEnd()}needsRedraw(t={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);const i=this.viewManager.needsRedraw(t),r=this.layerManager.needsRedraw(t),s=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return e=e||i||r||s||o,e}redraw(t){if(!this.layerManager)return;let e=this.needsRedraw({clearRedrawFlags:!0});e=t||e,e&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(e):this._drawLayers(e))}get isInitialized(){return this.viewManager!==null}getViews(){return nt(this.viewManager),this.viewManager.views}getViewports(t){return nt(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){const e=this._pick("pickObject","pickObject Time",t).result;return e.length?e[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_addResources(t,e=!1){for(const i in t)this.layerManager.resourceManager.add({resourceId:i,data:t[i],force
758Update:e})}_removeResources(t){for(const e of t)this.layerManager.resourceManager.remove(e)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_pick(t,e,i){nt(this.deckPicker);const{stats:r}=this;r.get("Pick Count").incrementCount(),r.get(e).timeStart();const s=this.deckPicker[t]({layers:this.layerManager.getLayers(i),views:this.viewManager.getViews(),viewports:this.getViewports(i),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...i});return r.get(e).timeEnd(),s}_createCanvas(t){let e=t.canvas;return typeof e=="string"&&(e=document.getElementById(e),nt(e)),e||(e=document.createElement("canvas"),e.id=t.id||"deckgl-overlay",(t.parent||document.body).appendChild(e)),Object.assign(e.style,t.style),e}_setCanvasSize(t){if(!this.canvas)return;const{width:e,height:i}=t;if(e||e===0){const s=Number.isFinite(e)?"".concat(e,"px"):e;this.canvas.style.width=s}if(i||i===0){var r;const s=Number.isFinite(i)?"".concat(i,"px"):i;this.canvas.style.position=((r=t.style)===null||r===void 0?void 0:r.position)||"absolute",this.canvas.style.height=s}}_updateCanvasSize(){var t,e;const{canvas:i}=this;if(!i)return;const r=(t=i.clientWidth)!==null&&t!==void 0?t:i.width,s=(e=i.clientHeight)!==null&&e!==void 0?e:i.height;if(r!==this.width||s!==this.height){var o,a;this.width=r,this.height=s,(o=this.viewManager)===null||o===void 0||o.setProps({width:r,height:s}),(a=this.layerManager)===null||a===void 0||a.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:s})}}_createAnimationLoop(t){const{width:e,height:i,gl:r,glOptions:s,debug:o,onError:a,onBeforeRender:c,onAfterRender:l,useDevicePixels:u}=t;return new tp({width:e,height:i,useDevicePixels:u,autoResizeDrawingBuffer:!r,autoResizeViewport:!1,gl:r,onCreateContext:d=>Za({...s,...d,canvas:this.canvas,debug:o,onContextLost:()=>this._onContextLost()}),onInitialize:d=>this._setGLContext(d.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:c,onAfterRender:l,onError:a})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let t=this.props.views||[new Gc({id:"default-view"})];return t=Array.isArray(t)?t:[t],t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){const{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){const{_pickRequest:t}=this;if(t.event){const{result:i,emptyInfo:r}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=i.length>0;let s=r,o=!1;for(const a of i){var e;s=a,o=((e=a.layer)===null||e===void 0?void 0:e.onHover(a,t.event))||o}if(!o&&this.props.onHover&&this.props.onHover(s,t.event),this.props.getTooltip&&this.tooltip){const a=this.props.getTooltip(s);this.tooltip.setTooltip(a,s.x,s.y)}t.event=null}}_updateCursor(){const t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(t){if(this.layerManager)return;this.canvas||(this.canvas=t.canvas,Gr(t,{enable:!0,copyState:!0})),this.tooltip=new ob(this.canvas),jt(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);const e=new Sc;e.play(),this.animationLoop.attachTimeline(e),this.eventManager=new Bb(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const r in qs)this.eventManager.on(r,this._onEvent);this.viewManager=new O0({timeline:e,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const i=this.viewManager.getViewports()[0];this.layerManager=new C0(t,{deck:this,stats:this.stats,viewport:i,timeline:e}),this.effectManager=new Z0,this.deckRenderer=new Q0(t),this.deckPicker=new rb(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,e){const{gl:i}=this.layerManager.context;jt(i,this.props.parameters),this.props.onBeforeRender({gl:i}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...e}),this.props.onAfterRender({gl:i})}_onRenderFrame(t){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),z.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(
758),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){const e=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:e},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){const{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();const e=this.animationLoop.stats;t.get("GPU Time").addTime(e.get("GPU Time").lastTiming),t.get("CPU Time").addTime(e.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:t,stats:e}=this;t.fps=e.get("frameRate").getHz(),t.setPropsTime=e.get("setProps Time").time,t.updateAttributesTime=e.get("Update Attributes").time,t.framesRedrawn=e.get("Redraw Count").count,t.pickTime=e.get("pickObject Time").time+e.get("pickMultipleObjects Time").time+e.get("pickObjects Time").time,t.pickCount=e.get("Pick Count").count,t.gpuTime=e.get("GPU Time").time,t.cpuTime=e.get("CPU Time").time,t.gpuTimePerFrame=e.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=e.get("CPU Time").getAverageTime();const i=ue.get("Memory Usage");t.bufferMemory=i.get("Buffer Memory").count,t.textureMemory=i.get("Texture Memory").count,t.renderbufferMemory=i.get("Renderbuffer Memory").count,t.gpuMemory=i.get("GPU Memory").count}}f(bi,"defaultProps",Zc);f(bi,"VERSION",sf);class ir{constructor(t,e){f(this,"opts",void 0),f(this,"source",void 0),this.opts=e,this.source=t}get value(){return this.source.value}getValue(){const t=this.source.getBuffer(),e=this.getAccessor();if(t)return[t,e];const{value:i}=this.source,{size:r}=e;let s=i;if(i&&i.length!==r){s=new Float32Array(r);const o=e.elementOffset||0;for(let a=0;a<r;++a)s[a]=i[o+a]}return s}getAccessor(){return{...this.source.getAccessor(),...this.opts}}}function jb(n){switch(n){case 5126:return Float32Array;case 5130:return Float64Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return Uint8ClampedArray;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Unknown GL type")}}function Kn(n){return n.stride||n.size*n.bytesPerElement}function Kc(n,t){t.offset&&z.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const e=Kn(n),i=t.vertexOffset!==void 0?t.vertexOffset:n.vertexOffset||0,r=t.elementOffset||0,s=i*e+r*n.bytesPerElement+(n.offset||0);return{...t,offset:s,stride:e}}function zb(n,t){const e=Kc(n,t);return{high:e,low:{...e,offset:e.offset+n.size*4}}}class Gb{constructor(t,e,i){f(this,"gl",void 0),f(this,"id",void 0),f(this,"size",void 0),f(this,"settings",void 0),f(this,"value",void 0),f(this,"doublePrecision",void 0),f(this,"_buffer",void 0),f(this,"state",void 0),this.gl=t,this.id=e.id||"",this.size=e.size||1;const r=e.logicalType||e.type,s=r===5130;let{defaultValue:o}=e;o=Number.isFinite(o)?[o]:o||new Array(this.size).fill(0);let a;s?a=5126:!r&&e.isIndexed?a=t&&Id(t,X.ELEMENT_INDEX_UINT32)?5125:5123:a=r||5126;let c=jb(r||a||5126);this.doublePrecision=s,s&&e.fp64===!1&&(c=Float32Array),this.value=null,this.settings={...e,defaultType:c,defaultValue:o,logicalType:r,type:a,size:this.size,bytesPerElement:c.BYTES_PER_ELEMENT},this.state={...i,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1},this._buffer=null}get isConstant(){return this.state.constant}get buffer(){if(!this._buffer){const{isIndexed:t,type:e}=this.settings;this._buffer=new j(this.gl,{id:this.id,target:t?34963:34962,accessor:{type:e}})}return this._buffer}get byteOffset(){const t=this.getAccessor();return t.vertexOffset?t.vertexOffset*Kn(t):0}get numInstances(){return this.state.numInstances}set numInstances(t){this.state.numInstances=t}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),fn.release(this.state.allocatedValue)}getShaderAttributes(t,e){if(this.doublePrecision){const i={},r=this.value instanceof Float64Array,s=zb(this.getAccessor(),e||{});return i[t]=new ir(this,s.high),i["".concat(t,"64Low")]=r?new ir(this,s.low):new Float32Array(this.size),i}if(e){const i=Kc(this.getAccessor(),e);return{[t]:new ir(this,i)}}return{[t]:this}}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(){return this.state.constant?this.value:[this.getBuffer(),this.getAccessor()]}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let t=null;if(this.state.constant&&this.value){const e=Array.from(this.value);t=[e,e]}else{const{value:e,numInstances:i,size:r}=this,s=i*r;if(e&&s&&e.length>=s){const o=new Array(r).fill(1/0),a=new Array(r).fill(-1/0);for(let c=0;c<s;)for(let l=0;l<r;l++){const u=e[c++];u<o[l]&&(o[l]=u),u>a[l]&&(a[l]=u)}t=[o,a]}}return this.state.bounds=t,t}setData(t){const{state:e}=this;let i;
758ArrayBuffer.isView(t)?i={value:t}:t instanceof j?i={buffer:t}:i=t;const r={...this.settings,...i};if(e.bufferAccessor=r,e.bounds=null,i.constant){let s=i.value;if(s=this._normalizeValue(s,[],0),this.settings.normalized&&(s=this.normalizeConstant(s)),!(!e.constant||!this._areValuesEqual(s,this.value)))return!1;e.externalBuffer=null,e.constant=!0,this.value=s}else if(i.buffer){const s=i.buffer;e.externalBuffer=s,e.constant=!1,this.value=i.value||null;const o=i.value instanceof Float64Array;r.type=i.type||s.accessor.type,r.bytesPerElement=s.accessor.BYTES_PER_ELEMENT*(o?2:1),r.stride=Kn(r)}else if(i.value){this._checkExternalBuffer(i);let s=i.value;e.externalBuffer=null,e.constant=!1,this.value=s,r.bytesPerElement=s.BYTES_PER_ELEMENT,r.stride=Kn(r);const{buffer:o,byteOffset:a}=this;this.doublePrecision&&s instanceof Float64Array&&(s=Ji(s,r));const c=s.byteLength+a+r.stride*2;o.byteLength<c&&o.reallocate(c),o.setAccessor(null),o.subData({data:s,offset:a}),r.type=i.type||o.accessor.type}return!0}updateSubBuffer(t={}){this.state.bounds=null;const e=this.value,{startOffset:i=0,endOffset:r}=t;this.buffer.subData({data:this.doublePrecision&&e instanceof Float64Array?Ji(e,{size:this.size,startIndex:i,endIndex:r}):e.subarray(i,r),offset:i*e.BYTES_PER_ELEMENT+this.byteOffset})}allocate(t,e=!1){const{state:i}=this,r=i.allocatedValue,s=fn.allocate(r,t+1,{size:this.size,type:this.settings.defaultType,copy:e});this.value=s;const{buffer:o,byteOffset:a}=this;return o.byteLength<s.byteLength+a&&(o.reallocate(s.byteLength+a),e&&r&&o.subData({data:r instanceof Float64Array?Ji(r,this):r,offset:a})),i.allocatedValue=s,i.constant=!1,i.externalBuffer=null,i.bufferAccessor=this.settings,!0}_checkExternalBuffer(t){const{value:e}=t;if(!ArrayBuffer.isView(e))throw new Error("Attribute ".concat(this.id," value is not TypedArray"));const i=this.settings.defaultType;let r=!1;if(this.doublePrecision&&(r=e.BYTES_PER_ELEMENT<4),r)throw new Error("Attribute ".concat(this.id," does not support ").concat(e.constructor.name));!(e instanceof i)&&this.settings.normalized&&!("normalized"in t)&&z.warn("Attribute ".concat(this.id," is normalized"))()}normalizeConstant(t){switch(this.settings.type){case 5120:return new Float32Array(t).map(e=>(e+128)/255*2-1);case 5122:return new Float32Array(t).map(e=>(e+32768)/65535*2-1);case 5121:return new Float32Array(t).map(e=>e/255);case 5123:return new Float32Array(t).map(e=>e/65535);default:return t}}_normalizeValue(t,e,i){const{defaultValue:r,size:s}=this.settings;if(Number.isFinite(t))return e[i]=t,e;if(!t){let o=s;for(;--o>=0;)e[i+o]=r[o];return e}switch(s){case 4:e[i+3]=Number.isFinite(t[3])?t[3]:r[3];case 3:e[i+2]=Number.isFinite(t[2])?t[2]:r[2];case 2:e[i+1]=Number.isFinite(t[1])?t[1]:r[1];case 1:e[i+0]=Number.isFinite(t[0])?t[0]:r[0];break;default:let o=s;for(;--o>=0;)e[i+o]=Number.isFinite(t[o])?t[o]:r[o]}return e}_areValuesEqual(t,e){if(!t||!e)return!1;const{size:i}=this;for(let r=0;r<i;r++)if(t[r]!==e[r])return!1;return!0}}const fa=[],da=[];function Hb(n,t=0,e=1/0){let i=fa;const r={index:-1,data:n,target:[]};return n?typeof n[Symbol.iterator]=="function"?i=n:n.length>0&&(da.length=n.length,i=da):i=fa,(t>0||Number.isFinite(e))&&(i=(Array.isArray(i)?i:Array.from(i)).slice(t,e),r.index=t-1),{iterable:i,objectInfo:r}}function $c(n){return n&&n[Symbol.asyncIterator]}function Wb(n,t){const{size:e,stride:i,offset:r,startIndices:s,nested:o}=t,a=n.BYTES_PER_ELEMENT,c=i?i/a:e,l=r?r/a:0,u=Math.floor((n.length-l)/c);return(d,{index:p,target:_})=>{if(!s){const T=p*c+l;for(let w=0;w<e;w++)_[w]=n[T+w];return _}const b=s[p],y=s[p+1]||u;let E;if(o){E=new Array(y-b);for(let T=b;T<y;T++){const w=T*c+l;_=new Array(e);for(let A=0;A<e;A++)_[A]=n[w+A];E[T-b]=_}}else if(c===e)E=n.subarray(b*e+l,y*e+l);else{E=new n.constructor((y-b)*e);let T=0;for(let w=b;w<y;w++){const A=w*c+l;for(let x=0;x<e;x++)E[T++]=n[A+x]}}return E}}const Xb=[],$n=[[0,1/0]];function Yb(n,t){if(n===$n||(t[0]<0&&(t[0]=0),t[0]>=t[1]))return n;const e=[],i=n.length;let r=0;for(let s=0;s<i;s++){const o=n[s];o[1]<t[0]?(e.push(o),r=s+1):o[0]>t[1]?e.push(o):t=[Math.min(o[0],t[0]),Math.max(o[1],t[1])]}return e.splice(r,0,t),e}function rr(n){const{source:t,target:e,start:i=0,size:r,getData:s}=n,o=n.end||e.length,a=t.length,c=o-i;if(a>c){e.set(t.subarray(0,c),i);return}if(e.set(t,i),!s)return;let l=a;for(;l<c;){const u=s(l,t);for(let d=0;d<r;d++)e[i+l]=u[d]||0,l++}}function qb({source:n,target:t,size:e,getData:i,sourceStartIndices:r,targetStartIndices:s}){if(!Array.isArray(s))return rr({source:n,target:t,size:e,getData:i}),t;let o=0,a=0;const c=i&&((u,d)=>i(u+a,d)),l=Math.min(r.length,s.length);for(let u=1;u<l;u++){const d=r[u]*e,p=s[u]*e;rr({source:n.subarray(o,d),target:t,start:a,end:p,size:e,getData:c}),o=d,a=p}return a<t.length&&rr({source:[],target:t,start:a,size:e,getData:c}),t}const Zb={interpolation:{duration:0,easing:n=>n},spring:{stiffness:.05,damping:.5}};function Qc(n,t){if(!n)return null;Number.isFinite(n)&&(n={type:"interpolation",duration:n});const e=n.type||"interpolation";return{...Zb[e],...t,...n,type:e}}
758function Jc(n,t){const e=t.getBuffer();return e?[e,{divisor:0,size:t.size,normalized:t.settings.normalized}]:t.value}function tl(n){switch(n){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error('No defined attribute type for size "'.concat(n,'"'))}}function el(n){n.push(n.shift())}function is(n,t){const{doublePrecision:e,settings:i,value:r,size:s}=n,o=e&&r instanceof Float64Array?2:1;return(i.noAlloc?r.length:t*s)*o}function nl({buffer:n,numInstances:t,attribute:e,fromLength:i,fromStartIndices:r,getData:s=o=>o}){const o=e.doublePrecision&&e.value instanceof Float64Array?2:1,a=e.size*o,c=e.byteOffset,l=e.startIndices,u=r&&l,d=is(e,t),p=e.isConstant;if(!u&&i>=d)return;const _=p?e.value:e.getBuffer().getData({srcByteOffset:c});if(e.settings.normalized&&!p){const T=s;s=(w,A)=>e.normalizeConstant(T(w,A))}const b=p?(T,w)=>s(_,w):(T,w)=>s(_.subarray(T,T+a),w),y=n.getData({length:i}),E=new Float32Array(d);qb({source:y,target:E,sourceStartIndices:r,targetStartIndices:l,size:a,getData:b}),n.byteLength<E.byteLength+c&&n.reallocate(E.byteLength+c),n.subData({data:E,offset:c})}class rs extends Gb{constructor(t,e){super(t,e,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,updateRanges:$n}),f(this,"constant",!1),this.settings.update=e.update||(e.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(t){this.state.startIndices=t}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:t=!1}={}){const e=this.state.needsRedraw;return this.state.needsRedraw=e&&!t,e}getUpdateTriggers(){const{accessor:t}=this.settings;return[this.id].concat(typeof t!="function"&&t||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;const{accessor:e}=this.settings,i=this.settings.transition,r=Array.isArray(e)?t[e.find(s=>t[s])]:t[e];return Qc(r,i)}setNeedsUpdate(t=this.id,e){if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),e){const{startRow:i=0,endRow:r=1/0}=e;this.state.updateRanges=Yb(this.state.updateRanges,[i,r])}else this.state.updateRanges=$n}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=Xb}setNeedsRedraw(t=this.id){this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){const{state:e,settings:i}=this;return i.noAlloc?!1:i.update?(super.allocate(t,e.updateRanges!==$n),!0):!1}updateBuffer({numInstances:t,data:e,props:i,context:r}){if(!this.needsUpdate())return!1;const{state:{updateRanges:s},settings:{update:o,noAlloc:a}}=this;let c=!0;if(o){for(const[l,u]of s)o.call(r,this,{data:e,startRow:l,endRow:u,props:i,numInstances:t});if(this.value)if(this.constant||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(const[l,u]of s){const d=Number.isFinite(l)?this.getVertexOffset(l):0,p=Number.isFinite(u)?this.getVertexOffset(u):a||!Number.isFinite(t)?this.value.length:t*this.size;super.updateSubBuffer({startOffset:d,endOffset:p})}this._checkAttributeArray()}else c=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),c}setConstantValue(t){return t===void 0||typeof t=="function"?!1:(this.setData({constant:!0,value:t})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setExternalBuffer(t){const{state:e}=this;return t?(this.clearNeedsUpdate(),e.lastExternalBuffer===t||(e.lastExternalBuffer=t,this.setNeedsRedraw(),this.setData(t)),!0):(e.lastExternalBuffer=null,!1)}setBinaryValue(t,e=null){const{state:i,settings:r}=this;if(!t)return i.binaryValue=null,i.binaryAccessor=null,!1;if(r.noAlloc)return!1;if(i.binaryValue===t)return this.clearNeedsUpdate(),!0;if(i.binaryValue=t,this.setNeedsRedraw(),r.transform||e!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});const o=t;nt(ArrayBuffer.isView(o.value),"invalid ".concat(r.accessor));const a=!!o.size&&o.size!==this.size;return i.binaryAccessor=Wb(o.value,{size:o.size||this.size,stride:o.str
758ide,offset:o.offset,startIndices:e,nested:a}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){const{startIndices:e}=this;return(e?t<e.length?e[t]:this.numInstances:t)*this.size}getShaderAttributes(){const t=this.settings.shaderAttributes||{[this.id]:null},e={};for(const i in t)Object.assign(e,super.getShaderAttributes(i,t[i]));return e}_autoUpdater(t,{data:e,startRow:i,endRow:r,props:s,numInstances:o}){if(t.constant)return;const{settings:a,state:c,value:l,size:u,startIndices:d}=t,{accessor:p,transform:_}=a,b=c.binaryAccessor||(typeof p=="function"?p:s[p]);nt(typeof b=="function",'accessor "'.concat(p,'" is not a function'));let y=t.getVertexOffset(i);const{iterable:E,objectInfo:T}=Hb(e,i,r);for(const w of E){T.index++;let A=b(w,T);if(_&&(A=_.call(this,A)),d){const x=(T.index<d.length-1?d[T.index+1]:o)-d[T.index];if(A&&Array.isArray(A[0])){let L=y;for(const P of A)t._normalizeValue(P,l,L),L+=u}else A&&A.length>u?l.set(A,y):(t._normalizeValue(A,T.target,0),w0({target:l,source:T.target,start:y,count:x}));y+=x*u}else t._normalizeValue(A,l,y),y+=u}}_validateAttributeUpdaters(){const{settings:t}=this;if(!(t.noAlloc||typeof t.update=="function"))throw new Error("Attribute ".concat(this.id," missing update or accessor"))}_checkAttributeArray(){const{value:t}=this,e=Math.min(4,this.size);if(t&&t.length>=e){let i=!0;switch(e){case 4:i=i&&Number.isFinite(t[3]);case 3:i=i&&Number.isFinite(t[2]);case 2:i=i&&Number.isFinite(t[1]);case 1:i=i&&Number.isFinite(t[0]);break;default:i=!1}if(!i)throw new Error("Illegal attribute generated for ".concat(this.id))}}}class Kb{constructor({gl:t,attribute:e,timeline:i}){f(this,"gl",void 0),f(this,"type","interpolation"),f(this,"attributeInTransition",void 0),f(this,"settings",void 0),f(this,"attribute",void 0),f(this,"transition",void 0),f(this,"currentStartIndices",void 0),f(this,"currentLength",void 0),f(this,"transform",void 0),f(this,"buffers",void 0),this.gl=t,this.transition=new En(i),this.attribute=e,this.attributeInTransition=new rs(t,e.settings),this.currentStartIndices=e.startIndices,this.currentLength=0,this.transform=Qb(t,e);const r={byteLength:0,usage:35050};this.buffers=[new j(t,r),new j(t,r)]}get inProgress(){return this.transition.inProgress}start(t,e){if(t.duration<=0){this.transition.cancel();return}this.settings=t;const{gl:i,buffers:r,attribute:s}=this;el(r);const o={numInstances:e,attribute:s,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(const a of r)nl({buffer:a,...o});this.currentStartIndices=s.startIndices,this.currentLength=is(s,e),this.attributeInTransition.setData({buffer:r[1],value:s.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/s.size),sourceBuffers:{aFrom:r[0],aTo:Jc(i,s)},feedbackBuffers:{vCurrent:r[1]}})}update(){const t=this.transition.update();if(t){const{duration:e,easing:i}=this.settings,{time:r}=this.transition;let s=r/e;i&&(s=i(s)),this.transform.run({uniforms:{time:s}})}return t}cancel(){this.transition.cancel(),this.transform.delete();for(const t of this.buffers)t.delete();this.buffers.length=0}}const $b=`
759#define SHADER_NAME interpolation-transition-vertex-shader
760
761uniform float time;
762attribute ATTRIBUTE_TYPE aFrom;
763attribute ATTRIBUTE_TYPE aTo;
764varying ATTRIBUTE_TYPE vCurrent;
765
766void main(void) {
767  vCurrent = mix(aFrom, aTo, time);
768  gl_Position = vec4(0.0);
769}
770`;function Qb(n,t){const e=tl(t.size);return new $r(n,{vs:$b,defines:{ATTRIBUTE_TYPE:e},varyings:["vCurrent"]})}class Jb{constructor({gl:t,attribute:e,timeline:i}){f(this,"gl",void 0),f(this,"type","spring"),f(this,"attributeInTransition",void 0),f(this,"settings",void 0),f(this,"attribute",void 0),f(this,"transition",void 0),f(this,"currentStartIndices",void 0),f(this,"currentLength",void 0),f(this,"texture",void 0),f(this,"framebuffer",void 0),f(this,"transform",void 0),f(this,"buffers",void 0),this.gl=t,this.type="spring",this.transition=new En(i),this.attribute=e,this.attributeInTransition=new rs(t,{...e.settings,normalized:!1}),this.currentStartIndices=e.startIndices,this.currentLength=0,this.texture=ey(t),this.framebuffer=ny(t,this.texture),this.transform=ty(t,e,this.framebuffer);const r={byteLength:0,usage:35050};this.buffers=[new j(t,r),new j(t,r),new j(t,r)]}get inProgress(){return this.transition.inProgress}start(t,e){const{gl:i,buffers:r,attribute:s}=this,o={numInstances:e,attribute:s,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(const a of r)nl({buffer:a,...o});this.settings=t,this.currentStartIndices=s.startIndices,this.currentLength=is(s,e),this.attributeInTransition.setData({buffer:r[1],value:s.value}),this.transition.start({...t,duration:1/0}),this.transform.update({elementCount:Math.floor(this.currentLength/s.size),sourceBuffers:{aTo:Jc(i,s)}})}update(){const{buffers:t,transform:e,framebuffer:i,transition:r}=this;
770if(!r.update())return!1;const o=this.settings;return e.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),e.run({framebuffer:i,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:o.stiffness,damping:o.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),el(t),this.attributeInTransition.setData({buffer:t[1],value:this.attribute.value}),mi(i)[0]>0||r.end(),!0}cancel(){this.transition.cancel(),this.transform.delete();for(const t of this.buffers)t.delete();this.buffers.length=0,this.texture.delete(),this.framebuffer.delete()}}function ty(n,t,e){const i=tl(t.size);return new $r(n,{framebuffer:e,vs:`
771#define SHADER_NAME spring-transition-vertex-shader
772
773#define EPSILON 0.00001
774
775uniform float stiffness;
776uniform float damping;
777attribute ATTRIBUTE_TYPE aPrev;
778attribute ATTRIBUTE_TYPE aCur;
779attribute ATTRIBUTE_TYPE aTo;
780varying ATTRIBUTE_TYPE vNext;
781varying float vIsTransitioningFlag;
782
783ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {
784  ATTRIBUTE_TYPE velocity = cur - prev;
785  ATTRIBUTE_TYPE delta = dest - cur;
786  ATTRIBUTE_TYPE spring = delta * stiffness;
787  ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;
788  return spring + damper + velocity + cur;
789}
790
791void main(void) {
792  bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;
793  vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;
794
795  vNext = getNextValue(aCur, aPrev, aTo);
796  gl_Position = vec4(0, 0, 0, 1);
797  gl_PointSize = 100.0;
798}
799`,fs:`
800#define SHADER_NAME spring-transition-is-transitioning-fragment-shader
801
802varying float vIsTransitioningFlag;
803
804void main(void) {
805  if (vIsTransitioningFlag == 0.0) {
806    discard;
807  }
808  gl_FragColor = vec4(1.0);
809}`,defines:{ATTRIBUTE_TYPE:i},varyings:["vNext"]})}function ey(n){return new At(n,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}function ny(n,t){return new Q(n,{id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,attachments:{36064:t}})}const iy={interpolation:Kb,spring:Jb};class ry{constructor(t,{id:e,timeline:i}){f(this,"id",void 0),f(this,"isSupported",void 0),f(this,"gl",void 0),f(this,"timeline",void 0),f(this,"transitions",void 0),f(this,"needsRedraw",void 0),f(this,"numInstances",void 0),this.id=e,this.gl=t,this.timeline=i,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=$r.isSupported(t)}finalize(){for(const t in this.transitions)this._removeTransition(t)}update({attributes:t,transitions:e,numInstances:i}){this.numInstances=i||1;for(const r in t){const s=t[r],o=s.getTransitionSetting(e);o&&this._updateAttribute(r,s,o)}for(const r in this.transitions){const s=t[r];(!s||!s.getTransitionSetting(e))&&this._removeTransition(r)}}hasAttribute(t){const e=this.transitions[t];return e&&e.inProgress}getAttributes(){const t={};for(const e in this.transitions){const i=this.transitions[e];i.inProgress&&(t[e]=i.attributeInTransition)}return t}run(){if(!this.isSupported||this.numInstances===0)return!1;for(const e in this.transitions)this.transitions[e].update()&&(this.needsRedraw=!0);const t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].cancel(),delete this.transitions[t]}_updateAttribute(t,e,i){const r=this.transitions[t];let s=!r||r.type!==i.type;if(s){if(!this.isSupported){z.warn("WebGL2 not supported by this browser. Transition for ".concat(t," is disabled."))();return}r&&this._removeTransition(t);const o=iy[i.type];o?this.transitions[t]=new o({attribute:e,timeline:this.timeline,gl:this.gl}):(z.error("unsupported transition type '".concat(i.type,"'"))(),s=!1)}(s||e.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(i,this.numInstances))}}const ga="attributeManager.invalidate",sy="attributeManager.updateStart",oy="attributeManager.updateEnd",ay="attribute.updateStart",cy="attribute.allocate",ly="attribute.updateEnd";class uy{constructor(t,{id:e="attribute-manager",stats:i,timeline:r}={}){f(this,"id",void 0),f(this,"gl",void 0),f(this,"attributes",void 0),f(this,"updateTriggers",void 0),f(this,"needsRedraw",void 0),f(this,"userData",void 0),f(this,"stats",void 0),f(this,"attributeTransitionManager",void 0),f(this,"mergeBoundsMemoized",vn(g0
809)),this.id=e,this.gl=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=i,this.attributeTransitionManager=new ry(t,{id:"".concat(e,"-transitions"),timeline:r}),Object.seal(this)}finalize(){for(const t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(t={clearRedrawFlags:!1}){const e=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,e&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{instanced:1})}remove(t){for(const e of t)this.attributes[e]!==void 0&&(this.attributes[e].delete(),delete this.attributes[e])}invalidate(t,e){const i=this._invalidateTrigger(t,e);ot(ga,this,t,i)}invalidateAll(t){for(const e in this.attributes)this.attributes[e].setNeedsUpdate(e,t);ot(ga,this,"all")}update({data:t,numInstances:e,startIndices:i=null,transitions:r,props:s={},buffers:o={},context:a={}}){let c=!1;ot(sy,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const l in this.attributes){const u=this.attributes[l],d=u.settings.accessor;u.startIndices=i,u.numInstances=e,s[l]&&z.removed("props.".concat(l),"data.attributes.".concat(l))(),u.setExternalBuffer(o[l])||u.setBinaryValue(typeof d=="string"?o[d]:void 0,t.startIndices)||typeof d=="string"&&!o[d]&&u.setConstantValue(s[d])||u.needsUpdate()&&(c=!0,this._updateAttribute({attribute:u,numInstances:e,data:t,props:s,context:a})),this.needsRedraw=this.needsRedraw||u.needsRedraw()}c&&ot(oy,this,e),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:e,transitions:r})}updateTransition(){const{attributeTransitionManager:t}=this,e=t.run();return this.needsRedraw=this.needsRedraw||e,e}getAttributes(){return this.attributes}getBounds(t){const e=t.map(i=>{var r;return(r=this.attributes[i])===null||r===void 0?void 0:r.getBounds()});return this.mergeBoundsMemoized(e)}getChangedAttributes(t={clearChangedFlags:!1}){const{attributes:e,attributeTransitionManager:i}=this,r={...i.getAttributes()};for(const s in e){const o=e[s];o.needsRedraw(t)&&!i.hasAttribute(s)&&(r[s]=o)}return r}getShaderAttributes(t,e={}){t||(t=this.getAttributes());const i={};for(const r in t)e[r]||Object.assign(i,t[r].getShaderAttributes());return i}_add(t,e={}){for(const i in t){const r=t[i];this.attributes[i]=this._createAttribute(i,r,e)}this._mapUpdateTriggersToAttributes()}_createAttribute(t,e,i){const r={...e,id:t,size:e.isIndexed&&1||e.size||1,divisor:i.instanced?1:e.divisor||0};return new rs(this.gl,r)}_mapUpdateTriggersToAttributes(){const t={};for(const e in this.attributes)this.attributes[e].getUpdateTriggers().forEach(r=>{t[r]||(t[r]=[]),t[r].push(e)});this.updateTriggers=t}_invalidateTrigger(t,e){const{attributes:i,updateTriggers:r}=this,s=r[t];return s&&s.forEach(o=>{const a=i[o];a&&a.setNeedsUpdate(a.id,e)}),s}_updateAttribute(t){const{attribute:e,numInstances:i}=t;if(ot(ay,e),e.constant){e.setConstantValue(e.value);return}e.allocate(i)&&ot(cy,e,i),e.updateBuffer(t)&&(this.needsRedraw=!0,ot(ly,e,i))}}class hy extends En{get value(){return this._value}_onUpdate(){const{time:t,settings:{fromValue:e,toValue:i,duration:r,easing:s}}=this,o=s(t/r);this._value=ii(e,i,o)}}const pa=1e-5;function ma(n,t,e,i,r){const s=t-n,a=(e-t)*r,c=-s*i;return a+c+s+t}function fy(n,t,e,i,r){if(Array.isArray(e)){const s=[];for(let o=0;o<e.length;o++)s[o]=ma(n[o],t[o],e[o],i,r);return s}return ma(n,t,e,i,r)}function _a(n,t){if(Array.isArray(n)){let e=0;for(let i=0;i<n.length;i++){const r=n[i]-t[i];e+=r*r}return Math.sqrt(e)}return Math.abs(n-t)}class dy extends En{get value(){return this._currValue}_onUpdate(){const{fromValue:t,toValue:e,damping:i,stiffness:r}=this.settings,{_prevValue:s=t,_currValue:o=t}=this;let a=fy(s,o,e,i,r);const c=_a(a,e),l=_a(a,o);c<pa&&l<pa&&(a=e,this.end()),this._prevValue=o,this._currValue=a}}const gy={interpolation:hy,spring:dy};class py{constructor(t){this.transitions=new Map,this.timeline=t}get active(){return this.transitions.size>0}add(t,e,i,r){const{transitions:s}=this;if(s.has(t)){const c=s.get(t),{value:l=c.settings.fromValue}=c;e=l,this.remove(t)}if(r=Qc(r),!r)return;const o=gy[r.type];if(!o){z.error("unsupported transition type '".concat(r.type,"'"))();return}const a=new o(this.timeline);a.start({...r,fromValue:e,toValue:i}),s.set(t,a)}remove(t){const{transitions:e}=this;e.has(t)&&(e.get(t).cancel(),e.delete(t))}update(){const t={};for(const[e,i]of this.transitions)i.update(),t[e]=i.value,i.inProgress||this.remove(e);return t}clear(){for(const t of this.transitions.keys())this.remove(t)}}function my(n){const t=n[fe];for(const e in t){const i=t[e],{validate:r}=i;if(r&&!r(n[e],i))throw new Error("Invalid prop ".concat(e,": ").concat(n[e]))}}function _y(n,t){const e=il({newProps:n,oldProps:t,propTypes:n[fe],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),i=yy(n,t);let r=!1;
vendor: 9,982 bytes, line 809
809return i||(r=vy(n,t)),{dataChanged:i,propsChanged:e,updateTriggersChanged:r,extensionsChanged:Ey(n,t),transitionsChanged:by(n,t)}}function by(n,t){if(!n.transitions)return!1;const e={},i=n[fe];let r=!1;for(const s in n.transitions){const o=i[s],a=o&&o.type;(a==="number"||a==="color"||a==="array")&&Lr(n[s],t[s],o)&&(e[s]=!0,r=!0)}return r?e:!1}function il({newProps:n,oldProps:t,ignoreProps:e={},propTypes:i={},triggerName:r="props"}){if(t===n)return!1;if(typeof n!="object"||n===null||typeof t!="object"||t===null)return"".concat(r," changed shallowly");for(const s of Object.keys(n))if(!(s in e)){if(!(s in t))return"".concat(r,".").concat(s," added");const o=Lr(n[s],t[s],i[s]);if(o)return"".concat(r,".").concat(s," ").concat(o)}for(const s of Object.keys(t))if(!(s in e)){if(!(s in n))return"".concat(r,".").concat(s," dropped");if(!Object.hasOwnProperty.call(n,s)){const o=Lr(n[s],t[s],i[s]);if(o)return"".concat(r,".").concat(s," ").concat(o)}}return!1}function Lr(n,t,e){let i=e&&e.equal;return i&&!i(n,t,e)||!i&&(i=n&&t&&n.equals,i&&!i.call(n,t))?"changed deeply":!i&&t!==n?"changed shallowly":null}function yy(n,t){if(t===null)return"oldProps is null, initial diff";let e=!1;const{dataComparator:i,_dataDiff:r}=n;return i?i(n.data,t.data)||(e="Data comparator detected a change"):n.data!==t.data&&(e="A new data container was supplied"),e&&r&&(e=r(n.data,t.data)||e),e}function vy(n,t){if(t===null)return{all:!0};if("all"in n.updateTriggers&&ba(n,t,"all"))return{all:!0};const e={};let i=!1;for(const r in n.updateTriggers)r!=="all"&&ba(n,t,r)&&(e[r]=!0,i=!0);return i?e:!1}function Ey(n,t){if(t===null)return!0;const e=t.extensions,{extensions:i}=n;if(i===e)return!1;if(!e||!i||i.length!==e.length)return!0;for(let r=0;r<i.length;r++)if(!i[r].equals(e[r]))return!0;return!1}function ba(n,t,e){let i=n.updateTriggers[e];i=i??{};let r=t.updateTriggers[e];return r=r??{},il({oldProps:r,newProps:i,triggerName:e})}const Ty="count(): argument not an object",wy="count(): argument not a container";function Ay(n){if(!xy(n))throw new Error(Ty);if(typeof n.count=="function")return n.count();if(Number.isFinite(n.size))return n.size;if(Number.isFinite(n.length))return n.length;if(Sy(n))return Object.keys(n).length;throw new Error(wy)}function Sy(n){return n!==null&&typeof n=="object"&&n.constructor===Object}function xy(n){return n!==null&&typeof n=="object"}function Py(n,t){if(!t)return n;const e={...n,...t};if("defines"in t&&(e.defines={...n.defines,...t.defines}),"modules"in t&&(e.modules=(n.modules||[]).concat(t.modules),t.modules.some(i=>i.name==="project64"))){const i=e.modules.findIndex(r=>r.name==="project32");i>=0&&e.modules.splice(i,1)}if("inject"in t)if(!n.inject)e.inject=t.inject;else{const i={...n.inject};for(const r in t.inject)i[r]=(i[r]||"")+t.inject[r];e.inject=i}return e}const Ly={10241:9987,10240:9729,10242:33071,10243:33071},Rr={};function Ry(n,t,e,i){if(e instanceof At)return e;e.constructor&&e.constructor.name!=="Object"&&(e={data:e});let r=null;e.compressed&&(r={10241:e.data.length>1?9985:9729});const s=new At(t,{...e,parameters:{...Ly,...r,...i}});return Rr[s.id]=n,s}function Iy(n,t){!t||!(t instanceof At)||Rr[t.id]===n&&(t.delete(),delete Rr[t.id])}const My={boolean:{validate(n,t){return!0},equal(n,t,e){return!!n==!!t}},number:{validate(n,t){return Number.isFinite(n)&&(!("max"in t)||n<=t.max)&&(!("min"in t)||n>=t.min)}},color:{validate(n,t){return t.optional&&!n||Ir(n)&&(n.length===3||n.length===4)},equal(n,t,e){return Ot(n,t,1)}},accessor:{validate(n,t){const e=ui(n);return e==="function"||e===ui(t.value)},equal(n,t,e){return typeof t=="function"?!0:Ot(n,t,1)}},array:{validate(n,t){return t.optional&&!n||Ir(n)},equal(n,t,e){const{compare:i}=e,r=Number.isInteger(i)?i:i?1:0;return i?Ot(n,t,r):n===t}},object:{equal(n,t,e){if(e.ignore)return!0;const{compare:i}=e,r=Number.isInteger(i)?i:i?1:0;return i?Ot(n,t,r):n===t}},function:{validate(n,t){return t.optional&&!n||typeof n=="function"},equal(n,t,e){return!e.compare&&e.ignore!==!1||n===t}},data:{transform:(n,t,e)=>{const{dataTransform:i}=e.props;return i&&n?i(n):n}},image:{transform:(n,t,e)=>{const i=e.context;return!i||!i.gl?null:Ry(e.id,i.gl,n,{...t.parameters,...e.props.textureParameters})},release:(n,t,e)=>{Iy(e.id,n)}}};function Cy(n){const t={},e={},i={};for(const[r,s]of Object.entries(n)){const o=s?.deprecatedFor;if(o)i[r]=Array.isArray(o)?o:[o];else{const a=Oy(r,s);t[r]=a,e[r]=a.value}}return{propTypes:t,defaultProps:e,deprecatedProps:i}}function Oy(n,t){switch(ui(t)){case"object":return Je(n,t);case"array":return Je(n,{type:"array",value:t,compare:!1});case"boolean":return Je(n,{type:"boolean",value:t});case"number":return Je(n,{type:"number",value:t});case"function":return Je(n,{type:"function",value:t,compare:!0});default:return{name:n,type:"unknown",value:t}}}function Je(n,t){return"type"in t?{name:n,...My[t.type],...t}:"value"in t?{name:n,type:ui(t.value),...t}:{name:n,type:"object",value:t}}function Ir(n){return Array.isArray(n)||ArrayBuffer.isView(n)}function ui(n){return Ir(n)?"array":n===null?"null":typeof n}function Ny(n,t){let e;for(let s=t.length-1;s>=0;s--){const o=t[s];"extensions"in o&&(e=o.extensions)}const i=Mr(n.constructor,e),r=Object.create(i);r[li]=n,r[de]={},r[Jt]={};for(let s=0;s<t.length;++s){const o=t[s];for(const a in o)r[a]=o[a]}return Object.freeze(r),r}const ky="_mergedDefaultProps";function Mr(n,t){let e=ky;if(t)for(const r of t){const s=r.constructor;s&&(e+=":".concat(s.extensionName||s.name))}const i=rl(n,e);return i||(n[e]=Dy(n,t||[]))}function Dy(n,t){if(!n.prototype)return null;const i=Object.getPrototypeOf(n),r=Mr(i),s=rl(n,"defaultProps")||{},o=Cy(s),a=Object.assign(Object.create(null),r,o.defaultProps),c=Object.assign(Object.create(null),r?.[fe],o.propTypes),l=Object.assign(Object.create(null),r?.[er],o.deprecatedProps);for(const u of t){const d=Mr(u.constructor);d&&(Object.assign(a,d),Object.assign(c,d[fe]),Object.assign(l,d[er]))}return Fy(a,n),By(a,c),Uy(a,l),a[fe]=c,a[er]=l,t.length===0&&!ss(n,"_propTypes")&&(n._propTypes=c),a}function Fy(n,t){const e=jy(t);Object.defineProperties(n,{id:{writable:!0,value:e}})}function Uy(n,t){for(const e in t)Object.defineProperty(n,e,{enumerable:!1,set(i){const r="".concat(this.id,": ").concat(e);for(const s of t[e])ss(this,s)||(this[s]=i);z.deprecated(r,t[e].join("/"))()}})}function By(n,t){const e={},i={};for(const r in t){const s=t[r],{name:o,value:a}=s;s.async&&(e[o]=a,i[o]=Vy(o))}n[Le]=e,n[de]={},Object.defineProperties(n,i)}function Vy(n){return{enumerable:!0,set(t){typeof t=="string"||t instanceof Promise||$c(t)?this[de][n]=t:this[Jt][n]=t},get(){if(this[Jt]){if(n in this[Jt])return this[Jt][n]||this[Le][n];if(n in this[de]){const t=this[li]&&this[li].internalState;if(t&&t.hasAsyncProp(n))return t.getAsyncProp(n)||this[Le][n]}}return this[Le][n]}}}function ss(n,t){return Object.prototype.hasOwnProperty.call(n,t)}function rl(n,t){return ss(n,t)&&n[t]}function jy(n){const t=n.componentName;return t||z.warn("".concat(n.name,".componentName not specified"))(),t||n.name}let zy=0;class os{constructor(...t){f(this,"id",void 0),f(this,"props",void 0),f(this,"count",void 0),this.props=Ny(this,t),this.id=this.props.id,this.count=zy++}clone(t){const{props:e}=this,i={};for(const r in e[Le])r in e[Jt]?i[r]=e[Jt][r]:r in e[de]&&(i[r]=e[de][r]);return new this.constructor({...e,...i,...t})}}f(os,"componentName","Component");f(os,"defaultProps",{});const Gy=Object.freeze({});class Hy{constructor(t){f(this,"component",void 0),f(this,"onAsyncPropUpdated",void 0),f(this,"asyncProps",void 0),f(this,"oldProps",void 0),f(this,"oldAsyncProps",void 0),this.component=t,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const t in this.asyncProps){const e=this.asyncProps[t];e&&e.type&&e.type.release&&e.type.release(e.resolvedValue,e.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||Gy}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){const e=this.asyncProps[t];return e&&e.resolvedValue}isAsyncPropLoading(t){if(t){const e=this.asyncProps[t];return!!(e&&e.pendingLoadCount>0&&e.pendingLoadCount!==e.resolvedLoadCount)}for(const e in this.asyncProps)if(this.isAsyncPropLoading(e))return!0;return!1}reloadAsyncProp(t,e){this._watchPromise(t,Promise.resolve(e))}setAsyncProps(t){this.component=t[li]||this.component;const e=t[Jt]||{},i=t[de]||t,r=t[Le]||{};for(const s in e){const o=e[s];this._createAsyncPropData(s,r[s]),this._updateAsyncProp(s,o),e[s]=this.getAsyncProp(s)}for(const s in i){const o=i[s];this._createAsyncPropData(s,r[s]),this._updateAsyncProp(s,o)}}_fetch(t,e){return null}_onResolve(t,e){}_onError(t,e){}_updateAsyncProp(t,e){if(this._didAsyncInputValueChange(t,e)){if(typeof e=="string"&&(e=this._fetch(t,e)),e instanceof Promise){this._watchPromise(t,e);return}if($c(e)){this._resolveAsyncIterable(t,e);return}this._setPropValue(t,e)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,e){const i=this.asyncProps[t];return e===i.resolvedValue||e===i.lastValue?!1:(i.lastValue=e,!0)}_setPropValue(t,e){this._freezeAsyncOldProps();const i=this.asyncProps[t];i&&(e=this._postProcessValue(i,e),i.resolvedValue=e,i.pendingLoadCount++,i.resolvedLoadCount=i.pendingLoadCount)}_setAsyncPropValue(t,e,i){const r=this.asyncProps[t];r&&i>=r.resolvedLoadCount&&e!==void 0&&(this._freezeAsyncOldProps(),r.resolvedValue=e,r.resolvedLoadCount=i,this.onAsyncPropUpdated(t,e))}_watchPromise(t,e){const i=this.asyncProps[t];if(i){i.pendingLoadCount++;const r=i.pendingLoadCount;e.then(s=>{this.component&&(s=this._postProcessValue(i,s),this._setAsyncPropValue(t,s,r),this._onRes
809olve(t,s))}).catch(s=>{this._onError(t,s)})}}async _resolveAsyncIterable(t,e){if(t!=="data"){this._setPropValue(t,e);return}const i=this.asyncProps[t];if(!i)return;i.pendingLoadCount++;const r=i.pendingLoadCount;let s=[],o=0;for await(const a of e){if(!this.component)return;const{dataTransform:c}=this.component.props;c?s=c(a,s):s=s.concat(a),Object.defineProperty(s,"__diff",{enumerable:!1,value:[{startRow:o,endRow:s.length}]}),o=s.length,this._setAsyncPropValue(t,s,r)}this._onResolve(t,s)}_postProcessValue(t,e){const i=t.type;return i&&this.component&&(i.release&&i.release(t.resolvedValue,i,this.component),i.transform)?i.transform(e,i,this.component):e}_createAsyncPropData(t,e){if(!this.asyncProps[t]){const r=this.component&&this.component.props[fe];this.asyncProps[t]={type:r&&r[t],lastValue:null,resolvedValue:e,pendingLoadCount:0,resolvedLoadCount:0}}}}class Wy extends Hy{constructor({attributeManager:t,layer:e}){super(e),f(this,"attributeManager",void 0),f(this,"needsRedraw",void 0),f(this,"needsUpdate",void 0),f(this,"subLayers",void 0),f(this,"usesPickingColorCache",void 0),f(this,"hasPickingBuffer",void 0),f(this,"changeFlags",void 0),f(this,"viewport",void 0),f(this,"uniformTransitions",void 0),f(this,"propsInTransition",void 0),this.attributeManager=t,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,e){const i=this.layer,r=i?.props.fetch;return r?r(e,{propName:t,layer:i}):super._fetch(t,e)}_onResolve(t,e){const i=this.layer;if(i){const r=i.props.onDataLoad;t==="data"&&r&&r(e,{propName:t,layer:i})}}_onError(t,e){const i=this.layer;i&&i.raiseError(e,"loading ".concat(t," of ").concat(this.layer))}}const Xy="layer.changeFlag",Yy="layer.initialize",qy="layer.update",Zy="layer.finalize",Ky="layer.matched",ya=2**24-1,$y=Object.freeze([]),Qy=vn(({oldViewport:n,viewport:t})=>n.equals(t));let It=new Uint8ClampedArray(0);const Jy={data:{type:"data",value:$y,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:n=>n&&n.__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:(n,{propName:t,layer:e,loaders:i,loadOptions:r,signal:s})=>{const{resourceManager:o}=e.context;if(r=r||e.getLoadOptions(),i=i||e.props.loaders,s){var a;r={...r,fetch:{...(a=r)===null||a===void 0?void 0:a.fetch,signal:s}}}let c=o.contains(n);return!c&&!r&&(o.add({resourceId:n,data:ar(n,i),persistent:!1}),c=!0),c?o.subscribe({resourceId:n,onChange:l=>{var u;return(u=e.internalState)===null||u===void 0?void 0:u.reloadAsyncProp(t,l)},consumerId:e.id,requestId:t}):ar(n,i,r)}},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:V.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:n})=>[0,-n*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class wn extends os{constructor(...t){super(...t),f(this,"internalState",null),f(this,"lifecycle",Ae.NO_STATE),f(this,"context",void 0),f(this,"state",void 0),f(this,"parent",null)}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){const t=this.constructor.layerName||this.constructor.name;return"".concat(t,"({id: '").concat(this.props.id,"'})")}project(t){nt(this.internalState);const e=this.internalState.viewport||this.context.viewport,i=Dc(t,{viewport:e,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[r,s,o]=Nc(i,e.pixelProjectionMatrix);return t.length===2?[r,s]:[r,s,o]}unproject(t){return nt(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,e){nt(this.internalState);const i=this.internalState.viewport||this.context.viewport;return v0(t,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...e})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),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(){return this.state&&(this.state.models||this.state.model&&[this.state.model])||[]}setModuleParameters(t){for(const e of this.getModels())e.updateModuleSettings(t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:t}=this.props;return t===V.DEFAULT||t===V.LNGLAT||t===V.CARTESIAN}onHover(t,e){return this.props.onHover&&this.props.onHover(t,e)||!1}onClick(t,e){return this.props.onClick&&this.props.onClick(t,e)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t,e=[]){return e[0]=t+1&255,e[1]=t+1>>8&255,e[2]=t+1>>8>>8&255,e}decodePickingColor(t){nt(t instanceof Uint8Array);const[e,i,r]=t;return e+i*256+r*65536-1}
809getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:Ay(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds(["positions","instancePositions"])}getShaders(t){for(const e of this.props.extensions)t=Py(t,e.getShaders.call(this,e));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){const e=this.getAttributeManager(),{dataChanged:i}=t.changeFlags;if(i&&e)if(Array.isArray(i))for(const r of i)e.invalidateAll(r);else e.invalidateAll();if(e){const{props:r}=t,s=this.internalState.hasPickingBuffer,o=Number.isInteger(r.highlightedObjectIndex)||r.pickable||r.extensions.some(a=>a.getNeedsPickingBuffer.call(this,a));if(s!==o){this.internalState.hasPickingBuffer=o;const{pickingColors:a,instancePickingColors:c}=e.attributes,l=a||c;
809l&&(o&&l.constant&&(l.constant=!1,e.invalidate(l.id)),!l.value&&!o&&(l.constant=!0,l.value=[0,0,0]))}}}finalizeState(t){for(const i of this.getModels())i.delete();const e=this.getAttributeManager();e&&e.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(const e of this.getModels())e.draw(t)}getPickingInfo({info:t,mode:e,sourceLayer:i}){const{index:r}=t;return r>=0&&Array.isArray(this.props.data)&&(t.object=this.props.data[r]),t}raiseError(t,e){var i,r;if(e&&(t=new Error("".concat(e,": ").concat(t.message),{cause:t})),!((i=(r=this.props).onError)!==null&&i!==void 0&&i.call(r,t))){var s,o;(s=this.context)===null||s===void 0||(o=s.onError)===null||o===void 0||o.call(s,t,this)}}getNeedsRedraw(t={clearRedrawFlags:!1}){return this._getNeedsRedraw(t)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var t;return((t=this.internalState)===null||t===void 0?void 0:t.uniformTransitions.active)||!1}activateViewport(t){if(!this.internalState)return;const e=this.internalState.viewport;this.internalState.viewport=t,(!e||!Qy({oldViewport:e,viewport:t}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(t="all"){const e=this.getAttributeManager();
vendor: 6,580 bytes, line 809
809e&&(t==="all"?e.invalidateAll():e.invalidate(t))}updateAttributes(t){for(const e of this.getModels())this._setModelAttributes(e,t)}_updateAttributes(){const t=this.getAttributeManager();if(!t)return;const e=this.props,i=this.getNumInstances(),r=this.getStartIndices();t.update({data:e.data,numInstances:i,startIndices:r,props:e,transitions:e.transitions,buffers:e.data.attributes,context:this});const s=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(s)}_updateAttributeTransition(){const t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){const{uniformTransitions:t}=this.internalState;if(t.active){const e=t.update(),i=Object.create(this.props);for(const r in e)Object.defineProperty(i,r,{value:e[r]});return i}return this.props}calculateInstancePickingColors(t,{numInstances:e}){if(t.constant)return;const i=Math.floor(It.length/3);if(this.internalState.usesPickingColorCache=!0,i<e){e>ya&&z.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),It=fn.allocate(It,e,{size:3,copy:!0,maxCount:Math.max(e,ya)});const r=Math.floor(It.length/3),s=[];for(let o=i;o<r;o++)this.encodePickingColor(o,s),It[o*3+0]=s[0],It[o*3+1]=s[1],It[o*3+2]=s[2]}t.value=It.subarray(0,e*3)}_setModelAttributes(t,e){const i=this.getAttributeManager(),r=t.userData.excludeAttributes||{},s=i.getShaderAttributes(e,r);t.setAttributes(s)}disablePickingIndex(t){const e=this.props.data;if(!("attributes"in e)){this._disablePickingIndex(t);return}const{pickingColors:i,instancePickingColors:r}=this.getAttributeManager().attributes,s=i||r,o=s&&e.attributes&&e.attributes[s.id];if(o&&o.value){const a=o.value,c=this.encodePickingColor(t);for(let l=0;l<e.length;l++){const u=s.getVertexOffset(l);a[u]===c[0]&&a[u+1]===c[1]&&a[u+2]===c[2]&&this._disablePickingIndex(l)}}else this._disablePickingIndex(t)}_disablePickingIndex(t){const{pickingColors:e,instancePickingColors:i}=this.getAttributeManager().attributes,r=e||i;if(!r)return;const s=r.getVertexOffset(t),o=r.getVertexOffset(t+1);r.buffer.subData({data:new Uint8Array(o-s),offset:s})}restorePickingColors(){const{pickingColors:t,instancePickingColors:e}=this.getAttributeManager().attributes,i=t||e;i&&(this.internalState.usesPickingColorCache&&i.value.buffer!==It.buffer&&(i.value=It.subarray(0,i.value.length)),i.updateSubBuffer({startOffset:0}))}_initialize(){nt(!this.internalState),nt(Number.isFinite(this.props.coordinateSystem)),ot(Yy,this);const t=this._getAttributeManager();t&&t.addInstanced({instancePickingColors:{type:5121,size:3,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new Wy({attributeManager:t,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(z.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),t)}),this.internalState.uniformTransitions=new py(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const e of this.props.extensions)e.initializeState.call(this,this.context,e);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){ot(Ky,this,this===t);const{state:e,internalState:i}=t;this!==t&&(this.internalState=i,this.state=e,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){const t=this.needsUpdate();if(ot(qy,this,t),!t)return;const e=this.props,i=this.context,r=this.internalState,s=i.viewport,o=this._updateUniformTransition();r.propsInTransition=o,i.viewport=r.viewport||s,this.props=o;try{const a=this._getUpdateParams(),c=this.getModels();if(i.gl)this.updateState(a);else try{this.updateState(a)}catch{}for(const u of this.props.extensions)u.updateState.call(this,a,u);const l=this.getModels()[0]!==c[0];this._postUpdate(a,l)}finally{i.viewport=s,this.props=e,this._clearChangeFlags(),r.needsUpdate=!1,r.resetOldProps()}}_finalize(){ot(Zy,this),this.finalizeState(this.context);for(const t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer({moduleParameters:t=null,uniforms:e={},parameters:i={}}){this._updateAttributeTransition();const r=this.props,s=this.context;this.props=this.internalState.propsInTransition||r;const o=this.props.opacity;e.opacity=Math.pow(o,1/2.2);try{t&&this.setModuleParameters(t);const{getPolygonOffset:a}=this.props,c=a&&a(e)||[0,0];jt(s.gl,{polygonOffset:c}),wt(s.gl,i,()=>{const l={moduleParameters:t,uniforms:e,parameters:i,context:s};for(const u of this.props.extensions)u.draw.call(this,l,u);this.draw(l)})}finally{this.props=r}}getChangeFlags(){var t;return(t=this.internalState)===null||t===void 0?void 0:t.changeFlags}setChangeFlags(t){if(!this.internalState)return;const{changeFlags:e}=this.internalState;for(const r in t)if(t[r]){let s=!1;switch(r){case"dataChanged":const o=t[r],a=e[r];o&&Array.isArray(a)&&(e.dataChanged=Array.isArray(o)?a.concat(o):o,s=!0);default:e[r]||(e[r]=t[r],s=!0)}s&&ot(Xy,this,r,t)}const i=!!(e.dataChanged||e.updateTriggersChanged||e.propsChanged||e.extensionsChanged);e.propsOrDataChanged=i,e.somethingChanged=i||e.viewportChanged||e.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,e){const i=_y(t,e);if(i.updateTriggersChanged)for(const s in i.updateTriggersChanged)i.updateTriggersChanged[s]&&this.invalidateAttribute(s);if(i.transitionsChanged)for(const s in i.transitionsChanged){var r;this.internalState.uniformTransitions.add(s,e[s],t[s],(r=t.transitions)===null||r===void 0?void 0:r[s])}return this.setChangeFlags(i)}validateProps(){my(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){const e={pickingSelectedColor:t.picked?t.color:null},{highlightColor:i}=this.props;t.picked&&typeof i=="function"&&(e.pickingHighlightColor=i(t)),this.setModuleParameters(e),this.setNeedsRedraw()}_getAttributeManager(){const t=this.context;return new uy(t.gl,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,e){const{props:i,oldProps:r}=t;this.setNeedsRedraw(),this._updateAttributes();const{model:s}=this.state;s?.setInstanceCount(this.getNumInstances());const{autoHighlight:o,highlightedObjectIndex:a,highlightColor:c}=i;
809if(e||r.autoHighlight!==o||r.highlightedObjectIndex!==a||r.highlightColor!==c){const l={};o||(l.pickingSelectedColor=null),Array.isArray(c)&&(l.pickingHighlightColor=c),(e||a!==r.highlightedObjectIndex)&&(l.pickingSelectedColor=Number.isFinite(a)&&a>=0?this.encodePickingColor(a):null),this.setModuleParameters(l)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let e=!1;e=e||this.internalState.needsRedraw&&this.id;const i=this.getAttributeManager(),r=i?i.getNeedsRedraw(t):!1;if(e=e||r,e)for(const s of this.props.extensions)s.onNeedsRedraw.call(this,s);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,e}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}f(wn,"defaultProps",Jy);f(wn,"layerName","Layer");const tv=typeof window<"u"?Z.useLayoutEffect:Z.useEffect;function hi(n,t){for(;n;){if(n===t)return!0;n=Object.getPrototypeOf(n)}return!1}const ev={position:"absolute",zIndex:-1};function sl(n,t){if(typeof n=="function")return n(t);if(Array.isArray(n))return n.map(e=>sl(e,t));if(yi(n)){if(nv(n))return t.style=ev,Z.cloneElement(n,t);if(iv(n))return Z.cloneElement(n,t)}return n}function yi(n){return n&&typeof n=="object"&&"type"in n||!1}function nv(n){var t;return(t=n.props)===null||t===void 0?void 0:t.mapStyle}function iv(n){const t=n.type;return t&&t.deckGLViewProps}function Cr(n){if(typeof n=="function")return Z.createElement(Ue,{},n);if(Array.isArray(n))return n.map(Cr);if(yi(n)){if(n.type===Z.Fragment)return Cr(n.props.children);if(hi(n.type,Ue))return n}return n}function rv({children:n,layers:t=[],views:e=null}){const i=[],r=[],s={};return Z.Children.forEach(Cr(n),o=>{if(yi(o)){const a=o.type;if(hi(a,wn)){const c=sv(a,o.props);r.push(c)}else i.push(o);if(hi(a,Ue)&&a!==Ue&&o.props.id){const c=new a(o.props);s[c.id]=c}}else o&&i.push(o)}),Object.keys(s).length>0&&(Array.isArray(e)?e.forEach(o=>{s[o.id]=o}):e&&(s[e.id]=e),e=Object.values(s)),t=r.length>0?[...r,...t]:t,{layers:t,children:i,views:e}}function sv(n,t){const e={},i=n.defaultProps||{};for(const r in t)i[r]!==t[r]&&(e[r]=t[r]);return new n(e)}function ov({children:n,deck:t,ContextProvider:e}){const{viewManager:i}=t||{};if(!i||!i.views.length)return[];const r={},s=i.views[0].id;for(const o of n){let a=s,c=o;yi(o)&&hi(o.type,Ue)&&(a=o.props.id||s,c=o.props.children);const l=i.getViewport(a),u=i.getViewState(a);if(l){u.padding=l.padding;const{x:d,y:p,width:_,height:b}=l;c=sl(c,{x:d,y:p,width:_,height:b,viewport:l,viewState:u}),r[a]||(r[a]={viewport:l,children:[]}),r[a].children.push(c)}}return Object.keys(r).map(o=>{const{viewport:a,children:c}=r[o],{x:l,y:u,width:d,height:p}=a,_={position:"absolute",left:l,top:u,width:d,height:p},b="view-".concat(o),y=Z.createElement("div",{key:b,id:b,style:_},...c);if(e){const E={viewport:a,container:t.canvas.offsetParent,eventManager:t.eventManager,onViewStateChange:T=>{T.viewId=o,t._onViewStateChange(T)}};return Z.createElement(e,{key:b,value:E},y)}return y})}const av={mixBlendMode:null};function cv({width:n,height:t,style:e}){const i={position:"absolute",zIndex:0,left:0,top:0,width:n,height:t},r={left:0,top:0};if(e)for(const s in e)s in av?r[s]=e[s]:i[s]=e[s];return{containerStyle:i,canvasStyle:r}}function lv(n){return{get deck(){return n.deck},pickObject:t=>n.deck.pickObject(t),pickMultipleObjects:t=>n.deck.pickMultipleObjects(t),pickObjects:t=>n.deck.pickObjects(t)}}function ol(n){n.redrawReason&&(n.deck._drawLayers(n.redrawReason),n.redrawReason=null)}function uv(n,t,e){const i=new t({...e,_customRender:r=>{n.redrawReason=r;const s=i.getViewports();n.lastRenderedViewports!==s?n.forceUpdate():ol(n)}});return i}const hv=Z.forwardRef((n,t)=>{const[e,i]=Z.useState(0),s=Z.useRef({control:null,version:e,forceUpdate:()=>i(L=>L+1)}).current,o=Z.useRef(null),a=Z.useRef(null),c=Z.useMemo(()=>rv(n),[n.layers,n.views,n.children]);let l=!0;const u=L=>{var P;return l&&n.viewState?(s.viewStateUpdateRequested=L,null):(s.viewStateUpdateRequested=null,(P=n.onViewStateChange)===null||P===void 0?void 0:P.call(n,L))},d=L=>{if(l)s.interactionStateUpdateRequested=L;else{var P;s.interactionStateUpdateRequested=null,(P=n.onInteractionStateChange)===null||P===void 0||P.call(n,L)}},p=Z.useMemo(()=>{const L={...n,style:null,width:"100%",height:"100%",parent:o.current,canvas:a.current,layers:c.layers,views:c.views,onViewStateChange:u,onInteractionStateChange:d};return delete L._customRender,s.deck&&s.deck.setProps(L),L},[n]);Z.useEffect(()=>{const L=n.Deck||bi;return s.deck=uv(s,L,{...p,parent:o.current,canvas:a.current}),()=>{var P;return(P=s.deck)===null||P===void 0?void 0:P.finalize()}},[]),tv(()=>{ol(s);const{viewStateUpdateRequested:L,interactionStateUpdateRequested:P}=s;L&&u(L),P&&d(P)}),Z.useImperativeHandle(t,()=>lv(s),[]);const _=s.deck&&s.deck.isInitialized?s.deck.getViewports():void 0,{ContextProvider:b,width:y,height:E,id:T,style:w}=n,{containerStyle:A,canvasStyle:x}=Z.useMemo(()=>cv({width:y,height:E,style:w}),[y,E,w]);if(!s.viewStateUpdateRequested&&s.lastRenderedViewports===_||s.version!==e){s.lastRenderedViewports=_,s.version=e;
809const L=ov({children:c.children,deck:s.deck,ContextProvider:b}),P=Z.createElement("canvas",{key:"canvas",id:T||"deckgl-overlay",ref:a,style:x});s.control=Z.createElement("div",{id:"".concat(T||"deckgl","-wrapper"),ref:o,style:A},[P,L])}return l=!1,s.control});hv.defaultProps=bi.defaultProps;const fv=`#define SHADER_NAME arc-layer-vertex-shader
810
811attribute vec3 positions;
812attribute vec4 instanceSourceColors;
813attribute vec4 instanceTargetColors;
814attribute vec3 instanceSourcePositions;
815attribute vec3 instanceSourcePositions64Low;
816attribute vec3 instanceTargetPositions;
817attribute vec3 instanceTargetPositions64Low;
818attribute vec3 instancePickingColors;
819attribute float instanceWidths;
820attribute float instanceHeights;
821attribute float instanceTilts;
822
823uniform bool greatCircle;
824uniform bool useShortestPath;
825uniform float numSegments;
826uniform float opacity;
827uniform float widthScale;
828uniform float widthMinPixels;
829uniform float widthMaxPixels;
830uniform int widthUnits;
831
832varying vec4 vColor;
833varying vec2 uv;
834varying float isValid;
835
836float paraboloid(float distance, float sourceZ, float targetZ, float ratio) {
837
838  float deltaZ = targetZ - sourceZ;
839  float dh = distance * instanceHeights;
840  if (dh == 0.0) {
841    return sourceZ + deltaZ * ratio;
842  }
843  float unitZ = deltaZ / dh;
844  float p2 = unitZ * unitZ + 1.0;
845  float dir = step(deltaZ, 0.0);
846  float z0 = mix(sourceZ, targetZ, dir);
847  float r = mix(ratio, 1.0 - ratio, dir);
848  return sqrt(r * (p2 - r)) * dh + z0;
849}
850vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
851  vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);
852  dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
853
854  return dir_screenspace * offset_direction * width / 2.0;
855}
856
857float getSegmentRatio(float index) {
858  return smoothstep(0.0, 1.0, index / (numSegments - 1.0));
859}
860
861vec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {
862  float distance = length(source.xy - target.xy);
863  float z = paraboloid(distance, source.z, target.z, segmentRatio);
864
865  float tiltAngle = radians(instanceTilts);
866  vec2 tiltDirection = normalize(target.xy - source.xy);
867  vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);
868
869  return vec3(
870    mix(source.xy, target.xy, segmentRatio) + tilt,
871    z * cos(tiltAngle)
872  );
873}
874float getAngularDist (vec2 source, vec2 target) {
875  vec2 sourceRadians = radians(source);
876  vec2 targetRadians = radians(target);
877  vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);
878  vec2 shd_sq = sin_half_delta * sin_half_delta;
879
880  float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;
881  return 2.0 * asin(sqrt(a));
882}
883
884vec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {
885  vec2 lngLat;
886  if(abs(angularDist - PI) < 0.001) {
887    lngLat = (1.0 - t) * source.xy + t * target.xy;
888  } else {
889    float a = sin((1.0 - t) * angularDist);
890    float b = sin(t * angularDist);
891    vec3 p = source3D.yxz * a + target3D.yxz * b;
892    lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));
893  }
894
895  float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);
896
897  return vec3(lngLat, z);
898}
899
900void main(void) {
901  geometry.worldPosition = instanceSourcePositions;
902  geometry.worldPositionAlt = instanceTargetPositions;
903
904  float segmentIndex = positions.x;
905  float segmentRatio = getSegmentRatio(segmentIndex);
906  float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));
907  float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));
908  float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
909  isValid = 1.0;
910
911  uv = vec2(segmentRatio, positions.y);
912  geometry.uv = uv;
913  geometry.pickingColor = instancePickingColors;
914
915  vec4 curr;
916  vec4 next;
917  vec3 source;
918  vec3 target;
919
920  if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {
921    source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));
922    target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));
923    float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);
924
925    vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);
926    vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);
927    vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);
928
929    if (abs(currPos.x - prevPos.x) > 180.0) {
930      indexDir = -1.0;
931      isValid = 0.0;
932    } else if (abs(currPos.x - nextPos.x) > 180.0) {
933      indexDir = 1.0;
934      isValid = 0.0;
935    }
936    nextPos = indexDir < 0.0 ? prevPos : nextPos;
937    nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
938
939    if (isValid == 0.0) {
940      nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;
941      float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);
942      currPos = mix(currPos, nextPos, t);
943      segmentRatio = mix(segmentRatio, nextSegmentRatio, t);
944    }
945
946    vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);
947    vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);
948  
949    curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);
950    next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));
951  
952  } else {
953    vec3 source_world = instanceSourcePositions;
954    vec3 target_world = instanceTargetPositions;
955    if (useShortestPath) {
956      source_world.x = mod(source_world.x + 180., 360.0) - 180.;
957      target_world.x = mod(target_world.x + 180., 360.0) - 180.;
958
959      float deltaLng = target_world.x - source_world.x;
960      if (deltaLng > 180.) target_world.x -= 360.;
961      if (deltaLng < -180.) source_world.x -= 360.;
962    }
963    source = project_position(source_world, instanceSourcePositions64Low);
964    target = project_position(target_world, instanceTargetPositions64Low);
965    float antiMeridianX = 0.0;
966
967    if (useShortestPath) {
968      if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {
969        antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;
970      }
971      float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);
972
973      if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {
974        isValid = 0.0;
975        indexDir = sign(segmentRatio - thresholdRatio);
976        segmentRatio = thresholdRatio;
977      }
978    }
979
980    nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;
981    vec3 currPos = interpolateFlat(source, target, segmentRatio);
982    vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);
983
984    if (useShortestPath) {
985      if (nextPos.x < antiMeridianX) {
986        currPos.x += TILE_SIZE;
987        nextPos.x += TILE_SIZE;
988      }
989    }
990
991    curr = project_common_position_to_clipspace(vec4(currPos, 1.0));
992    next = project_common_position_to_clipspace(vec4(nextPos, 1.0));
993    geometry.position = vec4(currPos, 1.0);
994  }
995  float widthPixels = clamp(
996    project_size_to_pixel(instanceWidths * widthScale, widthUnits),
997    widthMinPixels, widthMaxPixels
998  );
999  vec3 offset = vec3(
1000    getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),
1001    0.0);
1002  DECKGL_FILTER_SIZE(offset, geometry);
1003  DECKGL_FILTER_GL_POSITION(curr, geometry);
1004  gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);
1005
1006  vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);
1007  vColor = vec4(color.rgb, color.a * opacity);
1008  DECKGL_FILTER_COLOR(vColor, geometry);
1009}
1010`,dv=`#define SHADER_NAME arc-layer-fragment-shader
1011
1012precision highp float;
1013
1014varying vec4 vColor;
1015varying vec2 uv;
1016varying float isValid;
1017
1018void main(void) {
1019  if (isValid == 0.0) {
1020    discard;
1021  }
1022
1023  gl_FragColor = vColor;
1024  geometry.uv = uv;
1025
1026  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
1027}
1028`,fi=[0,0,0,255],gv={getSourcePosition:{type:"accessor",value:n=>n.sourcePosition},getTargetPosition:{type:"accessor",value:n=>n.targetPosition},getSourceColor:{type:"accessor",value:fi},getTargetColor:{type:"accessor",value:fi},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,numSegments:{type:"number",value:50,min:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}};class al extends wn{constructor(...t){super(...t),f(this,"state",void 0)}getBounds(){var t;return(t=this.getAttributeManager())===null||t===void 0?void 0:t.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:fv,fs:dv,modules:[Vc,jc]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getSourceColor",defaultValue:fi},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getTargetColor",defaultValue:fi},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}updateState(t){super.updateState(t);const{props:e,oldProps:i,changeFlags:r}=t;if(r.extensionsChanged||r.propsChanged&&e.numSegments!==i.numSegments){var s;const{gl:o}=this.context;(s=this.state.model)===null||s===void 0||s.delete(),this.state.model=this._getModel(o),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}){const{widthUnits:e,widthScale:i,widthMinPixels:r,widthMaxPixels:s,greatCircle:o,wrapLongitude:a}=this.props;this.state.model.setUniforms(t).setUniforms({greatCircle:o,widthUnits:an[e],widthScale:i,widthMinPixels:r,widthMaxPixels:s,useShortestPath:a}).draw()}_getModel(t){const{id:e,numSegments:i}=this.props;let r=[];for(let o=0;o<i;o++)r=r.concat([o,1,0,o,-1,0]);
1028const s=new Kr(t,{...this.getShaders(),id:e,geometry:new Ac({drawMode:5,attributes:{positions:new Float32Array(r)}}),isInstanced:!0});return s.setUniforms({numSegments:i}),s}}f(al,"layerName","ArcLayer");f(al,"defaultProps",gv);const pv=`#define SHADER_NAME scatterplot-layer-vertex-shader
1029
1030attribute vec3 positions;
1031
1032attribute vec3 instancePositions;
1033attribute vec3 instancePositions64Low;
1034attribute float instanceRadius;
1035attribute float instanceLineWidths;
1036attribute vec4 instanceFillColors;
1037attribute vec4 instanceLineColors;
1038attribute vec3 instancePickingColors;
1039
1040uniform float opacity;
1041uniform float radiusScale;
1042uniform float radiusMinPixels;
1043uniform float radiusMaxPixels;
1044uniform float lineWidthScale;
1045uniform float lineWidthMinPixels;
1046uniform float lineWidthMaxPixels;
1047uniform float stroked;
1048uniform bool filled;
1049uniform bool antialiasing;
1050uniform bool billboard;
1051uniform int radiusUnits;
1052uniform int lineWidthUnits;
1053
1054varying vec4 vFillColor;
1055varying vec4 vLineColor;
1056varying vec2 unitPosition;
1057varying float innerUnitRadius;
1058varying float outerRadiusPixels;
1059
1060
1061void main(void) {
1062  geometry.worldPosition = instancePositions;
1063  outerRadiusPixels = clamp(
1064    project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),
1065    radiusMinPixels, radiusMaxPixels
1066  );
1067  float lineWidthPixels = clamp(
1068    project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),
1069    lineWidthMinPixels, lineWidthMaxPixels
1070  );
1071  outerRadiusPixels += stroked * lineWidthPixels / 2.0;
1072  float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;
1073  unitPosition = edgePadding * positions.xy;
1074  geometry.uv = unitPosition;
1075  geometry.pickingColor = instancePickingColors;
1076
1077  innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;
1078  
1079  if (billboard) {
1080    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);
1081    DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
1082    vec3 offset = edgePadding * positions * outerRadiusPixels;
1083    DECKGL_FILTER_SIZE(offset, geometry);
1084    gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);
1085  } else {
1086    vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);
1087    DECKGL_FILTER_SIZE(offset, geometry);
1088    gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);
1089    DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
1090  }
1091  vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);
1092  DECKGL_FILTER_COLOR(vFillColor, geometry);
1093  vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);
1094  DECKGL_FILTER_COLOR(vLineColor, geometry);
1095}
1096`,mv=`#define SHADER_NAME scatterplot-layer-fragment-shader
1097
1098precision highp float;
1099
1100uniform bool filled;
1101uniform float stroked;
1102uniform bool antialiasing;
1103
1104varying vec4 vFillColor;
1105varying vec4 vLineColor;
1106varying vec2 unitPosition;
1107varying float innerUnitRadius;
1108varying float outerRadiusPixels;
1109
1110void main(void) {
1111  geometry.uv = unitPosition;
1112
1113  float distToCenter = length(unitPosition) * outerRadiusPixels;
1114  float inCircle = antialiasing ? 
1115    smoothedge(distToCenter, outerRadiusPixels) : 
1116    step(distToCenter, outerRadiusPixels);
1117
1118  if (inCircle == 0.0) {
1119    discard;
1120  }
1121
1122  if (stroked > 0.5) {
1123    float isLine = antialiasing ? 
1124      smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :
1125      step(innerUnitRadius * outerRadiusPixels, distToCenter);
1126
1127    if (filled) {
1128      gl_FragColor = mix(vFillColor, vLineColor, isLine);
1129    } else {
1130      if (isLine == 0.0) {
1131        discard;
1132      }
1133      gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);
1134    }
1135  } else if (!filled) {
1136    discard;
1137  } else {
1138    gl_FragColor = vFillColor;
1139  }
1140
1141  gl_FragColor.a *= inCircle;
1142  DECKGL_FILTER_COLOR(gl_FragColor, geometry);
1143}
1144`,va=[0,0,0,255],_v={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:n=>n.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:va},getLineColor:{type:"accessor",value:va},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class cl extends wn{getShaders(){return super.getShaders({vs:pv,fs:mv,modules:[Vc,jc]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var e;const{gl:i}=this.context;(e=this.state.model)===null||e===void 0||e.delete(),this.state.model=this._getModel(i),this.getAttributeManager().invalidateAll()}}draw({uniforms:t}
1144){const{radiusUnits:e,radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,stroked:o,filled:a,billboard:c,antialiasing:l,lineWidthUnits:u,lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:_}=this.props;this.state.model.setUniforms(t).setUniforms({stroked:o?1:0,filled:a,billboard:c,antialiasing:l,radiusUnits:an[e],radiusScale:i,radiusMinPixels:r,radiusMaxPixels:s,lineWidthUnits:an[u],lineWidthScale:d,lineWidthMinPixels:p,lineWidthMaxPixels:_}).draw()}_getModel(t){const e=[-1,-1,0,1,-1,0,1,1,0,-1,1,0];return new Kr(t,{...this.getShaders(),id:this.props.id,geometry:new Ac({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}f(cl,"defaultProps",_v);f(cl,"layerName","ScatterplotLayer");export{al as A,hv as D,Gc as M,cl as S};
1145//# sourceMappingURL=deck-gl-Ce2nZgZd.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.