1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="0a4d9de2-eb28-b68f-12fa-a8835959407e")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,449852,e=>{"use strict";var t=e.i(908391);let r={};e.s(["default",0,function(e,i,n,s){t.default.level>0&&r[e]&&r[e].call(null,i,n,s)},"register",0,function(e){r=e}])},642358,908391,662912,335537,e=>{"use strict";var t,r,i,n,s,o;let a=new(e.i(422291)).Log({id:"deck"});e.s(["default",0,a],908391),(n=t||(t={}))[n.Start=1]="Start",n[n.Move=2]="Move",n[n.End=4]="End",n[n.Cancel=8]="Cancel",(s=r||(r={}))[s.None=0]="None",s[s.Left=1]="Left",s[s.Right=2]="Right",s[s.Up=4]="Up",s[s.Down=8]="Down",s[s.Horizontal=3]="Horizontal",s[s.Vertical=12]="Vertical",s[s.All=15]="All",(o=i||(i={}))[o.Possible=1]="Possible",o[o.Began=2]="Began",o[o.Changed=4]="Changed",o[o.Ended=8]="Ended",o[o.Recognized=8]="Recognized",o[o.Cancelled=16]="Cancelled",o[o.Failed=32]="Failed";let l="manipulation",c="none",u="pan-x",h="pan-y";class f{constructor(e,t){this.actions="",this.manager=e,this.set(t)}set(e){"compute"===e&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(let t of this.manager.recognizers)t.options.enable&&(e=e.concat(t.getTouchAction()));var t=e.join(" ");if(t.includes(c))return c;let r=t.includes(u),i=t.includes(h);return r&&i?c:r||i?r?u:h:t.includes(l)?l:"auto"}}function _(e){return e.trim().split(/\s+/g)}function d(e,t,r){if(e)for(let i of _(t))e.addEventListener(i,r,!1)}function E(e,t,r){if(e)for(let i of _(t))e.removeEventListener(i,r,!1)}function p(e){return(e.ownerDocument||e).defaultView}function g(e){let t=e.length;if(1===t)return{x:Math.round(e[0].clientX),y:Math.round(e[0].clientY)};let r=0,i=0,n=0;for(;n<t;)r+=e[n].clientX,i+=e[n].clientY,n++;return{x:Math.round(r/t),y:Math.round(i/t)}}function m(e){let t=[],r=0;for(;r<e.pointers.length;)t[r]={clientX:Math.round(e.pointers[r].clientX),clientY:Math.round(e.pointers[r].clientY)},r++;return{timeStamp:Date.now(),pointers:t,center:g(t),deltaX:e.deltaX,deltaY:e.deltaY}}function T(e,t){let r=t.x-e.x,i=t.y-e.y;return Math.sqrt(r*r+i*i)}function A(e,t){let r=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(r*r+i*i)}function R(e,t){let r=t.clientX-e.clientX;return 180*Math.atan2(t.clientY-e.clientY,r)/Math.PI}function b(e,t){return e===t?r.None:Math.abs(e)>=Math.abs(t)?e<0?r.Left:r.Right:t<0?r.Up:r.Down}function S(e,t,r){return{x:t/e||0,y:r/e||0}}class M{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=e=>{this.manager.options.enable&&this.handler(e)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,r){var i;let n,s,o,a,l;i=this.manager,n=r.pointers.length,s=r.changedPointers.length,o=e&t.Start&&n-s==0,a=e&(t.End|t.Cancel)&&n-s==0,r.isFirst=!!o,r.isFinal=!!a,o&&(i.session={}),r.eventType=e,l=function(e,r){var i,n;let s,o,a,l,c,{session:u}=e,{pointers:h}=r,{length:f}=h;u.firstInput||(u.firstInput=m(r)),f>1&&!u.firstMultiple?u.firstMultiple=m(r):1===f&&(u.firstMultiple=!1);let{firstInput:_,firstMultiple:d}=u,E=d?d.center:_.center,p=r.center=g(h);r.timeStamp=Date.now(),r.deltaTime=r.timeStamp-_.timeStamp,s=p.x-E.x,r.angle=180*Math.atan2(p.y-E.y,s)/Math.PI,r.distance=T(E,p);let{deltaX:M,deltaY:C}=(o=r.center,a=u.offsetDelta,l=u.prevDelta,c=u.prevInput,(r.eventType===t.Start||c?.eventType===t.End)&&(l=u.prevDelta={x:c?.deltaX||0,y:c?.deltaY||0},a=u.offsetDelta={x:o.x,y:o.y}),{deltaX:l.x+(o.x-a.x),deltaY:l.y+(o.y-a.y)});r.deltaX=M,r.deltaY=C,r.offsetDirection=b(r.deltaX,r.deltaY);let O=S(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=O.x,r.overallVelocityY=O.y,r.overallVelocity=Math.abs(O.x)>Math.abs(O.y)?O.x:O.y,r.scale=d?(i=d.pointers,A(h[0],h[1])/A(i[0],i[1])):1,r.rotation=d?(n=d.pointers,R(h[1],h[0])-R(n[1],n[0])):0,r.maxPointers=u.prevInput?r.pointers.length>u.prevInput.maxPointers?r.pointers.length:u.prevInput.maxPointers:r.pointers.length;let v=e.element;return function(e,t){let r=e;for(;r;){if(r===t)return!0;r=r.parentNode}return!1}(r.srcEvent.target,v)&&(v=r.srcEvent.target),r.target=v,!function(e,r){let i,n,s,o,a=e.lastInterval||r,l=r.timeStamp-a.timeStamp;if(r.eventType!==t.Cancel&&(l>25||void 0===a.velocity)){let t=r.deltaX-a.deltaX,c=r.deltaY-a.deltaY,u=S(l,t,c);n=u.x,s=u.y,i=Math.abs(u.x)>Math.abs(u.y)?u.x:u.y,o=b(t,c),e.lastInterval=r}else i=a.velocity,n=a.velocityX,s=a.velocityY,o=a.direction;r.velocity=i,r.velocityX=n,r.velocityY=s,r.direction=o}(u,r),r}(i,r),i.emit("hammer.input",l),i.recognize(l),i.session.prevInput=l}init(){d(this.element,this.evEl,this.domHandler),d(this.target,this.evTarget,this.domHandler),d(p(this.element),this.evWin,this.domHandler)}destroy(){E(this.element,this.evEl,this.domHandler),E(this.target,this.evTarget,this.domHandler),E(p(this.element),this.evWin,this.domHandler)}}let C={pointerdown:t.Start,pointermove:t.Move,pointerup:t.End,pointercancel:t.Cancel,pointerout:t.Cancel};class O extends M{constructor(e){super(e),this.evEl="pointerdown",this.evWin="pointermove pointerup pointercancel",this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){let{store:r}=this,i=!1,n=C[e.type],s=e.pointerType,o="touch"===s,a=r.findIndex(t=>t.pointerId===e.pointerId);n&t.Start&&(e.buttons||o)?a<0&&(r.push(e),a=r.length-1):n&(t.End|t.Cancel)&&(i=!0),!(a<0)&&(r[a]=e,this.callback(n,{pointers:r,changedPointers:[e],eventType:n,pointerType:s,srcEvent:e}),i&&r.splice(a,1))}}let v=["","webkit","Moz","MS","ms","o"],N={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};class I{constructor(e,t){this.options={...N,...t,cssProps:{...N.cssProps,...t.cssProps},inputTarget:t.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new O(this),this.touchAction=new f(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?2:1}recognize(e){let t,{session:r}=this;if(r.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let{recognizers:n}=this,{curRecognizer:s}=r;(!s||s&&s.state&i.Recognized)&&(s=r.curRecognizer=null);let o=0;for(;o<n.length;)t=n[o],2!==r.stopped&&(!s||t===s||t.canRecognizeWith(s))?t.recognize(e):t.reset(),!s&&t.state&(i.Began|i.Changed|i.Ended)&&(s=r.curRecognizer=t),o++}get(e){let{recognizers:t}=this;for(let r=0;r<t.length;r++)if(t[r].options.event===e)return t[r];return null}add(e){if(Array.isArray(e)){for(let t of e)this.add(t);return this}let t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e}remove(e){if(Array.isArray(e)){for(let t of e)this.remove(t);return this}let t="string"==typeof e?this.get(e):e;if(t){let{recognizers:e}=this,r=e.indexOf(t);-1!==r&&(e.splice(r,1),this.touchAction.update())}return this}on(e,t){if(!e||!t)return;let{handlers:r}=this;for(let i of _(e))r[i]=r[i]||[],r[i].push(t)}off(e,t){if(!e)return;let{handlers:r}=this;for(let i of _(e))t?r[i]&&r[i].splice(r[i].indexOf(t),1):delete r[i]}emit(e,t){let r=this.handlers[e]&&this.handlers[e].slice();if(!r||!r.length)return;t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};let i=0;for(;i<r.length;)r[i](t),i++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(e){let{element:t}=this;if(t){for(let[r,i]of Object.entries(this.options.cssProps)){let n=function(e,t){let r=t[0].toUpperCase()+t.slice(1);for(let i of v){let n=i?i+r:t;if(n in e)return n}}(t.style,r);e?(this.oldCssProps[n]=t.style[n],t.style[n]=i):t.style[n]=this.oldCssProps[n]||""}e||(this.oldCssProps={})}}}let y=1;function L(e){return e&i.Cancelled?"cancel":e&i.Ended?"end":e&i.Changed?"move":e&i.Began?"
2start":""}class P{constructor(e){this.options=e,this.id=y++,this.state=i.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){let t;if(Array.isArray(e)){for(let t of e)this.recognizeWith(t);return this}if("string"==typeof e){if(!(t=this.manager.get(e)))throw Error(`Cannot find recognizer ${e}`)}else t=e;let{simultaneous:r}=this;return r[t.id]||(r[t.id]=t,t.recognizeWith(this)),this}dropRecognizeWith(e){let t;if(Array.isArray(e)){for(let t of e)this.dropRecognizeWith(t);return this}return(t="string"==typeof e?this.manager.get(e):e)&&delete this.simultaneous[t.id],this}requireFailure(e){let t;if(Array.isArray(e)){for(let t of e)this.requireFailure(t);return this}if("string"==typeof e){if(!(t=this.manager.get(e)))throw Error(`Cannot find recognizer ${e}`)}else t=e;let{requireFail:r}=this;return -1===r.indexOf(t)&&(r.push(t),t.requireFailure(this)),this}dropRequireFailure(e){let t;if(Array.isArray(e)){for(let t of e)this.dropRequireFailure(t);return this}if(t="string"==typeof e?this.manager.get(e):e){let e=this.requireFail.indexOf(t);e>-1&&this.requireFail.splice(e,1)}return this}hasRequireFailures(){return!!this.requireFail.find(e=>e.options.enable)}canRecognizeWith(e){return!!this.simultaneous[e.id]}emit(e){if(!e)return;let{state:t}=this;t<i.Ended&&this.manager.emit(this.options.event+L(t),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),t>=i.Ended&&this.manager.emit(this.options.event+L(t),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=i.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(i.Failed|i.Possible)))return!1;e++}return!0}recognize(e){let t={...e};if(!this.options.enable){this.reset(),this.state=i.Failed;return}this.state&(i.Recognized|i.Cancelled|i.Failed)&&(this.state=i.Possible),this.state=this.process(t),this.state&(i.Began|i.Changed|i.Ended|i.Cancelled)&&this.tryEmit(t)}getEventNames(){return[this.options.event]}reset(){}}class D extends P{attrTest(e){let t=this.options.pointers;return 0===t||e.pointers.length===t}process(e){let{state:r}=this,{eventType:n}=e,s=r&(i.Began|i.Changed),o=this.attrTest(e);return s&&(n&t.Cancel||!o)?r|i.Cancelled:s||o?n&t.End?r|i.Ended:r&i.Began?r|i.Changed:i.Began:i.Failed}}class F extends P{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[l]}process(e){let{options:r}=this,n=e.pointers.length===r.pointers,s=e.distance<r.threshold,o=e.deltaTime<r.time;if(this.reset(),e.eventType&t.Start&&0===this.count)return this.failTimeout();if(s&&o&&n){if(e.eventType!==t.End)return this.failTimeout();let n=!this.pTime||e.timeStamp-this.pTime<r.interval,s=!this.pCenter||T(this.pCenter,e.center)<r.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,s&&n?this.count+=1:this.count=1,this._input=e,0==this.count%r.taps)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=i.Recognized,this.tryEmit(this._input)},r.interval),i.Began):i.Recognized}return i.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=i.Failed},this.options.interval),i.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===i.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}}let x=["","start","move","end","cancel","up","down","left","right"];class B extends D{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:r.All,...e}),this.pX=null,this.pY=null}getTouchAction(){let{options:{direction:e}}=this,t=[];return e&r.Horizontal&&t.push(h),e&r.Vertical&&t.push(u),t}getEventNames(){return x.map(e=>this.options.event+e)}directionTest(e){let{options:t}=this,i=!0,{distance:n}=e,{direction:s}=e,o=e.deltaX,a=e.deltaY;return s&t.direction||(t.direction&r.Horizontal?(s=0===o?r.None:o<0?r.Left:r.Right,i=o!==this.pX,n=Math.abs(e.deltaX)):(s=0===a?r.None:a<0?r.Up:r.Down,i=a!==this.pY,n=Math.abs(e.deltaY))),e.direction=s,i&&n>t.threshold&&!!(s&t.direction)}attrTest(e){return super.attrTest(e)&&(!!(this.state&i.Began)||!(this.state&i.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;let t=r[e.direction].toLowerCase();t&&(e.additionalEvent=this.options.event+t),super.emit(e)}}let w=["","start","move","end","cancel","in","out"];class U{constructor(e,t,r){this.element=e,this.callback=t,this.options=r}}let G="u">typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"";"u">typeof window?window:e.g,e.g;let k=-1!==G.indexOf("firefox");class W extends U{constructor(e,t,r){super(e,t,{enable:!0,...r}),this.handleEvent=e=>{if(!this.options.enable)return;let t=e.deltaY;globalThis.WheelEvent&&(k&&e.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(t/=globalThis.devicePixelRatio),e.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(t*=40)),0!==t&&t%4.000244140625==0&&(t=Math.floor(t/4.000244140625)),e.shiftKey&&t&&(t*=.25),this.callback({type:"wheel",center:{x:e.clientX,y:e.clientY},delta:-t,srcEvent:e,pointerType:"mouse",target:e.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,t){"wheel"===e&&(this.options.enable=t)}}let j=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"];class H extends U{constructor(e,t,r){super(e,t,{enable:!0,...r}),this.handleEvent=e=>{this.handleOverEvent(e),this.handleOutEvent(e),this.handleEnterEvent(e),this.handleLeaveEvent(e),this.handleMoveEvent(e)},this.pressed=!1;const{enable:i}=this.options;this.enableMoveEvent=i,this.enableLeaveEvent=i,this.enableEnterEvent=i,this.enableOutEvent=i,this.enableOverEvent=i,j.forEac
2h(t=>e.addEventListener(t,this.handleEvent))}destroy(){j.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){switch(e){case"pointermove":this.enableMoveEvent=t;break;case"pointerover":this.enableOverEvent=t;break;case"pointerout":this.enableOutEvent=t;break;case"pointerenter":this.enableEnterEvent=t;break;case"pointerleave":this.enableLeaveEvent=t}}handleOverEvent(e){this.enableOverEvent&&"mouseover"===e.type&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&"mouseout"===e.type&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&"mouseenter"===e.type&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&"mouseleave"===e.type&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":0===e.buttons&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1}}_emit(e,t){this.callback({type:e,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})}}let X=["keydown","keyup"];class V extends U{constructor(e,t,r){super(e,t,{enable:!0,tabIndex:0,...r}),this.handleEvent=e=>{let t=e.target||e.srcElement;("INPUT"!==t.tagName||"text"!==t.type)&&"TEXTAREA"!==t.tagName&&(this.enableDownEvent&&"keydown"===e.type&&this.callback({type:"keydown",srcEvent:e,key:e.key,target:e.target}),this.enableUpEvent&&"keyup"===e.type&&this.callback({type:"keyup",srcEvent:e,key:e.key,target:e.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",X.forEach(t=>e.addEventListener(t,this.handleEvent))}
2destroy(){X.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,t){"keydown"===e&&(this.enableDownEvent=t),"keyup"===e&&(this.enableUpEvent=t)}}class z extends U{constructor(e,t,r){super(e,t,r),this.handleEvent=e=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:e.clientX,y:e.clientY},srcEvent:e,pointerType:"mouse",target:e.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,t){"contextmenu"===e&&(this.options.enable=t)}}let Y={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4},$={srcElement:"root",priority:0};class K{constructor(e,t){this.handleEvent=e=>{if(this.isEmpty())return;let t=this._normalizeEvent(e),r=e.srcEvent.target;for(;r&&r!==t.rootElement;){if(this._emit(t,r),t.handled)return;r=r.parentNode}this._emit(t,"root")},this.eventManager=e,this.recognizerName=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,t,r,i=!1,n=!1){let{handlers:s,handlersByElement:o}=this,a={...$,...r},l=o.get(a.srcElement);l||(l=[],o.set(a.srcElement,l));let c={type:e,handler:t,srcElement:a.srcElement,priority:a.priority};i&&(c.once=!0),n&&(c.passive=!0),s.push(c),this._active=this._active||!c.passive;let u=l.length-1;for(;u>=0&&!(l[u].priority>=c.priority);)u--;l.splice(u+1,0,c)}remove(e,t){let{handlers:r,handlersByElement:i}=this;for(let n=r.length-1;n>=0;n--){let s=r[n];if(s.type===e&&s.handler===t){r.splice(n,1);let e=i.get(s.srcElement);e.splice(e.indexOf(s),1),0===e.length&&i.delete(s.srcElement)}}this._active=r.some(e=>!e.passive)}_emit(e,t){let r=this.handlersByElement.get(t);if(r){let t=!1,i=()=>{e.handled=!0},n=()=>{e.handled=!0,t=!0},s=[];for(let o=0;o<r.length;o++){let{type:a,handler:l,once:c}=r[o];if(l({...e,type:a,stopPropagation:i,stopImmediatePropagation:n}),c&&s.push(r[o]),t)break}for(let e=0;e<s.length;e++){let{type:t,handler:r}=s[e];this.remove(t,r)}}}_normalizeEvent(e){let t=this.eventManager.getElement();return{...e,...function(e){let t=Y[e.srcEvent.type];if(!t)return null;let{buttons:r,button:i}=e.srcEvent,n=!1,s=!1,o=!1;return 2===t?(n=!!(1&r),s=!!(4&r),o=!!(2&r)):(n=0===i,s=1===i,o=2===i),{leftButton:n,middleButton:s,rightButton:o}}(e),...function(e,t){let r=e.center;if(!r)return null;let i=t.getBoundingClientRect(),n=i.width/t.offsetWidth||1,s=i.height/t.offsetHeight||1,o={x:(r.x-i.left-t.clientLeft)/n,y:(r.y-i.top-t.clientTop)/s};return{center:r,offsetCenter:o}}(e,t),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:t}}}e.s(["EventManager",0,class{constructor(e=null,t={}){if(this._onBasicInput=e=>{this.manager.emit(e.srcEvent.type,e)},this._onOtherEvent=e=>{this.manager.emit(e.type,e)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...t},this.events=new Map,this.element=e,!e)return;for(const t of(this.manager=new I(e,this.options),this.options.recognizers)){const{recognizer:e,recognizeWith:r,requireFailure:i}=function(e){let t;if("recognizer"in e)return e;let r=Array.isArray(e)?[...e]:[e];return{recognizer:t="function"==typeof r[0]?new(r.shift())(r.shift()||{}):r.shift(),recognizeWith:"string"==typeof r[0]?[r[0]]:r[0],requireFailure:"string"==typeof r[1]?[r[1]]:r[1]}}(t);this.manager.add(e),r&&e.recognizeWith(r),i&&e.requireFailure(i)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new W(e,this._onOtherEvent,{enable:!1}),this.moveInput=new H(e,this._onOtherEvent,{enable:!1}),this.keyInput=new V(e,this._onOtherEvent,{enable:!1,tabIndex:t.tabIndex}),this.contextmenuInput=new z(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,t,r){this._addEventHandler(e,t,r,!1)}once(e,t,r){this._addEventHandler(e,t,r,!0)}watch(e,t,r){this._addEventHandler(e,t,r,!1,!0)}off(e,t){this._removeEventHandler(e,t)}_toggleRecognizer(e,t){let{manager:r}=this;if(!r)return;let i=r.get(e);i&&(i.set({enable:t}),r.touchAction.update()),this.wheelInput?.enableEventType(e,t),this.moveInput?.enableEventType(e,t),this.keyInput?.enableEventType(e,t),this.contextmenuInput?.enableEventType(e,t)}_addEventHandler(e,t,r,i,n){if("string"!=typeof e){for(let[s,o]of(r=t,Object.entries(e)))this._addEventHandler(s,o,r,i,n);return}let{manager:s,events:o}=this;if(!s)return;let a=o.get(e);!a&&(a=new K(this,this._getRecognizerName(e)||e),o.set(e,a),s&&s.on(e,a.handleEvent)),a.add(e,t,r,i,n),a.isEmpty()||this._toggleRecognizer(a.recognizerName,!0)}_removeEventHandler(e,t){if("string"!=typeof e){for(let[t,r]of Object.entries(e))this._removeEventHandler(t,r);return}let{events:r}=this,i=r.get(e);if(i&&(i.remove(e,t),i.isEmpty())){let{recognizerName:e}=i,t=!1;for(let i of r.values())if(i.recognizerName===e&&!i.isEmpty()){t=!0;break}t||this._toggleRecognizer(e,!1)}}_getRecognizerName(e){return this.manager.recognizers.find(t=>t.getEventNames().includes(e))?.options.event}}],662912),e.s([],335537);let q={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(q,"IDENTITY",{get:()=>(a.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});let Z={multipan:[B,{threshold:10,direction:r.Vertical,pointers:2}],pinch:[class extends D{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[c]}getEventNames(){return w.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||!!(this.state&i.Began))}emit(e){if(1!==e.scale){let t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}super.emit(e)}},{},null,["multipan"]],pan:[B,{threshold:1},["pinch"],["multipan"]],dblclick:[F,{event:"dblclick",taps:2}],click:[F,{event:"click"},null,["dblclick"]]};e.s(["COORDINATE_SYSTEM",0,q,"EVENT_HANDLERS",0,{click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},"PROJECTION_MODE",0,{WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0}
2,"RECOGNIZERS",0,Z,"UNIT",0,{common:0,meters:1,pixels:2}],642358)},915674,e=>{"use strict";let t=Symbol.for("component"),r=Symbol.for("propTypes"),i=Symbol.for("deprecatedProps"),n=Symbol.for("asyncPropDefaults"),s=Symbol.for("asyncPropOriginal"),o=Symbol.for("asyncPropResolved");e.s(["ASYNC_DEFAULTS_SYMBOL",0,n,"ASYNC_ORIGINAL_SYMBOL",0,s,"ASYNC_RESOLVED_SYMBOL",0,o,"COMPONENT_SYMBOL",0,t,"DEPRECATED_PROPS_SYMBOL",0,i,"LIFECYCLE",0,{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"},"PROP_TYPES_SYMBOL",0,r])},733934,e=>{"use strict";let t=`\ 3const SMOOTH_EDGE_RADIUS: f32 = 0.5; 4 5struct VertexGeometry { 6 position: vec4<f32>, 7 worldPosition: vec3<f32>, 8 worldPositionAlt: vec3<f32>, 9 normal: vec3<f32>, 10 uv: vec2<f32>, 11 pickingColor: vec3<f32>, 12}; 13 14var<private> geometry_: VertexGeometry = VertexGeometry( 15 vec4<f32>(0.0, 0.0, 1.0, 0.0), 16 vec3<f32>(0.0, 0.0, 0.0), 17 vec3<f32>(0.0, 0.0, 0.0), 18 vec3<f32>(0.0, 0.0, 0.0), 19 vec2<f32>(0.0, 0.0), 20 vec3<f32>(0.0, 0.0, 0.0) 21); 22 23struct FragmentGeometry { 24 uv: vec2<f32>, 25}; 26 27var<private> fragmentGeometry: FragmentGeometry; 28 29fn smoothedge(edge: f32, x: f32) -> f32 { 30 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 31} 32`,r="#define SMOOTH_EDGE_RADIUS 0.5",i=`\ 33${r} 34 35struct VertexGeometry { 36 vec4 position; 37 vec3 worldPosition; 38 vec3 worldPositionAlt; 39 vec3 normal; 40 vec2 uv; 41 vec3 pickingColor; 42} geometry = VertexGeometry( 43 vec4(0.0, 0.0, 1.0, 0.0), 44 vec3(0.0), 45 vec3(0.0), 46 vec3(0.0), 47 vec2(0.0), 48 vec3(0.0) 49); 50`,n=`\ 51${r} 52 53struct FragmentGeometry { 54 vec2 uv; 55} geometry; 56 57float smoothedge(float edge, float x) { 58 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 59} 60`;e.s(["default",0,{name:"geometry",source:t,vs:i,fs:n}])},131503,e=>{"use strict";let t={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useFloatColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useFloatColors:!0,highlightedObjectColor:[0,0,0],highlightColor:[0,1,1,1]},vs:`\ 61uniform pickingUniforms { 62 float isActive; 63 float isAttribute; 64 float isHighlightActive; 65 float useFloatColors; 66 vec3 highlightedObjectColor; 67 vec4 highlightColor; 68} picking; 69 70out vec4 picking_vRGBcolor_Avalid; 71 72// Normalize unsigned byte color to 0-1 range 73vec3 picking_normalizeColor(vec3 color) { 74 return picking.useFloatColors > 0.5 ? color : color / 255.0; 75} 76 77// Normalize unsigned byte color to 0-1 range 78vec4 picking_normalizeColor(vec4 color) { 79 return picking.useFloatColors > 0.5 ? color : color / 255.0; 80} 81 82bool picking_isColorZero(vec3 color) { 83 return dot(color, vec3(1.0)) < 0.00001; 84} 85 86bool picking_isColorValid(vec3 color) { 87 return dot(color, vec3(1.0)) > 0.00001; 88} 89 90// Check if this vertex is highlighted 91bool isVertexHighlighted(vec3 vertexColor) { 92 vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 93 return 94 bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); 95} 96 97// Set the current picking color 98void picking_setPickingColor(vec3 pickingColor) { 99 pickingColor = picking_normalizeColor(pickingColor); 100 101 if (bool(picking.isActive)) { 102 // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable 103 picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); 104 105 if (!bool(picking.isAttribute)) { 106 // Stores the picking color so that the fragment shader can render it during picking 107 picking_vRGBcolor_Avalid.rgb = pickingColor; 108 } 109 } else { 110 // Do the comparison with selected item color in vertex shader as it should mean fewer compares 111 picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); 112 } 113} 114 115void picking_setPickingAttribute(float value) { 116 if (bool(picking.isAttribute)) {
117 picking_vRGBcolor_Avalid.r = value; 118 } 119} 120 121void picking_setPickingAttribute(vec2 value) { 122 if (bool(picking.isAttribute)) { 123 picking_vRGBcolor_Avalid.rg = value; 124 } 125} 126 127void picking_setPickingAttribute(vec3 value) { 128 if (bool(picking.isAttribute)) { 129 picking_vRGBcolor_Avalid.rgb = value; 130 } 131} 132`,fs:`\ 133uniform pickingUniforms { 134 float isActive; 135 float isAttribute; 136 float isHighlightActive; 137 float useFloatColors; 138 vec3 highlightedObjectColor; 139 vec4 highlightColor; 140} picking; 141 142in vec4 picking_vRGBcolor_Avalid; 143 144/* 145 * Returns highlight color if this item is selected. 146 */ 147vec4 picking_filterHighlightColor(vec4 color) { 148 // If we are still picking, we don't highlight 149 if (picking.isActive > 0.5) { 150 return color; 151 } 152 153 bool selected = bool(picking_vRGBcolor_Avalid.a); 154 155 if (selected) { 156 // Blend in highlight color based on its alpha value 157 float highLightAlpha = picking.highlightColor.a; 158 float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); 159 float highLightRatio = highLightAlpha / blendedAlpha; 160 161 vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); 162 return vec4(blendedRGB, blendedAlpha); 163 } else { 164 return color; 165 } 166} 167 168/* 169 * Returns picking color if picking enabled else unmodified argument. 170 */ 171vec4 picking_filterPickingColor(vec4 color) { 172 if (bool(picking.isActive)) { 173 if (picking_vRGBcolor_Avalid.a == 0.0) { 174 discard; 175 } 176 return picking_vRGBcolor_Avalid; 177 } 178 return color; 179} 180 181/* 182 * Returns picking color if picking is enabled if not 183 * highlight color if this item is selected, otherwise unmodified argument. 184 */ 185vec4 picking_filterColor(vec4 color) { 186 vec4 highlightColor = picking_filterHighlightColor(color); 187 return picking_filterPickingColor(highlightColor); 188} 189`,getUniforms:function(e={},t){let r={};if(void 0===e.highlightedObjectColor||(null===e.highlightedObjectColor?r.isHighlightActive=!1:(r.isHighlightActive=!0,r.highlightedObjectColor=e.highlightedObjectColor.slice(0,3))),e.highlightColor){let t=Array.from(e.highlightColor,e=>e/255);Number.isFinite(t[3])||(t[3]=1),r.highlightColor=t}return void 0!==e.isActive&&(r.isActive=!!e.isActive,r.isAttribute=!!e.isAttribute),void 0!==e.useFloatColors&&(r.useFloatColors=!!e.useFloatColors),r}},r={...t,defaultUniforms:{...t.defaultUniforms,useFloatColors:!1},inject:{"vs:DECKGL_FILTER_GL_POSITION":` 190 // for picking depth values 191 picking_setPickingAttribute(position.z / position.w); 192 `,"vs:DECKGL_FILTER_COLOR":` 193 picking_setPickingColor(geometry.pickingColor); 194 `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` 195 // use highlight color if this fragment belongs to the selected object. 196 color = picking_filterHighlightColor(color); 197 198 // use picking color if rendering to picking FBO. 199 color = picking_filterPickingColor(color); 200 `}}};e.s(["default",0,r],131503)},159505,e=>{"use strict";var t=e.i(313768),r=e.i(483890),i=e.i(642358),n=e.i(577665);let s=[0,0,0,0],o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],l=[0,0,0],c=[0,0,0],u=(0,n.default)(function({viewport:e,devicePixelRatio:n,coordinateSystem:c,coordinateOrigin:u}){let{projectionCenter:f,viewProjectionMatrix:_,originCommon:d,cameraPosCommon:E,shaderCoordinateOrigin:p,geospatialOrigin:g}=function(e,i,n){let{viewMatrixUncentered:a,projectionMatrix:l}=e,{viewMatrix:c,viewProjectionMatrix:u}=e,f=s,_=s,d=e.cameraPosition,{geospatialOrigin:E,shaderCoordinateOrigin:p,offsetMode:g}=h(e,i,n);return g&&(_=e.projectPosition(E||p),d=[d[0]-_[0],d[1]-_[1],d[2]-_[2]],_[3]=1,f=r.vec4.transformMat4([],_,u),c=a||c,u=t.mat4.multiply([],l,c),u=t.mat4.multiply([],u,o)),{viewMatrix:c,viewProjectionMatrix:u,projectionCenter:f,originCommon:_,cameraPosCommon:d,shaderCoordinateOrigin:p,geospatialOrigin:E}}(e,c,u),m=e.getDistanceScales(),T=[e.width*n,e.height*n],A=r.vec4.transformMat4([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,R={coordinateSystem:c,projectionMode:e.projectionMode,coordinateOrigin:p,commonOrigin:d.slice(0,3),center:f,pseudoMeters:!!e._pseudoMeters,viewportSize:T,devicePixelRatio:n,focalDistance:A,commonUnitsPerMeter:m.unitsPerMeter,commonUnitsPerWorldUnit:m.unitsPerMeter,commonUnitsPerWorldUnit2:l,scale:e.scale,wrapLongitude:!1,viewProjectionMatrix:_,modelMatrix:a,cameraPosition:E};if(g){let t=e.getDistanceScales(g);switch(c){case i.COORDINATE_SYSTEM.METER_OFFSETS:R.commonUnitsPerWorldUnit=t.unitsPerMeter,R.commonUnitsPerWorldUnit2=t.unitsPerMeter2;break;case i.COORDINATE_SYSTEM.LNGLAT:case i.COORDINATE_SYSTEM.LNGLAT_OFFSETS:e._pseudoMeters||(R.commonUnitsPerMeter=t.unitsPerMeter),R.commonUnitsPerWorldUnit=t.unitsPerDegree,R.commonUnitsPerWorldUnit2=t.unitsPerDegree2;break;case i.COORDINATE_SYSTEM.CARTESIAN:R.commonUnitsPerWorldUnit=[1,1,t.unitsPerMeter[2]],R.commonUnitsPerWorldUnit2=[0,0,t.unitsPerMeter2[2]]}}return R});function h(e,t,r=c){let n;r.length<3&&(r=[r[0],r[1],0]);let s=r,o=!0;switch(n=t===i.COORDINATE_SYSTEM.LNGLAT_OFFSETS||t===i.COORDINATE_SYSTEM.METER_OFFSETS?r:e.isGeospatial?[Math.fround(e.longitude),Math.fround(e.latitude),0]:null,e.projectionMode){case i.PROJECTION_MODE.WEB_MERCATOR:(t===i.COORDINATE_SYSTEM.LNGLAT||t===i.COORDINATE_SYSTEM.CARTESIAN)&&(n=[0,0,0],o=!1);break;case i.PROJECTION_MODE.WEB_MERCATOR_AUTO_OFFSET:t===i.COORDINATE_SYSTEM.LNGLAT?s=n:t===i.COORDINATE_SYSTEM.CARTESIAN&&(s=[Math.fround(e.center[0]),Math.fround(e.center[1]),0],n=e.unprojectPosition(s),s[0]-=r[0],s[1]-=r[1],s[2]-=r[2]);break;case i.PROJECTION_MODE.IDENTITY:(s=e.position.map(Math.fround))[2]=s[2]||0;break;case i.PROJECTION_MODE.GLOBE:o=!1,n=null;break;default:o=!1}return{geospatialOrigin:n,shaderCoordinateOrigin:s,offsetMode:o}}e.s(["getOffsetOrigin",0,h,"getUniformsFromViewport",0,function({viewport:e,devicePixelRatio:t=1,modelMatrix:r=null,coordinateSystem:n=i.COORDINATE_SYSTEM.DEFAULT,coordinateOrigin:s=c,autoWrapLongitude:o=!1}){n===i.COORDINATE_SYSTEM.DEFAULT&&(n=e.isGeospatial?i.COORDINATE_SYSTEM.LNGLAT:i.COORDINATE_SYSTEM.CARTESIAN);let l=u({viewport:e,devicePixelRatio:t,coordinateSystem:n,coordinateOrigin:s});return l.wrapLongitude=o,l.modelMatrix=r||a,l}])},797163,177870,e=>{"use strict";var t=e.i(834487),r=e.i(733934),i=e.i(159505),n=e.i(642358);let s=Object.keys(n.COORDINATE_SYSTEM).map(e=>`const COORDINATE_SYSTEM_${e}
200: i32 = ${n.COORDINATE_SYSTEM[e]};`).join(""),o=Object.keys(n.PROJECTION_MODE).map(e=>`const PROJECTION_MODE_${e}: i32 = ${n.PROJECTION_MODE[e]};`).join(""),a=Object.keys(n.UNIT).map(e=>`const UNIT_${e.toUpperCase()}: i32 = ${n.UNIT[e]};`).join(""),l=`\ 201${s} 202${o} 203${a} 204 205const TILE_SIZE: f32 = 512.0; 206const PI: f32 = 3.1415926536; 207const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0); 208const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); 209const EARTH_RADIUS: f32 = 6370972.0; // meters 210const GLOBE_RADIUS: f32 = 256.0; 211 212// ----------------------------------------------------------------------------- 213// Uniform block (converted from GLSL uniform block) 214// ----------------------------------------------------------------------------- 215struct ProjectUniforms { 216 wrapLongitude: i32, 217 coordinateSystem: i32, 218 commonUnitsPerMeter: vec3<f32>, 219 projectionMode: i32, 220 scale: f32, 221 commonUnitsPerWorldUnit: vec3<f32>, 222 commonUnitsPerWorldUnit2: vec3<f32>, 223 center: vec4<f32>, 224 modelMatrix: mat4x4<f32>, 225 viewProjectionMatrix: mat4x4<f32>, 226 viewportSize: vec2<f32>, 227 devicePixelRatio: f32, 228 focalDistance: f32, 229 cameraPosition: vec3<f32>, 230 coordinateOrigin: vec3<f32>, 231 commonOrigin: vec3<f32>, 232 pseudoMeters: i32, 233}; 234 235@group(0) @binding(0) 236var<uniform> project: ProjectUniforms; 237 238// ----------------------------------------------------------------------------- 239// Geometry data 240// (In your GLSL code, "geometry" was assumed to be available globally. In WGSL, 241// you might supply this via vertex attributes or a uniform. Here we define a 242// uniform struct for demonstration.) 243// ----------------------------------------------------------------------------- 244 245// Structure to carry additional geometry data used by deck.gl filters. 246struct Geometry { 247 worldPosition: vec3<f32>, 248 worldPositionAlt: vec3<f32>, 249 position: vec4<f32>, 250 uv: vec2<f32>, 251 pickingColor: vec3<f32>, 252}; 253 254// @group(0) @binding(1) 255var<private> geometry: Geometry; 256`,c=`\ 257${l} 258 259// ----------------------------------------------------------------------------- 260// Functions 261// ----------------------------------------------------------------------------- 262 263// Returns an adjustment factor for commonUnitsPerMeter 264fn _project_size_at_latitude(lat: f32) -> f32 { 265 let y = clamp(lat, -89.9, 89.9); 266 return 1.0 / cos(radians(y)); 267} 268 269// Overloaded version: scales a value in meters at a given latitude. 270fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 { 271 return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat); 272} 273 274// Computes a non-linear scale factor based on geometry. 275// (Note: This function relies on "geometry" being provided.) 276fn project_size() -> f32 { 277 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 278 project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 279 project.pseudoMeters == 0) { 280 if (geometry.position.w == 0.0) { 281 return _project_size_at_latitude(geometry.worldPosition.y); 282 } 283 let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 284 let y2 = y * y; 285 let y4 = y2 * y2; 286 let y6 = y4 * y2; 287 return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 288 } 289 return 1.0; 290} 291 292// Overloads to scale offsets (meters to world units) 293fn project_size_float(meters: f32) -> f32 { 294 return meters * project.commonUnitsPerMeter.z * project_size(); 295} 296 297fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> { 298 return meters * project.commonUnitsPerMeter.xy * project_size(); 299} 300 301fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> { 302 return meters * project.commonUnitsPerMeter * project_size(); 303} 304 305fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> { 306 return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w); 307} 308 309// Returns a rotation matrix aligning the z‑axis with the given up vector. 310fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> { 311 let uz = normalize(up); 312 let ux = select( 313 vec3<f32>(1.0, 0.0, 0.0), 314 normalize(vec3<f32>(uz.y, -uz.x, 0.0)), 315 abs(uz.z) == 1.0 316 ); 317 let uy = cross(uz, ux); 318 return mat3x3<f32>(ux, uy, uz); 319} 320 321// Since WGSL does not support "out" parameters, we return a struct. 322struct RotationResult { 323 needsRotation: bool, 324 transform: mat3x3<f32>, 325}; 326 327fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult { 328 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 329 return RotationResult(true, project_get_orientation_matrix(commonPosition)); 330 } else { 331 return RotationResult(false, mat3x3<f32>()); // identity alternative if needed 332 }; 333} 334 335// Projects a normal vector from the current coordinate system to world space. 336fn project_normal(vector: vec3<f32>) -> vec3<f32> { 337 let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0); 338 var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 339 let rotResult = project_needs_rotation(geometry.position.xyz); 340 if (rotResult.needsRotation) { 341 n = rotResult.transform * n; 342 } 343 return n; 344} 345 346// Applies a scale offset based on y-offset (dy) 347fn project_offset_(offset: vec4<f32>) -> vec4<f32> { 348 let dy: f32 = offset.y; 349 let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 350 return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w); 351} 352 353// Projects lng/lat coordinates to a unit tile [0,1] 354fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> { 355 var x = lnglat.x; 356 if (project.wrapLongitude != 0) { 357 x = ((x + 180.0) % 360.0) - 180.0; 358 } 359 let y = clamp(lnglat.y, -89.9, 89.9); 360 return vec2<f32>( 361 radians(x) + PI, 362 PI + log(tan(PI * 0.25 + radians(y) * 0.5)) 363 ) * WORLD_SCALE; 364} 365 366// Projects lng/lat/z coordinates for a globe projection. 367fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> { 368 let lambda = radians(lnglatz.x); 369 let phi = radians(lnglatz.y); 370 let cosPhi = cos(phi); 371 let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 372 return vec3<f32>( 373 sin(lambda) * cosPhi, 374 -cos(lambda) * cosPhi, 375 sin(phi) 376 ) * D; 377} 378 379// Projects positions (with an optional 64-bit low part) from the input 380// coordinate system to the common space. 381fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> { 382 var position_world = project.modelMatrix * position; 383 384 // Work around for a Mac+NVIDIA bug: 385 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 386 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 387 return vec4<f32>( 388 project_mercator_(position_world.xy), 389 _project_size_at_latitude_m(position_world.z, position_world.y), 390 position_world.w 391 ); 392 } 393 if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
394 position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w); 395 } 396 } 397 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 398 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 399 return vec4<f32>( 400 project_globe_(position_world.xyz), 401 position_world.w 402 ); 403 } 404 } 405 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 406 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 407 if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 408 return vec4<f32>( 409 project_mercator_(position_world.xy) - project.commonOrigin.xy, 410 project_size_float(position_world.z), 411 position_world.w 412 ); 413 } 414 } 415 } 416 if (project.projectionMode == PROJECTION_MODE_IDENTITY || 417 (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 418 (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 419 project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 420 position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w); 421 } 422 423 return project_offset_(position_world) + 424 project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0)); 425} 426 427// Overloaded versions for different input types. 428fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> { 429 return project_position_vec4_f64(position, ZERO_64_LOW); 430} 431 432fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> { 433 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low); 434 return projected_position.xyz; 435} 436 437fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> { 438 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW); 439 return projected_position.xyz; 440} 441 442fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> { 443 let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW); 444 return projected_position.xy; 445} 446 447// Transforms a common space position to clip space. 448fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> { 449 return viewProjectionMatrix * position + center; 450} 451 452// Uses the project viewProjectionMatrix and center. 453fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> { 454 return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center); 455} 456 457// Returns a clip space offset corresponding to a given number of screen pixels. 458fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> { 459 let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 460 return offset * project.focalDistance; 461} 462 463fn project_meter_size_to_pixel(meters: f32) -> f32 { 464 return project_size_float(meters) * project.scale; 465} 466 467fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 { 468 if (unit == UNIT_METERS) { 469 return project_meter_size_to_pixel(size); 470 } else if (unit == UNIT_COMMON) { 471 return size * project.scale; 472 } 473 // UNIT_PIXELS: no scaling applied. 474 return size; 475} 476 477fn project_pixel_size_float(pixels: f32) -> f32 { 478 return pixels / project.scale; 479} 480 481fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> { 482 return pixels / project.scale; 483} 484`,u=Object.keys(n.COORDINATE_SYSTEM).map(e=>`const int COORDINATE_SYSTEM_${e} = ${n.COORDINATE_SYSTEM[e]};`).join(""),h=Object.keys(n.PROJECTION_MODE).map(e=>`const int PROJECTION_MODE_${e} = ${n.PROJECTION_MODE[e]};`).join(""),f=Object.keys(n.UNIT).map(e=>`const int UNIT_${e.toUpperCase()} = ${n.UNIT[e]};`).join(""),_=`\ 485${u} 486${h} 487${f} 488uniform projectUniforms { 489bool wrapLongitude; 490int coordinateSystem; 491vec3 commonUnitsPerMeter; 492int projectionMode; 493float scale; 494vec3 commonUnitsPerWorldUnit; 495vec3 commonUnitsPerWorldUnit2; 496vec4 center; 497mat4 modelMatrix; 498mat4 viewProjectionMatrix; 499vec2 viewportSize; 500float devicePixelRatio; 501float focalDistance; 502vec3 cameraPosition; 503vec3 coordinateOrigin; 504vec3 commonOrigin; 505bool pseudoMeters; 506} project; 507const float TILE_SIZE = 512.0; 508const float PI = 3.1415926536; 509const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); 510const vec3 ZERO_64_LOW = vec3(0.0); 511const float EARTH_RADIUS = 6370972.0; 512const float GLOBE_RADIUS = 256.0; 513float project_size_at_latitude(float lat) { 514float y = clamp(lat, -89.9, 89.9); 515return 1.0 / cos(radians(y)); 516} 517float project_size() { 518if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 519project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 520project.pseudoMeters == false) { 521if (geometry.position.w == 0.0) { 522return project_size_at_latitude(geometry.worldPosition.y); 523} 524float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;
525float y2 = y * y; 526float y4 = y2 * y2; 527float y6 = y4 * y2; 528return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 529} 530return 1.0; 531} 532float project_size_at_latitude(float meters, float lat) { 533return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat); 534} 535float project_size(float meters) { 536return meters * project.commonUnitsPerMeter.z * project_size(); 537} 538vec2 project_size(vec2 meters) { 539return meters * project.commonUnitsPerMeter.xy * project_size(); 540} 541vec3 project_size(vec3 meters) { 542return meters * project.commonUnitsPerMeter * project_size(); 543} 544vec4 project_size(vec4 meters) { 545return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w); 546} 547mat3 project_get_orientation_matrix(vec3 up) { 548vec3 uz = normalize(up); 549vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); 550vec3 uy = cross(uz, ux); 551return mat3(ux, uy, uz); 552} 553bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { 554if (project.projectionMode == PROJECTION_MODE_GLOBE) { 555transform = project_get_orientation_matrix(commonPosition); 556return true; 557} 558return false; 559} 560vec3 project_normal(vec3 vector) { 561vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0); 562vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 563mat3 rotation; 564if (project_needs_rotation(geometry.position.xyz, rotation)) { 565n = rotation * n; 566} 567return n; 568} 569vec4 project_offset_(vec4 offset) { 570float dy = offset.y; 571vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 572return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); 573} 574vec2 project_mercator_(vec2 lnglat) { 575float x = lnglat.x; 576if (project.wrapLongitude) {
577x = mod(x + 180., 360.0) - 180.; 578} 579float y = clamp(lnglat.y, -89.9, 89.9); 580return vec2( 581radians(x) + PI, 582PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) 583) * WORLD_SCALE; 584} 585vec3 project_globe_(vec3 lnglatz) { 586float lambda = radians(lnglatz.x); 587float phi = radians(lnglatz.y); 588float cosPhi = cos(phi); 589float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 590return vec3( 591sin(lambda) * cosPhi, 592-cos(lambda) * cosPhi, 593sin(phi) 594) * D; 595} 596vec4 project_position(vec4 position, vec3 position64Low) { 597vec4 position_world = project.modelMatrix * position; 598if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 599if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 600return vec4( 601project_mercator_(position_world.xy), 602project_size_at_latitude(position_world.z, position_world.y), 603position_world.w 604); 605} 606if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { 607position_world.xyz += project.coordinateOrigin; 608} 609} 610if (project.projectionMode == PROJECTION_MODE_GLOBE) { 611if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 612return vec4( 613project_globe_(position_world.xyz), 614position_world.w 615); 616} 617} 618if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 619if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 620if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 621return vec4( 622project_mercator_(position_world.xy) - project.commonOrigin.xy, 623project_size(position_world.z), 624position_world.w 625); 626} 627} 628} 629if (project.projectionMode == PROJECTION_MODE_IDENTITY || 630(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 631(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 632project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 633position_world.xyz -= project.coordinateOrigin; 634} 635return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0)); 636} 637vec4 project_position(vec4 position) { 638return project_position(position, ZERO_64_LOW); 639} 640vec3 project_position(vec3 position, vec3 position64Low) { 641vec4 projected_position = project_position(vec4(position, 1.0), position64Low); 642return projected_position.xyz; 643} 644vec3 project_position(vec3 position) { 645vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); 646return projected_position.xyz; 647} 648vec2 project_position(vec2 position) { 649vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); 650return projected_position.xy; 651} 652vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { 653return viewProjectionMatrix * position + center; 654} 655vec4 project_common_position_to_clipspace(vec4 position) { 656return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center); 657} 658vec2 project_pixel_size_to_clipspace(vec2 pixels) { 659vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 660return offset * project.focalDistance; 661} 662float project_size_to_pixel(float meters) { 663return project_size(meters) * project.scale; 664} 665float project_size_to_pixel(float size, int unit) { 666if (unit == UNIT_METERS) return project_size_to_pixel(size); 667if (unit == UNIT_COMMON) return size * project.scale; 668return size; 669} 670float project_pixel_size(float pixels) { 671return pixels / project.scale; 672} 673vec2 project_pixel_size(vec2 pixels) { 674return pixels / project.scale; 675} 676`,d={},E={name:"project",dependencies:[t.fp32,r.default],source:c,vs:_,getUniforms:function(e=d){return"viewport"in e?(0,i.getUniformsFromViewport)(e):{}},uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}};e.s(["default",0,E],177870);let p=`\ 677// Define a structure to hold both the clip-space position and the common position. 678struct ProjectResult { 679 clipPosition: vec4<f32>, 680 commonPosition: vec4<f32>, 681}; 682 683// This function mimics the GLSL version with the 'out' parameter by returning both values. 684fn project_position_to_clipspace_and_commonspace( 685 position: vec3<f32>, 686 position64Low: vec3<f32>, 687 offset: vec3<f32> 688) -> ProjectResult { 689 // Compute the projected position. 690 let projectedPosition: vec3<f32> = project_position_vec3_f64(position, position64Low); 691 692 // Start with the provided offset. 693 var finalOffset: vec3<f32> = offset; 694 695 // Get whether a rotation is needed and the rotation matrix. 696 let rotationResult = project_needs_rotation(projectedPosition); 697 698 // If rotation is needed, update the offset. 699 if (rotationResult.needsRotation) { 700 finalOffset = rotationResult.transform * offset; 701 } 702 703 // Compute the common position. 704 let commonPosition: vec4<f32> = vec4<f32>(projectedPosition + finalOffset, 1.0); 705 706 // Convert to clip-space. 707 let clipPosition: vec4<f32> = project_common_position_to_clipspace(commonPosition); 708 709 return ProjectResult(clipPosition, commonPosition); 710} 711 712// A convenience overload that returns only the clip-space position. 713fn project_position_to_clipspace( 714 position: vec3<f32>, 715 position64Low: vec3<f32>, 716 offset: vec3<f32> 717) -> vec4<f32> { 718 return project_position_to_clipspace_and_commonspace(position, position64Low, offset).clipPosition; 719} 720`,g=`\ 721vec4 project_position_to_clipspace( 722 vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition 723) { 724 vec3 projectedPosition = project_position(position, position64Low); 725 mat3 rotation; 726 if (project_needs_rotation(projectedPosition, rotation)) { 727 // offset is specified as ENU 728 // when in globe projection, rotate offset so that the ground alighs with the surface of the globe 729 offset = rotation * offset; 730 } 731 commonPosition = vec4(projectedPosition + offset, 1.0); 732 return project_common_position_to_clipspace(commonPosition); 733} 734 735vec4 project_position_to_clipspace( 736 vec3 position, vec3 position64Low, vec3 offset 737) { 738 vec4 commonPosition; 739 return project_position_to_clipspace(position, position64Low, offset, commonPosition); 740} 741`;
741e.s(["default",0,{name:"project32",dependencies:[E],source:p,vs:g}],797163)},264681,e=>{"use strict";e.s(["default",0,class{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){this.cancel(),this.settings=e,this._inProgress=!0,this.settings.onStart?.(this)}end(){this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,this.settings.onEnd?.(this))}cancel(){this._inProgress&&(this.settings.onInterrupt?.(this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){if(!this._inProgress)return!1;if(null===this._handle){let{_timeline:e,settings:t}=this;this._handle=e.addChannel({delay:e.getTime(),duration:t.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),this.settings.onUpdate?.(this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}])},778400,e=>{"use strict";e.s(["default",0,function(e,t){if(!e)throw Error(t||"deck.gl: assertion failed.")}])},741034,e=>{"use strict";e.s(["deepEqual",0,function e(t,r,i){if(t===r)return!0;if(!i||!t||!r)return!1;if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(!e(t[n],r[n],i-1))return!1;return!0}if(Array.isArray(r))return!1;if("object"==typeof t&&"object"==typeof r){let n=Object.keys(t),s=Object.keys(r);if(n.length!==s.length)return!1;for(let s of n)if(!r.hasOwnProperty(s)||!e(t[s],r[s],i-1))return!1;return!0}return!1}])},220693,e=>{"use strict";e.s(["fillArray",0,function({target:e,source:t,start:r=0,count:i=1}){let n=t.length,s=i*n,o=0;for(let i=r;o<n;o++)e[i++]=t[o];for(;o<s;)o<s-o?(e.copyWithin(r+o,r,r+o),o*=2):(e.copyWithin(r+o,r,r+s-o),o=s);return e},"flatten",0,function(e,t=()=>!0){return Array.isArray(e)?function e(t,r,i){let n=-1;for(;++n<t.length;){let s=t[n];Array.isArray(s)?e(s,r,i):r(s)&&i.push(s)}return i}(e,t,[]):t(e)?[e]:[]}])},227447,e=>{"use strict";var t=e.i(908391);e.s(["log",()=>t.default])},594831,e=>{"use strict";let t;var r=e.i(201475),i=e.i(969170);let n=new i.Vector3;function s(e,t,r,s){n.set(e,t,r);let o=n.len();return{distance:s/o,normal:new i.Vector3(-e/o,-t/o,-r/o)}}e.s(["createMat4",0,function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},"getCameraPosition",0,function(e){return[e[12],e[13],e[14]]},"getFrustumPlanes",0,function(e){return{left:s(e[3]+e[0],e[7]+e[4],e[11]+e[8],e[15]+e[12]),right:s(e[3]-e[0],e[7]-e[4],e[11]-e[8],e[15]-e[12]),bottom:s(e[3]+e[1],e[7]+e[5],e[11]+e[9],e[15]+e[13]),top:s(e[3]-e[1],e[7]-e[5],e[11]-e[9],e[15]-e[13]),near:s(e[3]+e[2],e[7]+e[6],e[11]+e[10],e[15]+e[14]),far:s(e[3]-e[2],e[7]-e[6],e[11]-e[10],e[15]-e[14])}},"mergeBounds",0,function(e){let t=null,r=!1;for(let i of e)i&&(t?(r||(t=[[t[0][0],t[0][1]],[t[1][0],t[1][1]]],r=!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},"mod",0,function(e,t){let r=e%t;return r<0?t+r:r},"toDoublePrecisionArray",0,function(e,i){let{size:n=1,startIndex:s=0}=i,o=void 0!==i.endIndex?i.endIndex:e.length,a=(o-s)/n;t=r.default.allocate(t,a,{type:Float32Array,size:2*n});let l=s,c=0;for(;l<o;){for(let r=0;r<n;r++){let i=e[l++];t[c+r]=i,t[c+r+n]=i-Math.fround(i)}c+=2*n}return t.subarray(0,a*n*2)}])},577665,e=>{"use strict";e.s(["default",0,function(e){let t,r={};return i=>{for(let n in i)if(!function(e,t){if(e===t)return!0;if(Array.isArray(e)){let r=e.length;if(!t||t.length!==r)return!1;for(let i=0;i<r;i++)if(e[i]!==t[i])return!1;return!0}return!1}(i[n],r[n])){t=e(i),r=i;break}return t}}])},201475,e=>{"use strict";let t=new class{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,t,{size:r=1,type:i,padding:n=0,copy:s=!1,initialize:o=!1,maxCount:a}){let l=i||e&&e.constructor||Float32Array,c=t*r+n;if(ArrayBuffer.isView(e)){if(c<=e.length)return e;if(c*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new l(e.buffer,0,c)}let u=1/0;a&&(u=a*r+n);let h=this._allocate(l,c,o,u);return e&&s?h.set(e):o||h.fill(0,0,4),this._release(e),h}release(e){this._release(e)}
741_allocate(e,t,r,i){let n=Math.max(Math.ceil(t*this.opts.overAlloc),1);n>i&&(n=i);let s=this._pool,o=e.BYTES_PER_ELEMENT*n,a=s.findIndex(e=>e.byteLength>=o);if(a>=0){let t=new e(s.splice(a,1)[0],0,n);return r&&t.fill(0),t}return new e(n)}_release(e){if(!ArrayBuffer.isView(e))return;let t=this._pool,{buffer:r}=e,{byteLength:i}=r,n=t.findIndex(e=>e.byteLength>=i);n<0?t.push(r):(n>0||t.length<this.opts.poolSize)&&t.splice(n,0,r),t.length>this.opts.poolSize&&t.shift()}};e.s(["default",0,t])},8823,e=>{"use strict";var t=e.i(908391),r=e.i(594831),i=e.i(306719),n=e.i(969170),s=e.i(514727),o=e.i(313768),a=e.i(723102),l=e.i(642358);let c=Math.PI/180,u=(0,r.createMat4)(),h=[0,0,0],f={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};class _{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||f,this.focalDistance=e.focalDistance||1,this.position=e.position||h,this.modelMatrix=e.modelMatrix||null;const{longitude:t,latitude:r}=e;this.isGeospatial=Number.isFinite(r)&&Number.isFinite(t),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?l.PROJECTION_MODE.WEB_MERCATOR:l.PROJECTION_MODE.WEB_MERCATOR_AUTO_OFFSET:l.PROJECTION_MODE.IDENTITY}equals(e){return e instanceof _&&(this===e||e.width===this.width&&e.height===this.height&&e.scale===this.scale&&(0,s.equals)(e.projectionMatrix,this.projectionMatrix)&&(0,s.equals)(e.viewMatrix,this.viewMatrix))}project(e,{topLeft:t=!0}={}){let r=this.projectPosition(e),i=(0,a.worldToPixels)(r,this.pixelProjectionMatrix),[n,s]=i,o=t?s:this.height-s;return 2===e.length?[n,o]:[n,o,i[2]]}unproject(e,{topLeft:t=!0,targetZ:r}={}){let[i,n,s]=e,o=t?n:this.height-n,l=r&&r*this.distanceScales.unitsPerMeter[2],c=(0,a.pixelsToWorld)([i,o,s],this.pixelUnprojectionMatrix,l),[u,h,f]=this.unprojectPosition(c);return Number.isFinite(s)?[u,h,f]:Number.isFinite(r)?[u,h,r]:[u,h]}projectPosition(e){let[t,r]=this.projectFlat(e);return[t,r,(e[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(e){let[t,r]=this.unprojectFlat(e);return[t,r,(e[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(e){if(this.isGeospatial){let t=(0,a.lngLatToWorld)(e);return t[1]=(0,s.clamp)(t[1],-318,830),t}return e}unprojectFlat(e){return this.isGeospatial?(0,a.worldToLngLat)(e):e}getBounds(e={}){let t={targetZ:e.z||0},r=this.unproject([0,0],t),i=this.unproject([this.width,0],t),n=this.unproject([0,this.height],t),s=this.unproject([this.width,this.height],t);return[Math.min(r[0],i[0],n[0],s[0]),Math.min(r[1],i[1],n[1],s[1]),Math.max(r[0],i[0],n[0],s[0]),Math.max(r[1],i[1],n[1],s[1])]}getDistanceScales(e){return e&&this.isGeospatial?(0,a.getDistanceScales)({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:t,width:r=1,height:i=1}){return e<this.x+this.width&&this.x<e+r&&t<this.y+this.height&&this.y<t+i}getFrustumPlanes(){return this._frustumPlanes.near||Object.assign(this._frustumPlanes,(0,r.getFrustumPlanes)(this.viewProjectionMatrix)),this._frustumPlanes}panByPosition(e,t){return null}_initProps(e){let t=e.longitude,r=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=(0,a.getMeterZoom)({latitude:r})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||(0,a.getDistanceScales)({latitude:r,longitude:t}));let s=Math.pow(2,this.zoom);this.scale=s;let{position:o,modelMatrix:l}=e,c=h;if(o&&(c=l?new i.Matrix4(l).transformAsVector(o,[]):o),this.isGeospatial){let e=this.projectPosition([t,r,0]);this.center=new n.Vector3(c).scale(this.distanceScales.unitsPerMeter).add(e)}else this.center=this.projectPosition(c)}_initMatrices(e){let{viewMatrix:a=u,projectionMatrix:l=null,orthographic:h=!1,fovyRadians:f,fovy:_=75,near:d=.1,far:E=1e3,padding:p=null,focalDistance:g=1}=e;this.viewMatrixUncentered=a,this.viewMatrix=new i.Matrix4().multiplyRight(a).translate(new n.Vector3(this.center).negate()),this.projectionMatrix=l||function({width:e,height:t,orthographic:r,fovyRadians:n,focalDistance:o,padding:a,near:l,far:c}){let u=e/t,h=r?new i.Matrix4().orthographic({fovy:n,aspect:u,focalDistance:o,near:l,far:c}):new i.Matrix4().perspective({fovy:n,aspect:u,near:l,far:c});if(a){let{left:r=0,right:i=0,top:n=0,bottom:o=0}=a,l=(0,s.clamp)((r+e-i)/2,0,e)-e/2,c=(0,s.clamp)((n+t-o)/2,0,t)-t/2;h[8]-=2*l/e,h[9]+=2*c/t}return h}({width:this.width,height:this.height,orthographic:h,fovyRadians:f||_*c,focalDistance:g,padding:p,near:d,far:E});let m=(0,r.createMat4)();o.mat4.multiply(m,m,this.projectionMatrix),o.mat4.multiply(m,m,this.viewMatrix),this.viewProjectionMatrix=m,this.viewMatrixInverse=o.mat4.invert([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=(0,r.getCameraPosition)(this.viewMatrixInverse);let T=(0,r.createMat4)(),A=(0,r.createMat4)();o.mat4.scale(T,T,[this.width/2,-this.height/2,1]),o.mat4.translate(T,T,[1,-1,0]),o.mat4.multiply(A,T,this.viewProjectionMatrix),this.pixelProjectionMatrix=A,this.pixelUnprojectionMatrix=o.mat4.invert((0,r.createMat4)(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||t.default.warn("Pixel project matrix not invertible")()}}_.displayName="Viewport",e.s(["default",0,_])},705582,e=>{"use strict";var t=e.i(8823),r=e.i(723102),i=e.i(617891),n=e.i(558037),s=e.i(727719);let o=Math.PI/180;function a(e,t,i){let{pixelUnprojectionMatrix:o}=e,a=(0,n.transformVector)(o,[t,0,1,1]),l=(0,n.transformVector)(o,[t,e.height,1,1]),c=(i*e.distanceScales.unitsPerMeter[2]-a[2])/(l[2]-a[2]),u=s.vec2.lerp([],a,l,c),h=(0,r.worldToLngLat)(u);return h.push(i),h}var l=e.i(306719),c=e.i(514727);class u extends t.default{constructor(e={}){let t;const{latitude:i=0,longitude:n=0,zoom:s=0,pitch:o=0,bearing:a=0,nearZMultiplier:u=.1,farZMultiplier:h=1.01,nearZ:f,farZ:_,orthographic:d=!1,projectionMatrix:E,repeat:p=!1,worldOffset:g=0,position:m,padding:T,legacyMeterSizes:A=!1}=e;let{width:R,height:b,altitude:S=1.5}=e;const M=Math.pow(2,s);R=R||1,b=b||1;let C=null;if(E)S=E[5]/2,t=(0,r.altitudeToFovy)(S);else{let n;if(e.fovy?(t=e.fovy,S=(0,r.fovyToAltitude)(t)):t=(0,r.altitudeToFovy)(S),T){const{top:e=0,bottom:t=0}=T;n=[0,(0,c.clamp)((e+b-t)/2,0,b)-b/2]}C=(0,r.getProjectionParameters)({width:R,height:b,scale:M,center:m&&[0,0,m[2]*(0,r.unitsPerMeter)(i)],offset:n,pitch:o,fovy:t,nearZMultiplier:u,farZMultiplier:h}),Number.isFinite(f)&&(C.near=f),Number.isFinite(_)&&(C.far=_)}let O=(0,r.getViewMatrix)({height:b,pitch:o,bearing:a,scale:M,alt
741itude:S});g&&(O=new l.Matrix4().translate([512*g,0,0]).multiplyLeft(O)),super({...e,width:R,height:b,viewMatrix:O,longitude:n,latitude:i,zoom:s,...C,fovy:t,focalDistance:S}),this.latitude=i,this.longitude=n,this.zoom=s,this.pitch=o,this.bearing=a,this.altitude=S,this.fovy=t,this.orthographic=d,this._subViewports=p?[]:null,this._pseudoMeters=A,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){let e=this.getBounds(),t=Math.floor((e[0]+180)/360),r=Math.ceil((e[2]-180)/360);for(let e=t;e<=r;e++){let t=e?new u({...this,worldOffset:e}):this;this._subViewports.push(t)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);let[t,i]=this.projectFlat(e);return[t,i,(e[2]||0)*(0,r.unitsPerMeter)(e[1])]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);let[t,i]=this.unprojectFlat(e),n=(e[2]||0)/(0,r.unitsPerMeter)(i);return[t,i,n]}addMetersToLngLat(e,t){return(0,r.addMetersToLngLat)(e,t)}panByPosition(e,t){let i=(0,r.pixelsToWorld)(t,this.pixelUnprojectionMatrix),n=this.projectFlat(e),o=s.vec2.add([],n,s.vec2.negate([],i)),a=s.vec2.add([],this.center,o),[l,c]=this.unprojectFlat(a);return{longitude:l,latitude:c}}getBounds(e={}){let t=function(e,t=0){let r,i,{width:n,height:s,unproject:l}=e,c={targetZ:t},u=l([0,s],c),h=l([n,s],c);return(e.fovy?.5*e.fovy*o:Math.atan(.5/e.altitude))>(90-e.pitch)*o-.01?(r=a(e,0,t),i=a(e,n,t)):(r=l([0,0],c),i=l([n,0],c)),[u,h,i,r]}(this,e.z||0);return[Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),Math.min(t[0][1],t[1][1],t[2][1],t[3][1]),Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),Math.max(t[0][1],t[1][1],t[2][1],t[3][1])]}fitBounds(e,t={}){let{width:s,height:o}=this,{longitude:a,latitude:l,zoom:c}=function(e){let{width:t,height:s,bounds:o,minExtent:a=0,maxZoom:l=24,offset:c=[0,0]}=e,[[u,h],[f,_]]=o,d=function(e=0){return"number"==typeof e?{top:e,bottom:e,left:e,right:e}:((0,i.assert)(Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&Number.isFinite(e.left)&&Number.isFinite(e.right)),e)}(e.padding),E=(0,r.lngLatToWorld)([u,(0,n.clamp)(_,-r.MAX_LATITUDE,r.MAX_LATITUDE)]),p=(0,r.lngLatToWorld)([f,(0,n.clamp)(h,-r.MAX_LATITUDE,r.MAX_LATITUDE)]),g=[Math.max(Math.abs(p[0]-E[0]),a),Math.max(Math.abs(p[1]-E[1]),a)],m=[t-d.left-d.right-2*Math.abs(c[0]),s-d.top-d.bottom-2*Math.abs(c[1])];(0,i.assert)(m[0]>0&&m[1]>0);let T=m[0]/g[0],A=m[1]/g[1],R=(d.right-d.left)/2/T,b=(d.top-d.bottom)/2/A,S=[(p[0]+E[0])/2+R,(p[1]+E[1])/2+b],M=(0,r.worldToLngLat)(S),C=Math.min(l,(0,n.log2)(Math.abs(Math.min(T,A))));return(0,i.assert)(Number.isFinite(C)),{longitude:M[0],latitude:M[1],zoom:C}}({width:s,height:o,bounds:e,...t});return new u({width:s,height:o,longitude:a,latitude:l,zoom:c})}}u.displayName="WebMercatorViewport",e.s(["default",0,u],705582)},191762,14163,e=>{"use strict";let t,r=e=>null!==e&&"object"==typeof e,i=e=>r(e)&&e.constructor===({}).constructor,n=e=>"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer,s=e=>r(e)&&"number"==typeof e.byteLength&&"function"==typeof e.slice,o=e=>"u">typeof Response&&e instanceof Response||r(e)&&"function"==typeof e.arrayBuffer&&"function"==typeof e.text&&"function"==typeof e.json,a=e=>"u">typeof Blob&&e instanceof Blob,l=e=>{let t,i;return t=e,"u">typeof ReadableStream&&t instanceof ReadableStream||r(t)&&"function"==typeof t.tee&&"function"==typeof t.cancel&&"function"==typeof t.getReader||r(i=e)&&"function"==typeof i.read&&"function"==typeof i.pipe&&"boolean"==typeof i.readable};function c(e,t){if(!e)throw Error(t||"loader assertion failed.")}function u(e){return!!e&&(Array.isArray(e)&&(e=e[0]),Array.isArray(e?.extensions))}function h(e){let t;return c(e,"null loader"),c(u(e),"invalid loader"),Array.isArray(e)&&(t=e[1],e={...e=e[0],options:{...e.options,...t}}),(e?.parseTextSync||e?.parseText)&&(e.text=!0),e.text||(e.binary=!0),e}let f={};class _ extends Error{constructor(e,t){super(e),this.reason=t.reason,this.url=t.url,this.response=t.response}reason;url;response}let d=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,E=/^([-\w.]+\/[-\w.+]+)/;function p(e,t){return e.toLowerCase()===t.toLowerCase()}function g(e){let t=d.exec(e);return t?t[1]:""}let m=/\?.*/;function T(e){return e.replace(m,"")}function A(e){return o(e)?e.url:a(e)?("name"in e?e.name:"")||"":"string"==typeof e?e:""}function R(e){if(o(e)){let t,r=e.headers.get("content-type")||"",i=T(e.url);return((t=E.exec(r))?t[1]:r)||g(i)}return a(e)?e.type||"":"string"==typeof e?g(e):""}async function b(e){var t;if(o(e))return e;let r={},i=o(t=e)?t.headers["content-length"]||-1:a(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1;i>=0&&(r["content-length"]=String(i));let n=A(e),s=R(e);s&&(r["content-type"]=s);let l=await C(e);l&&(r["x-first-bytes"]=l),"string"==typeof e&&(e=new TextEncoder().encode(e));let c=new Response(e,{headers:r});return Object.defineProperty(c,"url",{value:n}),c}async function S(e){if(!e.ok)throw await M(e)}async function M(e){let t=function(e){if(e.length<50)return e;let t=e.slice(e.length-15),r=e.substr(0,32);return`${r}...${t}`}(e.url),r=`Failed to fetch resource (${e.status}) ${e.statusText}: ${t}`;r=r.length>100?`${r.slice(0,100)}...`:r;let i={reason:e.statusText,url:e.url,response:e};try{let t=e.headers.get("Content-Type");i.reason=!e.bodyUsed&&t?.includes("application/json")?await e.json():await e.text()}catch(e){}return new _(r,i)}async function C(e){if("string"==typeof e)return`data:,${e.slice(0,5)}`;if(e instanceof Blob){let t=e.slice(0,5);return await new Promise(e=>{let r=new FileReader;r.onload=t=>
741e(t?.target?.result),r.readAsDataURL(t)})}if(e instanceof ArrayBuffer){let t=function(e){let t="",r=new Uint8Array(e);for(let e=0;e<r.byteLength;e++)t+=String.fromCharCode(r[e]);return btoa(t)}(e.slice(0,5));return`data:base64,${t}`}return null}async function O(e,t){if("string"==typeof e){var r;let i=function(e){for(let t in f)if(e.startsWith(t)){let r=f[t];e=e.replace(t,r)}return e.startsWith("http://")||e.startsWith("https://")||(e=`${e}`),e}(e);return!((r=i).startsWith("http:")||r.startsWith("https:"))&&!i.startsWith("data:")&&globalThis.loaders?.fetchNode?globalThis.loaders?.fetchNode(i,t):await fetch(i,t)}return await b(e)}var v=e.i(321831);e.s(["dirname",0,function(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""},"filename",0,function(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e},"join",0,function(...e){return(e=e.map((t,r)=>(r&&(t=t.replace(RegExp("^/"),"")),r!==e.length-1&&(t=t.replace(RegExp("/$"),"")),t))).join("/")},"resolve",0,function(...e){let t,r=[];for(let t=0;t<e.length;t++)r[t]=e[t];let i="",n=!1;for(let e=r.length-1;e>=-1&&!n;e--){let s;e>=0?s=r[e]:(void 0===t&&(t=function(){if(void 0!==v.default&&void 0!==v.default.cwd)return v.default.cwd();let e=window.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}()),s=t),0!==s.length&&(i=`${s}/${i}`,n=47===s.charCodeAt(0))}return(i=function(e,t){let r,i="",n=-1,s=0,o=!1;for(let a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else if(47===r)break;else r=47;if(47===r){if(n===a-1||1===s);else if(n!==a-1&&2===s){if(i.length<2||!o||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2)){if(i.length>2){let e=i.length-1,t=e;for(;t>=0&&47!==i.charCodeAt(t);--t);if(t!==e){i=-1===t?"":i.slice(0,t),n=a,s=0,o=!1;continue}}else if(2===i.length||1===i.length){i="",n=a,s=0,o=!1;continue}}t&&(i.length>0?i+="/..":i="..",o=!0)}else{let t=e.slice(n+1,a);i.length>0?i+=`/${t}`:i=t,o=!1}n=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}(i,!n),n)?`/${i}`:i.length>0?i:"."}],216062);var N=e.i(216062),N=N,I=e.i(422291);let y=new I.Log({id:"loaders.gl"});class L{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}let P={self:"u">typeof self&&self,window:"u">typeof window&&window,global:e.g,document:"u">typeof document&&document};P.self||P.window||P.global,P.window||P.self||P.global,P.global||P.self||P.window,P.document;let D=("object"!=typeof v.default||"[object process]"!==String(v.default),!0),F=void 0!==v.default&&v.default.version&&/v([0-9]*)/.exec(v.default.version);F&&parseFloat(F[1]);let x={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new class{console;constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}},useLocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:D,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},B={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"
741core.fetch.keepalive",signal:"core.fetch.signal"},w=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function U(){globalThis.loaders=globalThis.loaders||{};let{loaders:e}=globalThis;return e._state||(e._state={}),e._state}function G(){let e=U();return e.globalOptions=e.globalOptions||{...x,core:{...x.core}},k(e.globalOptions)}function k(e){var t;let r,i=(r={...t=e},t.core&&(r.core={...t.core}),r);for(let e of(H(i),w))i.core&&void 0!==i.core[e]&&delete i[e];return i.core&&void 0!==i.core._workerType&&delete i._worker,i}function W(e,t,i,n,s){let o=t||"Top level",a=t?`${t}.`:"";for(let l in e){let c=!t&&r(e[l]),u="baseUri"===l&&!t,h="workerUrl"===l&&t;if(!(l in i)&&!u&&!h){if(l in n)y.level>0&&y.warn(`${o} loader option '${a}${l}' no longer supported, use '${n[l]}'`)();else if(!c&&y.level>0){let e=function(e,t){let r=e.toLowerCase(),i="";for(let n of t)for(let t in n.options){if(e===t)return`Did you mean '${n.id}.${t}'?`;let s=t.toLowerCase();(r.startsWith(s)||s.startsWith(r))&&(i=i||`Did you mean '${n.id}.${t}'?`)}return i}(l,s);y.warn(`${o} loader option '${a}${l}' not recognized. ${e}`)()}}}}function j(e,t){for(let r in t)r in t&&(i(t[r])&&i(e[r])?e[r]={...e[r],...t[r]}:e[r]=t[r])}function H(e){for(let t of(void 0!==e.baseUri&&(e.core||={},void 0===e.core.baseUrl&&(e.core.baseUrl=e.baseUri)),w))if(void 0!==e[t]){let r=e.core=e.core||{};void 0===r[t]&&(r[t]=e[t])}let t=e._worker;void 0!==t&&(e.core||={},void 0===e.core._workerType&&(e.core._workerType=t))}function X(e,t){let i=G(),n=e||i,s=n.fetch??n.core?.fetch;return"function"==typeof s?s:r(s)?e=>O(e,s):t?.fetch?t?.fetch:O}let V={self:"u">typeof self&&self,window:"u">typeof window&&window,global:e.g,document:"u">typeof document&&document};V.self||V.window||V.global,V.window||V.self||V.global,V.global||V.self||V.window,V.document;let z="object"!=typeof v.default||"[object process]"!==String(v.default)||!0,Y="u">typeof window&&void 0!==window.orientation,$=void 0!==v.default&&v.default.version&&/v([0-9]*)/.exec(v.default.version);$&&parseFloat($[1]);class K{terminate(){}}function q(e,t){if(!e)throw Error(t||"loaders.gl assertion failed.")}let Z=new Map;function Q(e){let t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function J(e){return!!e&&!!(e instanceof ArrayBuffer||"u">typeof MessagePort&&e instanceof MessagePort||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas)}let ee=()=>{};class et{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return"u">typeof Worker&&z||!z}constructor(e){const{name:t,source:r,url:i}=e;q(r||i),this.name=t,this.source=r,this.url=i,this.onMessage=ee,this.onError=e=>console.log(e),this.worker=z?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=ee,this.onError=ee,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,t){t=t||function e(t,r=!0,i){let n=i||new Set;if(t){if(J(t))n.add(t);else if(J(t.buffer))n.add(t.buffer);else if(ArrayBuffer.isView(t));else if(r&&"object"==typeof t)for(let i in t)e(t[i],r,n)}return void 0===i?Array.from(n):[]}(e),this.worker.postMessage(e,t)}_getErrorFromErrorEvent(e){let t="Failed to load ";return t+=`worker ${this.name} from ${this.url}. `,e.message&&(t+=`${e.message} in `),e.lineno&&(t+=`:${e.lineno}:${e.colno}`),Error(t)}_createBrowserWorker(){var e,t,r;let i;this._loadableURL=(q((e={source:this.source,url:this.url}).source&&!e.url||!e.source&&e.url),(i=Z.get(e.source||e.url))||(e.url&&(i=(t=e.url).startsWith("http")?Q((r=t,`\ 742try { 743 importScripts('${r}'); 744} catch (error) { 745 console.error(error); 746 throw error; 747}`)):t,Z.set(e.url,i)),e.source&&(i=Q(e.source),Z.set(e.source,i))),q(i),i);let n=new Worker(this._loadableURL,{name:this.name});return n.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(Error("No data received"))},n.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},n.onmessageerror=e=>console.error(e),n}_createNodeWorker(){let e;if(this.url)e=new K(this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,{eval:!1,type:this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs"});else if(this.source)e=new K(this.source,{eval:!0});else throw Error("no worker");return e.on("message",e=>{this.onMessage(e)}),e.on("error",e=>{this.onError(e)}),e.on("exit",e=>{}),e}}class er{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(e,t){this.name=e,this.workerThread=t,this.result=new Promise((e,t)=>
747{this._resolve=e,this._reject=t})}postMessage(e,t){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:t})}done(e){q(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){q(this.isRunning),this.isRunning=!1,this._reject(e)}}class ei{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return et.isSupported()}constructor(e){this.source=e.source,this.url=e.url,this.setProps(e)}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},void 0!==e.name&&(this.name=e.name),void 0!==e.maxConcurrency&&(this.maxConcurrency=e.maxConcurrency),void 0!==e.maxMobileConcurrency&&(this.maxMobileConcurrency=e.maxMobileConcurrency),void 0!==e.reuseWorkers&&(this.reuseWorkers=e.reuseWorkers),void 0!==e.onDebug&&(this.onDebug=e.onDebug)}async startJob(e,t=(e,t,r)=>e.done(r),r=(e,t)=>e.error(t)){let i=new Promise(i=>(this.jobQueue.push({name:e,onMessage:t,onError:r,onStart:i}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let e=this._getAvailableWorker();if(!e)return;let t=this.jobQueue.shift();if(t){this.onDebug({message:"Starting job",name:t.name,workerThread:e,backlog:this.jobQueue.length});let r=new er(t.name,e);e.onMessage=e=>t.onMessage(r,e.type,e.payload),e.onError=e=>t.onError(r,e),t.onStart(r);try{await r.result}catch(e){console.error(`Worker exception: ${e}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!z||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){return this.idleQueue.length>0?this.idleQueue.shift()||null:this.count<this._getMaxConcurrency()?(this.count++,new et({name:`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`,source:this.source,url:this.url})):null}_getMaxConcurrency(){return Y?this.maxMobileConcurrency:this.maxConcurrency}}let en={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}};class es{props;workerPools=new Map;static _workerFarm;static isSupported(){return et.isSupported()}static getWorkerFarm(e={}){return es._workerFarm=es._workerFarm||new es({}),es._workerFarm.setProps(e),es._workerFarm}constructor(e){this.props={...en},this.setProps(e),this.workerPools=new Map}destroy(){for(let e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){for(let t of(this.props={...this.props,...e},this.workerPools.values()))t.setProps(this._getWorkerPoolProps())}getWorkerPool(e){let{name:t,source:r,url:i}=e,n=this.workerPools.get(t);return n||((n=new ei({name:t,source:r,url:i})).setProps(this._getWorkerPoolProps()),this.workerPools.set(t,n)),n}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}async function eo(e,t,r,i,n){let s=e.id,o=function(e,t={}){let r=t[e.id]||{},i=z?`${e.id}-worker.js`:`${e.id}-worker-node.js`,n=r.workerUrl;if(n||"compression"!==e.id||(n=t.workerUrl),"test"===(t._workerType||t?.core?._workerType)&&(n=z?`modules/${e.module}/dist/${i}`:`modules/${e.module}/src/workers/${e.id}-worker-node.ts`),!n){let t=e.version;"latest"===t&&(t="latest");let r=t?`@${t}`:"";n=`https://unpkg.com/@loaders.gl/${e.module}${r}/dist/${i}`}return q(n),n}(e,r),a=es.getWorkerFarm(r?.core).getWorkerPool({name:s,url:o});r=JSON.parse(JSON.stringify(r)),i=JSON.parse(JSON.stringify(i||{}));let l=await a.startJob("process-on-worker",ea.bind(null,n));l.postMessage("process",{input:t,options:r,context:i});let c=await l.result;return await c.result}async function ea(e,t,r,i){switch(r){case"done":t.done(i);break;case"error":t.error(Error(i.error));break;case"process":let{id:n,input:s,options:o}=i;try{let r=await e(s,o);t.postMessage("done",{id:n,result:r})}catch(r){let e=r instanceof Error?r.message:"unknown error";t.postMessage("error",{id:n,error:e})}break;
747default:console.warn(`parse-with-worker unknown message ${r}`)}}let el=(globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.4"),globalThis._loadersgl_.version);async function ec(e){let t=[];for await(let r of e)t.push(function(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:i}=e;return eu(t,r,i)}return eu(e)}(r));return function(...e){var t=e;let r=t.map(e=>e instanceof ArrayBuffer?new Uint8Array(e):e),i=new Uint8Array(r.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let e of r)i.set(e,n),n+=e.byteLength;return i.buffer}(...t)}function eu(e,t=0,r=e.byteLength-t){let i=new Uint8Array(e,t,r),n=new Uint8Array(i.length);return n.set(i),n.buffer}function eh(e){return e&&"object"==typeof e&&e.isBuffer}function ef(e){if(eh(e)||e instanceof ArrayBuffer)return e;if(n(e))return ed(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return 0===e.byteOffset&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if("string"==typeof e)return new TextEncoder().encode(e).buffer;if(e&&"object"==typeof e&&e._toArrayBuffer)return e._toArrayBuffer();throw Error("toArrayBuffer")}function e_(e){if(e instanceof ArrayBuffer)return e;if(n(e))return ed(e);let{buffer:t,byteOffset:r,byteLength:i}=e;return t instanceof ArrayBuffer&&0===r&&i===t.byteLength?t:ed(t,r,i)}function ed(e,t=0,r=e.byteLength-t){let i=new Uint8Array(e,t,r),n=new Uint8Array(i.length);return n.set(i),n.buffer}async function*eE(e,t){let r=t?.chunkSize||1048576,i=0;for(;i<e.size;){let t=i+r,n=await e.slice(i,t).arrayBuffer();i=t,yield n}}function ep(e,t){return D?eg(e,t):em(e,t)}async function*eg(e,t){let r,i=e.getReader();try{for(;;){let e=r||i.read();t?._streamReadAhead&&(r=i.read());let{done:n,value:s}=await e;if(n)return;yield ef(s)}}catch(e){i.releaseLock()}}async function*em(e,t){for await(let t of e)yield ef(t)}let eT="Cannot convert supplied data type";async function eA(e,t,r){let i,n;if("string"==typeof e||s(e)){var c,u=e;if(t.text&&"string"==typeof u)return u;if(eh(u)&&(u=u.buffer),s(u)){let e=ArrayBuffer.isView(c=u)?c:new Uint8Array(c);return t.text&&!t.binary?new TextDecoder("utf8").decode(e):ef(e)}throw Error(eT)}if(a(e)&&(e=await b(e)),o(e))return await S(e),t.binary?await e.arrayBuffer():await e.text();if(l(e)&&(e=function(e,t){if("string"==typeof e)return function*(e,t){let r=t?.chunkSize||262144,i=0,n=new TextEncoder;for(;i<e.length;){let t=Math.min(e.length-i,r),s=e.slice(i,i+t);i+=t,yield e_(n.encode(s))}}(e,t);if(e instanceof ArrayBuffer)return function*(e,t={}){let{chunkSize:r=262144}=t,i=0;for(;i<e.byteLength;){let t=Math.min(e.byteLength-i,r),n=new ArrayBuffer(t),s=new Uint8Array(e,i,t);new Uint8Array(n).set(s),i+=t,yield n}}(e,t);if(a(e))return eE(e,t);if(l(e))return ep(e,t);if(o(e)){let r=e.body;if(!r)throw Error("Readable stream not available on Response");return ep(r,t)}throw Error("makeIterator")}(e,r)),(i=e)&&"function"==typeof i[Symbol.iterator]||(n=e)&&"function"==typeof n[Symbol.asyncIterator])return ec(e);throw Error(eT)}var N=N,N=N;let eR="4.4.4",eb=eR[0]>="0"&&eR[0]<="9"?`v${eR}`:"",eS=(t=new I.Log({id:"loaders.gl"}),globalThis.loaders||={},globalThis.loaders.log=t,globalThis.loaders.version=eb,globalThis.probe||={},globalThis.probe.loaders=t,t),eM=()=>{let e=U();return e.loaderRegistry=e.loaderRegistry||[],e.loaderRegistry};function eC(){return eM()}e.s(["getRegisteredLoaders",0,eC,"registerLoaders",0,function(e){let t=eM();for(let r of e=Array.isArray(e)?e:[e]){let e=h(r);t.find(t=>e===t)||t.unshift(e)}}],14163);let eO=/\.([^.]+)$/;async function ev(e,t=[],r,i){if(!ey(e))return null;let n=k(r||{});if(n.core||={},e instanceof Response&&eN(e)){let r=eI(await e.clone().text(),t,{...n,core:{...n.core,nothrow:!0}},i);if(r)return r}let s=eI(e,t,{...n,core:{...n.core,nothrow:!0}},i);if(s)return s;if(a(e)&&(s=eI(e=await e.slice(0,10).arrayBuffer(),t,n,i)),!s&&e instanceof Response&&eN(e)&&(s=eI(await e.clone().text(),t,n,i)),!s&&!n.core.nothrow)throw Error(eL(e));return s}function eN(e){let t=R(e);return!!(t&&(t.startsWith("text/")||"application/json"===t||t.endsWith("+json")))}function eI(e,t=[],r,i){var n,s,o,a,l,c;let u,f,_,d,E,p,g;if(!ey(e))return null;let m=k(r||{});if(m.core||={},t&&!Array.isArray(t))return h(t);let b=[];
747t&&(b=b.concat(t)),m.core.ignoreRegisteredLoaders||b.push(...eC()),function(e){for(let t of e)h(t)}(b);let S=(n=e,s=b,o=m,a=i,u=A(n),f=R(n),_=T(u)||a?.url,d=null,E="",o?.core?.mimeType&&(d=eP(s,o?.core?.mimeType),E=`match forced by supplied MIME type ${o?.core?.mimeType}`),d=d||(l=s,(g=(p=(c=_)&&eO.exec(c))&&p[1])?function(e,t){for(let r of(t=t.toLowerCase(),e))for(let e of r.extensions)if(e.toLowerCase()===t)return r;return null}(l,g):null),E=E||(d?`matched url ${_}`:""),d=d||eP(s,f),E=E||(d?`matched MIME type ${f}`:""),d=d||function(e,t){if(!t)return null;for(let r of e)if("string"==typeof t){if(function(e,t){return t.testText?t.testText(e):(Array.isArray(t.tests)?t.tests:[t.tests]).some(t=>e.startsWith(t))}(t,r))return r}else if(ArrayBuffer.isView(t)){if(eD(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer&&eD(t,0,r))return r;return null}(s,n),E=E||(d?`matched initial data ${eF(n)}`:""),o?.core?.fallbackMimeType&&(d=d||eP(s,o?.core?.fallbackMimeType),E=E||(d?`matched fallback MIME type ${f}`:"")),E&&eS.log(1,`selectLoader selected ${d?.name}: ${E}.`),d);if(!S&&!m.core.nothrow)throw Error(eL(e));return S}function ey(e){return!(e instanceof Response)||204!==e.status}function eL(e){let t=A(e),r=R(e),i="No valid loader found (";i+=(t?`${N.filename(t)}, `:"no url provided, ")+`MIME type: ${r?`"${r}"`:"not provided"}, `;let n=e?eF(e):"";return i+((n?` first bytes: "${n}"`:"first bytes: not available")+")")}function eP(e,t){for(let r of e)if(r.mimeTypes?.some(e=>p(t,e))||p(t,`application/x.${r.id}`))return r;return null}function eD(e,t,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some(r=>(function(e,t,r){if(s(r))return function(e,t,r){if(r=r||e.byteLength,e.byteLength<r||t.byteLength<r)return!1;let i=new Uint8Array(e),n=new Uint8Array(t);for(let e=0;e<i.length;++e)if(i[e]!==n[e])return!1;return!0}(r,e,r.byteLength);switch(typeof r){case"function":return r(e_(e));case"string":let i=ex(e,t,r.length);return r===i;default:return!1}})(e,t,r))}function eF(e,t=5){return"string"==typeof e?e.slice(0,t):ArrayBuffer.isView(e)?ex(e.buffer,e.byteOffset,t):e instanceof ArrayBuffer?ex(e,0,t):""}function ex(e,t,r){if(e.byteLength<t+r)return"";let i=new DataView(e),n="";for(let e=0;e<r;e++)n+=String.fromCharCode(i.getUint8(t+e));return n}async function eB(e,t,r,i){var n,s,o,a,l,c,h;let f,_;!t||Array.isArray(t)||u(t)||(i=void 0,r=t,t=void 0),e=await e,r=r||{};let d=A(e),E=function(e,t){let r;if(e&&!Array.isArray(e))return e;if(e&&(r=Array.isArray(e)?e:[e]),t&&t.loaders){let e=Array.isArray(t.loaders)?t.loaders:[t.loaders];r=r?[...r,...e]:e}return r&&r.length?r:void 0}(t,i),p=await ev(e,E,r);if(!p)return null;let g=(function(e,t){for(let r of(W(e,null,x,B,t),t)){let i=e&&e[r.id]||{},n=r.options&&r.options[r.id]||{},s=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};W(i,r.id,n,s,t)}}(n=r,s=Array.isArray(s=(s=E)||[])?s:[s]),k((o=p,a=n,l=d,_={...f=o.options||{}},f.core&&(_.core={...f.core}),H(_),_.core?.log===null&&(_.core={..._.core,log:new L}),j(_,k(G())),j(_,k(a)),c=_,(h=l)&&c.core?.baseUrl===void 0&&(c.core||={},c.core.baseUrl=N.dirname(T(h))),function(e){let t=e.core;if(t)for(let r of w)void 0!==t[r]&&(e[r]=t[r])}(_),_)));return i=function(e,t,r){if(r)return r;let i={fetch:X(t,e),...e};if(i.url){let e,t=T(i.url);i.baseUrl=t,e=i.url.match(m),i.queryString=e&&e[0],i.filename=N.filename(t),i.baseUrl=N.dirname(t)}return Array.isArray(i.loaders)||(i.loaders=null),i}({url:d,_parse:eB,loaders:E},g,i||null),await ew(p,e,g,i)}async function ew(e,t,r,i){if(!function(e,t=el){q(e,"no worker provided");e.version}(e),r=function e(t,r,i=0){if(i>3)return r;let n={...t};for(let[t,s]of Object.entries(r))s&&"object"==typeof s&&!Array.isArray(s)?n[t]=e(n[t]||{},r[t],i+1):n[t]=r[t];return n}(e.options||{},r),o(t)){let{ok:e,redirected:r,status:n,statusText:s,type:o,url:a}=t;i.response={headers:Object.fromEntries(t.headers.entries()),ok:e,redirected:r,status:n,statusText:s,type:o,url:a}}if(t=await eA(t,e,r),e.parseTextSync&&"string"==typeof t)return e.parseTextSync(t,r,i);if(function(e,t){if(!es.isSupported())return!1;let r=t?._nodeWorkers??t?.core?._nodeWorkers;if(!z&&!r)return!1;let i=t?.worker??t?.core?.worker;return!!(e.worker&&i)}(e,r))return await eo(e,t,r,i,eB);if(e.parseText&&"string"==typeof t)return await e.parseText(t,r,i);if(e.parse)return await e.parse(t,r,i);throw q(!e.parseSync),Error(`${e.id} loader - no parser found and worker is disabled`)}async function eU(e,t,r,i){let n,s;Array.isArray(t)||u(t)?(n=t,s=r):(n=[],s=t);let o=X(s),l=e;if("string"==typeof e&&(l=await o(e)),a(e)&&(l=await o(e)),"string"==typeof e){let t=k(s||{});t.core?.baseUrl||(s={...s,core:{...s?.core,baseUrl:e}})}return Array.isArray(n),await eB(l,n,s)}e.s(["load",0,eU],191762)},591341,629805,374612,e=>{"use strict";let t={};function r(e="id"){t[e]=t[e]||1;let i=t[e]++;return`${e}-${i}`}e.s(["uid",0,r],629805);
747class i{static defaultProps={id:"undefined",handle:void 0,userData:void 0};toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}id;props;userData={};_device;destroyed=!1;allocatedBytes=0;_attachedResources=new Set;constructor(e,t,i){if(!e)throw Error("no device");this._device=e,this.props=function(e,t){let r={...t};for(let t in e)void 0!==e[t]&&(r[t]=e[t]);return r}(t,i);const n="undefined"!==this.props.id?this.props.id:r(this[Symbol.toStringTag]);this.props.id=n,this.id=n,this.userData=this.props.userData||{},this.addStats()}destroy(){this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(let e of Object.values(this._attachedResources))e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0}removeStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get(`${t}s Active`).decrementCount()}trackAllocatedMemory(e,t=this[Symbol.toStringTag]){let r=this._device.statsManager.getStats("Resource Counts");r.get("GPU Memory").addCount(e),r.get(`${t} Memory`).addCount(e),this.allocatedBytes=e}trackDeallocatedMemory(e=this[Symbol.toStringTag]){let t=this._device.statsManager.getStats("Resource Counts");t.get("GPU Memory").subtractCount(this.allocatedBytes),t.get(`${e} Memory`).subtractCount(this.allocatedBytes),this.allocatedBytes=0}addStats(){let e=this._device.statsManager.getStats("Resource Counts"),t=this[Symbol.toStringTag];e.get("Resources Created").incrementCount(),e.get(`${t}s Created`).incrementCount(),e.get(`${t}s Active`).incrementCount()}}e.s(["Resource",0,i],374612);class n extends i{static defaultProps={...i.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",mappedAtCreation:!1};static MAP_READ=1;static MAP_WRITE=2;static COPY_SRC=4;static COPY_DST=8;static INDEX=16;static VERTEX=32;static UNIFORM=64;static STORAGE=128;static INDIRECT=256;static QUERY_RESOLVE=512;get[Symbol.toStringTag](){return"Buffer"}usage;indexType;updateTimestamp;constructor(e,t){const r={...t};(t.usage||0)&n.INDEX&&!t.indexType&&(t.data instanceof Uint32Array?r.indexType="uint32":t.data instanceof Uint16Array&&(r.indexType="uint16")),delete r.data,super(e,r,n.defaultProps),this.usage=r.usage||0,this.indexType=r.indexType,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createBuffer({...this.props,...e})}readSyncWebGL(e,t){throw Error("not implemented")}static DEBUG_DATA_MAX_LENGTH=32;debugData=new ArrayBuffer(0);_setDebugData(e,t,r){let i=ArrayBuffer.isView(e)?e.buffer:e,s=Math.min(e?e.byteLength:r,n.DEBUG_DATA_MAX_LENGTH);null===i?this.debugData=new ArrayBuffer(s):0===t&&r===i.byteLength?this.debugData=i.slice(0,s):this.debugData=i.slice(t,t+s)}}e.s(["Buffer",0,n],591341)},191494,e=>{"use strict";let t=new(e.i(422291)).Log({id:"luma.gl"});e.s(["log",0,t])},929086,e=>{"use strict";var t=e.i(408173);class r{stats=new Map;getStats(e){return this.get(e)}get(e){return this.stats.has(e)||this.stats.set(e,new t.Stats({id:e})),this.stats.get(e)}}let i=new r;e.s(["lumaStats",0,i])},143591,956117,e=>{"use strict";let t={number:{type:"number",validate:(e,t)=>Number.isFinite(e)&&"object"==typeof t&&(void 0===t.max||e<=t.max)&&(void 0===t.min||e>=t.min)},array:{type:"array",validate:(e,t)=>Array.isArray(e)||ArrayBuffer.isView(e)}};function r(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}let i={vertex:`\ 748#ifdef MODULE_LOGDEPTH 749 logdepth_adjustPosition(gl_Position); 750#endif 751`,fragment:`\ 752#ifdef MODULE_MATERIAL 753 fragColor = material_filterColor(fragColor); 754#endif 755 756#ifdef MODULE_LIGHTING 757 fragColor = lighting_filterColor(fragColor); 758#endif 759 760#ifdef MODULE_FOG 761 fragColor = fog_filterColor(fragColor); 762#endif 763 764#ifdef MODULE_PICKING 765 fragColor = picking_filterHighlightColor(fragColor); 766 fragColor = picking_filterPickingColor(fragColor); 767#endif 768 769#ifdef MODULE_LOGDEPTH 770 logdepth_setFragDepth(); 771#endif 772`},n=/void\s+main\s*\([^)]*\)\s*\{\n?/,s=/}\n?[^{}]*$/,o=[],a="__LUMA_INJECT_DECLARATIONS__";function l(e,t,r,c=!1){let u="vertex"===t;for(let t in r){let i=r[t];i.sort((e,t)=>
772e.order-t.order),o.length=i.length;for(let e=0,t=i.length;e<t;++e)o[e]=i[e].injection;let l=`${o.join("\n")} 773`;switch(t){case"vs:#decl":u&&(e=e.replace(a,l));break;case"vs:#main-start":u&&(e=e.replace(n,e=>e+l));break;case"vs:#main-end":u&&(e=e.replace(s,e=>l+e));break;case"fs:#decl":u||(e=e.replace(a,l));break;case"fs:#main-start":u||(e=e.replace(n,e=>e+l));break;case"fs:#main-end":u||(e=e.replace(s,e=>l+e));break;default:e=e.replace(t,e=>e+l)}}return e=e.replace(a,""),c&&(e=e.replace(/\}\s*$/,e=>e+i[t])),e}function c(e){e.map(e=>(function(e){var i;if(e.instance)return;c(e.dependencies||[]);let{propTypes:n={},deprecations:s=[],inject:o={}}=e,a={normalizedInjections:function(e){let t={vertex:{},fragment:{}};for(let r in e){let i=e[r];"string"==typeof i&&(i={order:0,injection:i}),t[function(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw Error(t)}}(r)][r]=i}return t}(o),parsedDeprecations:((i=s).forEach(e=>{"function"===e.type?e.regex=RegExp(`\\b${e.old}\\(`):e.regex=RegExp(`${e.type} ${e.old};`)}),i)};n&&(a.propValidators=function(e){let i={};for(let[n,s]of Object.entries(e))i[n]=function(e){let i=r(e);if("object"!==i)return{value:e,...t[i],type:i};if("object"==typeof e)return e?void 0!==e.type?{...e,...t[e.type],type:e.type}:void 0===e.value?{type:"object",value:e}:(i=r(e.value),{...e,...t[i],type:i}):{type:"object",value:null};throw Error("props")}(s);return i}(n)),e.instance=a;let l={};n&&(l=Object.entries(n).reduce((e,[t,r])=>{let i=r?.value;return i&&(e[t]=i),e},{})),e.defaultUniforms={...e.defaultUniforms,...l}})(e))}function u(e,t,r){e.deprecations?.forEach(e=>{e.regex?.test(t)&&(e.deprecated?r.deprecated(e.old,e.new)():r.removed(e.old,e.new)())})}function h(e){c(e);let t={},r={};!function e(t){let{modules:r,level:i,moduleMap:n,moduleDepth:s}=t;if(i>=5)throw Error("Possible loop in shader dependency graph");for(let e of r)n[e.name]=e,(void 0===s[e.name]||s[e.name]<i)&&(s[e.name]=i);for(let t of r)t.dependencies&&e({modules:t.dependencies,level:i+1,moduleMap:n,moduleDepth:s})}({modules:e,level:0,moduleMap:t,moduleDepth:r});let i=Object.keys(r).sort((e,t)=>r[t]-r[e]).map(e=>t[e]);return c(i),i}e.s(["getShaderModuleDependencies",0,h],956117);let f=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],_=[...f,[p("attribute"),"in $1"],[p("varying"),"out $1"]],d=[...f,[p("varying"),"in $1"]];function E(e,t){for(let[r,i]of t)e=e.replace(r,i);return e}function p(e){return RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function g(e,t){let r="";for(let i in e){let n=e[i];if(r+=`void ${n.signature} { 774`,n.header&&(r+=` ${n.header}`),t[i]){let e=t[i];for(let t of(e.sort((e,t)=>e.order-t.order),e))r+=` ${t.injection} 775`}n.footer&&(r+=` ${n.footer}`),r+="}\n"}return r}function m(e){let t={vertex:{},fragment:{}};for(let r of e){let e,i;"string"!=typeof r?i=(e=r).hook:(e={},i=r);let[n,s]=(i=i.trim()).split(":"),o=i.replace(/\(.+/,""),a=Object.assign(e,{signature:s});switch(n){case"vs":t.vertex[o]=a;break;case"fs":t.fragment[o]=a;break;default:throw Error(n)}}return t}function T(e,t){if(!e)throw Error(t||"shadertools: assertion failed.")}let A=` 776 777${a} 778`,R=`\ 779precision highp float; 780`;function b(e,t){let{id:r,source:i,stage:n,language:s="glsl",modules:o,defines:a={},hookFunctions:c=[],inject:h={},prologue:f=!0,log:p}=t;T("string"==typeof i,"shader source must be a string");let b="glsl"===s?({name:function(e,t="unnamed"){let r=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return r?r[1]:t}(i,void 0),language:"glsl",version:function(e){let t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&"#version"===r[0]){let e=parseInt(r[1],10);Number.isFinite(e)&&(t=e)}if(100!==t&&300!==t)throw Error(`Invalid GLSL version ${t}`);return t}(i)}).version:-1,S=e.shaderLanguageVersion,C=100===b?"#version 100":"#version 300 es",O=i.split("\n").slice(1).join("\n"),v={};o.forEach(e=>{Object.assign(v,e.defines)}),Object.assign(v,a);let N="";switch(s){case"wgsl":break;case"glsl":N=f?`\ 781${C} 782 783// ----- PROLOGUE ------------------------- 784${function(e){let{id:t,source:r,stage:i}=e;return t&&-1===r.indexOf("SHADER_NAME")?` 785#define SHADER_NAME ${t}_${i}`:""}({id:r,source:i,stage:n})} 786#define SHADER_TYPE_${n.toUpperCase()} 787 788${function(e){switch(e?.gpu.toLowerCase()){case"apple":return`\
789#define APPLE_GPU 790// Apple optimizes away the calculation necessary for emulated fp64 791#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 792#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 793// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 794#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 795`;case"nvidia":return`\ 796#define NVIDIA_GPU 797// Nvidia optimizes away the calculation necessary for emulated fp64 798#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 799`;case"intel":return`\ 800#define INTEL_GPU 801// Intel optimizes away the calculation necessary for emulated fp64 802#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 803// Intel's built-in 'tan' function doesn't have acceptable precision 804#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 805// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 806#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 807`;case"amd":return`\ 808#define AMD_GPU 809`;default:return`\ 810#define DEFAULT_GPU 811// Prevent driver from optimizing away the calculation necessary for emulated fp64 812#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 813// Headless Chrome's software shader 'tan' function doesn't have acceptable precision 814#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 815// If the GPU doesn't have full 32 bits precision, will causes overflow 816#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 817`}}(e)} 818${"fragment"===n?R:""} 819 820// ----- APPLICATION DEFINES ------------------------- 821 822${function(e={}){let t="";for(let r in e){let i=e[r];(i||Number.isFinite(i))&&(t+=`#define ${r.toUpperCase()} ${e[r]} 823`)}return t}(v)} 824 825`:`${C} 826`}let I=m(c),y={},L={},P={};for(let e in h){let t="string"==typeof h[e]?{injection:h[e],order:0}:h[e],r=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(r){let i=r[2],n=r[3];i?"decl"===n?L[e]=[t]:P[e]=[t]:y[e]=[t]}else P[e]=[t]}for(let e of o){p&&u(e,O,p),N+=M(e,n);let t=e.instance?.normalizedInjections[n]||{};for(let e in t){let r=/^(v|f)s:#([\w-]+)$/.exec(e);if(r){let i="decl"===r[2]?L:P;i[e]=i[e]||[],i[e].push(t[e])}else y[e]=y[e]||[],y[e].push(t[e])}}return N+="// ----- MAIN SHADER SOURCE -------------------------",N+=A,N=l(N,n,L)+g(I[n],y)+O,N=l(N,n,P),"glsl"===s&&b!==S&&(N=function(e,t){if(300!==Number(e.match(/^#version[ \t]+(\d+)/m)?.[1]||100))throw Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case"vertex":return E(e,_);case"fragment":return E(e,d);default:throw Error(t)}}(N,n)),N.trim()}function S(e){return function(t){let r={};for(let i of e){let e=i.getUniforms?.(t,r);Object.assign(r,e)}return r}}function M(e,t){let r;switch(t){case"vertex":r=e.vs||"";break;case"fragment":r=e.fs||"";break;case"wgsl":r=e.source||"";break;default:T(!1)}if(!e.name)throw Error("Shader module must have a name");let i=e.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),n=`\ 827// ----- MODULE ${e.name} --------------- 828 829`;return"wgsl"!==t&&(n+=`#define MODULE_${i} 830`),n+=`${r} 831`}let C=/^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/,O=/^\s*\#\s*endif\s*$/;class v{static defaultShaderAssembler;_hookFunctions=[];_defaultModules=[];static getDefaultShaderAssembler(){return v.defaultShaderAssembler=v.defaultShaderAssembler||new v,v.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(t=>t.name===("string"==typeof e?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){let t="string"==typeof e?e:e.name;this._defaultModules=this._defaultModules.filter(e=>e.name!==t)}addShaderHook(e,t){t&&(e=Object.assign(t,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){var t;let r,i=this._getModuleList(e.modules),n=this._hookFunctions,{source:s,getUniforms:o}=(r=h((t={...e,source:e.source,modules:i,hookFunctions:n}).modules||[]),{source:function(e,t){let{source:r,stage:i,modules:n,hookFunctions:s=[],inject:o={},log:a}=t;T("string"==typeof r,"shader source must be a string");let c="",h=m(s),f={},_={},d={};for(let e in o){let t="string"==typeof o[e]?{injection:o[e],order:0}:o[e],r=/^(v|f)s:(#)?([\w-]+)$/.exec(e);if(r){let i=r[2],n=r[3];i?"decl"===n?_[e]=[t]:d[e]=[t]:f[e]=[t]}else d[e]=[t]}for(let e of n){a&&u(e,r,a),c+=M(e,"wgsl");let t=e.injections?.[i]||{};for(let e in t){let r=/^(v|f)s:#([\w-]+)$/.exec(e);if(r){let i="decl"===r[2]?_:d;i[e]=i[e]||[],i[e].push(t[e])}else f[e]=f[e]||[],f[e].push(t[e])}}return c+=A,c=l(c,i,_)+g(h[i],f)+r,c=l(c,i,d)}(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:r}),getUniforms:S(r)});return{source:"wgsl"===e.platformInfo.shaderLanguage?function(e){let t=e.split("\n"),r=[],i=!0;for(let e of t){let t=e.match(C),n=e.match(O);t?(t[1],i=!1):n?i=!0:i&&r.push(e)}return r.join("\n")}(s):s,getUniforms:o,modules:i}}assembleGLSLShaderPair(e){let t=this._getModuleList(e.modules),r=this._hookFunctions;return{...function(e){let{vs:t,fs:r}=e,i=h(e.modules||[]);return{vs:b(e.platformInfo,{...e,source:t,stage:"vertex",modules:i}),fs:b(e.platformInfo,{...e,source:r,stage:"fragment",modules:i}),getUniforms:S(i)}}({...e,vs:e.vs,fs:e.fs,modules:t,hookFunctions:r}),modules:t}}_getModuleList(e=[]){let t=Array(this._defaultModules.length+e.length),r={},i=0;for(let e=0,n=this._defaultModules.length;e<n;++e){let n=this._defaultModules[e],s=n.name;t[i++]=n,r[s]=!0}for(let n=0,s=e.length;n<s;++n){let s=e[n],o=s.name;r[o]||(t[i++]=s,r[o]=!0)}return t.length=i,c(t),t}}e.s(["ShaderAssembler",0,v],143591)},834487,e=>{"use strict";let t=`\ 832#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 833 834// All these functions are for substituting tan() function from Intel GPU only 835const float TWO_PI = 6.2831854820251465; 836const float PI_2 = 1.5707963705062866; 837const float PI_16 = 0.1963495463132858; 838 839const float SIN_TABLE_0 = 0.19509032368659973; 840const float SIN_TABLE_1 = 0.3826834261417389; 841const float SIN_TABLE_2 = 0.5555702447891235; 842const float SIN_TABLE_3 = 0.7071067690849304; 843 844const float COS_TABLE_0 = 0.9807852506637573; 845const float COS_TABLE_1 = 0.9238795042037964; 846const float COS_TABLE_2 = 0.8314695954322815; 847const float COS_TABLE_3 = 0.7071067690849304; 848 849const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3! 850const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5! 851const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!
852const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9! 853 854float sin_taylor_fp32(float a) { 855 float r, s, t, x; 856 857 if (a == 0.0) { 858 return 0.0; 859 } 860 861 x = -a * a; 862 s = a; 863 r = a; 864 865 r = r * x; 866 t = r * INVERSE_FACTORIAL_3; 867 s = s + t; 868 869 r = r * x; 870 t = r * INVERSE_FACTORIAL_5; 871 s = s + t; 872 873 r = r * x; 874 t = r * INVERSE_FACTORIAL_7; 875 s = s + t; 876 877 r = r * x; 878 t = r * INVERSE_FACTORIAL_9; 879 s = s + t; 880 881 return s; 882} 883 884void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) { 885 if (a == 0.0) { 886 sin_t = 0.0; 887 cos_t = 1.0; 888 } 889 sin_t = sin_taylor_fp32(a); 890 cos_t = sqrt(1.0 - sin_t * sin_t); 891} 892 893float tan_taylor_fp32(float a) { 894 float sin_a; 895 float cos_a; 896 897 if (a == 0.0) { 898 return 0.0; 899 } 900 901 // 2pi range reduction 902 float z = floor(a / TWO_PI); 903 float r = a - TWO_PI * z; 904 905 float t; 906 float q = floor(r / PI_2 + 0.5); 907 int j = int(q); 908 909 if (j < -2 || j > 2) { 910 return 1.0 / 0.0; 911 } 912 913 t = r - PI_2 * q; 914 915 q = floor(t / PI_16 + 0.5); 916 int k = int(q); 917 int abs_k = int(abs(float(k))); 918 919 if (abs_k > 4) { 920 return 1.0 / 0.0; 921 } else { 922 t = t - PI_16 * q; 923 } 924 925 float u = 0.0; 926 float v = 0.0; 927 928 float sin_t, cos_t; 929 float s, c; 930 sincos_taylor_fp32(t, sin_t, cos_t); 931 932 if (k == 0) { 933 s = sin_t; 934 c = cos_t; 935 } else { 936 if (abs(float(abs_k) - 1.0) < 0.5) { 937 u = COS_TABLE_0; 938 v = SIN_TABLE_0; 939 } else if (abs(float(abs_k) - 2.0) < 0.5) { 940 u = COS_TABLE_1; 941 v = SIN_TABLE_1; 942 } else if (abs(float(abs_k) - 3.0) < 0.5) { 943 u = COS_TABLE_2; 944 v = SIN_TABLE_2; 945 } else if (abs(float(abs_k) - 4.0) < 0.5) { 946 u = COS_TABLE_3; 947 v = SIN_TABLE_3; 948 } 949 if (k > 0) { 950 s = u * sin_t + v * cos_t; 951 c = u * cos_t - v * sin_t; 952 } else { 953 s = u * sin_t - v * cos_t; 954 c = u * cos_t + v * sin_t; 955 } 956 } 957 958 if (j == 0) { 959 sin_a = s; 960 cos_a = c; 961 } else if (j == 1) { 962 sin_a = c; 963 cos_a = -s; 964 } else if (j == -1) { 965 sin_a = -c; 966 cos_a = s; 967 } else { 968 sin_a = -s; 969 cos_a = -c; 970 } 971 return sin_a / cos_a; 972} 973#endif 974 975float tan_fp32(float a) { 976#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 977 return tan_taylor_fp32(a); 978#else 979 return tan(a); 980#endif 981} 982`;e.s(["fp32",0,{name:"fp32",vs:t}])},889330,263739,878144,758358,132158,956839,782212,139830,791937,229463,987906,216246,e=>{"use strict";let t;var r,i,n=e.i(929086),s=e.i(191494),o=e.i(629805),a=e.i(591341);function l(e){let t=u[c[e]],r=e.includes("norm"),i=!r&&!e.startsWith("float"),n=e.startsWith("s");return{dataType:c[e],byteLength:t,integer:i,signed:n,normalized:r}}let c={uint8:"uint8",sint8:"sint8",unorm8:"uint8",snorm8:"sint8",uint16:"uint16",sint16:"sint16",unorm16:"uint16",snorm16:"sint16",float16:"float16",float32:"float32",uint32:"uint32",sint32:"sint32"},u={uint8:1,sint8:1,uint16:2,sint16:2,float16:2,float32:4,uint32:4,sint32:4},h="texture-compression-bc",f="texture-compression-astc",_="texture-compression-etc2",d="texture-compression-pvrtc-webgl",E="texture-compression-atc-webgl",p="float32-renderable-webgl",g="float16-renderable-webgl",m="snorm8-renderable-webgl",T="norm16-renderable-webgl",A="snorm16-renderable-webgl",R="float32-filterable",b="float16-filterable-webgl";function S(e){let t=M[e];if(!t)throw Error(`Unsupported texture format ${e}`);return t}let M={r8unorm:{},r8snorm:{render:m},r8uint:{},r8sint:{},rg8unorm:{},rg8snorm:{render:m},rg8uint:{},rg8sint:{},r16uint:{},r16sint:{},r16float:{render:g,filter:"float16-filterable-webgl"},"r16unorm-webgl":{f:T},"r16snorm-webgl":{f:A},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},"rgb8unorm-webgl":{},"rgb8snorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},rgba8snorm:{render:m},rgba8uint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{},rg16sint:{},rg16float:{render:g,filter:b},"rg16unorm-webgl":{render:T},"rg16snorm-webgl":{render:A},r32uint:{},r32sint:{},r32float:{render:p,filter:R},rgb9e5ufloat:{channels:"rgb",packed:!0,render:"rgb9e5ufloat-renderable-webgl"},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:p},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},"rgb10a2uint-webgl":{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1,wgpu:!1},"rgb16unorm-webgl":{f:T},"rgb16snorm-webgl":{f:T},rg32uint:{},rg32sint:{},rg32float:{render:!1,filter:R},rgba16uint:{},rgba16sint:{},rgba16float:{render:g,filter:b},"rgba16unorm-webgl":{render:T},"rgba16snorm-webgl":{render:A},"rgb32float-webgl":{render:p,filter:R},rgba32uint:{},rgba32sint:{},rgba32float:{render:p,filter:R},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}
982,"bc1-rgb-unorm-webgl":{f:h},"bc1-rgb-unorm-srgb-webgl":{f:h},"bc1-rgba-unorm":{f:h},"bc1-rgba-unorm-srgb":{f:h},"bc2-rgba-unorm":{f:h},"bc2-rgba-unorm-srgb":{f:h},"bc3-rgba-unorm":{f:h},"bc3-rgba-unorm-srgb":{f:h},"bc4-r-unorm":{f:h},"bc4-r-snorm":{f:h},"bc5-rg-unorm":{f:h},"bc5-rg-snorm":{f:h},"bc6h-rgb-ufloat":{f:h},"bc6h-rgb-float":{f:h},"bc7-rgba-unorm":{f:h},"bc7-rgba-unorm-srgb":{f:h},"etc2-rgb8unorm":{f:_},"etc2-rgb8unorm-srgb":{f:_},"etc2-rgb8a1unorm":{f:_},"etc2-rgb8a1unorm-srgb":{f:_},"etc2-rgba8unorm":{f:_},"etc2-rgba8unorm-srgb":{f:_},"eac-r11unorm":{f:_},"eac-r11snorm":{f:_},"eac-rg11unorm":{f:_},"eac-rg11snorm":{f:_},"astc-4x4-unorm":{f:f},"astc-4x4-unorm-srgb":{f:f},"astc-5x4-unorm":{f:f},"astc-5x4-unorm-srgb":{f:f},"astc-5x5-unorm":{f:f},"astc-5x5-unorm-srgb":{f:f},"astc-6x5-unorm":{f:f},"astc-6x5-unorm-srgb":{f:f},"astc-6x6-unorm":{f:f},"astc-6x6-unorm-srgb":{f:f},"astc-8x5-unorm":{f:f},"astc-8x5-unorm-srgb":{f:f},"astc-8x6-unorm":{f:f},"astc-8x6-unorm-srgb":{f:f},"astc-8x8-unorm":{f:f},"astc-8x8-unorm-srgb":{f:f},"astc-10x5-unorm":{f:f},"astc-10x5-unorm-srgb":{f:f},"astc-10x6-unorm":{f:f},"astc-10x6-unorm-srgb":{f:f},"astc-10x8-unorm":{f:f},"astc-10x8-unorm-srgb":{f:f},"astc-10x10-unorm":{f:f},"astc-10x10-unorm-srgb":{f:f},"astc-12x10-unorm":{f:f},"astc-12x10-unorm-srgb":{f:f},"astc-12x12-unorm":{f:f},"astc-12x12-unorm-srgb":{f:f},"pvrtc-rgb4unorm-webgl":{f:d},"pvrtc-rgba4unorm-webgl":{f:d},"pvrtc-rbg2unorm-webgl":{f:d},"pvrtc-rgba2unorm-webgl":{f:d},"etc1-rbg-unorm-webgl":{f:"texture-compression-etc1-webgl"},"atc-rgb-unorm-webgl":{f:E},"atc-rgba-unorm-webgl":{f:E},"atc-rgbai-unorm-webgl":{f:E}},C=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"],O=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/;function v(e){return C.some(t=>e.startsWith(t))}function N(e){var t;let r,i,n,s=(i=(r=S(t=e)).bytesPerPixel||1,n=r.bitsPerChannel||[8,8,8,8],delete r.bitsPerChannel,delete r.bytesPerPixel,delete r.f,delete r.render,delete r.filter,delete r.blend,delete r.store,{...r,format:t,attachment:r.attachment||"color",channels:r.channels||"r",components:r.components||r.channels?.length||1,bytesPerPixel:i,bitsPerChannel:n,dataType:r.dataType||"uint8",srgb:r.srgb??!1,packed:r.packed??!1,webgl:r.webgl??!1,integer:r.integer??!1,signed:r.signed??!1,normalized:r.normalized??!1,compressed:r.compressed??!1});if(v(e)){s.channels="rgb",s.components=3,s.bytesPerPixel=1,s.srgb=!1,s.compressed=!0;let t=function(e){let t=/.*-(\d+)x(\d+)-.*/.exec(e);if(t){let[,e,r]=t;return{blockWidth:Number(e),blockHeight:Number(r)}}return null}(e);t&&(s.blockWidth=t.blockWidth,s.blockHeight=t.blockHeight)}let o=O.exec(e);if(o){let[,t,r,i,n,a]=o,c=l(`${i}${r}`),u=8*c.byteLength,h=t.length;s={format:e,attachment:s.attachment,dataType:c.dataType,components:h,channels:t,integer:c.integer,signed:c.signed,normalized:c.normalized,bitsPerChannel:[u,h>=2?u:0,h>=3?u:0,h>=4?u:0],bytesPerPixel:c.byteLength*t.length,packed:s.packed,srgb:s.srgb},"-webgl"===a&&(s.webgl=!0),"-srgb"===n&&(s.srgb=!0)}return e.endsWith("-webgl")&&(s.webgl=!0),e.endsWith("-srgb")&&(s.srgb=!0),s}class I{}class y{features;disabledFeatures;constructor(e=[],t){this.features=new Set(e),this.disabledFeatures=t||{}}*[Symbol.iterator](){yield*this.features}has(e){return!this.disabledFeatures?.[e]&&this.features.has(e)}}class L{static defaultProps={id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,onError:e=>s.log.error(e.message)(),_reuseDevices:!1,_requestMaxLimits:!0,_factoryDestroyPolicy:"unused",_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_resourceDefaults:{},webgl:{},debug:s.log.get("debug")||void 0,debugShaders:s.log.get("debug-shaders")||void 0,debugFramebuffers:!!s.log.get("debug-framebuffers"),debugWebGL:!!s.log.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_handle:void 0};get[Symbol.toStringTag](){return"Device"}constructor(e){this.props={...L.defaultProps,...e},this.id=this.props.id||(0,o.uid)(this[Symbol.toStringTag].toLowerCase())}id;props;userData={};statsManager=n.lumaStats;timestamp=0;_reused=!1;_lumaData={};getTextureFormatCapabilities(e){let t,r,i,n,s,o,a,l=(t=S(e),r={format:e,create:t.f??!0,render:t.render??!0,filter:t.filter??!0,blend:t.blend??!0,store:t.store??!0},i=N(e),n=e.startsWith("depth")||e.startsWith("stencil"),s=i?.signed,o=i?.integer,a=i?.webgl,r.render&&=!s,r.filter&&=!n&&!s&&!o&&!a,r),c=e=>("string"==typeof e?this.features.has(e):e)??!0,u=c(l.create),h={format:e,create:u,render:u&&c(l.render),filter:u&&c(l.filter),blend:u&&c(l.blend),store:u&&c(l.store)};return this._getDeviceSpecificTextureFormatCapabilities(h)}isTextureFormatSupported(e,t){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return v(e)}loseDevice(){return!1}reportError(e){this.props.onError(e)}getDefaultCanvasContext(){if(!this.canvasContext)throw Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createCommandEncoder(e={}){throw Error("not implemented")}incrementTimestamp(){return this.timestamp++}onError(e){this.props.onError(e)}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,t){throw Error("not implemented")}readPixelsToBufferWebGL(e,t){throw Error("not implemented")}setParametersWebGL(e){throw Error("not implemented")}getParametersWebGL(e){throw Error("not implemented")}withParametersWebGL(e,t){throw Error("not implemented")}clearWebGL(e){throw Error("not implemented")}resetWebGL(){throw Error("not implemented")}static _getCanvasContextProps(e){return!0===e.createCanvasContext?{}:e.createCanvasContext}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});let t={...e};return(e.usage||0)&a.Buffer.INDEX&&!e.indexType&&(e.data instanceof Uint32Array?t.indexType="uint32":e.data instanceof Uint16Array?t.indexType="uint16":s.log.warn("indices buffer content must be of integer type")()),t}}e.s(["Device",0,L,"DeviceFeatures",0,y,"DeviceLimits",0,I],263739);let P={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,35725:null,36006:null,36007:null,34229:null,34964:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32926:!1,32928:!1,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:0xffffffff,36005:0xffffffff,2962:519,2967:0,2963:0xffffffff,34816:519,36003:0,36004:0xffffffff,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],36389:null,36662:null,36663:null,35053:null,35055:null,35723:4352,36010:null,35977:!1,3333:4,3317:4,37440:!1,37441:!1,37443:37444,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},D=(e,t,r)=>t?e.enable(r):e.disable(r),F=(e,t,r)=>e.hint(r,t),x=(e,t,r)=>e.pixelStorei(r,t),B=(e,t,r)=>e.bindFramebuffer(36006===r?36009:36008,t),w=(e,t,r)=>{e.bindBuffer({34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[r],t)};function U(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}let G={3042:D,32773:(e,t)=>
982e.blendColor(...t),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(e,t)=>e.clearColor(...t),3107:(e,t)=>e.colorMask(...t),2884:D,2885:(e,t)=>e.cullFace(t),2929:D,2931:(e,t)=>e.clearDepth(t),2932:(e,t)=>e.depthFunc(t),2928:(e,t)=>e.depthRange(...t),2930:(e,t)=>e.depthMask(t),3024:D,35723:F,35725:(e,t)=>e.useProgram(t),36007:(e,t)=>e.bindRenderbuffer(36161,t),36389:(e,t)=>e.bindTransformFeedback?.(36386,t),34229:(e,t)=>e.bindVertexArray(t),36006:B,36010:B,34964:w,36662:w,36663:w,35053:w,35055:w,2886:(e,t)=>e.frontFace(t),33170:F,2849:(e,t)=>e.lineWidth(t),32823:D,32824:"polygonOffset",10752:"polygonOffset",35977:D,32926:D,32928:D,32938:"sampleCoverage",32939:"sampleCoverage",3089:D,3088:(e,t)=>e.scissor(...t),2960:D,2961:(e,t)=>e.clearStencil(t),2968:(e,t)=>e.stencilMaskSeparate(1028,t),36005:(e,t)=>e.stencilMaskSeparate(1029,t),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(e,t)=>e.viewport(...t),34383:D,10754:D,12288:D,12289:D,12290:D,12291:D,12292:D,12293:D,12294:D,12295:D,3333:x,3317:x,37440:x,37441:x,37443:x,3330:x,3332:x,3331:x,3314:x,32878:x,3316:x,3315:x,32877:x,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{e.blendEquationSeparate(..."number"==typeof t?[t,t]:t)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>
982e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(t[0],t[1]||!1),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{let[r,i]=t=U(t)?t:[t,t];e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,i)},stencilFunc:(e,t)=>{let[r,i,n,s,o,a]=t=U(t)&&3===t.length?[...t,...t]:t;e.stencilFuncSeparate(1028,r,i,n),e.stencilFuncSeparate(1029,s,o,a)},stencilOp:(e,t)=>{let[r,i,n,s,o,a]=t=U(t)&&3===t.length?[...t,...t]:t;e.stencilOpSeparate(1028,r,i,n),e.stencilOpSeparate(1029,s,o,a)},viewport:(e,t)=>e.viewport(...t)};function k(e,t,r){return void 0!==t[e]?t[e]:r[e]}let W={blendEquation:(e,t,r)=>e.blendEquationSeparate(k(32777,t,r),k(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(k(32969,t,r),k(32968,t,r),k(32971,t,r),k(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(k(32824,t,r),k(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(k(32938,t,r),k(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,k(2962,t,r),k(2967,t,r),k(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,k(34816,t,r),k(36003,t,r),k(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,k(2964,t,r),k(2965,t,r),k(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,k(34817,t,r),k(34818,t,r),k(34819,t,r))},j={enable:(e,t)=>
982e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({35725:t}),bindRenderbuffer:(e,t,r)=>e({36007:r}),bindTransformFeedback:(e,t,r)=>e({36389:r}),bindVertexArray:(e,t)=>e({34229:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({36006:r,36010:r});case 36009:return e({36006:r});case 36008:return e({36010:r});default:return null}},bindBuffer:(e,t,r)=>{let i={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[t];return i?e({[i]:r}):{valueChanged:!0}},blendColor:(e,t,r,i,n)=>e({32773:new Float32Array([t,r,i,n])}),blendEquation:(e,t)=>e({32777:t,34877:t}),blendEquationSeparate:(e,t,r)=>e({32777:t,34877:r}),blendFunc:(e,t,r)=>e({32969:t,32968:r,32971:t,32970:r}),blendFuncSeparate:(e,t,r,i,n)=>e({32969:t,32968:r,32971:i,32970:n}),clearColor:(e,t,r,i,n)=>e({3106:new Float32Array([t,r,i,n])}),clearDepth:(e,t)=>e({2931:t}),clearStencil:(e,t)=>e({2961:t}),colorMask:(e,t,r,i,n)=>e({3107:[t,r,i,n]}),cullFace:(e,t)=>e({2885:t}),depthFunc:(e,t)=>e({2932:t}),depthRange:(e,t,r)=>e({2928:new Float32Array([t,r])}),depthMask:(e,t)=>e({2930:t}),frontFace:(e,t)=>e({2886:t}),lineWidth:(e,t)=>e({2849:t}),polygonOffset:(e,t,r)=>e({32824:t,10752:r}),sampleCoverage:(e,t,r)=>e({32938:t,32939:r}),scissor:(e,t,r,i,n)=>e({3088:new Int32Array([t,r,i,n])}),stencilMask:(e,t)=>e({2968:t,36005:t}),stencilMaskSeparate:(e,t,r)=>e({[1028===t?2968:36005]:r}),stencilFunc:(e,t,r,i)=>e({2962:t,2967:r,2963:i,34816:t,36003:r,36004:i}),stencilFuncSeparate:(e,t,r,i,n)=>e({[1028===t?2962:34816]:r,[1028===t?2967:36003]:i,[1028===t?2963:36004]:n}),stencilOp:(e,t,r,i)=>e({2964:t,2965:r,2966:i,34817:t,34818:r,34819:i}),stencilOpSeparate:(e,t,r,i,n)=>e({[1028===t?2964:34817]:r,[1028===t?2965:34818]:i,[1028===t?2966:34819]:n}),viewport:(e,t,r,i,n)=>e({2978:[t,r,i,n]})},H=(e,t)=>e.isEnabled(t),X={3042:H,2884:H,2929:H,3024:H,32823:H,32926:H,32928:H,3089:H,2960:H,35977:H},V=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function z(e,t){if(function(e){for(let t in e)return!1;return!0}(t))return;let r={};for(let i in t){let n=Number(i),s=G[i];s&&("string"==typeof s?r[s]=!0:s(e,t[i],n))}let i=e.state&&e.state.cache;if(i)for(let n in r)(0,W[n])(e,t,i)}function Y(e,t=P){if("number"==typeof t){let r=X[t];return r?r(e,t):e.getParameter(t)}let r=Array.isArray(t)?t:Object.keys(t),i={};for(let t of r){let r=X[t];i[t]=r?r(e,Number(t)):e.getParameter(Number(t))}return i}class ${static get(e){return e.state}gl;program=null;stateStack=[];enable=!0;cache=null;log;initialized=!1;constructor(e,t){this.gl=e,this.log=t?.log||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(e={}){this.stateStack.push({})}pop(){let e=this.stateStack[this.stateStack.length-1];z(this.gl,e),this.stateStack.pop()}trackState(e,t){var r;let i;if(this.cache=t.copyState?Y(e):Object.assign({},P),this.initialized)throw Error("WebGLStateTracker");for(let t in this.initialized=!0,this.gl.state=this,i=(r=e).useProgram.bind(r),r.useProgram=function(e){let t=$.get(r);t.program!==e&&(i(e),t.program=e)},j){let r=j[t];!function(e,t,r){if(!e[t])return;let i=e[t].bind(e);e[t]=function(...t){let{valueChanged:n,oldValue:s}=r($.get(e)._updateCache,...t);return n&&i(...t),s}
982,Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}(e,t,r)}K(e,"getParameter"),K(e,"isEnabled")}_updateCache(e){let t,r=!1,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let n in e){let s=e[n],o=this.cache[n];!function(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),i=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&i&&e.length===t.length){for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}return!1}(s,o)&&(r=!0,t=o,!i||n in i||(i[n]=o),this.cache[n]=s)}return{valueChanged:r,oldValue:t}}}function K(e,t){let r=e[t].bind(e);e[t]=function(t){if(void 0===t||V.has(t))return r(t);let i=$.get(e);return t in i.cache||(i.cache[t]=r(t)),i.enable?i.cache[t]:r(t)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function q(e,t,r){return void 0===r[t]&&(r[t]=e.getExtension(t)||null),r[t]}function Z(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Q(e){switch(e){case"uint8":case"unorm8":return 5121;case"sint8":case"snorm8":return 5120;case"uint16":case"unorm16":return 5123;case"sint16":case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw Error(String(e))}let J="WEBGL_compressed_texture_s3tc",ee="WEBGL_compressed_texture_s3tc_srgb",et="EXT_texture_compression_rgtc",er="EXT_texture_compression_bptc",ei="EXT_texture_norm16",en="EXT_render_snorm",es={"float32-renderable-webgl":["EXT_color_buffer_float"],"float16-renderable-webgl":["EXT_color_buffer_half_float"],"rgb9e5ufloat-renderable-webgl":["WEBGL_render_shared_exponent"],"snorm8-renderable-webgl":[en],"norm16-renderable-webgl":[ei],"snorm16-renderable-webgl":[ei,en],"float32-filterable":["OES_texture_float_linear"],"float16-filterable-webgl":["OES_texture_half_float_linear"],"texture-filterable-anisotropic-webgl":["EXT_texture_filter_anisotropic"],"texture-blend-float-webgl":["EXT_float_blend"],"texture-compression-bc":[J,ee,et,er],"texture-compression-bc5-webgl":[et],"texture-compression-bc7-webgl":[er],"texture-compression-etc2":["WEBGL_compressed_texture_etc"],"texture-compression-astc":["WEBGL_compressed_texture_astc"],"texture-compression-etc1-webgl":["WEBGL_compressed_texture_etc1"],"texture-compression-pvrtc-webgl":["WEBGL_compressed_texture_pvrtc"],"texture-compression-atc-webgl":["WEBGL_compressed_texture_atc"]},eo={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0},"r16unorm-webgl":{gl:33322,rb:!0},"r16snorm-webgl":{gl:36760},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0},"rg16unorm-webgl":{gl:33324},"rg16snorm-webgl":{gl:36761},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326},rgb9e5ufloat:{gl:35901},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},"rgb10a2uint-webgl":{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852},"rgb16snorm-webgl":{gl:36762},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842},"rgba16unorm-webgl":{gl:32859,rb:!0},"rgba16snorm-webgl":{gl:36763},"rgb32float-webgl":{gl:34837,x:"EXT_color_buffer_float",dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0}
982,"bc1-rgb-unorm-webgl":{gl:33776,x:J},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:ee},"bc1-rgba-unorm":{gl:33777,x:J},"bc1-rgba-unorm-srgb":{gl:35916,x:ee},"bc2-rgba-unorm":{gl:33778,x:J},"bc2-rgba-unorm-srgb":{gl:35918,x:ee},"bc3-rgba-unorm":{gl:33779,x:J},"bc3-rgba-unorm-srgb":{gl:35919,x:ee},"bc4-r-unorm":{gl:36283,x:et},"bc4-r-snorm":{gl:36284,x:et},"bc5-rg-unorm":{gl:36285,x:et},"bc5-rg-snorm":{gl:36286,x:et},"bc6h-rgb-ufloat":{gl:36495,x:er},"bc6h-rgb-float":{gl:36494,x:er},"bc7-rgba-unorm":{gl:36492,x:er},"bc7-rgba-unorm-srgb":{gl:36493,x:er},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37819},"astc-10x5-unorm-srgb":{gl:37851},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rbg2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function ea(e){let t=eo[e],r=function(e){let t=eo[e],r=t?.gl;if(void 0===r)throw Error(`Unsupported texture format ${e}`);return r}(e),i=N(e);return{internalFormat:r,format:t?.dataFormat||function(e,t,r,i){if(6408===i||6407===i)return i;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;case"bgra":throw Error("bgra pixels not supported by WebGL");default:return 6408}}(i.channels,i.integer,i.normalized,r),type:i.dataType?Q(i.dataType):t?.types?.[0]||5121,compressed:i.compressed||!1}}let el={"depth-clip-control":"EXT_depth_clamp","timer-query-webgl":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"};class ec extends y{gl;extensions;testedFeatures=new Set;constructor(e,t,r){super([],r),this.gl=e,this.extensions=t,q(e,"EXT_color_buffer_float",t)}*[Symbol.iterator](){for(let e of this.getFeatures())this.has(e)&&(yield e);return[]}has(e){if(this.disabledFeatures?.[e])return!1;if(!this.testedFeatures.has(e)){var t,r;this.testedFeatures.add(e),e in es&&(t=this.gl,r=this.extensions,(es[e]||[]).every(e=>q(t,e,r)))&&this.features.add(e),this.getWebGLFeature(e)&&this.features.add(e)}return this.features.has(e)}initializeFeatures(){for(let e of this.getFeatures().filter(e=>"polygon-mode-webgl"!==e))this.has(e)}getFeatures(){return[...Object.keys(el),...Object.keys(es)]}getWebGLFeature(e){let t=el[e];return"string"==typeof t?!!q(this.gl,t,this.extensions):!!t}}class eu extends I{get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderComponents(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}gl;limits={};constructor(e){super(),this.gl=e}getParameter(e){return void 0===this.limits[e]&&(this.limits[e]=this.gl.getParameter(e)),this.limits[e]||0}}var eh=e.i(113158);class ef{static defaultProps={canvas:null,width:800,height:600,useDevicePixels:!0,autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb"};id;props;canvas;htmlCanvas;offscreenCanvas;type;width=1;height=1;resizeObserver;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};toString(){return`${this[Symbol.toStringTag]}(${this.id})`}constructor(e){if(this.props={...ef.defaultProps,...e},e=this.props,!(0,eh.isBrowser)()){this.id="node-canvas-context",this.type="node",this.width=this.props.width,this.height=this.props.height,this.canvas=null;return}if(e.canvas)"string"==typeof e.canvas?this.canvas=function(e){let t=document.getElementById(e);if(!(t instanceof HTMLCanvasElement))throw Error("Object is not a canvas element");return t}(e.canvas):this.canvas=e.canvas;else{const t=function(e){let{width:t,height:r}=e,i=document.createElement("canvas");return i.id=(0,o.uid)("lumagl-auto-created-canvas"),i.width=t||1,i.height=r||1,i.style.width=Number.isFinite(t)?`${t}px`:"100%",i.style.height=Number.isFinite(r)?`${r}px`:"100%",i}(e),r=function(e){if("string"==typeof e){let t=document.getElementById(e);if(!t)throw Error(`${e} is not an HTML element`);return t}return e||document.body}(e?.container||null);r.insertBefore(t,r.firstChild),this.canvas=t,e?.visible||(this.canvas.style.visibility="hidden")}this.canvas instanceof HTMLCanvasElement?(this.id=this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):(this.id="offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas),this.canvas instanceof HTMLCanvasElement&&e.autoResize&&(this.resizeObserver=new ResizeObserver(e=>{for(let t of e)t.target===this.canvas&&this.update()}),this.resizeObserver.observe(this.canvas))}getDevicePixelRatio(e){return"u">typeof OffscreenCanvas&&this.canvas instanceof OffscreenCanvas||!(e=void 0===e?this.props.useDevicePixels:e)||e<=0?1:!0===e?"u">typeof window&&window.devicePixelRatio||1:e}getPixelSize(){switch(this.type){case"node":return[this.width,this.height];case"offscreen-canvas":return[this.canvas.width,this.canvas.height];case"html-canvas":let e=this.getDevicePixelRatio(),t=this.canvas;return t.parentElement?[t.clientWidth*e,t.clientHeight*e]:[this.canvas.width,this.canvas.height];
982default:throw Error(this.type)}}getAspect(){let[e,t]=this.getPixelSize();return e/t}cssToDeviceRatio(){try{let[e]=this.getDrawingBufferSize(),t=this._canvasSizeInfo.clientWidth||this.htmlCanvas?.clientWidth;return t?e/t:1}catch{return 1}}cssToDevicePixels(e,t=!0){var r,i,n,s,o;let a,l,c,u,h,f=this.cssToDeviceRatio(),[_,d]=this.getDrawingBufferSize();return r=e,i=f,n=_,s=d,o=t,l=e_(r[0],i,n),c=ed(r[1],i,s,o),h=(u=e_(r[0]+1,i,n))===n-1?u:u-1,u=ed(r[1]+1,i,s,o),o?(u=0===u?u:u+1,a=c,c=u):a=u===s-1?u:u-1,{x:l,y:c,width:Math.max(h-l+1,1),height:Math.max(a-c+1,1)}}setDevicePixelRatio(e,t={}){if(!this.htmlCanvas)return;let r="width"in t?t.width:this.htmlCanvas.clientWidth,i="height"in t?t.height:this.htmlCanvas.clientHeight;r&&i||(s.log.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,r=this.htmlCanvas.width||1,i=this.htmlCanvas.height||1);let n=this._canvasSizeInfo;if(n.clientWidth!==r||n.clientHeight!==i||n.devicePixelRatio!==e){let t=e,n=Math.floor(r*t),o=Math.floor(i*t);if(this.htmlCanvas.width=n,this.htmlCanvas.height=o,this.device.gl){let[a,l]=this.getDrawingBufferSize();(a!==n||l!==o)&&(t=Math.min(a/r,l/i),this.htmlCanvas.width=Math.floor(r*t),this.htmlCanvas.height=Math.floor(i*t),s.log.warn("Device pixel ratio clamped")()),this._canvasSizeInfo.clientWidth=r,this._canvasSizeInfo.clientHeight=i,this._canvasSizeInfo.devicePixelRatio=e}}}getDrawingBufferSize(){let e=this.device.gl;return e?[e.drawingBufferWidth,e.drawingBufferHeight]:this.getPixelSize()}_setAutoCreatedCanvasId(e){this.htmlCanvas?.id==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}}function e_(e,t,r){return Math.min(Math.round(e*t),r-1)}function ed(e,t,r,i){return i?Math.max(0,r-1-Math.round(e*t)):Math.min(Math.round(e*t),r-1)}var eE=e.i(374612),ep=eE;class eg extends ep.Resource{static COPY_SRC=1;static COPY_DST=2;static TEXTURE=4;static STORAGE=8;static RENDER_ATTACHMENT=16;static CubeFaces=["+X","-X","+Y","-Y","+Z","-Z"];static defaultProps={...ep.Resource.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",width:void 0,height:void 0,depth:1,mipmaps:!1,compressed:!1,usage:0,mipLevels:void 0,samples:void 0,sampler:{},view:void 0,flipY:void 0};get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}dimension;format;width;height;depth;mipLevels;updateTimestamp;constructor(e,t){if(t=eg.normalizeProps(e,t),super(e,t,eg.defaultProps),this.dimension=this.props.dimension,this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,void 0===this.props.width||void 0===this.props.height){const e=eg.getTextureDataSize(this.props.data);this.width=e?.width||1,this.height=e?.height||1}this.props.mipmaps&&void 0===this.props.mipLevels&&(this.props.mipLevels="pyramid"),this.mipLevels="pyramid"===this.props.mipLevels?eg.getMipLevelCount(this.width,this.height):this.props.mipLevels||1,this.updateTimestamp=e.incrementTimestamp()}clone(e){return this.device.createTexture({...this.props,...e})}static isExternalImage(e){return"u">typeof ImageData&&e instanceof ImageData||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLVideoElement&&e instanceof HTMLVideoElement||"u">typeof VideoFrame&&e instanceof VideoFrame||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas}static getExternalImageSize(e){if("u">typeof ImageData&&e instanceof ImageData||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return{width:e.width,height:e.height};if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement)return{width:e.naturalWidth,height:e.naturalHeight};if("u">typeof HTMLVideoElement&&e instanceof HTMLVideoElement)return{width:e.videoWidth,height:e.videoHeight};if("u">typeof VideoFrame&&e instanceof VideoFrame)return{width:e.displayWidth,height:e.displayHeight};throw Error("Unknown image type")}static isTextureLevelData(e){return ArrayBuffer.isView(e?.data)}static getTextureDataSize(e){if(!e||ArrayBuffer.isView(e))return null;if(Array.isArray(e))return eg.getTextureDataSize(e[0]);if(eg.isExternalImage(e))return eg.getExternalImageSize(e);if(e&&"object"==typeof e&&e.constructor===Object){let t=Object.values(e)[0];return{width:t.width,height:t.height}}throw Error("texture size deduction failed")}static normalizeTextureData(e,t){return ArrayBuffer.isView(e)?[{data:e,width:t.width,height:t.height}]:Array.isArray(e)?e:[e]}static getMipLevelCount(e,t){return Math.floor(Math.log2(Math.max(e,t)))+1}static getCubeFaceDepth(e){switch(e){case"+X":return 0;case"-X":return 1;case"+Y":return 2;case"-Y":return 3;case"+Z":return 4;case"-Z":return 5;default:throw Error(e)}}static defaultCopyExternalImageOptions={image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1};static normalizeProps(e,t){let r={...t};Object.assign(r,e?.props?._resourceDefaults?.texture||{});let{width:i,height:n}=r;return"number"==typeof i&&(r.width=Math.max(1,Math.ceil(i))),"number"==typeof n&&(r.height=Math.max(1,Math.ceil(n))),r}}e.s(["Texture",0,eg],878144);class em extends eE.Resource{static defaultProps={...eE.Resource.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null};get[Symbol.toStringTag](){return"Framebuffer"}width;height;constructor(e,t={}){super(e,t,em.defaultProps),this.width=this.props.width,this.height=this.props.height}clone(e){let t=this.colorAttachments.map(t=>t.texture.clone(e)),r=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(e);return this.device.createFramebuffer({...this.props,colorAttachments:t,depthStencilAttachment:r})}resize(e){let t=!e;if(e){let[r,i]=Array.isArray(e)?e:[e.width,e.height];t=t||i!==this.height||r!==this.width,this.width=r,this.height=i}t&&(s.log.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(0===this.props.colorAttachments.length&&!this.props.depthStencilAttachment)throw Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((e,t)=>{if("string"==typeof e){let r=this.createColorTexture(e,t);return this.attachResource(r),r.view}return e instanceof eg?e.view:e});let e=this.props.depthStencilAttachment;if(e)if("string"==typeof e){let t=this.createDepthStencilTexture(e);this.attachResource(t),this.depthStencilAttachment=t.view}else e instanceof eg?this.depthStencilAttachment=e.view:this.depthStencilAttachment=e}createColorTexture(e,t){return this.device.createTexture({id:`${this.id}-color-attachment-${t}`,usage:eg.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(e){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:eg.RENDER_ATTACHMENT,format:e,width:this.width,height:this.height,mipmaps:!1})}resizeAttachments(e,t){for(let r=0;r<this.colorAttachments.length;++r)if(this.colorAttachments[r]){let i=this.colorAttachments[r].texture.clone({width:e,height:t});this.destroyAttachedResource(this.colorAttachments[r]),this.colorAttachments[r]=i.view,this.attachResource(i.view)}if(this.depthStencilAttachment){let r=this.depthStencilAttachment.texture.clone({width:e,height:t});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=r.view,this.attachResource(r)}this.updateAttachments()}}class eT extends em{device;gl;handle;colorAttachments=[];depthStencilAttachment=null;constructor(e,t){super(e,t);const r=null===t.handle;this.device=e,this.gl=e.gl,this.handle=this.props.handle||r?this.props.handle:this.gl.createFramebuffer(),r||(e.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.updateAttachments())}destroy(){super.destroy(),this.destroyed||null===this.handle||this.gl.deleteFramebuffer(this.handle)}updateAttachments(){let e=this.gl.bindFramebuffer(36160,this.handle);for(let e=0;e<this.colorAttachments.length;++e){let t=this.colorAttachments[e];if(t){let r=36064+e;this._attachTextureView(r,t)}}if(this.depthStencilAttachment){let e=function(e){switch(N(e).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw Error(`Not a depth stencil format: ${e}`)}}(this.depthStencilAttachment.props.format);this._attachTextureView(e,this.depthStencilAttachment)}if(this.device.props.debug){let e=this.gl.checkFramebufferStatus(36160);if(36053!==e)throw Error(`Framebuffer ${function(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}(e)}`)}this.gl.bindFramebuffer(36160,e)}_attachTextureView(e,t){let{gl:r}=this.device,{texture:i}=t,n=t.props.baseMipLevel,s=t.props.baseArrayLayer;switch(r.bindTexture(i.glTarget,i.handle),i.glTarget){case 35866:case 32879:r.framebufferTextureLayer(36160,e,i.handle,n,s);break;case 34067:var o;let a=(o=s)<34069?o+34069:o;r.framebufferTexture2D(36160,e,a,i.handle,n);break;case 3553:r.framebufferTexture2D(36160,e,3553,i.handle,n);break;default:throw Error("Illegal texture type")}r.bindTexture(i.glTarget,null)}}class eA extends ef{device;format="rgba8unorm";depthStencilFormat="depth24plus";presentationSize;_framebuffer=null;get[Symbol.toStringTag](){return"WebGLCanvasContext"}constructor(e,t){super(t),this.device=e,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new eT(this.device,{handle:null}),this._framebuffer}update(){let e=this.getPixelSize();(e[0]!==this.presentationSize[0]||e[1]!==this.presentationSize[1])&&(this.presentationSize=e,this.resize())}resize(e){if(this.device.gl&&this.canvas){let t=this.getDevicePixelRatio(e?.useDevicePixels);this.setDevicePixelRatio(t,e);return}}commit(){}}async function eR(e,t){let r=document.getElementsByTagName("head")[0];if(!r)throw Error("loadScript");let i=document.createElement("script");return i.setAttribute("type","text/javascript"),i.setAttribute("src",e),t&&(i.id=t),new Promise((t,n)=>{i.onload=t,i.onerror=t=>n(Error(`Unable to load script '${e}': ${t}`)),r.appendChild(i)})}let eb=null,eS=!1,eM={debugSpectorJS:s.log.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js",gl:void 0};async function eC(e){if(!globalThis.SPECTOR)try{await eR(e.debugSpectorJSUrl||eM.debugSpectorJSUrl)}catch(e){s.log.warn(String(e))}}function eO(e){if(!(e={...eM,...e}).debugSpectorJS)return null;if(!eb&&globalThis.SPECTOR&&!globalThis.luma?.spector){s.log.probe(1,"SPECTOR foun
982d and initialized. Start with `luma.spector.displayUI()`")();let{Spector:e}=globalThis.SPECTOR;eb=new e,globalThis.luma&&(globalThis.luma.spector=eb)}if(!eb)return null;if(eS||(eS=!0,eb.spyCanvases(),eb?.onCaptureStarted.add(e=>s.log.info("Spector capture started:",e)()),eb?.onCapture.add(e=>{s.log.info("Spector capture complete:",e)(),eb?.getResultUI(),eb?.resultView.display(),eb?.resultView.addCapture(e)})),e.gl){let t=e.gl,r=t.device;eb?.startCapture(e.gl,500),t.device=r,new Promise(e=>setTimeout(e,2e3)).then(e=>{s.log.info("Spector capture stopped after 2 seconds")(),eb?.stopCapture()})}return eb}function ev(e){return e.luma=e.luma||{},e.luma}async function eN(){(0,eh.isBrowser)()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await eR("https://unpkg.com/[email protected]/index.js"))}function eI(e,t={}){var r;let n;return t.debugWebGL||t.traceWebGL?function(e,t){if(!globalThis.WebGLDebugUtils)return s.log.warn("webgl-debug not loaded")(),e;let r=ev(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...i,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,eL.bind(null,t),eP.bind(null,t));for(let e in i)e in n||"number"!=typeof i[e]||(n[e]=i[e]);class o{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);let a=Object.create(o);return r.realContext=e,r.debugContext=a,a.debug=!0,a}(e,t):(n=ev(r=e)).realContext?n.realContext:r}
982function ey(e,t){t=Array.from(t).map(e=>void 0===e?"undefined":e);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function eL(e,t,r,i){i=Array.from(i).map(e=>void 0===e?"undefined":e);let n=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,i),a=`${n} in gl.${r}(${o})`;s.log.error(a)()}function eP(e,t,r){let i="";for(let n of(s.log.level>=1&&(i=ey(t,r),e.traceWebGL&&s.log.log(1,i)()),r))void 0===n&&(i=i||ey(t,r))}e.s(["DEFAULT_SPECTOR_PROPS",0,eM,"initializeSpectorJS",0,eO,"loadSpectorJS",0,eC],758358),(r=i||(i={}))[r.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",r[r.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",r[r.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r[r.ZERO=0]="ZERO",r[r.ONE=1]="ONE",r[r.SRC_COLOR=768]="SRC_COLOR",r[r.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",r[r.SRC_ALPHA=770]="SRC_ALPHA",r[r.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",r[r.DST_ALPHA=772]="DST_ALPHA",r[r.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",r[r.DST_COLOR=774]="DST_COLOR",r[r.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",r[r.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",r[r.CONSTANT_COLOR=32769]="CONSTANT_COLOR",r[r.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",r[r.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",r[r.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",r[r.FUNC_ADD=32774]="FUNC_ADD",r[r.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",r[r.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",r[r.BLEND_EQUATION=32777]="BLEND_EQUATION",r[r.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",r[r.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",r[r.BLEND_DST_RGB=32968]="BLEND_DST_RGB",r[r.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",r[r.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",r[r.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",r[r.BLEND_COLOR=32773]="BLEND_COLOR",r[r.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",r[r.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",r[r.LINE_WIDTH=2849]="LINE_WIDTH",r[r.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",r[r.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",r[r.CULL_FACE_MODE=2885]="CULL_FACE_MODE",r[r.FRONT_FACE=2886]="FRONT_FACE",r[r.DEPTH_RANGE=2928]="DEPTH_RANGE",r[r.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",r[r.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",r[r.DEPTH_FUNC=2932]="DEPTH_FUNC",r[r.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",r[r.STENCIL_FUNC=2962]="STENCIL_FUNC",r[r.STENCIL_FAIL=2964]="STENCIL_FAIL",r[r.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",r[r.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",r[r.STENCIL_REF=2967]="STENCIL_REF",r[r.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",r[r.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",r[r.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",r[r.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",r[r.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",r[r.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",r[r.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",r[r.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",r[r.VIEWPORT=2978]="VIEWPORT",r[r.SCISSOR_BOX=3088]="SCISSOR_BOX",r[r.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",r[r.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",r[r.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",r[r.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",r[r.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",r[r.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",r[r.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",r[r.RED_BITS=3410]="RED_BITS",r[r.GREEN_BITS=3411]="GREEN_BITS",r[r.BLUE_BITS=3412]="BLUE_BITS",r[r.ALPHA_BITS=3413]="ALPHA_BITS",r[r.DEPTH_BITS=3414]="DEPTH_BITS",r[r.STENCIL_BITS=3415]="STENCIL_BITS",r[r.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",r[r.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",r[r.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",r[r.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",r[r.SAMPLES=32937]="SAMPLES",r[r.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",r[r.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",r[r.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",r[r.VENDOR=7936]="VENDOR",r[r.RENDERER=7937]="RENDERER",r[r.VERSION=7938]="VERSION",r[r.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",r[r.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",r[r.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",r[r.STATIC_DRAW=35044]="STATIC_DRAW",r[r.STREAM_DRAW=35040]="STREAM_DRAW",r[r.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.BUFFER_SIZE=34660]="BUFFER_SIZE",r[r.BUFFER_USAGE=34661]="BUFFER_USAGE",r[r.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",r[r.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",r[r.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",r[r.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",r[r.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",r[r.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",r[r.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",r[r.CULL_FACE=2884]="CULL_FACE",r[r.FRONT=1028]="FRONT",r[r.BACK=1029]="BACK",r[r.FRONT_AND_BACK=1032]="FRONT_AND_BACK",r[r.BLEND=3042]="BLEND",r[r.DEPTH_TEST=2929]="DEPTH_TEST",r[r.DITHER=3024]="DITHER",r[r.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",r[r.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",r[r.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",r[r.SCISSOR_TEST=3089]="SCISSOR_TEST",r[r.STENCIL_TEST=2960]="STENCIL_TEST",r[r.NO_ERROR=0]="NO_ERROR",r[r.INVALID_ENUM=1280]="INVALID_ENUM",r[r.INVALID_VALUE=1281]="INVALID_VALUE",r[r.INVALID_OPERATION=1282]="INVALID_OPERATION",r[r.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",r[r.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",r[r.CW=2304]="CW",r[r.CCW=2305]="CCW",r[r.DONT_CARE=4352]="DONT_CARE",r[r.FASTEST=4353]="FASTEST",r[r.NICEST=4354]="NICEST",r[r.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",r[r.BYTE=5120]="BYTE",r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.SHORT=5122]="SHORT",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.INT=5124]="INT",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.FLOAT=5126]="FLOAT",r[r.DOUBLE=5130]="DOUBLE",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.ALPHA=6406]="ALPHA",r[r.RGB=6407]="RGB",r[r.RGBA=6408]="RGBA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",r[r.VERTEX_SHADER=35633]="VERTEX_SHADER",r[r.COMPILE_STATUS=35713]="COMPILE_STATUS",r[r.DELETE_STATUS=35712]="DELETE_STATUS",r[r.LINK_STATUS=35714]="LINK_STATUS",r[r.VALIDATE_STATUS=35715]="VALIDATE_STATUS",r[r.ATTACHED_
982SHADERS=35717]="ATTACHED_SHADERS",r[r.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",r[r.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",r[r.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",r[r.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",r[r.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",r[r.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",r[r.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",r[r.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",r[r.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",r[r.SHADER_TYPE=35663]="SHADER_TYPE",r[r.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",r[r.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",r[r.NEVER=512]="NEVER",r[r.LESS=513]="LESS",r[r.EQUAL=514]="EQUAL",r[r.LEQUAL=515]="LEQUAL",r[r.GREATER=516]="GREATER",r[r.NOTEQUAL=517]="NOTEQUAL",r[r.GEQUAL=518]="GEQUAL",r[r.ALWAYS=519]="ALWAYS",r[r.KEEP=7680]="KEEP",r[r.REPLACE=7681]="REPLACE",r[r.INCR=7682]="INCR",r[r.DECR=7683]="DECR",r[r.INVERT=5386]="INVERT",r[r.INCR_WRAP=34055]="INCR_WRAP",r[r.DECR_WRAP=34056]="DECR_WRAP",r[r.NEAREST=9728]="NEAREST",r[r.LINEAR=9729]="LINEAR",r[r.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",r[r.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",r[r.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",r[r.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",r[r.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",r[r.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",r[r.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",r[r.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE=5890]="TEXTURE",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r[r.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",r[r.TEXTURE0=33984]="TEXTURE0",r[r.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",r[r.REPEAT=10497]="REPEAT",r[r.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r[r.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",r[r.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",r[r.FLOAT_VEC2=35664]="FLOAT_VEC2",r[r.FLOAT_VEC3=35665]="FLOAT_VEC3",r[r.FLOAT_VEC4=35666]="FLOAT_VEC4",r[r.INT_VEC2=35667]="INT_VEC2",r[r.INT_VEC3=35668]="INT_VEC3",r[r.INT_VEC4=35669]="INT_VEC4",r[r.BOOL=35670]="BOOL",r[r.BOOL_VEC2=35671]="BOOL_VEC2",r[r.BOOL_VEC3=35672]="BOOL_VEC3",r[r.BOOL_VEC4=35673]="BOOL_VEC4",r[r.FLOAT_MAT2=35674]="FLOAT_MAT2",r[r.FLOAT_MAT3=35675]="FLOAT_MAT3",r[r.FLOAT_MAT4=35676]="FLOAT_MAT4",r[r.SAMPLER_2D=35678]="SAMPLER_2D",r[r.SAMPLER_CUBE=35680]="SAMPLER_CUBE",r[r.LOW_FLOAT=36336]="LOW_FLOAT",r[r.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",r[r.HIGH_FLOAT=36338]="HIGH_FLOAT",r[r.LOW_INT=36339]="LOW_INT",r[r.MEDIUM_INT=36340]="MEDIUM_INT",r[r.HIGH_INT=36341]="HIGH_INT",r[r.FRAMEBUFFER=36160]="FRAMEBUFFER",r[r.RENDERBUFFER=36161]="RENDERBUFFER",r[r.RGBA4=32854]="RGBA4",r[r.RGB5_A1=32855]="RGB5_A1",r[r.RGB565=36194]="RGB565",r[r.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",r[r.STENCIL_INDEX=6401]="STENCIL_INDEX",r[r.STENCIL_INDEX8=36168]="STENCIL_INDEX8",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r[r.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",r[r.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",r[r.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",r[r.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",r[r.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",r[r.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",r[r.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",r[r.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",r[r.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_OBJ
982ECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",r[r.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",r[r.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",r[r.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",r[r.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",r[r.NONE=0]="NONE",r[r.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",r[r.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",r[r.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",r[r.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",r[r.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",r[r.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",r[r.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",r[r.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",r[r.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",r[r.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",r[r.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",r[r.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",r[r.READ_BUFFER=3074]="READ_BUFFER",r[r.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",r[r.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",r[r.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",r[r.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",r[r.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",r[r.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",r[r.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",r[r.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",r[r.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",r[r.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",r[r.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",r[r.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",r[r.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",r[r.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",r[r.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",r[r.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",r[r.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",r[r.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",r[r.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",r[r.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",r[r.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",r[r.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",r[r.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",r[r.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",r[r.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",r[r.RED=6403]="RED",r[r.RGB8=32849]="RGB8",r[r.RGBA8=32856]="RGBA8",r[r.RGB10_A2=32857]="RGB10_A2",r[r.TEXTURE_3D=32879]="TEXTURE_3D",r[r.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",r[r.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",r[r.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",r[r.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",r[r.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",r[r.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",r[r.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",r[r.SRGB=35904]="SRGB",r[r.SRGB8=35905]="SRGB8",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",r[r.RGBA32F=34836]="RGBA32F",r[r.RGB32F=34837]="RGB32F",r[r.RGBA16F=34842]="RGBA16F",r[r.RGB16F=34843]="RGB16F",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",r[r.R11F_G11F_B10F=35898]="R11F_G11F_B10F",r[r.RGB9_E5=35901]="RGB9_E5",r[r.RGBA32UI=36208]="RGBA32UI",r[r.RGB32UI=36209]="RGB32UI",r[r.RGBA16UI=36214]="RGBA16UI",r[r.RGB16UI=36215]="RGB16UI",r[r.RGBA8UI=36220]="RGBA8UI",r[r.RGB8UI=36221]="RGB8UI",r[r.RGBA32I=36226]="RGBA32I",r[r.RGB32I=36227]="RGB32I",r[r.RGBA16I=36232]="RGBA16I",r[r.RGB16I=36233]="RGB16I",r[r.RGBA8I=36238]="RGBA8I",r[r.RGB8I=36239]="RGB8I",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.R8=33321]="R8",r[r.RG8=33323]="RG8",r[r.R16F=33325]="R16F",r[r.R32F=33326]="R32F",r[r.RG16F=33327]="RG16F",r[r.RG32F=33328]="RG32F",r[r.R8I=33329]="R8I",r[r.R8UI=33330]="R8UI",r[r.R16I=33331]="R16I",r[r.R16UI=33332]="R16UI",r[r.R32I=33333]="R32I",r[r.R32UI=33334]="R32UI",r[r.RG8I=33335]="RG8I",r[r.RG8UI=33336]="RG8UI",r[r.RG16I=33337]="RG16I",r[r.RG16UI=33338]="RG16UI",r[r.RG32I=33339]="RG32I",r[r.RG32UI=33340]="RG32UI",r[r.R8_SNORM=36756]="R8_SNORM",r[r.RG8_SNORM=36757]="RG8_SNORM",r[r.RGB8_SNORM=36758]="RGB8_SNORM",r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGB10_A2UI=36975]="RGB10_A2UI",r[r.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",r[r.TEXTURE_IMMUTABLE_
982LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.HALF_FLOAT=5131]="HALF_FLOAT",r[r.RG=33319]="RG",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",r[r.CURRENT_QUERY=34917]="CURRENT_QUERY",r[r.QUERY_RESULT=34918]="QUERY_RESULT",r[r.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",r[r.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",r[r.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",r[r.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",r[r.DRAW_BUFFER0=34853]="DRAW_BUFFER0",r[r.DRAW_BUFFER1=34854]="DRAW_BUFFER1",r[r.DRAW_BUFFER2=34855]="DRAW_BUFFER2",r[r.DRAW_BUFFER3=34856]="DRAW_BUFFER3",r[r.DRAW_BUFFER4=34857]="DRAW_BUFFER4",r[r.DRAW_BUFFER5=34858]="DRAW_BUFFER5",r[r.DRAW_BUFFER6=34859]="DRAW_BUFFER6",r[r.DRAW_BUFFER7=34860]="DRAW_BUFFER7",r[r.DRAW_BUFFER8=34861]="DRAW_BUFFER8",r[r.DRAW_BUFFER9=34862]="DRAW_BUFFER9",r[r.DRAW_BUFFER10=34863]="DRAW_BUFFER10",r[r.DRAW_BUFFER11=34864]="DRAW_BUFFER11",r[r.DRAW_BUFFER12=34865]="DRAW_BUFFER12",r[r.DRAW_BUFFER13=34866]="DRAW_BUFFER13",r[r.DRAW_BUFFER14=34867]="DRAW_BUFFER14",r[r.DRAW_BUFFER15=34868]="DRAW_BUFFER15",r[r.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",r[r.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",r[r.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",r[r.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",r[r.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",r[r.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",r[r.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",r[r.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",r[r.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",r[r.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",r[r.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",r[r.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",r[r.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",r[r.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",r[r.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",r[r.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",r[r.SAMPLER_3D=35679]="SAMPLER_3D",r[r.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",r[r.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",r[r.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",r[r.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",r[r.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",r[r.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",r[r.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",r[r.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",r[r.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",r[r.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",r[r.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",r[r.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",r[r.MAX_SAMPLES=36183]="MAX_SAMPLES",r[r.SAMPLER_BINDING=35097]="SAMPLER_BINDING",r[r.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",r[r.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",r[r.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",r[r.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",r[r.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",r[r.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",r[r.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",r[r.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",r[r.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",r[r.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",r[r.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",r[r.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",r[r.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",r[r.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",r[r.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",r[r.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",r[r.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",r[r.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",r[r.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",r[r.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",r[r.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",r[r.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",r[r.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",r[r.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",r[r.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",r[r.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",r[r.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",r[r.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",r[r.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",r[r.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",r[r.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",r[r.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",r[r.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",r[r.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",r[r.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",r[r.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",r[r.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",r[r.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",r[r.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",r[r.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",r[r.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",r[r.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",r[r.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",r[r.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",r[r.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",r[r.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",r[r.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r[r.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",r[r.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",r[r.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",r[r.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",r[r.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",r[r.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",r[r.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",r[r.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",r[r.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",r[r.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",r[r.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",r[r.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",r[r.UNIFORM_TYPE=35383]="UNIFORM_TYPE",r[r.UNIFORM_SIZE=35384]="UNIFORM_SIZE",r[r.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",r[r.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",r[r.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",r[r.UNIFORM_MATRIX_STRI
982DE=35389]="UNIFORM_MATRIX_STRIDE",r[r.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",r[r.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",r[r.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",r[r.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",r[r.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",r[r.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",r[r.OBJECT_TYPE=37138]="OBJECT_TYPE",r[r.SYNC_CONDITION=37139]="SYNC_CONDITION",r[r.SYNC_STATUS=37140]="SYNC_STATUS",r[r.SYNC_FLAGS=37141]="SYNC_FLAGS",r[r.SYNC_FENCE=37142]="SYNC_FENCE",r[r.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",r[r.UNSIGNALED=37144]="UNSIGNALED",r[r.SIGNALED=37145]="SIGNALED",r[r.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",r[r.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",r[r.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",r[r.WAIT_FAILED=37149]="WAIT_FAILED",r[r.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",r[r.COLOR=6144]="COLOR",r[r.DEPTH=6145]="DEPTH",r[r.STENCIL=6146]="STENCIL",r[r.MIN=32775]="MIN",r[r.MAX=32776]="MAX",r[r.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",r[r.STREAM_READ=35041]="STREAM_READ",r[r.STREAM_COPY=35042]="STREAM_COPY",r[r.STATIC_READ=35045]="STATIC_READ",r[r.STATIC_COPY=35046]="STATIC_COPY",r[r.DYNAMIC_READ=35049]="DYNAMIC_READ",r[r.DYNAMIC_COPY=35050]="DYNAMIC_COPY",r[r.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",r[r.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",r[r.INVALID_INDEX=0xffffffff]="INVALID_INDEX",r[r.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",r[r.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",r[r.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",r[r.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",r[r.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",r[r.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",r[r.R16_EXT=33322]="R16_EXT",r[r.RG16_EXT=33324]="RG16_EXT",r[r.RGB16_EXT=32852]="RGB16_EXT",r[r.RGBA16_EXT=32859]="RGBA16_EXT",r[r.R16_SNORM_EXT=36760]="R16_SNORM_EXT",r[r.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",r[r.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",r[r.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",r[r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",r[r.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",r[r.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",r[r.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",r[r.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",r[r.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",r[r.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",r[r.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",r[r.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",r[r.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",r[r.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",r[r.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",r[r.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",r[r.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",r[r.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",r[r.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",r[r.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",r[r.LINE_WEBGL=6913]="LINE_WEBGL",r[r.FILL_WEBGL=6914]="FILL_WEBGL",r[r.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",r[r.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",r[r.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",r[r.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",r[r.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",r[r.CLIP_DISTANCE2_WEBGL=12290]="
982CLIP_DISTANCE2_WEBGL",r[r.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",r[r.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",r[r.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",r[r.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",r[r.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",r[r.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",r[r.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",r[r.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",r[r.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",r[r.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",r[r.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",r[r.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",r[r.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",r[r.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",r[r.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",r[r.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",r[r.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",r[r.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT",e.s(["loadWebGLDeveloperTools",0,eN,"makeDebugContext",0,eI],132158);let eD={};var eF=a;class ex extends eF.Buffer{device;gl;handle;glTarget;glUsage;glIndexType=5123;byteLength;bytesUsed;constructor(e,t={}){super(e,t),this.device=e,this.gl=this.device.gl;const r="object"==typeof t?t.handle:void 0;this.handle=r||this.gl.createBuffer(),e.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=function(e){return e&eF.Buffer.INDEX?34963:e&eF.Buffer.VERTEX?34962:e&eF.Buffer.UNIFORM?35345:34962}(this.props.usage),this.glUsage=function(e){return e&eF.Buffer.INDEX||e&eF.Buffer.VERTEX?35044:e&eF.Buffer.UNIFORM?35048:35044}(this.props.usage),this.glIndexType="uint32"===this.props.indexType?5125:5123,t.data?this._initWithData(t.data,t.byteOffset,t.byteLength):this._initWithByteLength(t.byteLength||0)}_initWithData(e,t=0,r=e.byteLength+t){let i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,r,this.glUsage),this.gl.bufferSubData(i,t,e),this.gl.bindBuffer(i,null),this.bytesUsed=r,this.byteLength=r,this._setDebugData(e,t,r),this.trackAllocatedMemory(r)}_initWithByteLength(e){let t=e;0===e&&(t=new Float32Array(0));let r=this.glTarget;return this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,t,this.glUsage),this.gl.bindBuffer(r,null),this.bytesUsed=e,this.byteLength=e,this._setDebugData(null,0,e),this.trackAllocatedMemory(e),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(e,t=0){this.gl.bindBuffer(36663,this.handle),this.gl.bufferSubData(36663,t,e),this.gl.bindBuffer(36663,null),this._setDebugData(e,t,e.byteLength)}async readAsync(e=0,t){return this.readSyncWebGL(e,t)}readSyncWebGL(e=0,t){let r=new Uint8Array(t=t??this.byteLength-e);return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,r,0,t),this.gl.bindBuffer(36662,null),this._setDebugData(r,e,t),r}}var eB=eE;function ew(e,t,r,i){if(i?.inlineSource){let i=function(e,t){let r="";for(let i=t-2;i<=t;i++){let n=e[i-1];void 0!==n&&(r+=eU(n,t,void 0))}return r}(t,r),n=e.linePos>0?`${" ".repeat(e.linePos+5)}^^^ 983`:"";return` 984${i}${n}${e.type.toUpperCase()}: ${e.message} 985 986`}let n="error"===e.type?"red":"#8B4000";return i?.html?`<div class='luma-compiler-log-error' style="color:${n};"><b> ${e.type.toUpperCase()}: ${e.message}</b></div>`:`${e.type.toUpperCase()}: ${e.message}`}function eU(e,t,r){let i=r?.html?e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"):e;return`${function(e){let t="";for(let r=e.length;r<4;++r)t+=" ";return t+e}(String(t))}: ${i}${r?.html?"<br/>":"\n"}`}class eG extends eB.Resource{static defaultProps={...eB.Resource.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0};get[Symbol.toStringTag](){return"Shader"}stage;source;compilationStatus="pending";constructor(e,t){t={...t,debugShaders:t.debugShaders||e.props.debugShaders||"errors"},super(e,{id:function(e){return ek(e.source)||e.id||(0,o.uid)(`unnamed ${e.stage}-shader`)}(t),...t},eG.defaultProps),this.stage=this.props.stage,this.source=this.props.source}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){let e=this.props.debugShaders;switch(e){case"never":return;case"errors":if("success"===this.compilationStatus)return}let t=await this.getCompilationInfo();("warnings"!==e||t?.length!==0)&&this._displayShaderLog(t)}
986_displayShaderLog(e){if("u"<typeof document||!document?.createElement)return;let t=ek(this.source),r=`${this.stage} ${t}`,i=function(e,t,r){let i="",n=t.split(/\r?\n/),s=e.slice().sort((e,t)=>e.lineNum-t.lineNum);switch(r?.showSourceCode||"no"){case"all":let o=0;for(let e=1;e<=n.length;e++)for(i+=eU(n[e-1],e,r);s.length>o&&s[o].lineNum===e;){let e=s[o++];i+=ew(e,n,e.lineNum,{...r,inlineSource:!1})}return i;case"issues":case"no":for(let t of e)i+=ew(t,n,t.lineNum,{inlineSource:r?.showSourceCode!=="no"});return i}}(e,this.source,{showSourceCode:"all",html:!0}),n=this.getTranslatedSource();n&&(i+=`<br /><br /><h1>Translated Source</h1><br /><br /><code style="user-select:text;"><pre>${n}</pre></code>`);let s=document.createElement("Button");s.innerHTML=` 987<h1>Shader Compilation Error in ${r}</h1><br /><br /> 988<code style="user-select:text;"><pre> 989${i} 990</pre></code>`,s.style.top="10px",s.style.left="10px",s.style.position="absolute",s.style.zIndex="9999",s.style.width="100%",s.style.textAlign="left",document.body.appendChild(s);let o=document.getElementsByClassName("luma-compiler-log-error");o[0]?.scrollIntoView(),s.onclick=()=>{let e=`data:text/plain,${encodeURIComponent(this.source)}`;navigator.clipboard.writeText(e)}}}function ek(e,t="unnamed"){let r=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return r?r[1]:t}function eW(e){let t=e.toLowerCase();return["warning","error","info"].includes(t)?t:"info"}e.s(["Shader",0,eG],956839);class ej extends eG{device;handle;constructor(e,t){switch(super(e,t),this.device=e,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>this.compilationStatus)}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){let e=this.device.gl.getShaderInfoLog(this.handle);return e?function(e){let t=e.split(/\r?\n/),r=[];for(let e of t){if(e.length<=1)continue;let t=e.split(":");if(2===t.length){let[e,i]=t;r.push({message:i.trim(),type:eW(e),lineNum:0,linePos:0});continue}let[i,n,s,...o]=t,a=parseInt(s,10);isNaN(a)&&(a=0);let l=parseInt(n,10);isNaN(l)&&(l=0),r.push({message:o.join(":").trim(),type:eW(i),lineNum:a,linePos:l})}return r}(e):[]}getTranslatedSource(){let e=this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders;return e?.getTranslatedShaderSource(this.handle)||null}async _compile(e){e=e.startsWith("#version ")?e:`#version 300 es 991${e}`;let{gl:t}=this.device;if(t.shaderSource(this.handle,e),t.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),"error"===this.compilationStatus)throw Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}s.log.once(1,"Shader compilation is asynchronous")(),await this._waitForCompilationComplete(),s.log.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()}async _waitForCompilationComplete(){let e=async e=>await new Promise(t=>setTimeout(t,e));if(!this.device.features.has("compilation-status-async-webgl"))return void await e(10);let{gl:t}=this.device;for(;;){if(t.getShaderParameter(this.handle,37297))return;await e(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}var eH=eE;class eX extends eH.Resource{static defaultProps={...eH.Resource.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1};get[Symbol.toStringTag](){return"Sampler"}constructor(e,t){t=eX.normalizeProps(e,t),super(e,t,eX.defaultProps)}static normalizeProps(e,t){let r=e?.props?._resourceDefaults?.sampler||{};return{...t,...r}}}function eV(e,t){return eK(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function ez(e,t){return eK(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function eY(e,t){return eK(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function e$(e,t){return eK(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,"constant-color":32769,"one-minus-constant-color":32770,"constant-alpha":32771,"one-minus-constant-alpha":32772})}function eK(e,t,r){if(!(t in r))throw Error(`Illegal parameter ${t} for ${e}`);return r[t]}function eq(e){let t={};return e.addressModeU&&(t[10242]=eZ(e.addressModeU)),e.addressModeV&&(t[10243]=eZ(e.addressModeV)),e.addressModeW&&(t[32882]=eZ(e.addressModeW)),e.magFilter&&(t[10240]=eQ(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=function(e,t="none"){if(!t)return eQ(e);switch(t){case"none":return eQ(e);case"nearest":return"nearest"===e?9984:9986;case"linear":return"nearest"===e?9985:9987}}(e.minFilter||"linear",e.mipmapFilter)),void 0!==e.lodMinClamp&&(t[33082]=e.lodMinClamp),void 0!==e.lodMaxClamp&&(t[33083]=e.lodMaxClamp),"comparison-sampler"===e.type&&(t[34892]=34894),e.compare&&(t[34893]=eV("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function eZ(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function eQ(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}e.s(["Sampler",0,eX],782212);class eJ extends eX{device;handle;parameters;constructor(e,t){super(e,t),this.device=e,this.parameters=eq(t),this.handle=this.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(e){for(let[t,r]of Object.entries(e)){let e=Number(t);switch(e){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,e,r);break;default:this.device.gl.samplerParameteri(this.handle,e,r)}}}}var e0=eE;class e1 extends e0.Resource{static defaultProps={...e0.Resource.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0};get[Symbol.toStringTag](){return"TextureView"}constructor(e,t){super(e,t,e1.defaultProps)}}e.s(["TextureView",0,e1],139830);class e3 extends e1{device;gl;handle;texture;constructor(e,t){super(e,{...eg.defaultProps,...t}),this.device=e,this.gl=this.device.gl,this.handle=null,this.texture=t.texture}}function e2(e){switch(e){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function e6(e,t,r){let i;if(function(e){for(let t in e)return!1;return!0}(t))return r(e);let{nocatch:n=!0}=t,s=$.get(e);if(s.push(),z(e,t),n)i=r(e),s.pop();else try{i=r(e)}finally{s.pop()}return i}
991function e4(e,t,r,i){let{width:n,height:s}=i,{dimension:o,depth:a=0,mipLevel:l=0}=i,{x:c=0,y:u=0,z:h=0}=i,{glFormat:f,glType:_}=i,d=e5(i.glTarget,o,a);e6(e,i.flipY?{37440:!0}:{},()=>{switch(o){case"2d-array":case"3d":e.bindTexture(d,t),e.texSubImage3D(d,l,c,u,h,n,s,a,f,_,r),e.bindTexture(d,null);break;case"2d":case"cube":e.bindTexture(d,t),e.texSubImage2D(d,l,c,u,n,s,f,_,r),e.bindTexture(d,null);break;default:throw Error(o)}})}function e8(e,t,r){let{dimension:i,width:n,height:s,depth:o=0,mipLevel:a=0,byteOffset:l=0}=r,{x:c=0,y:u=0,z:h=0}=r,{glFormat:f,glType:_,compressed:d}=r,E=e5(r.glTarget,i,o);switch(i){case"2d-array":case"3d":d?e.compressedTexSubImage3D(E,a,c,u,h,n,s,o,f,t,l):e.texSubImage3D(E,a,c,u,h,n,s,o,f,_,t,l);break;case"2d":case"cube":d?e.compressedTexSubImage2D(E,a,c,u,n,s,f,t,l):e.texSubImage2D(E,a,c,u,n,s,f,_,t,l);break;default:throw Error(i)}}function e5(e,t,r){return"cube"===t?34069+r:e}function e7(e){return e instanceof em?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:function(e){let{device:t,width:r,height:i,id:n}=e;return t.createFramebuffer({...void 0,id:`framebuffer-for-${n}`,width:r,height:i,colorAttachments:[e]})}(e),deleteFramebuffer:!0}}class e9 extends eg{device;gl;handle;sampler=void 0;view=void 0;mipmaps;compressed;glTarget;glFormat;glType;glInternalFormat;textureUnit=0;constructor(e,t){super(e,t);const r={...this.props};r.data=t.data,this.device=e,this.gl=this.device.gl,this.glTarget=function(e){switch(e){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866}throw Error(e)}(this.props.dimension);const i=ea(this.props.format);this.glInternalFormat=i.internalFormat,this.glFormat=i.format,this.glType=i.type,this.compressed=i.compressed,this.mipmaps=!!this.props.mipmaps,this._initialize(r),Object.seal(this)}_initialize(e){this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:e.data});let{width:t,height:r}=e;if(!t||!r){let i=eg.getTextureDataSize(e.data);t=i?.width||1,r=i?.height||1}if(this.width=t,this.height=r,this.depth=e.depth,this.setSampler(e.sampler),this.view=new e3(this.device,{...this.props,texture:this}),this.bind(),!function(e,t,r){let{dimension:i,width:n,height:s,depth:o=0}=r,{glInternalFormat:a}=r,l=r.glTarget;switch(i){case"2d-array":case"3d":e.texStorage3D(l,t,a,n,s,o);break;default:e.texStorage2D(l,t,a,n,s)}}(this.gl,this.mipLevels,this),e.data)switch(e.dimension){case"1d":this.setTexture1DData(e.data);break;case"2d":this.setTexture2DData(e.data);break;case"3d":this.setTexture3DData(e.data);break;case"cube":this.setTextureCubeData(e.data);break;case"2d-array":this.setTextureArrayData(e.data);break;case"cube-array":this.setTextureCubeArrayData(e.data);break;default:throw Error(e.dimension)}this.mipmaps&&this.generateMipmap()}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}createView(e){return new e3(this.device,{...e,texture:this})}setSampler(e={}){let t;e instanceof eJ?(this.sampler=e,t=e.props):(this.sampler=new eJ(this.device,e),t=e);let r=eq(t);this._setSamplerParameters(r)}generateMipmap(e){if(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format)||(s.log.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),e?.force))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(e){s.log.warn(`Error generating mipmap for ${this}: ${e.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}copyExternalImage(e){let t=eg.getExternalImageSize(e.image),r={...eg.defaultCopyExternalImageOptions,...t,...e},{image:i,depth:n,mipLevel:s,x:o,y:a,z:l,flipY:c}=r,{width:u,height:h}=r,{dimension:f,glTarget:_,glFormat:d,glInternalFormat:E,glType:p}=this;if(u=Math.min(u,this.width-o),h=Math.min(h,this.height-a),e.sourceX||e.sourceY)throw Error("WebGL does not support sourceX/sourceY)");return e4(this.device.gl,this.handle,i,{dimension:f,mipLevel:s,x:o,y:a,z:l,width:u,height:h,depth:n,glFormat:d,glInternalFormat:E,glType:p,glTarget:_,flipY:c}),{width:r.width,height:r.height}}setTexture1DData(e){throw Error("setTexture1DData not supported in WebGL.")}setTexture2DData(e,t=0){this.bind();let r=eg.normalizeTextureData(e,this);r.length>1&&!1!==this.props.mipmaps&&s.log.warn(`Texture ${this.id} mipmap and multiple LODs.`)();for(let e=0;e<r.length;e++){let i=r[e];this._setMipLevel(t,e,i)}this.unbind()}setTexture3DData(e){if("3d"!==this.props.dimension)throw Error(this.id
991);ArrayBuffer.isView(e)&&(this.bind(),e8(this.device.gl,e,this),this.unbind())}setTextureCubeData(e,t=0){if("cube"!==this.props.dimension)throw Error(this.id);for(let t of eg.CubeFaces)this.setTextureCubeFaceData(e[t],t)}setTextureArrayData(e){if("2d-array"!==this.props.dimension)throw Error(this.id);throw Error("setTextureArrayData not implemented.")}setTextureCubeArrayData(e){throw Error("setTextureCubeArrayData not supported in WebGL2.")}setTextureCubeFaceData(e,t,r=0){Array.isArray(e)&&e.length>1&&!1!==this.props.mipmaps&&s.log.warn(`${this.id} has mipmap and multiple LODs.`)();let i=eg.CubeFaces.indexOf(t);this.setTexture2DData(e,i)}update(){throw Error("Texture.update() not implemented. Use ExternalTexture")}setImageDataForFace(e){let{face:t,width:r,height:i,pixels:n,data:s,format:o=6408,type:a=5121}=e,{gl:l}=this,c=n||s;this.bind(),c instanceof Promise?c.then(r=>this.setImageDataForFace(Object.assign({},e,{face:t,data:r,pixels:r}))):this.width||this.height?l.texImage2D(t,0,o,r,i,0,o,a,c):l.texImage2D(t,0,o,o,a,c)}_getImageDataMap(e){for(let t=0;t<eg.CubeFaces.length;++t){let r=eg.CubeFaces[t];e[r]&&(e[34069+t]=e[r],delete e[r])}return e}_setSamplerParameters(e){for(let[t,r]of(s.log.log(1,`${this.id} sampler parameters`,this.device.getGLKeys(e))(),this.gl.bindTexture(this.glTarget,this.handle),Object.entries(e))){let e=Number(t);switch(e){case 33082:case 33083:this.gl.texParameterf(this.glTarget,e,r);break;case 10241:case 10242:case 10243:default:this.gl.texParameteri(this.glTarget,e,r);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,e,r)}}this.gl.bindTexture(this.glTarget,null)}_setMipLevel(e,t,r,i=this.glTarget){if(eg.isExternalImage(r))return void e4(this.device.gl,this.handle,r,{...this,depth:e,mipLevel:t,glTarget:i,flipY:this.props.flipY});if(eg.isTextureLevelData(r))return void e8(this.device.gl,r.data,{...this,depth:e,mipLevel:t,glTarget:i});throw Error("Texture: invalid image data")}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(e){let{gl:t}=this;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,this.handle),e}unbind(e){let{gl:t}=this;return void 0!==e&&(this.textureUnit=e,t.activeTexture(33984+e)),t.bindTexture(this.glTarget,null),e}}var te=eE;class tt extends te.Resource{static defaultClearColor=[0,0,0,1];static defaultClearDepth=1;static defaultClearStencil=0;static defaultProps={...te.Resource.defaultProps,framebuffer:null,parameters:void 0,clearColor:tt.defaultClearColor,clearColors:void 0,clearDepth:tt.defaultClearDepth,clearStencil:tt.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0};get[Symbol.toStringTag](){return"RenderPass"}constructor(e,t){t=tt.normalizeProps(e,t),super(e,t,tt.defaultProps)}static normalizeProps(e,t){return{...e.props._resourceDefaults?.renderPass,...t}}}let tr=[1,2,4,8];class ti extends tt{device;glParameters;constructor(e,t){let r;if(super(e,t),this.device=e,!t?.parameters?.viewport)if(t?.framebuffer){const{width:e,height:i}=t.framebuffer;r=[0,0,e,i]}else{const[t,i]=e.getCanvasContext().getDrawingBufferSize();r=[0,0,t,i]}this.device.pushState(),this.setParameters({viewport:r,...this.props.parameters});const i=this.props.framebuffer;if(i?.handle)if(this.props.framebuffer){const e=this.props.framebuffer.colorAttachments.map((e,t)=>36064+t);this.device.gl.drawBuffers(e)}else this.device.gl.drawBuffers([1029]);this.clear()}end(){this.device.popState()}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}setParameters(e={}){let t={...this.glParameters};t.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(t.depthMask=!this.props.depthReadOnly),t.stencilMask=+!this.props.stencilReadOnly,t[35977]=this.props.discard,e.viewport&&(e.viewport.length>=6?(t.viewport=e.viewport.slice(0,4),t.depthRange=[e.viewport[4],e.viewport[5]]):t.viewport=e.viewport),e.scissorRect&&(t.scissorTest=!0,t.scissor=e.scissorRect),e.blendConstant&&(t.blendColor=e.blendConstant),e.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),e[2967]=e.stencilReference),e.colorMask&&(t.colorMask=tr.map(t=>!!(t&e.colorMask))),this.glParameters=t,z(this.device.gl,t)}beginOcclusionQuery(e){let t=this.props.occlusionQuerySet;
991t?.beginOcclusionQuery()}endOcclusionQuery(){let e=this.props.occlusionQuerySet;e?.endOcclusionQuery()}clear(){let e={...this.glParameters},t=0;this.props.clearColors&&this.props.clearColors.forEach((e,t)=>{e&&this.clearColorBuffer(t,e)}),!1!==this.props.clearColor&&void 0===this.props.clearColors&&(t|=16384,e.clearColor=this.props.clearColor),!1!==this.props.clearDepth&&(t|=256,e.clearDepth=this.props.clearDepth),!1!==this.props.clearStencil&&(t|=1024,e.clearStencil=this.props.clearStencil),0!==t&&e6(this.device.gl,e,()=>{this.device.gl.clear(t)})}clearColorBuffer(e=0,t=[0,0,0,0]){e6(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,e,t);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,e,t);break;case Float32Array:this.device.gl.clearBufferfv(6144,e,t);break;default:throw Error("clearColorBuffer: color must be typed array")}})}}var tn=eE;class ts extends tn.Resource{static defaultProps={...tn.Resource.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",parameters:{},bindings:{},uniforms:{}};get[Symbol.toStringTag](){return"RenderPipeline"}shaderLayout;bufferLayout;linkStatus="pending";hash="";constructor(e,t){super(e,t,ts.defaultProps),this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[]}setUniformsWebGL(e){throw Error("Use uniform blocks")}}e.s(["RenderPipeline",0,ts],791937);let to=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],ta={5126:[5126,1,"float","f32","float32"],35664:[5126,2,"vec2","vec2<f32>","float32x2"],35665:[5126,3,"vec3","vec3<f32>","float32x3"],35666:[5126,4,"vec4","vec4<f32>","float32x4"],5124:[5124,1,"int","i32","sint32"],35667:[5124,2,"ivec2","vec2<i32>","sint32x2"],35668:[5124,3,"ivec3","vec3<i32>","sint32x3"],35669:[5124,4,"ivec4","vec4<i32>","sint32x4"],5125:[5125,1,"uint","u32","uint32"],36294:[5125,2,"uvec2","vec2<u32>","uint32x2"],36295:[5125,3,"uvec3","vec3<u32>","uint32x3"],36296:[5125,4,"uvec4","vec4<u32>","uint32x4"],35670:[5126,1,"bool","f32","float32"],35671:[5126,2,"bvec2","vec2<f32>","float32x2"],35672:[5126,3,"bvec3","vec3<f32>","float32x3"],35673:[5126,4,"bvec4","vec4<f32>","float32x4"],35674:[5126,8,"mat2","mat2x2<f32>"],35685:[5126,8,"mat2x3","mat2x3<f32>"],35686:[5126,8,"mat2x4","mat2x4<f32>"],35687:[5126,12,"mat3x2","mat3x2<f32>"],35675:[5126,12,"mat3","mat3x3<f32>"],35688:[5126,12,"mat3x4","mat3x4<f32>"],35689:[5126,16,"mat4x2","mat4x2<f32>"],35690:[5126,16,"mat4x3","mat4x3<f32>"],35676:[5126,16,"mat4","mat4x4<f32>"]};function tl(e){let t=ta[e];if(!t)throw Error("uniform");let[r,i,,n]=t;return{format:n,components:i,glType:r}}let tc={35678:["2d","float"],35680:["cube","float"],35679:["3d","float"],35682:["3d","depth"],36289:["2d-array","float"],36292:["2d-array","depth"],36293:["cube","float"],36298:["2d","sint"],36299:["3d","sint"],36300:["cube","sint"],36303:["2d-array","uint"],36306:["2d","uint"],36307:["3d","uint"],36308:["cube","uint"],36311:["2d-array","uint"]};function tu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)||!!Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}e.s(["isNumericArray",0,tu],229463);class th extends ts{device;handle;vs;fs;introspectedLayout;uniforms={};bindings={};varyings=null;_uniformCount=0;_uniformSetters={};constructor(e,t){super(e,t),this.device=e,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=t.vs,this.fs=t.fs;const{varyings:r,bufferMode:i=35981}=t;r&&r.length>0&&(this.varyings=r,this.device.gl.transformFeedbackVaryings(this.handle,r,i)),this._linkShaders(),s.log.time(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=function(e,t){let r={attributes:[],bindings:[]};for(let i of(r.attributes=function(e,t){let r=[],i=e.getProgramParameter(t,35721);for(let n=0;n<i;n++){let i=e.getActiveAttrib(t,n);if(!i)throw Error("activeInfo");let{name:s,type:o}=i,a=e.getAttribLocation(t,s);if(a>=0){let{attributeType:e}=function(e){let t=ta[e];if(!t)throw Error("attribute");let[,r,,i,n]=t;return{attributeType:i,vertexFormat:n,components:r}}(o),t=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:a,stepMode:t,type:e})}}return r.sort((e,t)=>
991e.location-t.location),r}(e,t),function(e,t){let r=(r,i)=>e.getActiveUniformBlockParameter(t,r,i),i=[],n=e.getProgramParameter(t,35382);for(let s=0;s<n;s++){let n={name:e.getActiveUniformBlockName(t,s)||"",location:r(s,35391),byteLength:r(s,35392),vertex:r(s,35396),fragment:r(s,35398),uniformCount:r(s,35394),uniforms:[]},o=r(s,35395)||[],a=e.getActiveUniforms(t,o,35383),l=e.getActiveUniforms(t,o,35384),c=e.getActiveUniforms(t,o,35387),u=e.getActiveUniforms(t,o,35388);for(let r=0;r<n.uniformCount;++r){let i=e.getActiveUniform(t,o[r]);if(!i)throw Error("activeInfo");n.uniforms.push({name:i.name,format:tl(a[r]).format,type:a[r],arrayLength:l[r],byteOffset:c[r],byteStride:u[r]})}i.push(n)}return i.sort((e,t)=>e.location-t.location),i}(e,t))){let e=i.uniforms.map(e=>({name:e.name,format:e.format,byteOffset:e.byteOffset,byteStride:e.byteStride,arrayLength:e.arrayLength}));r.bindings.push({type:"uniform",name:i.name,group:0,location:i.location,visibility:!!i.vertex&2*!!i.fragment,minBindingSize:i.byteLength,uniforms:e})}let i=function(e,t){let r=[],i=e.getProgramParameter(t,35718);for(let n=0;n<i;n++){let i=e.getActiveUniform(t,n);if(!i)throw Error("activeInfo");let{name:s,size:o,type:a}=i,{name:l,isArray:c}=function(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};let t=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!t||t.length<2)throw Error(`Failed to parse GLSL uniform name ${e}`);return{name:t[1],length:+!!t[2],isArray:!!t[2]}}(s),u=e.getUniformLocation(t,l),h={location:u,name:l,size:o,type:a,isArray:c};if(r.push(h),h.size>1)for(let i=0;i<h.size;i++){let n=`${l}[${i}]`;u=e.getUniformLocation(t,n);let s={...h,name:n,location:u};r.push(s)}}return r}(e,t),n=0;for(let e of i)if(to.includes(e.type)){let{viewDimension:t,sampleType:i}=function(e){let t=tc[e];if(!t)throw Error("sampler");let[r,i]=t;return{viewDimension:r,sampleType:i}}(e.type);r.bindings.push({type:"texture",name:e.name,group:0,location:n,viewDimension:t,sampleType:i}),e.textureUnit=n,n+=1}i.length&&(r.uniforms=i);let s=function(e,t){let r=[],i=e.getProgramParameter(t,35971);for(let n=0;n<i;n++){let i=e.getTransformFeedbackVarying(t,n);if(!i)throw Error("activeInfo");let{name:s,type:o,size:a}=i,{glType:l,components:c}=tl(o),u={location:n,name:s,type:l,size:a*c};r.push(u)}return r.sort((e,t)=>e.location-t.location),r}(e,t);return s?.length&&(r.varyings=s),r}(this.device.gl,this.handle),s.log.timeEnd(1,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.shaderLayout=function(e,t){let r={...e,attributes:e.attributes.map(e=>({...e}))};for(let e of t?.attributes||[]){let t=r.attributes.find(t=>t.name===e.name);t?(t.type=e.type||t.type,t.stepMode=e.stepMode||t.stepMode):s.log.warn(`shader layout attribute ${e.name} not present in shader`)}return r}(this.introspectedLayout,t.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(e,t){for(let[r,i]of Object.entries(e)){let e=this.shaderLayout.bindings.find(e=>e.name===r)||this.shaderLayout.bindings.find(e=>e.name===`${r}Uniforms`);if(!e){let e=this.shaderLayout.bindings.map(e=>`"${e.name}"`).join(", ");t?.disableWarnings||s.log.warn(`No binding "${r}" in render pipeline "${this.id}", expected one of ${e}`,i)();continue}switch(!i&&s.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),e.type){case"uniform":if(!(i instanceof ex)&&!(i.buffer instanceof ex))throw Error("buffer value");break;case"texture":if(!(i instanceof e3||i instanceof e9||i instanceof eT))throw Error("texture value");break;case"sampler":s.log.warn(`Ignoring sampler ${r}`)();break;default:throw Error(e.type)}this.bindings[r]=i}}draw(e){let{renderPass:t,parameters:r=this.props.parameters,topology:i=this.props.topology,vertexArray:n,vertexCount:o,instanceCount:a,isInstanced:l=!1,firstVertex:c=0,transformFeedback:u}=e,h=function(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw Error(e)}}(i),f=!!n.indexBuffer,_=n.indexBuffer?.glIndexType;return"success"!==this.linkStatus?(s.log.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1):this._areTexturesRenderable()?(this.device.gl.useProgram(this.handle),n.bindBeforeRender(t),u&&u.begin(this.props.topology),this._applyBindings(),this._applyUniforms(),!function(e,t,r,i){if(function(e){let t=!0;for(let r in e){t=!1;break}return t}(t))return i(e);e.pushState();try{return function(e,t){let{gl:r}=e;if(t.cullMode)switch(t.cullMode){case"none":r.disable(2884);break;case"front":r.enable(2884),r.cullFace(1028);break;case"back":r.enable(2884),r.cullFace(1029)}if(t.frontFace&&r.frontFace(eK("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.unclippedDepth&&e.features.has("depth-clip-control")&&r.enable(34383),void 0!==t.depthBias&&(r.enable(32823),r.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0)),t.provokingVertex&&e.features.has("provoking-vertex-webgl")){let r=e.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,i=eK("provokingVertex",t.provokingVertex,{first:36429,last:36430});r?.provokingVertexWEBGL(i)}if((t.polygonMode||t.polygonOffsetLine)&&e.features.has("polygon-mode-webgl")){if(t.polygonMode){let r=e.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,i=eK("polygonMode",t.polygonMode,{fill:6914,line:6913});r?.polygonModeWEBGL(1028,i),r?.polygonModeWEBGL(1029,i)}t.polygonOffsetLine&&r.enable(10754)}if(e.features.has("shader-clip-cull-distance-webgl")&&(t.clipDistance0&&r.enable(12288),t.clipDistance1&&r.enable(12289),t.clipDistance2&&r.enable(12290),t.clip
991Distance3&&r.enable(12291),t.clipDistance4&&r.enable(12292),t.clipDistance5&&r.enable(12293),t.clipDistance6&&r.enable(12294),t.clipDistance7&&r.enable(12295)),void 0!==t.depthWriteEnabled&&r.depthMask(t.depthWriteEnabled),t.depthCompare&&("always"!==t.depthCompare?r.enable(2929):r.disable(2929),r.depthFunc(eV("depthCompare",t.depthCompare))),t.stencilWriteMask){let e=t.stencilWriteMask;r.stencilMaskSeparate(1028,e),r.stencilMaskSeparate(1029,e)}if(t.stencilReadMask&&s.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let e=t.stencilReadMask||0xffffffff,i=eV("depthCompare",t.stencilCompare);"always"!==t.stencilCompare?r.enable(2960):r.disable(2960),r.stencilFuncSeparate(1028,i,0,e),r.stencilFuncSeparate(1029,i,0,e)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let e=ez("stencilPassOperation",t.stencilPassOperation),i=ez("stencilFailOperation",t.stencilFailOperation),n=ez("stencilDepthFailOperation",t.stencilDepthFailOperation);r.stencilOpSeparate(1028,i,n,e),r.stencilOpSeparate(1029,i,n,e)}switch(t.blend){case!0:r.enable(3042);break;case!1:r.disable(3042)}if(t.blendColorOperation||t.blendAlphaOperation){let e=eY("blendColorOperation",t.blendColorOperation||"add"),i=eY("blendAlphaOperation",t.blendAlphaOperation||"add");r.blendEquationSeparate(e,i);let n=e$("blendColorSrcFactor",t.blendColorSrcFactor||"one"),s=e$("blendColorDstFactor",t.blendColorDstFactor||"zero"),o=e$("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),a=e$("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");r.blendFuncSeparate(n,s,o,a)}}(e,t),z(e.gl,r),i(e)}finally{e.popState()}}(this.device,r,t.glParameters,()=>{f&&l?this.device.gl.drawElementsInstanced(h,o||0,_,c,a||0):f?this.device.gl.drawElements(h,o||0,_,c):l?this.device.gl.drawArraysInstanced(h,c,o||0,a||0):this.device.gl.drawArrays(h,c,o||0),u&&u.end()}),n.unbindAfterRender(t),!0):(s.log.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1)}setUniformsWebGL(e){let t,{bindings:r}=(t={bindings:{},uniforms:{}},Object.keys(e).forEach(r=>{let i=e[r];null!==tu(i)||"number"==typeof i||"boolean"==typeof i?t.uniforms[r]=i:t.bindings[r]=i}),t);Object.keys(r).forEach(e=>{s.log.warn(`Unsupported value "${JSON.stringify(r[e])}" used in setUniforms() for key ${e}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,e)}async _linkShaders(){let{gl:e}=this.device;if(e.attachShader(this.handle,this.vs.handle),e.attachShader(this.handle,this.fs.handle),s.log.time(4,`linkProgram for ${this.id}`)(),e.linkProgram(this.handle),s.log.timeEnd(4,`linkProgram for ${this.id}`)(),s.log.level,!this.device.features.has("compilation-status-async-webgl")){let e=this._getLinkStatus();this._reportLinkStatus(e);return}s.log.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),s.log.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();let t=this._getLinkStatus();this._reportLinkStatus(t)}async _reportLinkStatus(e){if("success"!==e){switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),Error(`Error during compilation of shader ${this.vs.id}`);case"pending":this.vs.asyncCompilationStatus.then(()=>this.vs.debugShader())}switch(this.fs?.compilationStatus){case"error":throw this.fs.debugShader(),Error(`Error during compilation of shader ${this.fs.id}`);case"pending":this.fs.asyncCompilationStatus.then(()=>this.fs.debugShader())}let t=this.device.gl.getProgramInfoLog(this.handle);throw Error(`Error during ${e}: ${t}`)}}_getLinkStatus(){let{gl:e}=this.device;return e.getProgramParameter(this.handle,35714)?(e.validateProgram(this.handle),e.getProgramParameter(this.handle,35715))?(this.linkStatus="success","success"):(this.linkStatus="error","validation"):(this.linkStatus="error","linking")}async _waitForLinkComplete(){let e=async e=>await new Promise(t=>setTimeout(t,e));if(!this.device.features.has("compilation-status-async-webgl"))return void await e(10);let{gl:t}=this.device;for(;;){if(t.getProgramParameter(this.handle,37297))return;await e(10)}}_areTexturesRenderable(){let e=!0;for(let t of this.shaderLayout.bindings)this.bindings[t.name]||this.bindings[t.name.replace(/Uniforms$/,"")]||(s.log.warn(`Binding ${t.name} not found in ${this.id}`)(),e=!1);return e}_applyBindings(){if("success"!==this.linkStatus)return;let{gl:e}=this.device;e.useProgram(this.handle);let t=0,r=0;for(let i of this.shaderLayout.bindings){let n=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!n)throw Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:o}=i,a=e.getUniformBlockIndex(this.handle,o);if(0xffffffff===a)throw Error(`Invalid uniform block name ${o}`);e.uniformBlockBinding(this.handle,r,a),n instanceof ex?e.bindBufferBase(35345,r,n.handle):e.bindBufferRange(35345,r,n.buffer.handle,n.offset||0,n.size||n.buffer.byteLength-n.offset),r+=1;break;case"texture":let l;if(!(n instanceof e3||n instanceof e9||n instanceof eT))throw Error("texture");
991if(n instanceof e3)l=n.texture;else if(n instanceof e9)l=n;else if(n instanceof eT&&n.colorAttachments[0]instanceof e3)s.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=n.colorAttachments[0].texture;else throw Error("No texture");e.activeTexture(33984+t),e.bindTexture(l.glTarget,l.handle),t+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let e of this.shaderLayout.uniforms||[]){let{name:t,location:r,type:i,textureUnit:n}=e,s=this.uniforms[t]??n;void 0!==s&&function(e,t,r,i){let n=i;!0===n&&(n=1),!1===n&&(n=0);let s="number"==typeof n?[n]:n;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if("number"!=typeof i)throw Error("samplers must be set to integers");return e.uniform1i(t,i);case 5126:return e.uniform1fv(t,s);case 35664:return e.uniform2fv(t,s);case 35665:return e.uniform3fv(t,s);case 35666:return e.uniform4fv(t,s);case 5124:case 35670:return e.uniform1iv(t,s);case 35667:case 35671:return e.uniform2iv(t,s);case 35668:case 35672:return e.uniform3iv(t,s);case 35669:case 35673:return e.uniform4iv(t,s);case 5125:return e.uniform1uiv(t,s,1);case 36294:return e.uniform2uiv(t,s,2);case 36295:return e.uniform3uiv(t,s,3);case 36296:return e.uniform4uiv(t,s,4);case 35674:return e.uniformMatrix2fv(t,!1,s);case 35675:return e.uniformMatrix3fv(t,!1,s);case 35676:return e.uniformMatrix4fv(t,!1,s);case 35685:return e.uniformMatrix2x3fv(t,!1,s);case 35686:return e.uniformMatrix2x4fv(t,!1,s);case 35687:return e.uniformMatrix3x2fv(t,!1,s);case 35688:return e.uniformMatrix3x4fv(t,!1,s);case 35689:return e.uniformMatrix4x2fv(t,!1,s);case 35690:return e.uniformMatrix4x3fv(t,!1,s)}throw Error("Illegal uniform")}(this.device.gl,r,i,s)}}}var tf=eE;class t_ extends tf.Resource{static defaultProps={...tf.Resource.defaultProps,measureExecutionTime:void 0};get[Symbol.toStringTag](){return"CommandEncoder"}constructor(e,t){super(e,t,t_.defaultProps)}}var td=eE;class tE extends td.Resource{static defaultProps={...td.Resource.defaultProps};get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,t){super(e,t,tE.defaultProps)}}class tp extends tE{device;commands=[];constructor(e){super(e,{}),this.device=e}submitCommands(e=this.commands){for(let t of e)switch(t.name){case"copy-buffer-to-buffer":!function(e,t){let r=t.sourceBuffer,i=t.destinationBuffer;e.gl.bindBuffer(36662,r.handle),e.gl.bindBuffer(36663,i.handle),e.gl.copyBufferSubData(36662,36663,t.sourceOffset??0,t.destinationOffset??0,t.size),e.gl.bindBuffer(36662,null),e.gl.bindBuffer(36663,null)}(this.device,t.options);break;case"copy-buffer-to-texture":this.device,t.options;throw Error("Not implemented");case"copy-texture-to-buffer":!function(e,t){let r,{sourceTexture:i,mipLevel:n=0,aspect:s="all",width:o=t.sourceTexture.width,height:a=t.sourceTexture.height,depthOrArrayLayers:l=0,origin:c=[0,0],destinationBuffer:u,byteOffset:h=0,bytesPerRow:f,rowsPerImage:_}=t;if("all"!==s)throw Error("aspect not supported in WebGL");if(0!==n||0!==l||f||_)throw Error("not implemented");let{framebuffer:d,destroyFramebuffer:E}=tg(i);try{let t=o||d.width,i=a||d.height,n=ea(d.colorAttachments[0].texture.props.format),s=n.format,l=n.type;e.gl.bindBuffer(35051,u.handle),r=e.gl.bindFramebuffer(36160,d.handle),e.gl.readPixels(c[0],c[1],t,i,s,l,h)}finally{e.gl.bindBuffer(35051,null),void 0!==r&&e.gl.bindFramebuffer(36160,r),E&&d.destroy()}}(this.device,t.options);break;case"copy-texture-to-texture":!function(e,t){let r,{sourceTexture:i,destinationMipLevel:n=0,origin:s=[0,0],destinationOrigin:o=[0,0],destinationTexture:a}=t,{width:l=t.destinationTexture.width,height:c=t.destinationTexture.height}=t,{framebuffer:u,destroyFramebuffer:h}=tg(i),[f,_]=s,[d,E,p]=o,g=e.gl.bindFramebuffer(36160,u.handle),m=null;if(a instanceof e9)m=a,l=Number.isFinite(l)?l:m.width,c=Number.isFinite(c)?c:m.height,m.bind(0),r=m.glTarget;else throw Error("invalid destination");switch(r){case 3553:case 34067:e.gl.copyTexSubImage2D(r,n,d,E,f,_,l,c);break;case 35866:case 32879:e.gl.copyTexSubImage3D(r,n,d,E,p,f,_,l,c)}m&&m.unbind(),e.gl.bindFramebuffer(36160,g),h&&u.destroy()}(this.device,t.options);break;default:throw Error(t.name)}}}function tg(e){if(e instanceof eg){let{width:t,height:r,id:i}=e;
991return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${i}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}class tm extends t_{device;commandBuffer;constructor(e,t){super(e,t),this.device=e,this.commandBuffer=new tp(e)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(e){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:e})}copyBufferToTexture(e){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:e})}copyTextureToBuffer(e){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:e})}copyTextureToTexture(e){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:e})}pushDebugGroup(e){}popDebugGroup(){}insertDebugMarker(e){}resolveQuerySet(e,t,r){}}let tT={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},tA={f32:4,f16:2,i32:4,u32:4};function tR(e){let t;e.endsWith("-webgl")&&(e.replace("-webgl",""),t=!0);let[r,i]=e.split("x"),n=i?parseInt(i):1,s=l(r),o={type:r,components:n,byteLength:s.byteLength*n,integer:s.integer,signed:s.signed,normalized:s.normalized};return t&&(o.webglOnly=!0),o}function tb(e,t){let r={};for(let i of e.attributes){let n=function(e,t,r){let i=function(e,t){let r=e.attributes.find(e=>e.name===t);return r||s.log.warn(`shader layout attribute "${t}" not present in shader`),r||null}(e,r),n=function(e,t){var r=e;for(let e of r)(e.attributes&&e.format||!e.attributes&&!e.format)&&s.log.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`);let i=function(e,t){for(let r of e)if(r.format&&r.name===t)return{attributeName:r.name,bufferName:t,stepMode:r.stepMode,vertexFormat:r.format,byteOffset:0,byteStride:r.byteStride||0};return null}(e,t);return i||(i=function(e,t){for(let r of e){let e=r.byteStride;if("number"!=typeof r.byteStride)for(let t of r.attributes||[])e+=tR(t.format).byteLength;let i=r.attributes?.find(e=>e.attribute===t);if(i)return{attributeName:i.attribute,bufferName:r.name,stepMode:r.stepMode,vertexFormat:i.format,byteOffset:i.byteOffset,byteStride:e}}return null}(e,t))?i:(s.log.warn(`layout for attribute "${t}" not present in buffer layout`),null)}(t,r);if(!i)return null;let o=function(e){let[t,r]=tT[e],i="i32"===t||"u32"===t,n="u32"!==t,s=tA[t]*r,o=function(e,t){let r;switch(e){case"f32":r="float32";break;case"i32":r="sint32";break;case"u32":r="uint32";break;case"f16":return t<=2?"float16x2":"float16x4"}return 1===t?r:`${r}x${t}`}(t,r);return{dataType:t,components:r,defaultVertexFormat:o,byteLength:s,integer:i,signed:n}}(i.type),a=n?.vertexFormat||o.defaultVertexFormat,l=tR(a);return{attributeName:n?.attributeName||i.name,bufferName:n?.bufferName||i.name,location:i.location,shaderType:i.type,shaderDataType:o.dataType,shaderComponents:o.components,vertexFormat:a,bufferDataType:l.type,bufferComponents:l.components,normalized:l.normalized,integer:o.integer,stepMode:n?.stepMode||i.stepMode||"vertex",byteOffset:n?.byteOffset||0,byteStride:n?.byteStride||0}}(e,t,i.name);n&&(r[i.name]=n)}return r}function tS(e,t,r=16){let i=tb(e,t),n=Array(r).fill(null);for(let e of Object.values(i))n[e.location]=e;return n}e.s(["getAttributeInfosByLocation",0,tS,"getAttributeInfosFromLayouts",0,tb],987906);var tM=eE;class tC extends tM.Resource{static defaultProps={...tM.Resource.defaultProps,renderPipeline:null};get[Symbol.toStringTag](){return"VertexArray"}maxVertexAttributes;attributeInfos;indexBuffer=null;attributes;constructor(e,t){super(e,t,tC.defaultProps),this.maxVertexAttributes=e.limits.maxVertexAttributes,this.attributes=Array(this.maxVertexAttributes).fill(null);const{shaderLayout:r,bufferLayout:i}=t.renderPipeline||{};if(!r||!i)throw Error("VertexArray");this.attributeInfos=tS(r,i,this.maxVertexAttributes)}setConstantWebGL(e,t){this.device.reportError(Error("constant attributes not supported"))}}function tO(e){return(!t||t.byteLength<e)&&(t=new ArrayBuffer(e)),t}function tv(e,t){let r=tO(e.BYTES_PER_ELEMENT*t);return new e(r,0,t)}e.s(["getScratchArray",0,tv,"getScratchArrayBuffer",0,tO],216246);var tN=e.i(388169),tI=e.i(288526);class ty extends tC{get[Symbol.toStringTag](){return"VertexArray"}device;handle;buffer=null;bufferValue=null;static isConstantAttributeZeroSupported(e){return"Chrome"===((0,eh.isBrowser)()?(0,tN.isElectron)(void 0)?"Electron":(tI.navigator.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node")}constructor(e,t){super(e,t),this.device=e,this.handle=this.device.gl.createVertexArray()}destroy(){super.destroy(),this.buffer&&this.buffer?.destroy(),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(e){if(e&&34963!==e.glTarget)throw Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,e?e.handle:null),this.indexBuffer=e,this.device.gl.bindVertexArray(null)}setBuffer(e,t){if(34963===t.glTarget)throw Error("Use .setIndexBuffer()");let{size:r,type:i,stride:n,offset:s,normalized:o,integer:a,divisor:l}=this._getAccessor(e);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,t.handle),a?this.device.gl.vertexAttribIPointer(e,r,i,n,s):this.device.gl.vertexAttribPointer(e,r,i,o,n,s),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(e),this.device.gl.vertexAttribDivisor(e,l||0),this.attributes[e]=t,this.device.gl.bindVertexArray(null)}setConstantWebGL(e,t){this._enable(e,!1),this.attributes[e]=t}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let e=0;e<this.maxVertexAttributes;++e){let t=this.attributes[e];ArrayBuffer.isView(t)&&this.device.setConstantAttributeWebGL(e,t)}}_getAccessor(e){let t=this.attributeInfos[e];if(!t)throw Error(`Unknown attribute location ${e}`);let r=Q(t.bufferDataType);return{size:t.bufferComponents,type:r,stride:t.byteStride,offset:t.byteOffset,normalized:t.normalized,integer:t.integer,divisor:+("instance"===t.stepMode)}}_enable(e,t=!0){let r=ty.isConstantAttributeZeroSupported(this.device)||0!==e;(t||r)&&(e=Number(e),this.device.gl.bindVertexArray(this.handle),t?this.device.gl.enableVertexAttribArray(e):this.device.gl.disableVertexAttribArray(e),this.device.gl.bindVertexArray(null))}getConstantBuffer(e,t){var r;let i=Array.isArray(r=t)?new Float32Array(r):r,n=i.byteLength*e,s=i.length*e;if(this.buffer&&n!==this.buffer.byteLength)throw Error(`Buffer size is immutable, byte length ${n} !== ${this.buffer.byteLength}.`);let o=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:n}),o=o||!function(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}(i,this.bufferValue)){let e=tv(t.constructor,s);!function(e){let{target:t,source:r,start:i=0,count:n=1}=e,s=r.length,o=n*s,a=0;for(let e=i;a<s;
991a++)t[e++]=r[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);e.target}({target:e,source:i,start:0,count:s}),this.buffer.write(e),this.bufferValue=t}return this.buffer}}var tL=eE;class tP extends tL.Resource{static defaultProps={...tL.Resource.defaultProps,layout:void 0,buffers:{}};get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,t){super(e,t,tP.defaultProps)}}class tD extends tP{device;gl;handle;layout;buffers={};unusedBuffers={};bindOnUse=!0;_bound=!1;constructor(e,t){super(e,t),this.device=e,this.gl=e.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,t.buffers&&this.setBuffers(t.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(e="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(function(e){switch(e){case"point-list":return 0;case"line-list":case"line-strip":return 1;case"triangle-list":case"triangle-strip":return 4;default:throw Error(e)}}(e))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(e){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let t in e)this.setBuffer(t,e[t])})}setBuffer(e,t){let r=this._getVaryingIndex(e),{buffer:i,byteLength:n,byteOffset:o}=this._getBufferRange(t);if(r<0){this.unusedBuffers[e]=i,s.log.warn(`${this.id} unusedBuffers varying buffer ${e}`)();return}this.buffers[r]={buffer:i,byteLength:n,byteOffset:o},this.bindOnUse||this._bindBuffer(r,i,o,n)}getBuffer(e){if(tF(e))return this.buffers[e]||null;let t=this._getVaryingIndex(e);return t>=0?this.buffers[t]:null}bind(e=this.handle){let t;return"function"!=typeof e?(this.gl.bindTransformFeedback(36386,e),this):(this._bound?t=e():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,t=e(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),t)}unbind(){this.bind(null)}_getBufferRange(e){if(e instanceof ex)return{buffer:e,byteOffset:0,byteLength:e.byteLength};let{buffer:t,byteOffset:r=0,byteLength:i=e.buffer.byteLength}=e;return{buffer:t,byteOffset:r,byteLength:i}}_getVaryingIndex(e){if(tF(e))return Number(e);for(let t of this.layout.varyings)if(e===t.name)return t.location;return -1}_bindBuffers(){for(let e in this.buffers){let{buffer:t,byteLength:r,byteOffset:i}=this._getBufferRange(this.buffers[e]);this._bindBuffer(Number(e),t,i,r)}}_unbindBuffers(){for(let e in this.buffers)this.gl.bindBufferBase(35982,Number(e),null)}_bindBuffer(e,t,r=0,i){let n=t&&t.handle;n&&void 0!==i?this.gl.bindBufferRange(35982,e,n,r,i):this.gl.bindBufferBase(35982,e,n)}}function tF(e){return"number"==typeof e?Number.isInteger(e):/^\d+$/.test(e)}var tx=eE;class tB extends tx.Resource{static defaultProps={...tx.Resource.defaultProps,type:void 0,count:void 0};get[Symbol.toStringTag](){return"QuerySet"}constructor(e,t){super(e,t,tB.defaultProps)}}class tw extends tB{device;handle;target=null;_queryPending=!1;_pollingPromise=null;get[Symbol.toStringTag](){return"Query"}constructor(e,t){if(super(e,t),this.device=e,t.count>1)throw Error("WebGL QuerySet can only have one value");this.handle=this.device.gl.createQuery(),Object.seal(this)}destroy(){this.device.gl.deleteQuery(this.handle)}beginTimestampQuery(){return this._begin(35007)}endTimestampQuery(){this._end()}beginOcclusionQuery(e){return this._begin(e?.conservative?36202:35887)}endOcclusionQuery(){this._end()}beginTransformFeedbackQuery(){return this._begin(35976)}endTransformFeedbackQuery(){this._end()}async resolveQuery(){return[await this.pollQuery()]}_begin(e){this._queryPending||(this.target=e,this.device.gl.beginQuery(this.target,this.handle))}_end(){!this._queryPending&&this.target&&(this.device.gl.endQuery(this.target),this.target=null,this._queryPending=!0)}isResultAvailable(){if(!this._queryPending)return!1;let e=this.device.gl.getQueryParameter(this.handle,34919);return e&&(this._queryPending=!1),e}isTimerDisjoint(){return this.device.gl.getParameter(36795)}getResult(){return this.device.gl.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}pollQuery(e=1/0){if(this._pollingPromise)return this._pollingPromise;let t=0;return this._pollingPromise=new Promise((r,i)=>{let n=()=>{this.isResultAvailable()?(r(this.getResult()),this._pollingPromise=null):t++>e?(i("Timed out"),this._pollingPromise=null):requestAnimationFrame(n)};requestAnimationFrame(n)}),this._pollingPromise}}e.s(["WebGLDevice",0,class extends L{type="webgl";handle;features;limits;info;canvasContext;lost;_resolveContextLost;gl;debug=!1;_canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1};_extensions={};_polyfilled=!1;spectorJS;constructor(e){super({...e,id:e.id||function(e="id"){eD[e]=eD[e]||1;let t=eD[e]++;return`${e}-${t}`}("webgl-device")});const t=L._getCanvasContextProps(e);if(!t)throw Error("WebGLDevice requires props.createCanvasContext to be set");let r=t.canvas?.gl?.device;if(r)throw Error(`WebGL context already attached to device ${r.id}`);this.canvasContext=new eA(this,t),this.lost=new Promise(e=>{this._resolveContextLost=e});const i={...e.webgl};"premultiplied"===t.alphaMode&&(i.premultipliedAlpha=!0),void 0!==e.powerPreference&&(i.powerPreference=e.powerPreference);const n=this.props._handle||function(e,t,r){let i="",n={preserveDrawingBuffer:!0,...r},s=null;if(s||=e.getContext("webgl2",n),n.failIfMajorPerformanceCaveat&&(i||="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."),s||r.failIfMajorPerformanceCaveat||(n.failIfMajorPerformanceCaveat=!1,s=e.getContext("webgl2",n),s.luma||={}
991,s.luma.softwareRenderer=!0),!s&&(s=e.getContext("webgl",{}))&&(s=null,i||="Your browser only supports WebGL1"),!s)throw i||="Your browser does not support WebGL",Error(`Failed to create WebGL context: ${i}`);let{onContextLost:o,onContextRestored:a}=t;return e.addEventListener("webglcontextlost",e=>o(e),!1),e.addEventListener("webglcontextrestored",e=>a(e),!1),s.luma||={},s}(this.canvasContext.canvas,{onContextLost:e=>this._resolveContextLost?.({reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."}),onContextRestored:e=>console.log("WebGL context restored")},i);if(!n)throw Error("WebGL context creation failed");if(r=n.device){if(e._reuseDevices)return s.log.log(1,`Not creating a new Device, instead returning a reference to Device ${r.id} already attached to WebGL context`,r)(),r._reused=!0,r;throw Error(`WebGL context already attached to device ${r.id}`)}this.handle=n,this.gl=n,this.spectorJS=eO({...this.props,gl:this.handle}),this.gl.device=this,this.gl._version=2,this.info=function(e,t){var r,i;let n=e.getParameter(7936),s=e.getParameter(7937);q(e,"WEBGL_debug_renderer_info",t);let o=t.WEBGL_debug_renderer_info,a=e.getParameter(o?o.UNMASKED_VENDOR_WEBGL:7936),l=e.getParameter(o?o.UNMASKED_RENDERER_WEBGL:7937),c=a||n,u=l||s,h=e.getParameter(7938),f=Z(c,u),_=(r=c,i=u,/Metal/i.exec(r)||/Metal/i.exec(i)?"metal":/ANGLE/i.exec(r)||/ANGLE/i.exec(i)?"opengl":"unknown");return{type:"webgl",gpu:f,gpuType:function(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Z(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}(c,u),gpuBackend:_,vendor:c,renderer:u,version:h,shadingLanguage:"glsl",shadingLanguageVersion:300}}(this.gl,this._extensions),this.limits=new eu(this.gl),this.features=new ec(this.gl,this._extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),!1!==t.autoResize&&this.canvasContext.resize(),new $(this.gl,{log:(...e)=>s.log.log(1,...e)()}).trackState(this.gl,{copyState:!1});const o=e.debugWebGL||e.debug,a=e.debugWebGL;o&&(this.gl=eI(this.gl,{debugWebGL:o,traceWebGL:a}),s.log.warn("WebGL debug mode activated. Performance reduced.")(),e.debugWebGL&&(s.log.level=Math.max(s.log.level,1)))}destroy(){this.props._reuseDevices||this._reused||delete this.gl.device}get isLost(){return this.gl.isContextLost()}createCanvasContext(e){throw Error("WebGL only supports a single canvas")}createBuffer(e){return new ex(this,this._normalizeBufferProps(e))}createTexture(e){return new e9(this,e)}createExternalTexture(e){throw Error("createExternalTexture() not implemented")}createSampler(e){return new eJ(this,e)}createShader(e){return new ej(this,e)}createFramebuffer(e){return new eT(this,e)}createVertexArray(e){return new ty(this,e)}createTransformFeedback(e){return new tD(this,e)}createQuerySet(e){return new tw(this,e)}createRenderPipeline(e){return new th(this,e)}beginRenderPass(e){return new ti(this,e)}createComputePipeline(e){throw Error("ComputePipeline not supported in WebGL")}beginComputePass(e){throw Error("ComputePass not supported in WebGL")}renderPass=null;createCommandEncoder(e={}){return new tm(this,e)}submit(){this.renderPass?.end(),this.renderPass=null}readPixelsToArrayWebGL(e,t){return function(e,t){var r,i,n,s,o;let{sourceX:a=0,sourceY:l=0,sourceAttachment:c=0}=t||{},{target:u=null,sourceWidth:h,sourceHeight:f,sourceDepth:_,sourceFormat:d,sourceType:E}=t||{},{framebuffer:p,deleteFramebuffer:g}=e7(e),{gl:m,handle:T}=p;h||=p.width,f||=p.height;let A=p.colorAttachments[c]?.texture;if(!A)throw Error(`Invalid framebuffer attachment ${c}`);_=A?.depth||1,d||=A?.glFormat||6408,E||=A?.glType||5121,r=u,i=E,n=d,s=h,o=f,u=r?r:new(function(e,t){let{clamped:r=!0}=t||{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;
991default:throw Error("Failed to deduce typed array type from GL constant")}}(i||=5121,{clamped:!1}))(s*o*e2(n)),E=E||function(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw Error("Failed to deduce GL constant from typed array")}}(u);let R=m.bindFramebuffer(36160,T);return m.readBuffer(36064+c),m.readPixels(a,l,h,f,d,E,u),m.readBuffer(36064),m.bindFramebuffer(36160,R||null),g&&p.destroy(),u}(e,t)}readPixelsToBufferWebGL(e,t){return function(e,t){let{target:r,sourceX:i=0,sourceY:n=0,sourceFormat:s=6408,targetByteOffset:o=0}=t||{},{sourceWidth:a,sourceHeight:l,sourceType:c}=t||{},{framebuffer:u,deleteFramebuffer:h}=e7(e);a=a||u.width,l=l||u.height,c=c||5121;let f=r;if(!f){let e=o+a*l*e2(s)*function(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}(c);f=u.device.createBuffer({byteLength:e})}let _=e.device.createCommandEncoder();return _.copyTextureToBuffer({sourceTexture:e,width:a,height:l,origin:[i,n],destinationBuffer:f,byteOffset:o}),_.destroy(),h&&u.destroy(),f}(e,t)}setParametersWebGL(e){z(this.gl,e)}getParametersWebGL(e){return Y(this.gl,e)}withParametersWebGL(e,t){return e6(this.gl,e,t)}resetWebGL(){s.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),z(this.gl,P)}_getDeviceSpecificTextureFormatCapabilities(e){var t,r;let i,n;return t=this.gl,r=this._extensions,i=e.create,n=eo[e.format],n?.gl===void 0&&(i=!1),n?.x&&(i=i&&!!q(t,n.x,r)),{format:e.format,create:i&&e.create,render:i&&e.render,filter:i&&e.filter,blend:i&&e.blend,store:i&&e.store}}loseDevice(){let e=!1,t=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return t&&(e=!0,t.loseContext()),this._resolveContextLost?.({reason:"destroyed",message:"Application triggered context loss"}),e}pushState(){$.get(this.gl).push()}popState(){$.get(this.gl).pop()}setSpectorMetadata(e,t){e.__SPECTOR_Metadata=t}getGLKey(e,t){let r=Number(e);for(let e in this.gl)if(this.gl[e]===r)return`GL.${e}`;return t?.emptyIfUnknown?"":String(e)}getGLKeys(e){let t={emptyIfUnknown:!0};return Object.entries(e).reduce((e,[r,i])=>(e[`${r}:${this.getGLKey(r,t)}`]=`${i}:${this.getGLKey(i,t)}`,e),{})}_constants;setConstantAttributeWebGL(e,t){let r=this.limits.maxVertexAttributes;this._constants=this._constants||Array(r).fill(null);let i=this._constants[e];switch(i&&function(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}(i,t)&&s.log.info(1,`setConstantAttributeWebGL(${e}) could have been skipped, value unchanged`)(),this._constants[e]=t,t.constructor){case Float32Array:var n,o,a,l,c,u,h=this,f=e,_=t;switch(_.length){case 1:h.gl.vertexAttrib1fv(f,_);break;case 2:h.gl.vertexAttrib2fv(f,_);break;case 3:h.gl.vertexAttrib3fv(f,_);break;case 4:h.gl.vertexAttrib4fv(f,_)}break;case Int32Array:n=this,o=e,a=t,n.gl.vertexAttribI4iv(o,a);break;case Uint32Array:l=this,c=e,u=t,l.gl.vertexAttribI4uiv(c,u);break;default:throw Error("constant")}}getExtension(e){return q(this.gl,e,this._extensions),this._extensions}}],889330)},853048,514727,491240,217682,e=>{"use strict";globalThis.mathgl=globalThis.mathgl||{config:{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1}};let t=globalThis.mathgl.config;function r(e,{precision:i=t.precision}={}){return e=Math.round(e/t.EPSILON)*t.EPSILON,`${parseFloat(e.toPrecision(i))}`}function i(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function n(e,r,s){let o=t.EPSILON;s&&(t.EPSILON=s);try{if(e===r)return!0;if(i(e)&&i(r)){if(e.length!==r.length)return!1;for(let t=0;t<e.length;++t)if(!n(e[t],r[t]))return!1;return!0}if(e&&e.equals)return e.equals(r);if(r&&r.equals)return r.equals(e);if("number"==typeof e&&"number"==typeof r)return Math.abs(e-r)<=t.EPSILON*Math.max(1,Math.abs(e),Math.abs(r));return!1}finally{t.EPSILON=o}}e.s(["clamp",0,function(e,t,r){return function(e,t,r){if(i(e)){r=r||(e.clone?e.clone():Array(e.length));for(let i=0;i<r.length&&i<e.length;++i){let n="number"==typeof e?e:e[i];r[i]=t(n,i,r)}return r}return t(e)}(e,e=>Math.max(t,Math.min(r,e)))},"config",0,t,"equals",0,n,"formatValue",0,r,"isArray",0,i,"lerp",0,function e(t,r,n){return i(t)?t.map((t,i)=>e(t,r[i],n)):n*r+(1-n)*t}],514727);class s extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,t=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=e[r+t];return this.check()}toArray(e=[],t=0){for(let r=0;r<this.ELEMENTS;++r)e[t+r]=this[r];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:i(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(t)}formatString(e){let t="";for(let i=0;i<this.ELEMENTS;++i)t+=(i>0?", ":"")+r(this[i],e);return`${e.printTypes?this.constructor.name:""}[${t}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(!n(this[t],e[t]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let t=0;t<this.ELEMENTS;++t)if(this[t]!==e[t])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,t,r){if(void 0===r)return this.lerp(this,e,t);for(let i=0;i<this.ELEMENTS;++i){let n=e[i],s="number"==typeof t?t:t[i];this[i]=n+r*(s-n)}return this.check()}min(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.min(e[t],this[t]);return this.check()}max(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=Math.max(e[t],this[t]);return this.check()}clamp(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e[r]),t[r]);return this.check()}add(...e){for(let t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]+=t[e];return this.check()}subtract(...e){for(let t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]-=t[e];return this.check()}scale(e){if("number"==typeof e)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;else for(let t=0;t<this.ELEMENTS&&t<e.length;++t)this[t]*=e[t];return this.check()}multiplyByScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}check(){if(t.debug&&!this.validate())throw Error(`math.gl: ${this.constructor.name}
991 some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let t=0;t<this.ELEMENTS;++t)e=e&&Number.isFinite(this[t]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]=e;return this.check()}addScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let t=0;t<this.ELEMENTS;++t)this[t]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],e),t);return this.check()}get elements(){return this}}function o(e){if(!Number.isFinite(e))throw Error(`Invalid number ${JSON.stringify(e)}`);return e}function a(e,t){if(!e)throw Error(`math.gl assertion ${t}`)}e.s(["MathArray",0,s],491240),e.s(["checkNumber",0,o,"checkVector",0,function(e,r,i=""){if(t.debug&&!function(e,t){if(e.length!==t)return!1;for(let t=0;t<e.length;++t)if(!Number.isFinite(e[t]))return!1;return!0}(e,r))throw Error(`math.gl: ${i} some fields set to invalid numbers'`);return e}],217682),e.s(["Vector",0,class extends s{get x(){return this[0]}set x(e){this[0]=o(e)}get y(){return this[1]}set y(e){this[1]=o(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let t=0;t<this.ELEMENTS;++t)e+=this[t]*this[t];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let t=0;for(let r=0;r<this.ELEMENTS;++r){let i=this[r]-e[r];t+=i*i}return o(t)}dot(e){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*e[r];return o(t)}normalize(){let e=this.magnitude();if(0!==e)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e;return this.check()}multiply(...e){for(let t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]*=t[e];return this.check()}divide(...e){for(let t of e)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t[e];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return a(e>=0&&e<this.ELEMENTS,"index is out of range"),o(this[e])}setComponent(e,t){return a(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=t,this.check()}addVectors(e,t){return this.copy(e).add(t)}subVectors(e,t){return this.copy(e).subtract(t)}multiplyVectors(e,t){return this.copy(e).multiply(t)}addScaledVector(e,t){return this.add(new this.constructor(e).multiplyScalar(t))}}],853048)},306719,558037,727719,824337,617891,723102,e=>{"use strict";let t,r,i;var n,s,o=e.i(491240),a=e.i(217682),l=e.i(514727);class c extends o.MathArray{toString(){let e="[";if(l.config.printRowMajor){e+="row-major:";for(let t=0;t<this.RANK;++t)for(let r=0;r<this.RANK;++r)e+=` ${this[r*this.RANK+t]}`}else{e+="column-major:";for(let t=0;t<this.ELEMENTS;++t)e+=` ${this[t]}`}return e+"]"}getElementIndex(e,t){return t*this.RANK+e}getElement(e,t){return this[t*this.RANK+e]}setElement(e,t,r){return this[t*this.RANK+e]=(0,a.checkNumber)(r),this}getColumn(e,t=Array(this.RANK).fill(-0)){let r=e*this.RANK;for(let e=0;e<this.RANK;++e)t[e]=this[r+e];return t}setColumn(e,t){let r=e*this.RANK;for(let e=0;e<this.RANK;++e)this[r+e]=t[e];return this}}var u=e.i(418861),h=e.i(401730),f=e.i(53290);function _(){let e=new f.ARRAY_TYPE(2);return f.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function d(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function E(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function p(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function g(e,t){let r=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(r*r+i*i)}function m(e,t){let r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function T(e){let t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function A(e){let t=e[0],r=e[1];return t*t+r*r}function R(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e}let b=(i=_(),function(e,t,r,n,s,o){let a,l;for(t||(t=2),r||(r=0),l=n?Math.min(n*t+r,e.length):e.length,a=r;a<l;a+=t)i[0]=e[a],i[1]=e[a+1],s(i,i,o),e[a]=i[0],e[a+1]=i[1];return e});e.s(["add",0,function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},"angle",0,function(e,t){let r=e[0],i=e[1],n=t[0],s=t[1],o=Math.sqrt((r*r+i*i)*(n*n+s*s));return Math.acos(Math.min(Math.max(o&&(r*n+i*s)/o,-1),1))},"ceil",0,function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},"clone",0,function(e){let t=new f.ARRAY_TYPE(2);return t[0]=e[0],t[1]=e[1],t},"copy",0,function(e,t){return e[0]=t[0],e[1]=t[1],e},"create",0,_,"cross",0,function(e,t,r){let i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e},"dist",0,g,"distance",0,g,"div",0,p,"divide",0,p,"dot",0,function(e,t){return e[0]*t[0]+e[1]*t[1]},"equals",0,function(e,t){let r=e[0],i=e[1],n=t[0],s=t[1];return Math.abs(r-n)<=f.EPSILON*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-s)<=f.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))},"exactEquals",0,function(e,t){return e[0]===t[0]&&e[1]===t[1]},"floor",0,function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},"forEach",0,b,"fromValues",0,function(e,t){let r=new f.ARRAY_TYPE(2);return r[0]=e,r[1]=t,r},"inverse",0,function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},"len",0,T,"length",0,T,"lerp",0,function(e,t,r,i){let n=t[0],s=t[1];return e[0]=n+i*(r[0]-n),e[1]=s+i*(r[1]-s),e},"max",0,function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},"min",0,function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},"mul",0,E,"multiply",0,E,"negate",0,function(e,t){return e[0]=-t[0],e[1]=-t[1],e},"normalize",0,function(e,t){let r=t[0],i=t[1],n=r*r+i*i;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e},"random",0,function(e,t){t=void 0===t?1:t;let r=2*f.RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},"rotate",0,function(e,t,r,i){let n=t[0]-r[0],s=t[1]-r[1],o=Math.sin(i),a=Math.cos(i);return e[0]=n*a-s*o+r[0],e[1]=n*o+s*a+r[1],e},"round",0,function(e,t){return e[0]=f.round(t[0]),e[1]=f.round(t[1]),e},"scale",0,function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},"scaleAndAdd",0,function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},"set",0,function(e,t,r){return e[0]=t,e[1]=r,e},"sqrDist",0,m,"sqrLen",0,A,"squaredDistance",0,m,"squaredLength",0,A,"
991str",0,function(e){return`vec2(${e[0]}, ${e[1]})`},"sub",0,d,"subtract",0,d,"transformMat2",0,function(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e},"transformMat2d",0,function(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e},"transformMat3",0,function(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e},"transformMat4",0,R,"zero",0,function(e){return e[0]=0,e[1]=0,e}],916168);var S=e.i(823164),M=e.i(980647);(n=s||(s={}))[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";let C=45*Math.PI/180,O=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);function v(e){if(e>2*Math.PI)throw Error("expected radians")}e.s(["Matrix4",0,class e extends c{static get IDENTITY(){return r||Object.freeze(r=new e),r}static get ZERO(){return t||Object.freeze(t=new e([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])),t}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return s}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1==arguments.length&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,t,r,i,n,s,o,a,l,c,u,h,f,_,d,E){return this[0]=e,this[1]=t,this[2]=r,this[3]=i,this[4]=n,this[5
991]=s,this[6]=o,this[7]=a,this[8]=l,this[9]=c,this[10]=u,this[11]=h,this[12]=f,this[13]=_,this[14]=d,this[15]=E,this.check()}setRowMajor(e,t,r,i,n,s,o,a,l,c,u,h,f,_,d,E){return this[0]=e,this[1]=n,this[2]=l,this[3]=f,this[4]=t,this[5]=s,this[6]=c,this[7]=_,this[8]=r,this[9]=o,this[10]=u,this[11]=d,this[12]=i,this[13]=a,this[14]=h,this[15]=E,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(O)}fromObject(e){return this.check()}fromQuaternion(e){return(0,h.fromQuat)(this,e),this.check()}frustum(e){var t,r,i,n,s,o;let{left:a,right:l,bottom:c,top:u,near:f=.1,far:_=500}=e;return _===1/0?(t=this,r=a,i=l,n=c,s=u,o=f,t[0]=2*o/(i-r),t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o/(s-n),t[6]=0,t[7]=0,t[8]=(i+r)/(i-r),t[9]=(s+n)/(s-n),t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=-2*o,t[15]=0):(0,h.frustum)(this,a,l,c,u,f,_),this.check()}lookAt(e){let{eye:t,center:r=[0,0,0],up:i=[0,1,0]}=e;return(0,h.lookAt)(this,t,r,i),this.check()}ortho(e){let{left:t,right:r,bottom:i,top:n,near:s=.1,far:o=500}=e;return(0,h.ortho)(this,t,r,i,n,s,o),this.check()}orthographic(e){let{fovy:t=C,aspect:r=1,focalDistance:i=1,near:n=.1,far:s=500}=e;v(t);let o=i*Math.tan(t/2),a=o*r;return this.ortho({left:-a,right:a,bottom:-o,top:o,near:n,far:s})}perspective(e){let{fovy:t=45*Math.PI/180,aspect:r=1,near:i=.1,far:n=500}=e;return v(t),(0,h.perspective)(this,t,r,i,n),this.check()}determinant(){return(0,h.determinant)(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),i=1/r[0],n=1/r[1],s=1/r[2];return e[0]=this[0]*i,e[1]=this[1]*n,e[2]=this[2]*s,e[3]=0,e[4]=this[4]*i,e[5]=this[5]*n,e[6]=this[6]*s,e[7]=0,e[8]=this[8]*i,e[9]=this[9]*n,e[10]=this[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,t){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],t=t||[-0,-0,-0];let r=this.getScale(t),i=1/r[0],n=1/r[1],s=1/r[2];return e[0]=this[0]*i,e[1]=this[1]*n,e[2]=this[2]*s,e[3]=this[4]*i,e[4]=this[5]*n,e[5]=this[6]*s,e[6]=this[8]*i,e[7]=this[9]*n,e[8]=this[10]*s,e}transpose(){return(0,h.transpose)(this,this),this.check()}invert(){return(0,h.invert)(this,this),this.check()}multiplyLeft(e){return(0,h.multiply)(this,e,this),this.check()}multiplyRight(e){return(0,h.multiply)(this,this,e),this.check()}rotateX(e){return(0,h.rotateX)(this,this,e),this.check()}rotateY(e){return(0,h.rotateY)(this,this,e),this.check()}rotateZ(e){return(0,h.rotateZ)(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,t){return(0,h.rotate)(this,this,e,t),this.check()}scale(e){return(0,h.scale)(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return(0,h.translate)(this,this,e),this.check()}transform(e,t){return 4===e.length?(t=(0,M.transformMat4)(t||[-0,-0,-0,-0],e,this),(0,a.checkVector)(t,4),t):this.transformAsPoint(e,t)}transformAsPoint(e,t){let r,{length:i}=e;switch(i){case 2:r=R(t||[-0,-0],e,this);break;case 3:r=(0,S.transformMat4)(t||[-0,-0,-0],e,this);break;default:throw Error("Illegal vector")}return(0,a.checkVector)(r,e.length),r}transformAsVector(e,t){let r;switch(e.length){case 2:r=(0,u.vec2_transformMat4AsVector)(t||[-0,-0],e,this);break;case 3:r=(0,u.vec3_transformMat4AsVector)(t||[-0,-0,-0],e,this);break;default:throw Error("Illegal vector")}return(0,a.checkVector)(r,e.length),r}transformPoint(e,t){return this.transformAsPoint(e,t)}transformVector(e,t){return this.transformAsPoint(e,t)}transformDirection(e,t){return this.transformAsVector(e,t)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,t,r){return this.identity().translate([e,t,r])}}],306719);var N=e.i(483890);function I(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function y(e,t){let r=N.vec4.transformMat4([],t,e);return N.vec4.scale(r,r,1/r[3]),r}function L(e,t,r){return e<t?t:e>r?r:e}let P=Math.log2||function(e){return Math.log(e)*Math.LOG2E};e.s(["clamp",0,L,"createMat4",0,I,"log2",0,P,"mod",0,function(e,t){let r=e%t;return r<0?t+r:r},"transformVector",0,y],558037);var D=e.i(313768),F=e.i(916168);
991e.s(["vec2",0,F],727719);var F=F,x=S;e.s(["vec3",0,x],824337);var x=S;function B(e,t){if(!e)throw Error(t||"@math.gl/web-mercator: assertion failed.")}e.s(["assert",0,B],617891);let w=Math.PI,U=w/4,G=w/180,k=180/w;function W(e){let[t,r]=e;B(Number.isFinite(t)),B(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let i=512*(w+Math.log(Math.tan(U+r*G*.5)))/(2*w);return[512*(t*G+w)/(2*w),i]}function j(e){let[t,r]=e,i=2*(Math.atan(Math.exp(r/512*(2*w)-w))-U);return[(t/512*(2*w)-w)*k,i*k]}function H(e){let{latitude:t,longitude:r,highPrecision:i=!1}=e;B(Number.isFinite(t)&&Number.isFinite(r));let n=Math.cos(t*G),s=512/360/n,o=512/4003e4/n,a={unitsPerMeter:[o,o,o],metersPerUnit:[1/o,1/o,1/o],unitsPerDegree:[512/360,s,o],degreesPerUnit:[1/(512/360),1/s,1/o]};if(i){let e=G*Math.tan(t*G)/n,r=512/4003e4*e,i=r/s*o;a.unitsPerDegree2=[0,512/360*e/2,r],a.unitsPerMeter2=[i,0,i]}return a}function X(e){return 2*Math.atan(.5/e)*k}function V(e){return .5/Math.tan(.5*e*G)}e.s(["MAX_LATITUDE",0,85.051129,"addMetersToLngLat",0,function(e,t){let[r,i,n]=e,[s,o,a]=t,{unitsPerMeter:l,unitsPerMeter2:c}=H({longitude:r,latitude:i,highPrecision:!0}),u=W(e);u[0]+=s*(l[0]+c[0]*o),u[1]+=o*(l[1]+c[1]*o);let h=j(u);return Number.isFinite(n)||Number.isFinite(a)?[h[0],h[1],(n||0)+(a||0)]:h},"altitudeToFovy",0,X,"fovyToAltitude",0,V,"getDistanceScales",0,H,"getMeterZoom",0,function(e){let{latitude:t}=e;return B(Number.isFinite(t)),P(4003e4*Math.cos(t*G))-9},"getProjectionParameters",0,function(e){let{width:t,height:r,altitude:i,pitch:n=0,offset:s,center:o,scale:a,nearZMultiplier:l=1,farZMultiplier:c=1}=e,{fovy:u=X(1.5)}=e;void 0!==i&&(u=X(i));let h=u*G,f=n*G,_=V(u),d=_;o&&(d+=o[2]*a/Math.cos(f)/r);let E=h*(.5+(s?s[1]:0)/r),p=Math.sin(E)*d/Math.sin(L(Math.PI/2-f-E,.01,Math.PI-.01));return{fov:h,aspect:t/r,focalDistance:_,near:l,far:Math.min((Math.sin(f)*p+d)*c,10*d)}},"getViewMatrix",0,function(e){let{height:t,pitch:r,bearing:i,altitude:n,scale:s,center:o}=e,a=I();D.mat4.translate(a,a,[0,0,-n]),D.mat4.rotateX(a,a,-r*G),D.mat4.rotateZ(a,a,i*G);let l=s/t;return D.mat4.scale(a,a,[l,l,l]),o&&D.mat4.translate(a,a,x.negate([],o)),a},"lngLatToWorld",0,W,"pixelsToWorld",0,function(e,t,r=0){let[i,n,s]=e;if(B(Number.isFinite(i)&&Number.isFinite(n),"invalid pixel coordinate"),Number.isFinite(s))return y(t,[i,n,s,1]);let o=y(t,[i,n,0,1]),a=y(t,[i,n,1,1]),l=o[2],c=a[2];return F.lerp([],o,a,l===c?0:((r||0)-l)/(c-l))},"unitsPerMeter",0,function(e){return 512/4003e4/Math.cos(e*G)},"worldToLngLat",0,j,"worldToPixels",0,function(e,t){let[r,i,n=0]=e;return B(Number.isFinite(r)&&Number.isFinite(i)&&Number.isFinite(n)),y(t,[r,i,n,1])}],723102)},969170,823164,418861,e=>{"use strict";let t,r;var i=e.i(853048),n=e.i(514727),s=e.i(217682),o=e.i(53290);function a(){let e=new o.ARRAY_TYPE(3);return o.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function l(e){let t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function c(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function u(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function h(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function f(e,t){let r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return Math.sqrt(r*r+i*i+n*n)}function _(e,t){let r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2];return r*r+i*i+n*n}function d(e){let t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function E(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function p(e,t,r){let i=t[0],n=t[1],s=t[2],o=r[0],a=r[1],l=r[2];return e[0]=n*l-s*a,e[1]=s*o-i*l,e[2]=i*a-n*o,e}function g(e,t,r){let i=t[0],n=t[1],s=t[2],o=r[3]*i+r[7]*n+r[11]*s+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*s+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*s+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*s+r[14])/o,e}function m(e,t,r){let i=t[0],n=t[1],s=t[2];return e[0]=i*r[0]+n*r[3]+s*r[6],e[1]=i*r[1]+n*r[4]+s*r[7],e[2]=i*r[2]+n*r[5]+s*r[8],e}function T(e,t,r){let i=r[0],n=r[1],s=r[2],o=r[3],a=t[0],l=t[1],c=t[2],u=n*c-s*l,h=s*a-i*c,f=i*l-n*a,_=n*f-s*h,d=s*u-i*f,E=i*h-n*u,p=2*o;return u*=p,h*=p,f*=p,_*=2,d*=2,E*=2,e[0]=a+u+_,e[1]=l+h+d,e[2]=c+f+E,e}
991function A(e,t,r,i){let n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[0],s[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),s[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function R(e,t,r,i){let n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),s[1]=n[1],s[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function b(e,t,r,i){let n=[],s=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],s[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),s[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),s[2]=n[2],e[0]=s[0]+r[0],e[1]=s[1]+r[1],e[2]=s[2]+r[2],e}function S(e,t){let r=e[0],i=e[1],n=e[2],s=t[0],o=t[1],a=t[2],l=Math.sqrt((r*r+i*i+n*n)*(s*s+o*o+a*a));return Math.acos(Math.min(Math.max(l&&E(e,t)/l,-1),1))}let M=(r=a(),function(e,t,i,n,s,o){let a,l;for(t||(t=3),i||(i=0),l=n?Math.min(n*t+i,e.length):e.length,a=i;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],r[2]=e[a+2],s(r,r,o),e[a]=r[0],e[a+1]=r[1],e[a+2]=r[2];return e});function C(e,t,r){let i=t[0],n=t[1],s=t[2],o=r[3]*i+r[7]*n+r[11]*s||1;return e[0]=(r[0]*i+r[4]*n+r[8]*s)/o,e[1]=(r[1]*i+r[5]*n+r[9]*s)/o,e[2]=(r[2]*i+r[6]*n+r[10]*s)/o,e}function O(e,t,r){let i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e[2]=t[2],e}e.s(["add",0,function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e},"angle",0,S,"bezier",0,function(e,t,r,i,n,s){let o=1-s,a=o*o,l=s*s,c=a*o,u=3*s*a,h=3*l*o,f=l*s;return e[0]=t[0]*c+r[0]*u+i[0]*h+n[0]*f,e[1]=t[1]*c+r[1]*u+i[1]*h+n[1]*f,e[2]=t[2]*c+r[2]*u+i[2]*h+n[2]*f,e},"ceil",0,function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},"clone",0,function(e){let t=new o.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},"copy",0,function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},"create",0,a,"cross",0,p,"dist",0,f,"distance",0,f,"div",0,h,"divide",0,h,"dot",0,E,"equals",0,function(e,t){let r=e[0],i=e[1],n=e[2],s=t[0],a=t[1],l=t[2];return Math.abs(r-s)<=o.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-a)<=o.EPSILON*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-l)<=o.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},"exactEquals",0,function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},"floor",0,function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},"forEach",0,M,"fromValues",0,function(e,t,r){let i=new o.ARRAY_TYPE(3);return i[0]=e,i[1]=t,i[2]=r,i},"hermite",0,function(e,t,r,i,n,s){let o=s*s,a=o*(2*s-3)+1,l=o*(s-2)+s,c=o*(s-1),u=o*(3-2*s);return e[0]=t[0]*a+r[0]*l+i[0]*c+n[0]*u,e[1]=t[1]*a+r[1]*l+i[1]*c+n[1]*u,e[2]=t[2]*a+r[2]*l+i[2]*c+n[2]*u,e},"inverse",0,function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},"len",0,l,"length",0,l,"lerp",0,function(e,t,r,i){let n=t[0],s=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=s+i*(r[1]-s),e[2]=o+i*(r[2]-o),e},"max",0,function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},"min",0,function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},"mul",0,u,"multiply",0,u,"negate",0,function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},"normalize",0,function(e,t){let r=t[0],i=t[1],n=t[2],s=r*r+i*i+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e},"random",0,function(e,t){t=void 0===t?1:t;let r=2*o.RANDOM()*Math.PI,i=2*o.RANDOM()-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e},"rotateX",0,A,"rotateY",0,R,"rotateZ",0,b,"round",0,function(e,t){return e[0]=o.round(t[0]),e[1]=o.round(t[1]),e[2]=o.round(t[2]),e},"scale",0,function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e},"scaleAndAdd",0,function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e},"set",0,function(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e},"slerp",0,function(e,t,r,i){let n=Math.acos(Math.min(Math.max(E(t,r),-1),1)),s=Math.sin(n),o=Math.sin((1-i)*n)/s,a=Math.sin(i*n)/s;return e[0]=o*t[0]+a*r[0],e[1]=o*t[1]+a*r[1],e[2]=o*t[2]+a*r[2],e},"sqrDist",0,_,"sqrLen",0,d,"squaredDistance",0,_,"squaredLength",0,d,"str",0,function(e){return`vec3(${e[0]}, ${e[1]}, ${e[2]})`},"sub",0,c,"subtract",0,c,"transformMat3",0,m,"transformMat4",0,g,"transformQuat",0,T,"zero",0,function(e){return e[0]=0,e[1]=0,e[2]=0,e}],823164),e.s(["vec2_transformMat4AsVector",0,function(e,t,r){let i=t[0],n=t[1],s=r[3]*i+r[7]*n||1;return e[0]=(r[0]*i+r[4]*n)/s,e[1]=(r[1]*i+r[5]*n)/s,e},"vec3_transformMat2",0,O,"vec3_transformMat4AsVector",0,C],418861);let v=[0,0,0];class N extends i.Vector{static get ZERO(){return t||Object.freeze(t=new N(0,0,0)),t}constructor(e=0,t=0,r=0){super(-0,-0,-0),1==arguments.length&&(0,n.isArray)(e)?this.copy(e):(n.config.debug&&((0,s.checkNumber)(e),(0,s.checkNumber)(t),(0,s.checkNumber)(r)),this[0]=e,this[1]=t,this[2]=r)}set(e,t,r){return this[0]=e,this[1]=t,this[2]=r,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return n.config.debug&&((0,s.checkNumber)(e.x),(0,s.checkNumber)(e.y),(0,s.checkNumber)(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=(0,s.checkNumber)(e)}angle(e){return S(this,e)}cross(e){return p(this,this,e),this.check()}rotateX({radians:e,origin:t=v}){return A(this,this,t,e),this.check()}rotateY({radians:e,origin:t=v}){return R(this,this,t,e),this.check()}rotateZ({radians:e,origin:t=v}){return b(this,this,t,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return g(this,this,e),this.check()}transformAsVector(e){return C(this,this,e),this.check()}transformByMatrix3(e){return m(this,this,e),this.check()}transformByMatrix2(e){return O(this,this,e),this.check()}transformByQuaternion(e){return T(this,this,e),this.check()}}e.s(["Vector3",0,N],969170)},53290,e=>{"use strict";let t="u">typeof Float32Array?Float32Array:Array,r=Math.random;e.s(["ARRAY_TYPE",()=>t,"EPSILON",0,1e-6,"RANDOM",0,r,"round",0,function(e){return e>=0?Math.round(e):e%.5==0?Math.floor(e):Math.round(e)}])},313768,401730,980647,483890,e=>{"use strict";let t;var r=e.i(53290);function i(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
991]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function n(e,t,r){let i=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=t[9],_=t[10],d=t[11],E=t[12],p=t[13],g=t[14],m=t[15],T=r[0],A=r[1],R=r[2],b=r[3];return e[0]=T*i+A*a+R*h+b*E,e[1]=T*n+A*l+R*f+b*p,e[2]=T*s+A*c+R*_+b*g,e[3]=T*o+A*u+R*d+b*m,T=r[4],A=r[5],R=r[6],b=r[7],e[4]=T*i+A*a+R*h+b*E,e[5]=T*n+A*l+R*f+b*p,e[6]=T*s+A*c+R*_+b*g,e[7]=T*o+A*u+R*d+b*m,T=r[8],A=r[9],R=r[10],b=r[11],e[8]=T*i+A*a+R*h+b*E,e[9]=T*n+A*l+R*f+b*p,e[10]=T*s+A*c+R*_+b*g,e[11]=T*o+A*u+R*d+b*m,T=r[12],A=r[13],R=r[14],b=r[15],e[12]=T*i+A*a+R*h+b*E,e[13]=T*n+A*l+R*f+b*p,e[14]=T*s+A*c+R*_+b*g,e[15]=T*o+A*u+R*d+b*m,e}function s(e,t,r){let i=t[0],n=t[1],s=t[2],o=t[3],a=i+i,l=n+n,c=s+s,u=i*a,h=i*l,f=i*c,_=n*l,d=n*c,E=s*c,p=o*a,g=o*l,m=o*c;return e[0]=1-(_+E),e[1]=h+m,e[2]=f-g,e[3]=0,e[4]=h-m,e[5]=1-(u+E),e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-(u+_),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function o(e,t){let r=t[0],i=t[1],n=t[2],s=t[4],o=t[5],a=t[6],l=t[8],c=t[9],u=t[10];return e[0]=Math.sqrt(r*r+i*i+n*n),e[1]=Math.sqrt(s*s+o*o+a*a),e[2]=Math.sqrt(l*l+c*c+u*u),e}function a(e,t,r,i,n){let s=1/Math.tan(t/2);if(e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){let t=1/(i-n);e[10]=(n+i)*t,e[14]=2*n*i*t}else e[10]=-1,e[14]=-2*i;return e}function l(e,t,r,i,n,s,o){let a=1/(t-r),l=1/(i-n),c=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*l,e[14]=(o+s)*c,e[15]=1,e}function c(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}e.s(["add",0,function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},"adjoint",0,function(e,t){let r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],f=t[10],_=t[11],d=t[12],E=t[13],p=t[14],g=t[15],m=r*a-i*o,T=r*l-n*o,A=r*c-s*o,R=i*l-n*a,b=i*c-s*a,S=n*c-s*l,M=u*E-h*d,C=u*p-f*d,O=u*g-_*d,v=h*p-f*E,N=h*g-_*E,I=f*g-_*p;return e[0]=a*I-l*N+c*v,e[1]=n*N-i*I-s*v,e[2]=E*S-p*b+g*R,e[3]=f*b-h*S-_*R,e[4]=l*O-o*I-c*C,e[5]=r*I-n*O+s*C,e[6]=p*A-d*S-g*T,e[7]=u*S-f*A+_*T,e[8]=o*N-a*O+c*M,e[9]=i*O-r*N-s*M,e[10]=d*b-E*A+g*m,e[11]=h*A-u*b-_*m,e[12]=a*C-o*v-l*M,e[13]=r*v-i*C+n*M,e[14]=E*T-d*R-p*m,e[15]=u*R-h*T+f*m,e},"clone",0,function(e){let t=new r.ARRAY_TYPE(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},"copy",0,function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},"create",0,function(){let e=new r.ARRAY_TYPE(16);return r.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},"decompose",0,function(e,t,r,i){t[0]=i[12],t[1]=i[13],t[2]=i[14];let n=i[0],s=i[1],o=i[2],a=i[4],l=i[5],c=i[6],u=i[8],h=i[9],f=i[10];r[0]=Math.sqrt(n*n+s*s+o*o),r[1]=Math.sqrt(a*a+l*l+c*c),r[2]=Math.sqrt(u*u+h*h+f*f);let _=1/r[0],d=1/r[1],E=1/r[2],p=n*_,g=s*d,m=o*E,T=a*_,A=l*d,R=c*E,b=u*_,S=h*d,M=f*E,C=p+A+M,O=0;return C>0?(O=2*Math.sqrt(C+1),e[3]=.25*O,e[0]=(R-S)/O,e[1]=(b-m)/O,e[2]=(g-T)/O):p>A&&p>M?(O=2*Math.sqrt(1+p-A-M),e[3]=(R-S)/O,e[0]=.25*O,e[1]=(g+T)/O,e[2]=(b+m)/O):A>M?(O=2*Math.sqrt(1+A-p-M),e[3]=(b-m)/O,e[0]=(g+T)/O,e[1]=.25*O,e[2]=(R+S)/O):(O=2*Math.sqrt(1+M-p-A),e[3]=(g-T)/O,e[0]=(b+m)/O,e[1]=(R+S)/O,e[2]=.25*O),e},"determinant",0,function(e){let t=e[0],r=e[1],i=e[2],n=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],u=e[9],h=e[10],f=e[11],_=e[12],d=e[13],E=e[14],p=e[15],g=t*o-r*s,m=t*a-i*s,T=r*a-i*o,A=c*d-u*_,R=c*E-h*_,b=u*E-h*d;return l*(t*b-r*R+i*A)-n*(s*b-o*R+a*A)+p*(c*T-u*m+h*g)-f*(_*T-d*m+E*g)},"equals",0,function(e,t){let i=e[0],n=e[1],s=e[2],o=e[3],a=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],_=e[10],d=e[11],E=e[12],p=e[13],g=e[14],m=e[15],T=t[0],A=t[1],R=t[2],b=t[3],S=t[4],M=t[5],C=t[6],O=t[7],v=t[8],N=t[9],I=t[10],y=t[11],L=t[12],P=t[13],D=t[14],F=t[15];return Math.abs(i-T)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(T))&&Math.abs(n-A)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(A))&&Math.abs(s-R)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(o-b)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(a-S)<=r.EPSILON*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(l-M)<=r.EPSILON*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(c-C)<=r.EPSILON*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(u-O)<=r.EPSILON*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(h-v)<=r.EPSILON*Math.max(1,Math.abs(h),Math.abs(v))&&Math.abs(f-N)<=r.EPSILON*Math.max(1,Math.abs(f),Math.abs(N))&&Math.abs(_-I)<=r.EPSILON*Math.max(1,Math.abs(_),Math.abs(I))&&Math.abs(d-y)<=r.EPSILON*Math.max(1,Math.abs(d),Math.abs(y))&&Math.abs(E-L)<=r.EPSILON*Math.max(1,Math.abs(E),Math.abs(L))&&Math.abs(p-P)<=r.EPSILON*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(g-D)<=r.EPSILON*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(m-F)<=r.EPSILON*Math.max(1,Math.abs(m),Math.abs(F))},"exactEquals",0,function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},"frob",0,function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])},"fromQuat",0,function(e,t){let r=t[0],i=t[1],n=t[2],s=t[3],o=r+r,a=i+i,l=n+n,c=r*o,u=i*o,h=i*a,f=n*o,_=n*a,d=n*l,E=s*o,p=s*a,g=s*l;return e[0]=1-h-d,e[1]=u+g,e[2]=f-p,e[3]=0,e[4]=u-g,e[5]=1-c-d,e[6]=_+E,e[7]=0,e[8]=f+p,e[9]=_-E,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},"fromQuat2",0,function(e,t){let i=new r.ARRAY_TYPE(3),n=-t[0],o=-t[1],a=-t[2],l=t[3],c=t[4],u=t[5],h=t[6],f=t[7],_=n*n+o*o+a*a+l*l;return _>0?(i[0]=(c*l+f*n+u*a-h*o)*2/_,i[1]=(u*l+f*o+h*n-c*a)*2/_,i[2]=(h*l+f*a+c*o-u*n)*2/_):(i[0]=(c*l+f*n+u*a-h*o)*2,i[1]=(u*l+f*o+h*n-c*a)*2,i[2]=(h*l+f*a+c*o-u*n)*2),s(e,t,i),e},"fromRotation",0,function(e,t,i){let n,s,o,a=i[0],l=i[1],c=i[2],u=Math.sqrt(a*a+l*l+c*c);return u<r.EPSILON?null:(a*=u=1/u,l*=u,c*=u,s=Math.sin(t),o=1-(n=Math.cos(t)),e[0]=a*a*o+n,e[1]=l*a*o+c*s,e[2]=c*a*o-l*s,e[3]=0,e[4]=a*l*o-c*s,e[5]=l*l*o+n,e[6]=c*l*o+a*s,e[7]=0,e[8]=a*c*o+l*s,e[9]=l*c*o-a*s,e[10]=c*c*o+n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},"fromRotationTranslation",0,s,"fromRotationTranslationScale",0,function(e,t,r,i){let n=t[0],s=t[1],o=t[2],a=t[3],l=n+n,c=s+s,u=o+o,h=n*l,f=n*c,_=n*u,d=s*c,E=s*u,p=o*u,g=a*l,m=a*c,T=a*u,A=i[0],R=i[1],b=i[2];return e[0]=(1-(d+p))*A,e[1]=(f+T)*A,e[2]=(_-m)*A,e[3]=0,e[4]=(f-T)*R,e[5]=(1-(h+p))*R,e[6]=(E+g)*R,e[7]=0,e[8]=(_+m)*b,e[9]=(E-g)*b,e[10]=(1-(h+d))*b,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},"fromRotationTranslationScaleOrigin",0,function(e,t,r,i,n){let s=t[0],o=t[1],a=t[2],l=t[3],c=s+s,u=o+o,h=a+a,f=s*c,_=s*u,d=s*h,E=o*u,p=o*h,g=a*h,m=l*c,T=l*u,A=l*h,R=i[0],b=i[1],S=i[2],M=n[0],C=n[1],O=n[2],v=(1-(E+g))*R,N=(_+A)*R,I=(d-T)*R,y=(_-A)*b,L=(1-(f+g))*b,P=(p+m)*b,D=(d+T)*S,F=(p-m)*S,x=(1-(f+E))*S;return e[0]=v,e[1]=N,e[2]=I,e[3]=0,e[4]=y,e[5]=L,e[6]=P,e[7]=0,e[8]=D,e[9]=F,e[10]=x,e[11]=0,e[12]=r[0]+M-(v*M+y*C+D*O),e[13]=r[1]+C-(N*M+L*C+F*O),e[14]=r[2]+O-(I*M+P*C+x*O),e[15]=1,e},"fromScaling",0,function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
991]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},"fromTranslation",0,function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},"fromValues",0,function(e,t,i,n,s,o,a,l,c,u,h,f,_,d,E,p){let g=new r.ARRAY_TYPE(16);return g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=s,g[5]=o,g[6]=a,g[7]=l,g[8]=c,g[9]=u,g[10]=h,g[11]=f,g[12]=_,g[13]=d,g[14]=E,g[15]=p,g},"fromXRotation",0,function(e,t){let r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},"fromYRotation",0,function(e,t){let r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},"fromZRotation",0,function(e,t){let r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},"frustum",0,function(e,t,r,i,n,s,o){let a=1/(r-t),l=1/(n-i),c=1/(s-o);return e[0]=2*s*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*s*l,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(n+i)*l,e[10]=(o+s)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*s*2*c,e[15]=0,e},"getRotation",0,function(e,t){let i=new r.ARRAY_TYPE(3);o(i,t);let n=1/i[0],s=1/i[1],a=1/i[2],l=t[0]*n,c=t[1]*s,u=t[2]*a,h=t[4]*n,f=t[5]*s,_=t[6]*a,d=t[8]*n,E=t[9]*s,p=t[10]*a,g=l+f+p,m=0;return g>0?(m=2*Math.sqrt(g+1),e[3]=.25*m,e[0]=(_-E)/m,e[1]=(d-u)/m,e[2]=(c-h)/m):l>f&&l>p?(m=2*Math.sqrt(1+l-f-p),e[3]=(_-E)/m,e[0]=.25*m,e[1]=(c+h)/m,e[2]=(d+u)/m):f>p?(m=2*Math.sqrt(1+f-l-p),e[3]=(d-u)/m,e[0]=(c+h)/m,e[1]=.25*m,e[2]=(_+E)/m):(m=2*Math.sqrt(1+p-l-f),e[3]=(c-h)/m,e[0]=(d+u)/m,e[1]=(_+E)/m,e[2]=.25*m),e},"getScaling",0,o,"getTranslation",0,function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},"identity",0,i,"invert",0,function(e,t){let r=t[0],i=t[1],n=t[2],s=t[3],o=t[4],a=t[5],l=t[6],c=t[7],u=t[8],h=t[9],f=t[10],_=t[11],d=t[12],E=t[13],p=t[14],g=t[15],m=r*a-i*o,T=r*l-n*o,A=r*c-s*o,R=i*l-n*a,b=i*c-s*a,S=n*c-s*l,M=u*E-h*d,C=u*p-f*d,O=u*g-_*d,v=h*p-f*E,N=h*g-_*E,I=f*g-_*p,y=m*I-T*N+A*v+R*O-b*C+S*M;return y?(y=1/y,e[0]=(a*I-l*N+c*v)*y,e[1]=(n*N-i*I-s*v)*y,e[2]=(E*S-p*b+g*R)*y,e[3]=(f*b-h*S-_*R)*y,e[4]=(l*O-o*I-c*C)*y,e[5]=(r*I-n*O+s*C)*y,e[6]=(p*A-d*S-g*T)*y,e[7]=(u*S-f*A+_*T)*y,e[8]=(o*N-a*O+c*M)*y,e[9]=(i*O-r*N-s*M)*y,e[10
991]=(d*b-E*A+g*m)*y,e[11]=(h*A-u*b-_*m)*y,e[12]=(a*C-o*v-l*M)*y,e[13]=(r*v-i*C+n*M)*y,e[14]=(E*T-d*R-p*m)*y,e[15]=(u*R-h*T+f*m)*y,e):null},"lookAt",0,function(e,t,n,s){let o,a,l,c,u,h,f,_,d,E,p=t[0],g=t[1],m=t[2],T=s[0],A=s[1],R=s[2],b=n[0],S=n[1],M=n[2];return Math.abs(p-b)<r.EPSILON&&Math.abs(g-S)<r.EPSILON&&Math.abs(m-M)<r.EPSILON?i(e):(o=1/Math.sqrt((_=p-b)*_+(d=g-S)*d+(E=m-M)*E),_*=o,d*=o,E*=o,(o=Math.sqrt((a=A*E-R*d)*a+(l=R*_-T*E)*l+(c=T*d-A*_)*c))?(a*=o=1/o,l*=o,c*=o):(a=0,l=0,c=0),(o=Math.sqrt((u=d*c-E*l)*u+(h=E*a-_*c)*h+(f=_*l-d*a)*f))?(u*=o=1/o,h*=o,f*=o):(u=0,h=0,f=0),e[0]=a,e[1]=u,e[2]=_,e[3]=0,e[4]=l,e[5]=h,e[6]=d,e[7]=0,e[8]=c,e[9]=f,e[10]=E,e[11]=0,e[12]=-(a*p+l*g+c*m),e[13]=-(u*p+h*g+f*m),e[14]=-(_*p+d*g+E*m),e[15]=1,e)},"mul",0,n,"multiply",0,n,"multiplyScalar",0,function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},"multiplyScalarAndAdd",0,function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10
991]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e},"ortho",0,l,"orthoNO",0,l,"orthoZO",0,function(e,t,r,i,n,s,o){let a=1/(t-r),l=1/(i-n),c=1/(s-o);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*l,e[14]=s*c,e[15]=1,e},"perspective",0,a,"perspectiveFromFieldOfView",0,function(e,t,r,i){let n=Math.tan(t.upDegrees*Math.PI/180),s=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),a=Math.tan(t.rightDegrees*Math.PI/180),l=2/(o+a),c=2/(n+s);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-((o-a)*l*.5),e[9]=(n-s)*c*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e},"perspectiveNO",0,a,"perspectiveZO",0,function(e,t,r,i,n){let s=1/Math.tan(t/2);if(e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0){let t=1/(i-n);e[10]=n*t,e[14]=n*i*t}else e[10]=-1,e[14]=-i;return e},"rotate",0,function(e,t,i,n){let s,o,a,l,c,u,h,f,_,d,E,p,g,m,T,A,R,b,S,M,C,O,v,N,I=n[0],y=n[1],L=n[2],P=Math.sqrt(I*I+y*y+L*L);return P<r.EPSILON?null:(I*=P=1/P,y*=P,L*=P,o=Math.sin(i),a=1-(s=Math.cos(i)),l=t[0],c=t[1],u=t[2],h=t[3],f=t[4],_=t[5],d=t[6],E=t[7],p=t[8],g=t[9],m=t[10],T=t[11],A=I*I*a+s,R=y*I*a+L*o,b=L*I*a-y*o,S=I*y*a-L*o,M=y*y*a+s,C=L*y*a+I*o,O=I*L*a+y*o,v=y*L*a-I*o,N=L*L*a+s,e[0]=l*A+f*R+p*b,e[1]=c*A+_*R+g*b,e[2]=u*A+d*R+m*b,e[3]=h*A+E*R+T*b,e[4]=l*S+f*M+p*C,e[5]=c*S+_*M+g*C,e[6]=u*S+d*M+m*C,e[7]=h*S+E*M+T*C,e[8]=l*O+f*v+p*N,e[9]=c*O+_*v+g*N,e[10]=u*O+d*v+m*N,e[11]=h*O+E*v+T*N,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)},"rotateX",0,function(e,t,r){let i=Math.sin(r),n=Math.cos(r),s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*n+c*i,e[5]=o*n+u*i,e[6]=a*n+h*i,e[7]=l*n+f*i,e[8]=c*n-s*i,e[9]=u*n-o*i,e[10]=h*n-a*i,e[11]=f*n-l*i,e},"rotateY",0,function(e,t,r){let i=Math.sin(r),n=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],c=t[8],u=t[9],h=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*n-c*i,e[1]=o*n-u*i,e[2]=a*n-h*i,e[3]=l*n-f*i,e[8]=s*i+c*n,e[9]=o*i+u*n,e[10]=a*i+h*n,e[11]=l*i+f*n,e},"rotateZ",0,function(e,t,r){let i=Math.sin(r),n=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],c=t[4],u=t[5],h=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*n+c*i,e[1]=o*n+u*i,e[2]=a*n+h*i,e[3]=l*n+f*i,e[4]=c*n-s*i,e[5]=u*n-o*i,e[6]=h*n-a*i,e[7]=f*n-l*i,e},"scale",0,function(e,t,r){let i=r[0],n=r[1],s=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},"set",0,function(e,t,r,i,n,s,o,a,l,c,u,h,f,_,d,E,p){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e[4]=s,e[5]=o,e[6]=a,e[7]=l,e[8]=c,e[9]=u,e[10]=h,e[11]=f,e[12]=_,e[13]=d,e[14]=E,e[15]=p,e},"str",0,function(e){return`mat4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]}, ${e[4]}, ${e[5]}, ${e[6]}, ${e[7]}, ${e[8]}, ${e[9]}, ${e[10]}, ${e[11]}, ${e[12]}, ${e[13]}, ${e[14]}, ${e[15]})`},"sub",0,c,"subtract",0,c,"targetTo",0,function(e,t,r,i){let n=t[0],s=t[1],o=t[2],a=i[0],l=i[1],c=i[2],u=n-r[0],h=s-r[1],f=o-r[2],_=u*u+h*h+f*f;_>0&&(u*=_=1/Math.sqrt(_),h*=_,f*=_);let d=l*f-c*h,E=c*u-a*f,p=a*h-l*u;return(_=d*d+E*E+p*p)>0&&(d*=_=1/Math.sqrt(_),E*=_,p*=_),e[0]=d,e[1]=E,e[2]=p,e[3]=0,e[4]=h*p-f*E,e[5]=f*d-u*p,e[6]=u*E-h*d,e[7]=0,e[8]=u,e[9]=h,e[10]=f,e[11]=0,e[12]=n,e[13]=s,e[14]=o,e[15]=1,e},"translate",0,function(e,t,r){let i,n,s,o,a,l,c,u,h,f,_,d,E=r[0],p=r[1],g=r[2];return t===e?(e[12]=t[0]*E+t[4]*p+t[8]*g+t[12],e[13]=t[1]*E+t[5]*p+t[9]*g+t[13],e[14]=t[2]*E+t[6]*p+t[10]*g+t[14],e[15]=t[3]*E+t[7]*p+t[11]*g+t[15]):(i=t[0],n=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=t[9],_=t[10],d=t[11],e[0]=i,e[1]=n,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=c,e[7]=u,e[8]=h,e[9]=f,e[10]=_,e[11]=d,e[12]=i*E+a*p+h*g+t[12],e[13]=n*E+l*p+f*g+t[13],e[14]=s*E+c*p+_*g+t[14],e[15]=o*E+u*p+d*g+t[15]),e},"transpose",0,function(e,t){if(e===t){let r=t[1],i=t[2],n=t[3],s=t[6],o=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=s,e[11]=t[14],e[12]=n,e[13]=o,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}],401730);var u=e.i(401730);function h(){let e=new r.ARRAY_TYPE(4);return r.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function f(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function _(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function d(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function E(e,t){let r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],s=t[3]-e[3];return Math.sqrt(r*r+i*i+n*n+s*s)}function p(e,t){let r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],s=t[3]-e[3];return r*r+i*i+n*n+s*s}function g(e){let t=e[0],r=e[1],i=e[2],n=e[3];return Math.sqrt(t*t+r*r+i*i+n*n)}function m(e){let t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n}e.s(["mat4",0,u],313768);let T=(t=h(),function(e,r,i,n,s,o){let a,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,a=i;a<l;a+=r)t[0]=e[a],t[1]=e[a+1],t[2]=e[a+2],t[3]=e[a+3],s(t,t,o),e[a]=t[0],e[a+1]=t[1],e[a+2]=t[2],e[a+3]=t[3];return e});e.s(["add",0,function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},"ceil",0,function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},"clone",0,function(e){let t=new r.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},"copy",0,function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},"create",0,h,"cross",0,function(e,t,r,i){let n=r[0]*i[1]-r[1]*i[0],s=r[0]*i[2]-r[2]*i[0],o=r[0]*i[3]-r[3]*i[0],a=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],c=r[2]*i[3]-r[3]*i[2],u=t[0],h=t[1],f=t[2],_=t[3];return e[0]=h*c-f*l+_*a,e[1]=-(u*c)+f*o-_*s,e[2]=u*l-h*o+_*n,e[3]=-(u*a)+h*s-f*n,e},"dist",0,E,"distance",0,E,"div",0,d,"divide",0,d,"dot",0,function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},"equals",0,function(e,t){let i=e[0],n=e[1],s=e[2],o=e[3],a=t[0],l=t[1],c=t[2],u=t[3];return Math.abs(i-a)<=r.EPSILON*Math.max(1,Math.abs(i),Math.abs(a)
991)&&Math.abs(n-l)<=r.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(s-c)<=r.EPSILON*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-u)<=r.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},"exactEquals",0,function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},"floor",0,function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},"forEach",0,T,"fromValues",0,function(e,t,i,n){let s=new r.ARRAY_TYPE(4);return s[0]=e,s[1]=t,s[2]=i,s[3]=n,s},"inverse",0,function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},"len",0,g,"length",0,g,"lerp",0,function(e,t,r,i){let n=t[0],s=t[1],o=t[2],a=t[3];return e[0]=n+i*(r[0]-n),e[1]=s+i*(r[1]-s),e[2]=o+i*(r[2]-o),e[3]=a+i*(r[3]-a),e},"max",0,function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},"min",0,function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},"mul",0,_,"multiply",0,_,"negate",0,function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},"normalize",0,function(e,t){let r=t[0],i=t[1],n=t[2],s=t[3],o=r*r+i*i+n*n+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=i*o,e[2]=n*o,e[3]=s*o,e},"random",0,function(e,t){let i,n,s,o,a,l;t=void 0===t?1:t;do a=(i=2*r.RANDOM()-1)*i+(n=2*r.RANDOM()-1)*n;while(a>=1)do l=(s=2*r.RANDOM()-1)*s+(o=2*r.RANDOM()-1)*o;while(l>=1)let c=Math.sqrt((1-a)/l);return e[0]=t*i,e[1]=t*n,e[2]=t*s*c,e[3]=t*o*c,e},"round",0,function(e,t){return e[0]=r.round(t[0]),e[1]=r.round(t[1]),e[2]=r.round(t[2]),e[3]=r.round(t[3]),e},"scale",0,function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},"scaleAndAdd",0,function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},"set",0,function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},"sqrDist",0,p,"sqrLen",0,m,"squaredDistance",0,p,"squaredLength",0,m,"str",0,function(e){return`vec4(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`},"sub",0,f,"subtract",0,f,"transformMat4",0,function(e,t,r){let i=t[0],n=t[1],s=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*s+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*s+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*s+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*s+r[15]*o,e},"transformQuat",0,function(e,t,r){let i=t[0],n=t[1],s=t[2],o=r[0],a=r[1],l=r[2],c=r[3],u=c*i+a*s-l*n,h=c*n+l*i-o*s,f=c*s+o*n-a*i,_=-o*i-a*n-l*s;return e[0]=u*c+-(_*o)+-(h*l)- -(f*a),e[1]=h*c+-(_*a)+-(f*o)- -(u*l),e[2]=f*c+-(_*l)+-(u*a)- -(h*o),e[3]=t[3],e},"zero",0,function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}],980647);var A=e.i(980647);e.s(["vec4",0,A],483890)},422291,388169,113158,288526,e=>{"use strict";let t="4.1.1";var r,i,n=e.i(321831);function s(){return"object"==typeof n.default&&"[object process]"===String(n.default),!0}function o(e,t){if(!e)throw Error(t||"Assertion failed")}function a(e){let t;if(!e)return 0;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return o(Number.isFinite(t)&&t>=0),t}e.s(["isElectron",0,function(e){if("u">typeof window&&window.process?.type==="renderer"||void 0!==n.default&&n.default.versions?.electron)return!0;let t="u">typeof navigator&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}],388169),e.s(["isBrowser",0,s],113158);let l=()=>{};class c{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...t){return this._log("warn",0,e,t,{once:!0})}error(e,...t){return this._log("error",0,e,t)}log(e,t,...r){return this._log("log",e,t,r)}info(e,t,...r){return this._log("info",e,t,r)}once(e,t,...r){return this._log("once",e,t,r,{once:!0})}_log(e,t,r,i,n={}){let s=function(e){let{logLevel:t,message:r}=e;e.logLevel=a(t);let i=e.args?Array.from(e.args):[];for(;i.length&&i.shift()!==r;);switch(typeof t){case"string":case"function":void 0!==r&&i.unshift(r),e.message=t;break;case"object":Object.assign(e,t)}"function"==typeof e.message&&(e.message=e.message());let n=typeof e.message;return o("string"===n||"object"===n),Object.assign(e,{args:i},e.opts)}({logLevel:t,message:r,args:this._buildArgs(t,r,i),opts:n});return this._createLogFunction(e,s,n)}_buildArgs(e,t,r){return[e,t,...r]}_createLogFunction(e,t,r){if(!this._shouldLog(t.logLevel))return l;let i=this._getOnceTag(r.tag??t.tag??t.message);if((r.once||t.once)&&void 0!==i){if(this._onceCache.has(i))return l;this._onceCache.add(i)}return this._emit(e,t)}_shouldLog(e){return this.getLevel()>=a(e)}_getOnceTag(e){if(void 0!==e)try{return"string"==typeof e?e:String(e)}catch{return}}}class u{constructor(e,t,r="sessionStorage"){this.storage=function(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch(e){return null}}(r),this.id=e,this.config=t,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let e=JSON.stringify(this.config);this.storage.setItem(this.id,e)}}_loadConfiguration(){let e={};
991if(this.storage){let t=this.storage.getItem(this.id);e=t?JSON.parse(t):{}}return Object.assign(this.config,e),this}}function h(e){return"string"!=typeof e?e:i[e=e.toUpperCase()]||i.WHITE}(r=i||(i={}))[r.BLACK=30]="BLACK",r[r.RED=31]="RED",r[r.GREEN=32]="GREEN",r[r.YELLOW=33]="YELLOW",r[r.BLUE=34]="BLUE",r[r.MAGENTA=35]="MAGENTA",r[r.CYAN=36]="CYAN",r[r.WHITE=37]="WHITE",r[r.BRIGHT_BLACK=90]="BRIGHT_BLACK",r[r.BRIGHT_RED=91]="BRIGHT_RED",r[r.BRIGHT_GREEN=92]="BRIGHT_GREEN",r[r.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",r[r.BRIGHT_BLUE=94]="BRIGHT_BLUE",r[r.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",r[r.BRIGHT_CYAN=96]="BRIGHT_CYAN",r[r.BRIGHT_WHITE=97]="BRIGHT_WHITE";let f=globalThis,_=globalThis.process||{},d=globalThis.navigator||{};function E(){let e;if(s()&&f.performance)e=f?.performance?.now?.();else if("hrtime"in _){let t=_?.hrtime?.();e=1e3*t[0]+t[1]/1e6}else e=Date.now();return e}e.s(["navigator",0,d,"process",0,_,"window",0,f],288526);let p={debug:s()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},g={enabled:!0,level:0};class m extends c{constructor({id:e}={id:""}){super({level:0}),this.VERSION=t,this._startTs=E(),this._deltaTs=E(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new u(`__probe-${this.id}__`,{[this.id]:g}),this.timeStamp(`${this.id} started`),function(e,t=["constructor"]){for(let r of Object.getOwnPropertyNames(Object.getPrototypeOf(e))){let i=e[r];"function"!=typeof i||t.find(e=>r===e)||(e[r]=i.bind(e))}}(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((E()-this._startTs).toPrecision(10))}getDelta(){return Number((E()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,t){this._updateConfiguration({[e]:t})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,t){if(!e)throw Error(t||"Assertion failed")}warn(e,...t){return this._log("warn",0,e,t,{method:p.warn,once:!0})}error(e,...t){return this._log("error",0,e,t,{method:p.error})}deprecated(e,t){return this.warn(`\`${e}\` is deprecated and will be removed \ 992in a later version. Use \`${t}\` instead`)}removed(e,t){return this.error(`\`${e}\` has been removed. Use \`${t}\` instead`)}probe(e,t,...r){return this._log("log",e,t,r,{method:p.log,time:!0,once:!0})}log(e,t,...r){return this._log("log",e,t,r,{method:p.debug})}info(e,t,...r){return this._log("info",e,t,r,{method:console.info})}once(e,t,...r){return this._log("once",e,t,r,{method:p.debug||p.info,once:!0})}table(e,t,r){return t?this._log("table",e,t,r&&[r]||[],{method:console.table||l,tag:function(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}(t)}):l}time(e,t){return this._log("time",e,t,[],{method:console.time?console.time:console.info})}timeEnd(e,t){return this._log("time",e,t,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,t){return this._log("time",e,t,[],{method:console.timeStamp||l})}group(e,t,r={collapsed:!1}){let i=(r.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,t,[],{method:i})}groupCollapsed(e,t,r={}){return this.group(e,t,Object.assign({},r,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||l})}withGroup(e,t,r){this.group(e,t)();try{r()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,t){let r=t.method;o(r),t.total=this.getTotal(),t.delta=this.getDelta(),this._deltaTs=E();let i=function(e,t,r){if("string"==typeof t){var i;let n=r.time?function(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}((i=r.total)<10?`${i.toFixed(2)}ms`:i<100?`${i.toFixed(1)}ms`:i<1e3?`${i.toFixed(0)}ms`:`${(i/1e3).toFixed(2)}s`):"";t=function(e,t,r){if(!s&&"string"==typeof e){if(t){let r=h(t);e=`\u001b[${r}m${e}\u001b[39m`}if(r){let t=h(r);e=`\u001b[${t+10}m${e}\u001b[49m`}}return e}(t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,r.color,r.background)}return t}(this.id,t.message,t);return r.bind(console,i,...t.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(g),this._storage.config[this.id]}_updateConfiguration(e){let t=this._storage.config[this.id]||{...g};this._storage.setConfiguration({[this.id]:{...t,...e}})}}m.VERSION=t,e.s(["Log",0,m],422291)},408173,e=>{"use strict";var t=e.i(321831);function r(){let e;if("u">typeof window&&window.performance)e=window.performance.now();else if(void 0!==t.default&&t.default.hrtime){let r=t.default.hrtime();e=1e3*r[0]+r[1]/1e6}else e=Date.now();return e}class i{constructor(e,t){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=t,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=r(),this._timerPending=!0,this}timeEnd(){return this._timerPending&&(this.addTime(r()-this._startTime),this._timerPending=!1,this._checkSampling()),this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}e.s(["Stats",0,class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,t="count"){return this._getOrCreate({name:e,type:t})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let t of Object.values(this.stats))e(t)}getTable(){let e={};return this.forEach(t=>{e[t.name]={time:t.time||0,count:t.count||0,average:t.getAverageTime()||0,hz:t.getHz()||0}}),e}
992_initializeStats(e=[]){e.forEach(e=>this._getOrCreate(e))}_getOrCreate(e){let{name:t,type:r}=e,n=this.stats[t];return n||(n=e instanceof i?e:new i(t,r),this.stats[t]=n),n}}],408173)}]); 993 994//# debugId=0a4d9de2-eb28-b68f-12fa-a8835959407e
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.